Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

List total length of polylines - Lisp query

2 REPLIES 2
Reply
Message 1 of 3
MatthewB80097
9932 Views, 2 Replies

List total length of polylines - Lisp query

Does anyone know where I can obtain a freeware lisp routine that lists the lengths of all the polylines on a specific layer or within a selection set? I want to avoid list if possible as there are rather a lot of polylines!

2 REPLIES 2
Message 2 of 3
Kent1Cooper
in reply to: MatthewB80097


@MatthewB80097 wrote:

Does anyone know where I can obtain a freeware lisp routine that lists the lengths of all the polylines on a specific layer or within a selection set? ....


You can no doubt find many routines on the Discussion Group that will do something or other to all Polylines in a selection set, and perhaps to all those on a certain Layer.  As for finding the lengths of them all, there are several approaches you can take:

 

(vl-load-com) if needed, then with the entity name saved in the 'path' variable....
 

(vlax-curve-getDistAtPoint path (vlax-curve-getEndPoint path)) returns 0 if it's closed, so you probably shouldn't use that [unless you would always be deailing only with open Polylines].

 
(vla-get-length (vlax-ename->vla-object path)) gives it for Lines and Polylines, so though it does NOT give it for Arcs or Circles or Ellipses or Splines, in this case it should be fine.

 
(vlax-curve-getDistAtParam path (vlax-curve-getEndParam path)) returns the length of any path type, open or closed, so it would also work, though it's longer than the previous one.

 

As to output, what do you mean by "lists the lengths"?  Just displays them at the Command: prompt line, or saves them into a list as a variable so you can do something with them, or writes them to a file, or....?

Kent Cooper, AIA
Message 3 of 3

Thanks all, however found tschau answers my query on this thread...

 

http://forums.autodesk.com/t5/AutoCAD-2010/how-to-get-the-total-distance-lenght/td-p/2737919

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

Post to forums  

Autodesk Design & Make Report

”Boost