gplow Posted September 3, 2010 Share Posted September 3, 2010 Hi LeeMac, Is it possible to label the delta Z of a line(s)? Thanks gplow Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted September 3, 2010 Share Posted September 3, 2010 (defun c:Test (/ ss) ;; AJ Thompson, angle modified by LeeMac (if (setq ss (ssget '((0 . "LINE")))) ((lambda (i / e l p p1 p2 a) (while (setq e (ssname ss (setq i (1+ i)))) (entmake (list '(0 . "TEXT") (cons 10 (setq p ; LM (mapcar (function (lambda (a b) (/ (+ a b) 2.))) (setq p1 (cdr (assoc 10 (setq l (entget e))))) (setq p2 (cdr (assoc 11 l))) ) ) ) (cons 40 (getvar 'textsize)) (cons 1 (rtos (- (caddr p2) (caddr p1)))) ; LM (cons 50 (LM:MakeReadable (angle p1 p2))) ; LM (cons 72 1) ; LM (cons 73 0) ; LM (cons 11 p) ; LM ) ) ) ) -1 ) ) (princ) ) (defun LM:MakeReadable ( a ) ;; © Lee Mac 2010 (cond ( (and (> a (/ pi 2)) (<= a pi)) (- a pi) ) ( (and (> a pi) (<= a (/ (* 3 pi) 2))) (+ a pi) ) ( a ) ) ) Quote Link to comment Share on other sites More sharing options...
gplow Posted September 6, 2010 Share Posted September 6, 2010 (defun c:Test (/ ss) ;; AJ Thompson, angle modified by LeeMac (if (setq ss (ssget '((0 . "LINE")))) ((lambda (i / e l p p1 p2 a) (while (setq e (ssname ss (setq i (1+ i)))) (entmake (list '(0 . "TEXT") (cons 10 (setq p ; LM (mapcar (function (lambda (a b) (/ (+ a b) 2.))) (setq p1 (cdr (assoc 10 (setq l (entget e))))) (setq p2 (cdr (assoc 11 l))) ) ) ) (cons 40 (getvar 'textsize)) (cons 1 (rtos (- (caddr p2) (caddr p1)))) ; LM (cons 50 (LM:MakeReadable (angle p1 p2))) ; LM (cons 72 1) ; LM (cons 73 0) ; LM (cons 11 p) ; LM ) ) ) ) -1 ) ) (princ) ) (defun LM:MakeReadable ( a ) ;; © Lee Mac 2010 (cond ( (and (> a (/ pi 2)) (<= a pi)) (- a pi) ) ( (and (> a pi) (<= a (/ (* 3 pi) 2))) (+ a pi) ) ( a ) ) ) Thank for your quick response. It is working fine except that I would like to know where I can change the text size (which is now at 0.2) in your lisp. Thank again GP Quote Link to comment Share on other sites More sharing options...
gplow Posted September 6, 2010 Share Posted September 6, 2010 LM, I can change the size/height now. Thanks. Where can I change the decimal places from 3 to 0. and also to the nearest integer. Thanks again. GP Quote Link to comment Share on other sites More sharing options...
Tharwat Posted September 6, 2010 Share Posted September 6, 2010 In this DXF code you could change it to suit your needs. (cons 40 [color="red"][b](getvar 'textsize)[/b][/color]) Good luck. Tharwat Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted September 6, 2010 Share Posted September 6, 2010 LM,I can change the size/height now. Thanks. Where can I change the decimal places from 3 to 0. and also to the nearest integer. Thanks again. GP Currently uses your LUPREC, but for manual precision control: (rtos (- (caddr p2) (caddr p1))) Becomes: (rtos (- (caddr p2) (caddr p1)) 2 [color=red][b]0[/b][/color]) Red part is the number of dp. Quote Link to comment Share on other sites More sharing options...
gplow Posted September 8, 2010 Share Posted September 8, 2010 LM, Thank you very much. GP Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted September 8, 2010 Share Posted September 8, 2010 LM,Thank you very much. GP You're welcome GP Quote Link to comment Share on other sites More sharing options...
autocrap Posted May 18, 2011 Author Share Posted May 18, 2011 This is the code I am now using (defun c:PT (/ p1 p2 di ins txt oldsnap) (while (setq oldsnap(getvar "osmode")) (setvar "osmode" 165) (setq p1 (getpoint "\nSpecify first point: ")) (setq p2 (getpoint p1 "\nSpecify second point: ")) (setq di (distance p1 p2)) (setq ang (angle p1 p2)) (setvar "osmode" 0) (setq ins (getpoint "\nSpecify text location: ")) (setq txt(rtos di)) (setvar "osmode" oldsnap) (entmake (list '(0 . "text") (cons 1 txt) (cons 10 ins) (cons 50 ang) (cons 40 8.0) (cons 72 1) (cons 73 3) (cons 11 ins) ) ) (princ) (setq ppt(getstring "\nSpecify pipe size" )) (entmake (list '(0 . "text") (cons 1 ppt) (cons 10 ins) (cons 50 ang) (cons 40 8.0) (cons 72 1) (cons 73 1) (cons 11 ins) ) ) (princ) ) ) however I would like the text to be further apart (vertically), but I am not sure how to this myself, can anyone ehlp me with this? Quote Link to comment Share on other sites More sharing options...
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.