wimal Posted February 20, 2013 Posted February 20, 2013 (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 Quote
MSasu Posted February 20, 2013 Posted February 20, 2013 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] ) Quote
Tharwat Posted February 20, 2013 Posted February 20, 2013 (edited) 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 February 20, 2013 by Tharwat Localizing options as well the command call Quote
MSasu Posted February 20, 2013 Posted February 20, 2013 Tharwat, please take care that on localized versions of AutoCAD the options were translated too, along the names of the commands. Quote
wimal Posted February 20, 2013 Author Posted February 20, 2013 Thanks for both of you it working. Quote
Tharwat Posted February 20, 2013 Posted February 20, 2013 Tharwat, please take care that on localized versions of AutoCAD the options were translated too, along the names of the commands. Good catch Mircea . thank you . Quote
Tharwat Posted February 20, 2013 Posted February 20, 2013 Thanks for both of you it working. Good for you . Quote
pBe Posted February 20, 2013 Posted February 20, 2013 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 Quote
Recommended Posts
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.