Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
AutoCAD Automation for Python
Python Shell
branch: master
Failed to load latest commit information.
docs Bump version 0.1.3
examples moved examples in separate folder
pyautocad Bump version 0.1.3
tests Use dynamic=True in GetActive/CreateObject
.gitignore .hgignore -> .gitignore
HISTORY.txt Add links to README
LICENSE.txt Fix comtypes version requirement, fix type library import, __version_…
MANIFEST.in rename README
README.rst README: typo fix (Feautures -> Features)
cx_setup.py
hello_world.py Change print to py3 in readme
setup.py Bump version 0.1.3

README.rst

pyautoacad - AutoCAD Automation for Python

This library aimed to simplify writing ActiveX Automation scripts for AutoCAD with Python

Requires:

Optional:

Features:

  • Simplifies work with coordinates (3D points)
  • Efficient objects iteration and searching (with casting to correct type)
  • Excel/csv/json import and export (xlrd and tablib required)

Simple usage example:

from pyautocad import Autocad, APoint


acad = Autocad()
acad.prompt("Hello, Autocad from Python\n")
print acad.doc.Name

p1 = APoint(0, 0)
p2 = APoint(50, 25)
for i in range(5):
    text = acad.model.AddText('Hi %s!' % i, p1, 2.5)
    acad.model.AddLine(p1, p2)
    acad.model.AddCircle(p1, 10)
    p1.y += 10

dp = APoint(10, 0)
for text in acad.iter_objects('Text'):
    print('text: %s at: %s' % (text.TextString, text.InsertionPoint))
    text.InsertionPoint = APoint(text.InsertionPoint) + dp

for obj in acad.iter_objects(['Circle', 'Line']):
    print(obj.ObjectName)

See more examples in source distribution.

Links

Something went wrong with that request. Please try again.