Autocad total length by selecting multiple dimension

Autocad total length by selecting multiple dimension

Anonymous
Not applicable
5,711 Views
9 Replies
Message 1 of 10

Autocad total length by selecting multiple dimension

Anonymous
Not applicable

Hi Friends...

 

I have multiple dimensions in separate location. I just want to know, is there anyway to find the total length by selecting together those dimension?. I wish I could have a LISP. Please help. Its really urgent

 

Thank you in advance.

0 Likes
Accepted solutions (1)
5,712 Views
9 Replies
Replies (9)
Message 2 of 10

vladimir_michl
Advisor
Advisor
Accepted solution

You can use the AddLen LISP utility to sum dimensions - see www.cadstudio.cz/freeware

 

Vladimir Michl, www.cadstudio.cz  www.cadforum.cz

 

Message 3 of 10

3wood
Advisor
Advisor

You can also try ADDDIM.

 

Message 4 of 10

Anonymous
Not applicable

Dear Vladimir

 

Thanks lot for your advise. Its works great!!!

 

However, Its shows the real value and always asking me to save a .sdf file. May I know why it is?

0 Likes
Message 5 of 10

Kent1Cooper
Consultant
Consultant

@Anonymous wrote:

.... is there anyway to find the total length by selecting together those dimension?. ....


In simplest terms:

 

(defun C:DIMLINADD (/ ss n)
  (setq total 0)
  (if (setq ss (ssget '((0 . "DIMENSION"))))
    (repeat (setq n (sslength ss))
      (setq total (+ total (cdr (assoc 42 (entget (ssname ss (setq n (1- n))))))))
    )
  )
  total
)

 

HOWEVER, that doesn't limit your selection to linear kinds of Dimensions, so if you pick any angular ones, it will include the angle of each [in radians] in the total, as if it's a "length."  It could be made to step through each Dimension and check what kind it is before adding it into the total, if needed.

 

It leaves the total in the 'total' variable value [which is not localized, so it will remain], for you to use in something if you want more than just a report of the total length.

Kent Cooper, AIA
Message 6 of 10

Anonymous
Not applicable

Dear 3Wood,

 

Thank you for your help and advise. While I'm trying this, its asking me to register. So is it vital? 

0 Likes
Message 7 of 10

vladimir_michl
Advisor
Advisor

You can just ESC the file-export prompt or suppress it completely by setting the LISP variable:

 

(setq AddLenNoFile T)

 

Vladimir Michl, www.cadstudio.cz  www.cadforum.cz

 

0 Likes
Message 8 of 10

sbussDVCLP
Observer
Observer

Is there a way to make this work for and give you the total Foot/Inches?

0 Likes
Message 9 of 10

Kent1Cooper
Consultant
Consultant

@sbussDVCLP wrote:

Is there a way to make this work for and give you the total Foot/Inches?


If your Units are Architectural, you can replace the line in Message 5 that says simply

  total

with this:

  (rtos total)

 

It will report according to your current Units mode and precision settings.  If you want the result differently, you can specify the mode and precision [read about the (rtos) function].

Kent Cooper, AIA
0 Likes
Message 10 of 10

tarik.rock92
Explorer
Explorer

@Anonymous  schrieb:

Hi Friends...

 

I have multiple dimensions in separate location. I just want to know, is there anyway to find the total length by selecting together those dimension?. I wish I could have a LISP. Please help. Its really urgent

 

Thank you in advance.


Hi, I'm a bit late, but I found one LISP that we use on work.

;|

TLEN.LSP - Total LENgth of selected objects
(c) 1998 Tee Square Graphics

|;

(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)
)
0 Likes