Anuncios

The Autodesk Community Forums has a new look. Read more about what's changed on the Community Announcements board.

Total Line Lengths / List command

ramjan3N9ZA
Enthusiast

Total Line Lengths / List command

ramjan3N9ZA
Enthusiast
Enthusiast

 Hi 

Is there any way to take total length of 5 or 6 lines in selection

 

Please help me

Ragards 

Ramjan

Ramjan
0 Me gusta
Responder
Soluciones aceptadas (3)
6.867 Vistas
3 Respuestas
Respuestas (3)

imadHabash
Mentor
Mentor
Solución aceptada

Hi,

 

I suggest to use addlines.vlx  or addlen that it may help.

 

Regards,

Imad Habash

EESignature

0 Me gusta

nichkherbsman
Advocate
Advocate
Solución aceptada

Hi Ram,

 

The easy way to get the total length of multiple lines is to use lisp.

 

Here is the code:

(defun C:TLEN (/ ss tl ent)
  (setq
    ss (ssget '((0 . "LINE,ARC,CIRCLE,*POLYLINE,SPLINE,ELLIPSE")))
    tl 0
  ); end setq
  (repeat (sslength ss)
    (setq
      ent (ssname ss 0)
      tl
        (+
          tl 
          (vlax-curve-getDistAtParam ent (vlax-curve-getEndParam ent))
        ); end + & tl
    ); end setq
    (ssdel ent ss)
  ); end repeat
  (alert (strcat "Total length of selected objects is " (rtos tl)))
  (princ)
); end defun

If you don't know how to use lisp, here is a link:

https://knowledge.autodesk.com/search-result/caas/CloudHelp/cloudhelp/2015/ENU/AutoCAD-AutoLISP/file...

 

See also screencasts below.

 

Thank you. Guiño

 

 

NiCHKCiD
BIM Modeler
Technical Officer
Technical Designer
Sr. Draftsman
0 Me gusta

Vinayv4v
Advisor
Advisor
Solución aceptada

Hi,

 

Here is a LISP to find all lengths of selected lines or polylines. File attached. (Credits : Tee Square Graphics 1998) TLEN

 

 

(defun C:TLEN (/ ss tl n ent itm obj l)
(setq ss (ssget)
tl 0
n (1- (sslength ss)))
(while (>= n 0)
(setq ent (entget (setq itm (ssname ss n)))
obj (cdr (assoc 0 ent))
l (cond
((= obj "LINE")
(distance (cdr (assoc 10 ent))(cdr (assoc 11 ent))))
((= obj "ARC")
(* (cdr (assoc 40 ent))
(if (minusp (setq l (- (cdr (assoc 51 ent))
(cdr (assoc 50 ent)))))
(+ pi pi l) l)))
((or (= obj "CIRCLE")(= obj "SPLINE")(= obj "POLYLINE")
(= obj "LWPOLYLINE")(= obj "ELLIPSE"))
(command "_.area" "_o" itm)
(getvar "perimeter"))
(T 0))
tl (+ tl l)
n (1- n)))
(alert (strcat "Total length of selected objects is " (rtos tl)))
(princ)
)

 

Cheers,

Vinay Vijayakumaran

0 Me gusta