Community
AutoCAD Forum
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Length of multiple polyline totals

19 REPLIES 19
SOLVED
Reply
Message 1 of 20
travisforsman2035
57731 Views, 19 Replies

Length of multiple polyline totals

travisforsman2035
Explorer
Explorer

I want to add up the lengths of multiple poly lines for quantity takeoff.  In 2017 and earlier versions there was "POLYQUANTITIES".  It added up all of them and exported to excel table for you.  

 

in 2018 they stopped supporting that, did something else replace it?  If so what?

 

Thanks

Length of multiple polyline totals

I want to add up the lengths of multiple poly lines for quantity takeoff.  In 2017 and earlier versions there was "POLYQUANTITIES".  It added up all of them and exported to excel table for you.  

 

in 2018 they stopped supporting that, did something else replace it?  If so what?

 

Thanks

19 REPLIES 19
Message 2 of 20

alique.langlois
Enthusiast
Enthusiast
Accepted solution

A quick google found this gem of a result

 

https://forums.autodesk.com/t5/autocad-map-3d-forum/total-length-of-polylines/td-p/6999996 

 

the Lisp should work.

 

I also use Tlen.LSP and it works

;|

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)
)

A quick google found this gem of a result

 

https://forums.autodesk.com/t5/autocad-map-3d-forum/total-length-of-polylines/td-p/6999996 

 

the Lisp should work.

 

I also use Tlen.LSP and it works

;|

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)
)
Message 3 of 20

Kent1Cooper
Consultant
Consultant

Another subject that comes up with some regularity.  >Here< is a long thread about it.

Kent Cooper, AIA
0 Likes

Another subject that comes up with some regularity.  >Here< is a long thread about it.

Kent Cooper, AIA
Message 4 of 20

rkmcswain
Mentor
Mentor

Sorry, but there has never been a command in AutoCAD called "POLYQUANTITIES".

 

Perhaps this was an add-on that you once had installed.

 

Technically, the DATAEXTRACTION command (part of AutoCAD) can do it (See image below), but it's a huge pain if all you want to do is get a quick total. TLEN.LSP is your best bet (Even Autodesk says so....)

 

@Civil3DReminders_com - add this to your list too

 

 dataextraction.png

 

 

 

 

 

 

R.K. McSwain     | CADpanacea | on twitter

Sorry, but there has never been a command in AutoCAD called "POLYQUANTITIES".

 

Perhaps this was an add-on that you once had installed.

 

Technically, the DATAEXTRACTION command (part of AutoCAD) can do it (See image below), but it's a huge pain if all you want to do is get a quick total. TLEN.LSP is your best bet (Even Autodesk says so....)

 

@Civil3DReminders_com - add this to your list too

 

 dataextraction.png

 

 

 

 

 

 

R.K. McSwain     | CADpanacea | on twitter
Message 5 of 20

Civil3DReminders_com
Mentor
Mentor
Accepted solution

The poster was referring to this addon:

https://cc.bingj.com/cache.aspx?q=POLYQUANTITIES&d=4931880919190853&mkt=en-US&setlang=en-US&w=urvfni...

 

I use DataExtraction since it has all of the features the user is wanting.

Civil Reminders
http://blog.civil3dreminders.com/
http://www.CivilReminders.com/
Alumni

The poster was referring to this addon:

https://cc.bingj.com/cache.aspx?q=POLYQUANTITIES&d=4931880919190853&mkt=en-US&setlang=en-US&w=urvfni...

 

I use DataExtraction since it has all of the features the user is wanting.

Civil Reminders
http://blog.civil3dreminders.com/
http://www.CivilReminders.com/
Alumni
Message 6 of 20

rkmcswain
Mentor
Mentor

@Civil3DReminders_com  - I figured you would agree that something this simple should be in the core product. I wish they would stop redesigning the icons, and changing color schemes every year and fix things like this.

R.K. McSwain     | CADpanacea | on twitter

@Civil3DReminders_com  - I figured you would agree that something this simple should be in the core product. I wish they would stop redesigning the icons, and changing color schemes every year and fix things like this.

R.K. McSwain     | CADpanacea | on twitter
Message 7 of 20

Civil3DReminders_com
Mentor
Mentor

I'm now afraid of asking for features. I figure Autodesk will take my request and have a workflow to export the polylines to a new export file format, have me import it into Revit, and then open Infraworks to read the Revit file to run the command to create the table in AutoCAD and Excel. 

 

I'm beginning to think there is a betting pool at Autodesk to see how many separate programs they can get their users to use and they started the range of available numbers at 10.

Civil Reminders
http://blog.civil3dreminders.com/
http://www.CivilReminders.com/
Alumni

I'm now afraid of asking for features. I figure Autodesk will take my request and have a workflow to export the polylines to a new export file format, have me import it into Revit, and then open Infraworks to read the Revit file to run the command to create the table in AutoCAD and Excel. 

 

I'm beginning to think there is a betting pool at Autodesk to see how many separate programs they can get their users to use and they started the range of available numbers at 10.

Civil Reminders
http://blog.civil3dreminders.com/
http://www.CivilReminders.com/
Alumni
Message 8 of 20

rkmcswain
Mentor
Mentor

@Civil3DReminders_com 

 

I appreciate that the dev team looks at the big picture sometimes. For example, DataExtraction does a LOT more than total polyline lengths.  So whatever problem they set out to solve, it probably solved a dozen more. Great.

 

But sometimes, simplicity is the answer. I see no reason why the PROPERTIES command just can't simply total the length of all selected polylines and display it. They are already doing this for the AREA property of multiple selected HATCH entities.

 

props66.png

 

 

 

 

R.K. McSwain     | CADpanacea | on twitter

@Civil3DReminders_com 

 

I appreciate that the dev team looks at the big picture sometimes. For example, DataExtraction does a LOT more than total polyline lengths.  So whatever problem they set out to solve, it probably solved a dozen more. Great.

 

But sometimes, simplicity is the answer. I see no reason why the PROPERTIES command just can't simply total the length of all selected polylines and display it. They are already doing this for the AREA property of multiple selected HATCH entities.

 

props66.png

 

 

 

 

R.K. McSwain     | CADpanacea | on twitter
Message 9 of 20

Kent1Cooper
Consultant
Consultant

@alique.langlois wrote:

....

I also use Tlen.LSP and it works


I notice that TLEN and some of the routines in the link in my first Reply go to more trouble than necessary.  They derive the length of different kinds of objects by different kinds of calculations, or in some cases using an AREA command on them so they can extract the length from the PERIMETER System Variable.  Some allow selection of things that don't have length at all, and either just pass them by in processing, or report on their invalidity.  But there's a way to disallow those right in the selection, and a single AutoLisp function that can get the length from all eligible object types in the same way, which greatly reduces the code required.

(vl-load-com) ; [if needed]
(defun C:TOTLEN (/ ss n ent tl)
  (if (setq ss (ssget '((0 . "LINE,ARC,CIRCLE,*POLYLINE,SPLINE,ELLIPSE"))))
    (progn ; then
      (repeat (setq n (sslength ss))
        (setq
          ent (ssname ss (setq n (1- n)))
          tl (+ (cond (tl) (0)) (vlax-curve-getDistAtParam ent (vlax-curve-getEndParam ent)))
        ); setq
      ); repeat
      (alert (strcat "Total length of selected objects is " (rtos tl) "."))
    ); progn
  ); if
  (princ)
); defun

No, it doesn't do the breakdown reporting or extraction to a file or anything, but is just an improvement on the TLEN command and some of the other approaches.

Kent Cooper, AIA


@alique.langlois wrote:

....

I also use Tlen.LSP and it works


I notice that TLEN and some of the routines in the link in my first Reply go to more trouble than necessary.  They derive the length of different kinds of objects by different kinds of calculations, or in some cases using an AREA command on them so they can extract the length from the PERIMETER System Variable.  Some allow selection of things that don't have length at all, and either just pass them by in processing, or report on their invalidity.  But there's a way to disallow those right in the selection, and a single AutoLisp function that can get the length from all eligible object types in the same way, which greatly reduces the code required.

(vl-load-com) ; [if needed]
(defun C:TOTLEN (/ ss n ent tl)
  (if (setq ss (ssget '((0 . "LINE,ARC,CIRCLE,*POLYLINE,SPLINE,ELLIPSE"))))
    (progn ; then
      (repeat (setq n (sslength ss))
        (setq
          ent (ssname ss (setq n (1- n)))
          tl (+ (cond (tl) (0)) (vlax-curve-getDistAtParam ent (vlax-curve-getEndParam ent)))
        ); setq
      ); repeat
      (alert (strcat "Total length of selected objects is " (rtos tl) "."))
    ); progn
  ); if
  (princ)
); defun

No, it doesn't do the breakdown reporting or extraction to a file or anything, but is just an improvement on the TLEN command and some of the other approaches.

Kent Cooper, AIA
Message 10 of 20
DapperDanMan
in reply to: Kent1Cooper

DapperDanMan
Enthusiast
Enthusiast

All of the links that I have found to LISP routines that total up lines or polyline lengths are dead.

 

Has AutoDesk created a command for this yet, or am I chasing a rainbow?

All of the links that I have found to LISP routines that total up lines or polyline lengths are dead.

 

Has AutoDesk created a command for this yet, or am I chasing a rainbow?

Message 11 of 20
Kent1Cooper
in reply to: DapperDanMan

Kent1Cooper
Consultant
Consultant

@DapperDanMan wrote:

All of the links that I have found to LISP routines that total up lines or polyline lengths are dead.

....


There are two routines in this very topic that do that.  Do they not work for you?

Kent Cooper, AIA
0 Likes


@DapperDanMan wrote:

All of the links that I have found to LISP routines that total up lines or polyline lengths are dead.

....


There are two routines in this very topic that do that.  Do they not work for you?

Kent Cooper, AIA
Message 12 of 20
DapperDanMan
in reply to: Kent1Cooper

DapperDanMan
Enthusiast
Enthusiast

I don't know how to program autolisp routines.

 

I have a masters degree in Architecture, not in computer programming.

There should be a command for this in acad. 

I don't know how to program autolisp routines.

 

I have a masters degree in Architecture, not in computer programming.

There should be a command for this in acad. 

Message 13 of 20

alique.langlois
Enthusiast
Enthusiast

@DapperDanMan  I don't think your education level should play into this.  Nor your sass about your ability and openness to learning.

 

Open notepad, copy and paste the code, and save-as "***.lsp". Then drag and drop that into the cad window. Now depending on the command name used it should work as everyone describes.

0 Likes

@DapperDanMan  I don't think your education level should play into this.  Nor your sass about your ability and openness to learning.

 

Open notepad, copy and paste the code, and save-as "***.lsp". Then drag and drop that into the cad window. Now depending on the command name used it should work as everyone describes.

Message 14 of 20
pendean
in reply to: DapperDanMan

pendean
Community Legend
Community Legend

@DapperDanMan AutocAD is a tool of your trade: learn how to use the tools of your trade like your paying customers expect (and how you expect your electrician/plumber/doctor/nurse/car repair shop to do for example), here are basic instructions that explain how to get started http://www.lee-mac.com/runlisp.html inn addition to the great quick-fix advise provided in message #13 above https://forums.autodesk.com/t5/autocad-forum/length-of-multiple-polyline-totals/m-p/11246279#M108223...

Tools of your trade bud. Tools of your trade.

0 Likes

@DapperDanMan AutocAD is a tool of your trade: learn how to use the tools of your trade like your paying customers expect (and how you expect your electrician/plumber/doctor/nurse/car repair shop to do for example), here are basic instructions that explain how to get started http://www.lee-mac.com/runlisp.html inn addition to the great quick-fix advise provided in message #13 above https://forums.autodesk.com/t5/autocad-forum/length-of-multiple-polyline-totals/m-p/11246279#M108223...

Tools of your trade bud. Tools of your trade.

Message 15 of 20
rkmcswain
in reply to: DapperDanMan

rkmcswain
Mentor
Mentor
@DapperDanMan wrote:

There should be a command for this in acad. 

There are a lot of things that *should* be in AutoCAD, that are not. Nobody is making us use it. There are lots of competitors out there, give them a look. Maybe something else is a better fit.

R.K. McSwain     | CADpanacea | on twitter
0 Likes

@DapperDanMan wrote:

There should be a command for this in acad. 

There are a lot of things that *should* be in AutoCAD, that are not. Nobody is making us use it. There are lots of competitors out there, give them a look. Maybe something else is a better fit.

R.K. McSwain     | CADpanacea | on twitter
Message 16 of 20
Kent1Cooper
in reply to: DapperDanMan

Kent1Cooper
Consultant
Consultant

@DapperDanMan wrote:

All of the links that I have found to LISP routines that total up lines or polyline lengths are dead.

....

I don't know how to program autolisp routines.

I have a masters degree in Architecture, not in computer programming.

There should be a command for this in acad. 


If those links has not been dead, you would still have needed to load the AutoLisp routines at them, just as you do those in this topic [or any other(s) you might find].

 

To suggest that AutoCAD implement such as thing, go to the >Product Feedback Page<.  We can't help with that here -- we're all just other Users like you, with minimal oversight by Autodesk employees, who are not the ones who can help with that, either.

Kent Cooper, AIA
0 Likes


@DapperDanMan wrote:

All of the links that I have found to LISP routines that total up lines or polyline lengths are dead.

....

I don't know how to program autolisp routines.

I have a masters degree in Architecture, not in computer programming.

There should be a command for this in acad. 


If those links has not been dead, you would still have needed to load the AutoLisp routines at them, just as you do those in this topic [or any other(s) you might find].

 

To suggest that AutoCAD implement such as thing, go to the >Product Feedback Page<.  We can't help with that here -- we're all just other Users like you, with minimal oversight by Autodesk employees, who are not the ones who can help with that, either.

Kent Cooper, AIA
Message 17 of 20
jesseQ2KVW
in reply to: Kent1Cooper

jesseQ2KVW
Community Visitor
Community Visitor

This worked great before I had to switch to 2020 LT ... any workarounds to get TLEN to function in LT? When I copy/paste into command line it keeps trying to open a new file for some reason. And, of course, LT doesn't support use of lisp.. thank you very much for your help!

0 Likes

This worked great before I had to switch to 2020 LT ... any workarounds to get TLEN to function in LT? When I copy/paste into command line it keeps trying to open a new file for some reason. And, of course, LT doesn't support use of lisp.. thank you very much for your help!

Message 18 of 20
Kent1Cooper
in reply to: jesseQ2KVW

Kent1Cooper
Consultant
Consultant

@jesseQ2KVW wrote:

.... any workarounds to get TLEN to function in LT? ....


None that I'm aware of, with no AutoLisp capability.  Nor is DATAEXTRACTION available in LT.  It's the price you pay for the lower price.

Kent Cooper, AIA


@jesseQ2KVW wrote:

.... any workarounds to get TLEN to function in LT? ....


None that I'm aware of, with no AutoLisp capability.  Nor is DATAEXTRACTION available in LT.  It's the price you pay for the lower price.

Kent Cooper, AIA
Message 20 of 20
afengP5L99
in reply to: Kent1Cooper

afengP5L99
Explorer
Explorer

Do you have a lisp routine like this but for area??? I love the face you can select and the total is a pop up notification. I posted something I found a while ago but I don't love it. Thank you!

0 Likes

Do you have a lisp routine like this but for area??? I love the face you can select and the total is a pop up notification. I posted something I found a while ago but I don't love it. Thank you!

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

AutoCAD Inside the Factory


Autodesk Design & Make Report