nkeseci Posted January 21, 2013 Posted January 21, 2013 Hi, I need to calculate distance between two points along a polyline. These points may exist on different segments of the same polyline. Maybe there is a function, I couldn't find it. I'd be very grateful for your help. Quote
Tharwat Posted January 21, 2013 Posted January 21, 2013 Take a deep look at the functions that start with vlax-curve-***** Quote
BIGAL Posted January 22, 2013 Posted January 22, 2013 If these two points are vertices why not just Getpoint pt1 Getpoint pt2 distance all done. If they are intersection points of say a line intersecting pline then same thing but like Tharwat Vla-intersectwith to work out pt1 pt2 There is plenty of pline vertice lsp here that will pull out the co-ords of the vertice's. You need to provide some more information. Quote
nkeseci Posted January 23, 2013 Author Posted January 23, 2013 Tharwat : I used vlax-curve-getDistAtPoint function but I get nil. i.e. (vlax-curve-getDistAtPoint plObj ip5) where ip5 is an intersection point on pline. BIGAL : With my lisp code, I have all the intersection points and the verticies. I only need to calculate distance from vp0 to ip1, then vp0 to ip2, vp0 to ip3 and so on. The path must be followed vp0-ip1-ip2-vp1-ip3-ip4-vp2-vp3-ip5 points for length of vp0-ip5, ie. As you guess, the points may vary case to case. Quote
Tharwat Posted January 23, 2013 Posted January 23, 2013 Tharwat : I used vlax-curve-getDistAtPoint function but I get nil. i.e. (vlax-curve-getDistAtPoint plObj ip5) where ip5 is an intersection point on pline. e.g. (vl-load-com) (if (and (progn (prompt "\n Select Polyline :") (setq e (ssget "_+.:s" '((0 . "*POLYLINE")))) ) (setq p (getpoint "\n Specify point on the previous selected polyline :")) ) (print (vlax-curve-getdistatpoint (ssname e 0) (vlax-curve-getclosestpointto (ssname e 0) p))) ) Quote
irneb Posted January 23, 2013 Posted January 23, 2013 Yes, the vlax-curve-* functions are extremely finicky about points being "exactly" on top of the polyline. Usually even snapping to it is not enough. Thus you use the vlax-curve-getClosestPointTo function to convert your point to something "exactly" on top of the PL - as Tharwat's shown. BTW, do you want to have the distances displayed on the dwg? I.e. something like a chaining-distance? Then perhaps look at this old thread: http://forums.augi.com/showthread.php?40128-distance-and-offset-along-a-polyline Quote
nkeseci Posted January 24, 2013 Author Posted January 24, 2013 Yes, it is working correctly with the vlax-curve-getClosestPointTo function. e.g. (setq distance (vlax-curve-getDistAtPoint plObj (vlax-curve-getClosestPointTo plObj (list (car intP) (cadr intP) 0.0)))) I want to display those distances like a chaining-distance. I will look at your link Thank you very much to all of you 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.