Skip to content

Instantly share code, notes, and snippets.

View LiaungYip's full-sized avatar

Li-aung Yip LiaungYip

View GitHub Profile
@thengineer
thengineer / autocadblockreader.py
Created October 25, 2013 16:27
AutoCAD automation via python and win32com: read all attributes from BlockReferences
import win32com.client
acad = win32com.client.Dispatch("AutoCAD.Application")
doc = acad.ActiveDocument # Document object
# iterate trough all objects (entities) in the currently opened drawing
# and if its a BlockReference, display its attributes and some other things.
for entity in acad.ActiveDocument.ModelSpace:
name = entity.EntityName