• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Leggi altro.

Somma progressiva delle distanze


Staff Forum
Professione: Variabile
Software: AutoCAD 2016
Regione: Italia

Consente di sommare in progressione le distanze.

"The standard AutoCAD DIST command measures only distances between two points.
If you want to measure a cumulative (total) distance defined by consecutive point clicks (multiple line segments), you can use the DIST2 LISP."

Ultima modifica:
Professione: *
Software: AutoCAD
Regione: Lombardia

(defun c:cumd ()
(setvar "cmdecho" 0)
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
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)