Measuring Distance
Measuring Distance
(OP)
I am running CAD 2005 and have a need to measure distance / length of portions of a line segment. I can use Tools Inquiry Distance but can't measure more than between two points. Is there another technique to measure along more points?





RE: Measuring Distance
Mike Halloran
Pembroke Pines, FL, USA
RE: Measuring Distance
CODE
(setvar "cmdecho" 0)
(graphscr)
(setq
p1 (getpoint "\nPick start point ")
p2 (getpoint p1 "\nPick next point ")
d1 (distance p1 p2)
prdist (strcat "\nDistance: " (rtos d1))
)
(princ prdist)
(setq p3 (getpoint p2 "\nPick next point or RETURN if done "))
(while p3
(setq
d0 (distance p2 p3)
d1 (+ (distance p2 p3) d1)
p2 p3
prdist (strcat "\nDistance: " (rtos d0) ", Cumulative distance: " (rtos d1))
)
(princ prdist)
(setq p3 (getpoint p2 "\nPick Next Point "))
)
(setq cumd (strcat "Cumulative distance --> " (rtos d1)))
(prompt cumd)
(princ)
)
Thanks to an unknown author
____________________
Acad2005, Terramodel
RE: Measuring Distance
Command: list 1 found
LINE Layer: "0"
Space: Model space
Handle = 8b
from point, X= 35.5496 Y= 17.8966 Z= 0.0000
to point, X= 15.9339 Y= 19.0093 Z= 0.0000
Length = 19.6472, Angle in XY Plane = 177
Delta X = -19.6157, Delta Y = 1.1127, Delta Z = 0.0000
Remember, amateurs designed and built the ark...professionals designed and built the Titanic. - Steve
RE: Measuring Distance
nice tool...
Lothar
ADT 2004
ACAD 2002
RE: Measuring Distance
(DEFUN c:GEL ( / attr elength ss dst cnt) ; Adds the lengths of selected lines, arcs, circles, polylines, or splines
(setq dst 0 cnt 0)(setvar "cmdecho" 0)
(princ "= Get length... Adds the lengths of selected lines, arcs, circles, polylines, or splines ")
;
(DEFUN attr (ent indx)(cdr (assoc indx ent)))
;
(DEFUN elength (ent / sa ea)
(cond
((= (attr ent 0) "LINE")(distance (attr ent 10)(attr ent 11)))
((= (attr ent 0) "ARC")(setq sa (attr ent 50) ea (attr ent 51))
(* (if (> ea sa)(- ea sa)(+ (- ea sa)(* 2 pi)))(attr ent 40)))
((= (attr ent 0) "CIRCLE")(* 2 pi (attr ent 40)))
((= (attr ent 0) "POLYLINE")(command "area" "e" (attr ent
-1))(getvar "perimeter"))
((= (attr ent 0) "SPLINE")(command "area" "e" (attr ent
-1))(getvar "perimeter"))
)
)
(if (setq ss (ssget '((-4 . "<or")(0 . "LINE")(0 . "ARC")(0 .
"CIRCLE")
(0 . "POLYLINE")(0 . "SPLINE")(-4 .
"or>"))))
(progn
(repeat (sslength ss)
(setq dst (+ dst (elength (entget (ssname ss cnt)))) cnt (+ cnt
1))
)
(princ (strcat "\n The length of the entity or entities selected
is "(rtos dst 2 8)" "))
)
(princ "\n Input error... ")
)
(princ)
)
RE: Measuring Distance
RE: Measuring Distance
Does it produce incorrect results?
Does it fail to run at all with no feedback?
Does it give an error of some sort?
How are you executing it?
You get the idea...
--------------------
How much do YOU owe?
http://www.brillig.com/debt_clock/
--------------------
RE: Measuring Distance
RE: Measuring Distance
Women and cats will do as they please; men and dogs should just learn to live with that - Steve
RE: Measuring Distance
RE: Measuring Distance