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

Python programming in autocad

4 REPLIES 4
Reply
Message 1 of 5
Oliver_C3D
28441 Views, 4 Replies

Python programming in autocad

Can I write to the AutoCAD program or extension with Python?
If you can provide a tutorial or reference file in this case?
4 REPLIES 4
Message 2 of 5
_gile
in reply to: Oliver_C3D

Hi,

 

You can use the pyautocad library with the AutoCAD COM API or IronPython with the AutoCAD .NET API (and also the COM API).



Gilles Chanteau
Programmation AutoCAD LISP/.NET
GileCAD
GitHub

Message 3 of 5
serag.hassouna
in reply to: Oliver_C3D

In addition to what @_gile said, there's the comtypes package.
If you understand AutoCAD's object model, you can invoke almost every method and fetch almost every value.
However, the main downside of comtypes is that you need to supply all arguments to every method you invoke, even the optional ones need to be explicitly supplied.
________
To catch the feeling of how it is "simple in theory" to connect to AutoCAD with python you can see the included code within this question of mine about an issue.
Postcommand doesn't read AutoLisp expression [Python 2.7 & AutoCAD 2016 Windows]

Message 4 of 5
rantaliran
in reply to: serag.hassouna

hello serag.hassouna ,

I wanted to ask you for more detailed instructions, on how can I receive specific measurement from AutoCAD (maybe student addition) to a python program:)))

thank you for your help!

Ran
Message 5 of 5
Chuong.Ho
in reply to: Oliver_C3D

You can use project cadpythonshell, An IronPython console for Autocad and Civil 3d API, include full snoop Database to explore CAD.

https://github.com/chuongmep/CadPythonShell

 

Chuong Ho

EESignature

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

Post to forums  

Autodesk Design & Make Report

”Boost