TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: Coder on July 19, 2019, 06:54:45 AM

Title: Angle of Closed polylines elbows
Post by: Coder on July 19, 2019, 06:54:45 AM
Hello guys.
Hope you all doing well.

I am trying to get the angle of closed LWPolyline elbows, like 30,45,90 ... etc.
How to code such a routine?
Thank you.
Title: Re: Angle of Closed polylines elbows
Post by: Lee Mac on July 19, 2019, 08:08:43 AM
Find the first non-zero bulge value (DXF group 42), calculate the arctangent (atan), and multiply by 4.

This will give an answer in radians, which may be converted to degrees if necessary by dividing by pi and multiplying by 180.
Title: Re: Angle of Closed polylines elbows
Post by: Coder on July 19, 2019, 08:26:49 AM
Wow that's great.  :wink:

Can you please tell how does atan work and why to multiply with 4.0 and not another decimal number?

Thank you Lee for your kind help.
Title: Re: Angle of Closed polylines elbows
Post by: Coder on July 19, 2019, 09:27:33 AM
I got it.  :wink:

Thanks again.
Title: Re: Angle of Closed polylines elbows
Post by: MP on July 19, 2019, 09:52:09 AM
In addition to Lee’s most excellent guidance you may find this useful in your lisp journey: http://www.afralisp.net/autolisp/tutorials/polyline-bulges-part-1.php ...
Title: Re: Angle of Closed polylines elbows
Post by: Coder on July 19, 2019, 11:14:57 AM
In addition to Lee’s most excellent guidance you may find this useful in your lisp journey: http://www.afralisp.net/autolisp/tutorials/polyline-bulges-part-1.php ...
Beautiful indeed.  8-)
Thank you for taking the time and post that informative link.
Title: Re: Angle of Closed polylines elbows
Post by: MP on July 19, 2019, 02:10:35 PM
My pleasure; cheers.