Jump to content

Set precisions


wimal

Recommended Posts

(setq p1 (getpoint "/ Pick on  insertion point"))
(setq x (car p1))
   (setq x1 (/ x 1000))  
 (command "text""j""ML" p1 100 0 x1 )

When I pick a point it insert the x value, but how can reduce the desimal points

Link to comment
Share on other sites

Please check the RTOS function - the example below will print the value with 3 decimals:

(command "[color=red]_[/color]text" "[color=red]_[/color]j" "[color=red]_[/color]ML" p1 100 0 [color=red](rtos[/color] x1[color=red] 2 3)[/color] )

Link to comment
Share on other sites

Try this ..

 

(if (setq p1 (getpoint "\n Pick on  insertion point"))
 (progn (setq x1 (/ (car p1) 1000.))
   (command "_.text" "_j" "_ML" p1 100. 0. (rtos x1 2 2)))
)

Edited by Tharwat
Localizing options as well the command call
Link to comment
Share on other sites

Always be wary of TEXTSTYLE with defined height when using "_text" command

 

A quick error prevention:

 

(if (setq p1 (getpoint "\n Pick on  insertion point"))
 (progn (setq x1 (/ (car p1) 1000.))
        (command "_.text" "_j" "_ML" p1)
       [color="blue"] (If (zerop (cdr (assoc 40 (tblsearch "style" (getvar "textstyle")))))
          (command 100.0 0.0)
          (command 0.))[/color]
        (command (rtos x1 2 2))))

 

Also consider current dimzin value

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...