LISP to extract and display as a note Z-elevation of a 3D snap points

LISP to extract and display as a note Z-elevation of a 3D snap points

alex7003
Enthusiast Enthusiast
434 Views
5 Replies
Message 1 of 6

LISP to extract and display as a note Z-elevation of a 3D snap points

alex7003
Enthusiast
Enthusiast

Hi guys, 

I have generated 3D path of a complex drain system.  Is any existing lisp routine to pick, extract and notate in XY plane Z-coordinates of a points of interest, similar to surveying points?

Thank you,

Alex

0 Likes
Accepted solutions (1)
435 Views
5 Replies
Replies (5)
Message 2 of 6

paullimapa
Mentor
Mentor
0 Likes
Message 3 of 6

alex7003
Enthusiast
Enthusiast

Paul, thanks for the tip! The link takes me to mapping forum with near 6000 threads, could you please send me the file or help finding it?

0 Likes
Message 4 of 6

autoid374ceb4990
Collaborator
Collaborator
Accepted solution

Here is a very simple LSP routine that I wrote many years ago. 

It will label the elevation of a picked point using the current TEXTSIZE variable.

 

(defun C:label_elev( / s p1 x y z)
(setq tsize (getvar "TEXTSIZE"))
(if (= prec nil) (setq prec 2))
(setq prmpt (strcat "\nCoordinate Precision <" (itoa prec) ">:"))
(setq s (getint prmpt))
(if (/= s nil) (setq prec s))
(while 1
(setq p1 (getpoint "\nSelect Point : "))
(setq z (caddr p1))
(setq s (rtos z 2 prec))
(setq p1 (getpoint "\nLocation : "))
(command "_.TEXT" p1 tsize 0.0 s)
)
)

0 Likes
Message 5 of 6

paullimapa
Mentor
Mentor

Unfortunately Autodesk has since archived the older threads so that link is no longer valid. 


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 6 of 6

Sea-Haven
Mentor
Mentor

If its a 3dPline then this will make a list of all the points.

 

(defun co-ords2xy (xyz co-ords / I XY )
(setq co-ordsxy '())
(if (= xyz 2)
  (progn
    (setq I 0)
    (repeat (/ (length co-ords) 2)
    (setq xy (list (nth i co-ords)(nth (+ I 1) co-ords) ))
    (setq co-ordsxy (cons xy co-ordsxy))
    (setq I (+ I 2))
    )
  )
)
(if (= xyz 3)
  (progn
    (setq I 0)
    (repeat (/ (length co-ords) 3)
    (setq xy (list (nth i co-ords)(nth (+ I 1) co-ords)(nth (+ I 2) co-ords) ))
    (setq co-ordsxy (cons xy co-ordsxy))
    (setq I (+ I 3))
    )
  )
)
(princ)
)
(defun c:getxyz ( / obj entname)
(setq obj (vlax-ename->vla-object (car (entsel "\nPlease choose 2d or 3d pline "))))
(setq entname (vlax-get obj 'objectname))
(if (= entname "AcDb3dPolyline")
  (setq 23d 3)
  (setq 23d 2)
)
(setq coords (vlax-get obj 'coordinates))
(co-ords2xy 23d coords)
(princ)
)

 

From this can add draw text.

0 Likes