Tharwat Posted March 7, 2014 Posted March 7, 2014 Thanks.That works and one thing more.i wanna change the precision to 3 digits if possible?and a suffix (meter)? Replace this . (strcat (cdr (assoc 1 en)) " = " (rtos l 2 2) ) With this . (strcat (cdr (assoc 1 en)) " = " (rtos l 2 3) " Meter" ) Quote
folderdash Posted March 7, 2014 Posted March 7, 2014 Thats now exactly what i want.Thanks very much... Quote
Tharwat Posted March 7, 2014 Posted March 7, 2014 Thats now exactly what i want.Thanks very much... You're welcome . Quote
Shoesunited Posted November 22, 2016 Posted November 22, 2016 Can this be lisp routine be modified to round the length up to the nearest inch and add 6"? Quote
Shoesunited Posted November 22, 2016 Posted November 22, 2016 Can this be lisp routine be modified to round the length up to the nearest inch and add 6"? could a prompt be added to add 6" instead of it automatically doing so? Quote
Lee Mac Posted November 22, 2016 Posted November 22, 2016 could a prompt be added to add 6" instead of it automatically doing so? Try the following: (defun c:len2txt ( / ent idx sel str tot txt ) (if (and (setq sel (ssget '( (0 . "ARC,CIRCLE,ELLIPSE,LINE,*POLYLINE,SPLINE") (-4 . "<NOT") (-4 . "<AND") (0 . "POLYLINE") (-4 . "&") (70 . 80) (-4 . "AND>") (-4 . "NOT>") ) ) ) (setq txt (LM:selectifobject "\nSelect text: " "TEXT,MTEXT")) ) (progn (setq tot (cond ((getreal "\nLength to add/subtract <0.0>: ")) (0.0)) txt (entget txt) str (assoc 1 txt) ) (repeat (setq idx (sslength sel)) (setq ent (ssname sel (setq idx (1- idx))) tot (+ tot (vlax-curve-getdistatparam ent (vlax-curve-getendparam ent))) ) ) (entmod (subst (cons 1 (strcat (cdr str) " = " (rtos tot 2 0))) str txt)) ) ) (princ) ) ;; Select if Object - Lee Mac ;; Continuously prompts the user for a selection of a specific object type (defun LM:selectifobject ( msg typ / ent ) (while (progn (setvar 'errno 0) (setq ent (car (entsel msg))) (cond ( (= 7 (getvar 'errno)) (princ "\nMissed, try again.") ) ( (null ent) nil) ( (not (wcmatch (cdr (assoc 0 (entget ent))) typ)) (princ "\nInvalid object selected.") ) ) ) ) ent ) (vl-load-com) (princ) Quote
Shoesunited Posted November 23, 2016 Posted November 23, 2016 Is it possible to replace the text with the length of the line and not add to what is already present. Example: If my text is X. Instead of getting X = 10'-0". Can it just say 10'-0"? Is there any way to round up the fractions to a 1/16? Thanks for your help on this. 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.