Get z value from 2d Point which is exact on 3D polyline

Get z value from 2d Point which is exact on 3D polyline

Anonymous
Not applicable
1,251 Views
3 Replies
Message 1 of 4

Get z value from 2d Point which is exact on 3D polyline

Anonymous
Not applicable

I have 2D point which is  exact on 3D polyline. get z value of that  Point which is on 3D Polyline.

0 Likes
Accepted solutions (1)
1,252 Views
3 Replies
Replies (3)
Message 2 of 4

dbhunia
Advisor
Advisor

You can approach like this....

 

(defun C:get_z_val ( / sp l PC PI)
(princ "Select the Point...") (setq SP (ssget "_:S" '((0 . "POINT")))) (setq L (vlax-ename->vla-object (car (entsel "\nSelect the line: ")))) (setq PC (cdr (assoc 10 (entget (setq EP (ssname SP 0)))))) (command "_.xline" "_none" PC "_none" (list (car pc) (cadr pc) 100) "") (setq PI (vlax-invoke (vlax-ename->vla-object (entlast)) 'IntersectWith L acExtendNone)) (entdel (entlast)) (if PI (princ (strcat "\nZ value of the Point on Line: " (rtos (caddr PI) 2 1))) (princ "\nLine is not exactly on the picked point....") ) (princ) )

Debashis Bhunia
Co-Founder of Geometrifying Trigonometry(C)
________________________________________________
Walking is the First step of Running, Technique comes Next....
0 Likes
Message 3 of 4

john.uhden
Mentor
Mentor
Accepted solution

If p0 is your 2D point exactly under/over a 3DPolyline, and the 3DPoly is a vla-object, then...

(setq p (vlax-curve-getclosestpointtoprojection object p0 '(0 0 1)))

which will include the desired Z value.

Actually, it doesn't have to be a 3DPoly; it could be a line or any other curve-type object.

John F. Uhden

Message 4 of 4

g_dossier
Explorer
Explorer

I saw this post and thought its exactly what i need, I have a series of coordinates in exact distance say 0.5m, the coordinates has a z=0, and along that coordinates if you plot it in CAD theres a 3d strings above it, I would like to get that z value at exactly the same point to that 2d coordinates. Would you mind help with this?

0 Likes