Lisp Routine for Creating a Chamfer Line of Fixed Length

Lisp Routine for Creating a Chamfer Line of Fixed Length

Yasir.Aman
Advocate Advocate
3,287 Views
36 Replies
Message 1 of 37

Lisp Routine for Creating a Chamfer Line of Fixed Length

Yasir.Aman
Advocate
Advocate

I searched the forums but couldn't find an existing solution.

I'm looking for a Lisp routine that creates a chamfer line of a fixed length, provided by the user. The routine should calculate the distances for Distance 1 and Distance 2 (which are usually user-defined in AutoCAD's built-in chamfer command).

In my case, both distances for Line 1 and Line 2 will be equal. The angle between Line 1 and Line 2 can be anything greater than 0 and less than 180 degrees.

Please refer to the attached image for further clarification.

Thank you all!

 

For-Chamfer-Lisp.png

0 Likes
Accepted solutions (1)
3,288 Views
36 Replies
Replies (36)
Message 21 of 37

Kent1Cooper
Consultant
Consultant

@komondormrex wrote:

this is holy everything but the autolisp, visual lisp and general customization imo.


[I'm not quite sure what you mean by that, but customizations other than by AutoLisp/Visual Lisp certainly have a place here, such as command macros and custom Hatch patterns and Linetypes.  I would categorize Python code as "general customization" as much as those.]

Kent Cooper, AIA
Message 22 of 37

komondormrex
Mentor
Mentor

@Kent1Cooper wrote:

a first try.


i think first should always come first.

0 Likes
Message 23 of 37

komondormrex
Mentor
Mentor

@Kent1Cooper wrote:

I would categorize Python code as "general customization" as much as those.]

can't find anything regarding python in the official autocad help. meant just this. anyway i think a python add-in is a cool feature, but...

0 Likes
Message 24 of 37

daniel_cadext
Advisor
Advisor

Thank you for your interest in Python. Your right, it’s a community effort to create a better scripting language for AutoCAD. I’ve been wrapping ObjectARX and my daughter wrapped the ActiveX stuff. Since the project has started, others have contributed as well. It’s all open source. The intent is to serve the community

 

I’m not insensitive to your opinion. I only post when AutoLISP struggles to achieve a desired result, or to illustrate a concept that is language agnostic.

 

Cheers:)

~Dan

Python for AutoCAD, Python wrappers for ARX https://github.com/CEXT-Dan/PyRx
Message 25 of 37

Sea-Haven
Mentor
Mentor

In built, no compilers required are Lisp and VBA. If Autodesk decide to include the Python core then it could become a 3rd open code. But the Autodesk push seems to be go down the developers path with Visual Studio. Lisp, .Net or C# etc. This may be a link with Microsoft. 

 

Look at Opendcl an improved version of dcl again a run time must be loaded. 

 

Personally I stay away from loading run time packages. I have enough problems with clients just using code provided without adding an overhead of making sure a runtime is loaded. A lot of clients have IT managers and would not allow adding run time packages. Where I use to work often downloaded stuff would fail and had to wait for IT to do their due diligence before we could use.

 

 

 

 

Message 26 of 37

daniel_cadext
Advisor
Advisor

Hi,

- “In built”

Certainly, that has value. AutoLISP has been the go-to scripting language for the past two decades. Nothing to install, it’s just there.

 

- “no compilers required are Lisp and VBA”

Same with Python, you can write your code in notepad, of course and IDE with Autocomplete would make more sense.

 

- “Look at Opendcl”

A wonderful project to bring an amazing GUI interface to the community. OpenDCL team has done an amazing job. It’s open source, so it’s very low risk

 

- “Personally I stay away from loading run time packages”

Valid reasons for that, I remember times where I couldn’t get the current ObjectDCL or DOS_LIB libraries. But now they’re all open source.

The downside of not using runtime packages is, you can only offer your clients 25-year-old technology.

 

Myself, I demand more. I want to be able to extract attributes / other drawing data and hand it off to the latest and greatest data science / machine learning tools to produce estimations, material takeoffs, or what over data I need analyzed. Literally, thousands upon thousands of amazing packages, covering a huge range of industries available. Meanwhile, Lispers are still trying to connect to excel with ActiveX automation, not that there’s anything wrong with that, but it’s like trying to drive an F250 with a toilet bowl plunger as the gearshift.

 

- If Autodesk decide to include the Python core…

IMHO, it’s more likely than not. One of Autodesk’s competitors has just published Python wrappers for their ARX like API. It’s not open source, so your stuck with the company's release cycle

 

Every highschooler from here to Timbuctoo is learning Python and machine learning. If I’m a company, why would I train users to learn a 25-year-old scripting language that is basically cutoff from the outside world?  Point being, I think companies will demand it.

 

***Sorry, the thread has gone way off topic, please create a new one if you wish to continue the python discussion

Python for AutoCAD, Python wrappers for ARX https://github.com/CEXT-Dan/PyRx
Message 27 of 37

komondormrex
Mentor
Mentor

i'm on the way

CI.gif

Message 28 of 37

Yasir.Aman
Advocate
Advocate

@komondormrex. Wow! This looks amazing 😍.

Can't wait to see the final result. Fingers crossed.

 

Do you plan to include curves similar to @daniel_cadext 's algorithm?

0 Likes
Message 29 of 37

Yasir.Aman
Advocate
Advocate

@daniel_cadext wrote:

***Sorry, the thread has gone way off topic, please create a new one if you wish to continue the python discussion


A thread on the topic would be interesting certainly.

0 Likes
Message 30 of 37

komondormrex
Mentor
Mentor

surely i do

CI.gif

Message 31 of 37

Yasir.Aman
Advocate
Advocate

Wow! I am getting excited so see the final product.

Will we be able to select a portion of polyline (e.g. one or more vertices) to be chamfered instead of the whole polyline?

0 Likes
Message 32 of 37

komondormrex
Mentor
Mentor

yep

komondormrex_0-1723185541131.gif

 

Message 33 of 37

Yasir.Aman
Advocate
Advocate

@komondormrexThis feels like a dream come true. When can we expect to see the final product?

0 Likes
Message 34 of 37

komondormrex
Mentor
Mentor

asap

Message 35 of 37

komondormrex
Mentor
Mentor

@john.uhden wrote:

This would be a simple way (so long as the legs are treated as straight chords, not arc lengths)...

 that is exactly how they did it in the chamfer command)

komondormrex_0-1723312599211.png

 

Message 36 of 37

Yasir.Aman
Advocate
Advocate

Thank you, @komondormrex!

This visual does an excellent job of illustrating how and why curves shift when using AutoCAD's built-in chamfer command.

0 Likes
Message 37 of 37

komondormrex
Mentor
Mentor

@Yasir.Aman,

that is what i came up with for now. sort of a lengthy one, hence the fas.

 

 

0 Likes