Area and lenght of polyline

Area and lenght of polyline

andreas7ZYXQ
Advocate Advocate
1,127 Views
4 Replies
Message 1 of 5

Area and lenght of polyline

andreas7ZYXQ
Advocate
Advocate

Im looking for a lisp that return the area and lenght of a polyline.

Procedure:
Start a polyline, calculate its lenght and area and store it to.

(setq lenght)
(setq area)

After that im planning to make some info through DCL but the area and lenghts is my big issue..

Anyone there that have something that fits or could give me a hand so i can continue.

Thanks

0 Likes
Accepted solutions (1)
1,128 Views
4 Replies
Replies (4)
Message 2 of 5

_gile
Consultant
Consultant

Hi,

 

Assuming 'pline' is bound to a polyline ename:

(setq length (getpropertyvalue pline "Length"))
(setq area (getpropertyvalue pline "Area"))

Note: getpropertyvalue function is available for AutoCAD MAC and Windows since 2012 versions.



Gilles Chanteau
Programmation AutoCAD LISP/.NET
GileCAD
GitHub

0 Likes
Message 3 of 5

andreas7ZYXQ
Advocate
Advocate

Thanks
How could i start a (command "_pline") and store its ename to pline? So i could pick it up later on.

0 Likes
Message 4 of 5

_gile
Consultant
Consultant
Accepted solution

You can get the polyline ename using the entlast function after the command ended (i.e. you cannot interact while _PLINE command is running).

 

(command "_pline")
(while (< 0 (getvar 'cmdactive)) (command pause))
(setq pline (entlast))


Gilles Chanteau
Programmation AutoCAD LISP/.NET
GileCAD
GitHub

0 Likes
Message 5 of 5

andreas7ZYXQ
Advocate
Advocate

Thanks for your help.  You saved my day 😃

0 Likes