Author Topic: Distances along a pline  (Read 1429 times)

0 Members and 1 Guest are viewing this topic.

jonesy

  • SuperMod
  • Seagull
  • Posts: 15568
Distances along a pline
« 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?
Thanks for explaining the word "many" to me, it means a lot.

Lee Mac

  • Seagull
  • Posts: 12914
  • London, England
Re: Distances along a pline
« Reply #1 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)

jonesy

  • SuperMod
  • Seagull
  • Posts: 15568
Re: Distances along a pline
« Reply #2 on: May 19, 2015, 06:40:38 AM »
Oh thanks Lee, I'll give it a go.
Thanks for explaining the word "many" to me, it means a lot.

Lee Mac

  • Seagull
  • Posts: 12914
  • London, England
Re: Distances along a pline
« Reply #3 on: May 19, 2015, 07:38:18 AM »
You're welcome! :-)

There is also this by alanjt.