samsudeenmanoos Posted June 12, 2018 Share Posted June 12, 2018 I tried many times to get elevation but i cannot make it please can anyone solve this? DSS.dwg[/ATTACH] Label Point.lsp Quote Link to comment Share on other sites More sharing options...
hanhphuc Posted June 12, 2018 Share Posted June 12, 2018 (edited) (defun C:ENZ (/ ov p pt e n z) (setq ov (getvar 'cmdecho)) (setvar 'cmdecho 0) (while (and (setq p (getpoint "\nPick Point : ")) (setq pt (getpoint p "\nInsert Text : "))) (progn (mapcar '(lambda(a b) (set a (strcat (vl-princ-to-string a) "= " (rtos b 2 3)))) '(E N Z) p) (eval (vl-list* vl-cmdf "_leader" "_non" 'p "_non" 'pt "" (list E N Z "") ) ) (princ (strcat "\r" E " " N " " Z)) ) ) (if ov (setvar 'cmdecho 0)) (princ "Done!\n") (princ) ) Edited June 12, 2018 by hanhphuc previous code was incorrect if the text not placed on each vertex Quote Link to comment Share on other sites More sharing options...
BIGAL Posted June 12, 2018 Share Posted June 12, 2018 Its a typo (setq P1Z (cadr pnt1)) ; returns Y (setq P1Z (cad[color="red"]d[/color]r pnt1)) ; returns Z also need ; [color="red"];[/color] Labeling N,E,Z Coordinates with Leader - David B. Stewart you could condense the code if you want and not use so many variables. (defun C:LP(/ pnt1 COORDN COORDE PTXT) (setq PNT1 (getpoint "\nPick coordinate point: ")) (setq COORDN (strcat "E " (rtos (car pnt1) 2 3) )) (setq COORDE (strcat "N " (rtos (cadr pnt1) 2 3) )) (setq ELEZ (strcat "EL " (rtos (caddr pnt1) 2 3) )) (setq PTXT (getpoint "\nPick text location: ")) (command "LEADER" PNT1 PTXT "" COORDN COORDE ELEZ "") (princ) ) ; even less (defun C:LP(/ ) (command "LEADER" (getpoint "\nPick coordinate point: ") (getpoint "\nPick text location: ") "" (strcat "E " (rtos (car pnt1) 2 3) ) (strcat "N " (rtos (cadr pnt1) 2 3) ) (strcat "EL " (rtos (caddr pnt1) 2 3) ) "") (princ) ) Quote Link to comment Share on other sites More sharing options...
BIGAL Posted June 12, 2018 Share Posted June 12, 2018 (edited) Back to the dwg its 3d pline etc are you after the vertice co-ords or a 3d point along the pline. ObjectName (RO) = "AcDb3dPolyline" What I posted previously does not work with 3dpoly. Try this just need to add a bettter defun and error check ; pline co-ords example ; By Alan H ; write z of vertices added (defun getcoords (ent) (vlax-safearray->list (vlax-variant-value (vlax-get-property (setq obj (vlax-ename->vla-object ent)) "Coordinates" ) ) ) ) ; convert now to a list of xy as co-ords are x y x y x y if 3d x y z x y z (defun co-ords2xy () (setq len (length co-ords)) (if (= (vla-get-ObjectName obj) "AcDb3dPolyline") (progn (setq numb (/ len 3)) (setq odd "yes") ) (progn (setq numb (/ len 2)) ; even and odd check required (setq odd "no") ) ) (setq I 0) (setq co-ordsxy '()) (repeat numb (cond ((= odd "yes") (setq xy (list (nth i co-ords)(nth (+ I 1) co-ords)(nth (+ I 2) co-ords) ))(setq I (+ I 3))) ((= odd "no" ) (setq xy (list (nth i co-ords)(nth (+ I 1) co-ords) ))(setq I (+ I 2))) ) (setq co-ordsxy (cons xy co-ordsxy)) ) ) ; program starts here (setq co-ords (getcoords (car (entsel "\nplease pick pline")))) (co-ords2xy) ; list of 2d or 3d points making pline ; list is co-ordsxy ` (repeat (setq i(length co-ordsxy)) (setq pt (nth (setq i (- i 1)) co-ordsxy)) (setq x (car pt) ) (setq y(cadr pt) ) (if (= odd "yes") (setq z (caddr pt)) (setq z "-") ) (command "-text" (list x y) "" "" (rtos z 2 3)) ) Edited June 12, 2018 by BIGAL 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.