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

How to retrieve the Length value of single entity?

3 REPLIES 3
Reply
Message 1 of 4
Gokr
403 Views, 3 Replies

How to retrieve the Length value of single entity?

When we launch the list command, the Area system variable holds the area value of the selected shape.

How to get the length value into an Autolisp program to use it?

3 REPLIES 3
Message 2 of 4
Kent1Cooper
in reply to: Gokr


@Gokr wrote:

When we launch the list command, the Area system variable holds the area value of the selected shape.

How to get the length value into an Autolisp program to use it?


Some things give "lengths", but not what you would want in all circumstances [with "path" a variable containing the entity name]:
(vlax-curve-getDistAtPoint path (vlax-curve-getEndPoint path)) returns 0 if closed.
(vla-get-length (vlax-ename->vla-object path)) gives it for Lines and Polylines, but NOT Arcs or Circles.

 

So use this, which returns length for any path type, open or closed:
(vlax-curve-getDistAtParam path (vlax-curve-getEndParam path))

Kent Cooper, AIA
Message 3 of 4
Kent1Cooper
in reply to: Gokr


@Gokr wrote:

When we launch the list command, the Area system variable holds the area value of the selected shape.

How to get the length value into an Autolisp program to use it?


To be a little more comparable to your question, you can also, after using the List command on a single Polyline or Spline or Ellipse, look at the Perimeter System Variable.  But that doesn't work for Lines or Arcs or Circles.

Kent Cooper, AIA
Message 4 of 4
hmsilva
in reply to: Gokr

You can use something like

 

 (setq ent (entsel "\nSelect object : "))

 

to get the object

and somelike

 

(COMMAND "LENGTHEN"  ent "")

 

to get the object lenght and pass to perimeter sistemvar

and some like

 

(setq perim (GETVAR "perimeter"))

 

to use the peimeter value...

 

Cheers

 

Henrique

 

EESignature

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

Post to forums  

Autodesk Design & Make Report

”Boost