JuniorNogueira Posted December 2, 2018 Posted December 2, 2018 Hello guys, Any way to insert coordinate text always on the same side and at the same angle as the alignment parameter of a block? and my text can not be turned upside down? I'll attach an example for better viewing !! Example2.dwg Quote
Tharwat Posted December 2, 2018 Posted December 2, 2018 Hi, Give this a shot and let me know. (defun c:Test (/ text_ inc int sel ent get ins rot ang ctr) ;; Tharwat - 02.Dec.2018 ;; (defun text_ (ins str rot clr lay) (entmake (list '(0 . "TEXT") (cons 8 lay) (cons 62 clr) (cons 10 ins) '(40 . 1.1543) (cons 1 str) (cons 50 (if (and (> rot (* pi 0.5)) (< rot (* pi 1.5))) (+ rot pi) rot ) ) '(41 . 1.0) '(71 . 0) '(72 . 1) (cons 11 ins) '(73 . 2) ) ) ) (if (setq inc 0 int -1 sel (ssget '((0 . "INSERT"))) ) (while (setq ent (ssname sel (setq int (1+ int)))) (setq get (entget ent) ins (cdr (assoc 10 get)) rot (cdr (assoc 50 get)) ang (+ rot (* pi 1.5)) inc (1+ inc) ) (mapcar 'text_ (list (polar ins ang 1.97715) (polar ins ang 3.96145) (setq ctr (polar ins ang 7.0083)) ) (list (strcat "X:" (rtos (car ins) 2 2)) (strcat "Y:" (rtos (cadr ins) 2 2)) (if (< inc 10) (strcat "0" (itoa inc)) (itoa inc) ) ) (list rot rot rot) '(2 2 1) '("Coordenada" "Coordenada" "N_Postes") ) (entmake (list '(0 . "CIRCLE") '(8 . "N_Postes") (cons 10 ctr) '(62 . 1) '(40 . 1.5) ) ) ) ) (princ) ) 1 Quote
JuniorNogueira Posted December 2, 2018 Author Posted December 2, 2018 @Tharwat Thank you very much, it worked very well !!!! Quote
Tharwat Posted December 2, 2018 Posted December 2, 2018 33 minutes ago, JuniorNogueira said: @Tharwat Thank you very much, it worked very well !!!! You're welcome anytime. 1 Quote
JuniorNogueira Posted December 3, 2018 Author Posted December 3, 2018 @Tharwat Why is not the coordinate coming out of the parameter side? Drawing3.dwg Quote
Tharwat Posted December 3, 2018 Posted December 3, 2018 29 minutes ago, JuniorNogueira said: @Tharwat Why is not the coordinate coming out of the parameter side? Drawing3.dwg Because the rotation of the block that you posted in the first reply is different than the one into this drawing. So just replace the following from the above posted codes: ang (cdr (assoc 50 get)) rot (+ ang (* pi 0.5)) 1 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.