TheSwamp

CAD Forums => CAD General => Topic started by: jonesy on May 19, 2015, 06:20:44 AM

Title: Distances along a pline
Post by: jonesy on May 19, 2015, 06:20:44 AM
We have a "jobette" to do where we need to be able to find the distances of objects along a pline.  All the distances need to be from the start point of the pline.  Unfortunately the pline twists and turns multiple times...  is there something I have overlooked in enabling me to pick the start position and the position of the object and get an accurate distance?
Title: Re: Distances along a pline
Post by: Lee Mac on May 19, 2015, 06:29:01 AM
Here's a quick LISP to help you:
Code: [Select]
(defun c:pdist ( / e p )
    (if (setq e (car (entsel "\nSelect object to measure: ")))
        (while (setq p (getpoint "\nPick point on object: "))
            (princ
                (strcat "\nDistance from start point: "
                    (rtos
                        (vlax-curve-getdistatpoint e
                            (vlax-curve-getclosestpointto e (trans p 1 0))
                        )
                    )
                )
            )
        )
    )
    (princ)
)
(vl-load-com) (princ)
Title: Re: Distances along a pline
Post by: jonesy on May 19, 2015, 06:40:38 AM
Oh thanks Lee, I'll give it a go.
Title: Re: Distances along a pline
Post by: Lee Mac on May 19, 2015, 07:38:18 AM
You're welcome! :-)

There is also this (http://www.theswamp.org/index.php?topic=32677.0) by alanjt.