PDA

View Full Version : Add up distances



robert.1.hall72202
2005-09-01, 01:13 PM
Is there a way to add up distances??

I routinely have to compute the total weld length for laser welded blanks.
It would be nice if I could just pick the points along the path the laser travels and
AutoCad would return the total distance. This could contain several points while gathering the distances in point A to point B fashion.

Can AutoCad currently do this somehow??

The current distance command does not have an add/subtract feature.

jaberwok
2005-09-01, 01:26 PM
I'm sure I have seen pd lisp routines to do that but, if you're picking a string of points anyway, why not pick them within the Pline command then list the pline for length? Or is it not one continuous run?

dhurtubise
2005-09-01, 06:15 PM
There's a Pline property call Length, you could use a pline with field in a table to do so.
I included an example.

robert.1.hall72202
2005-09-06, 12:36 PM
Thanks for posting the table....very handy.

I currently draw a pline across the required points and then
use the list command to derive the length. I then have to delete
the pline. I am looking for a work around as sometimes my
designers forget to delete the pline.

kennet.sjoberg
2005-09-06, 05:17 PM
Hi rhall !

Why are you not asking in the lisp forum ? ;)



(defun c:PickDist (/ Pkt1 Pkt2 Dist )
(setq Pkt1 (getpoint " Pick a point : " ) )
(setq Pkt2 (getpoint Pkt1 "and pick next : " ) )
(setq Dist 0 )
(while Pkt2
(princ "\n" )
(princ (setq Dist (+ Dist (distance Pkt1 Pkt2 ))) )
(setq Pkt1 Pkt2 )
(setq Pkt2 (getpoint Pkt1 " next : " ) )
)
(princ (strcat "\nCommand: Total distance is " (rtos Dist )) )
(princ)
)

: ) Happy Computing !

kennet

robert.1.hall72202
2005-09-06, 05:23 PM
sweet! That is exactly what I needed. I wasn't sure if AutoCad already had this one covered.