Thanks Ed! Below is the code and i'm using the latest svn version of comtypes.
import time
import comtypes.client
from comtypes.gen import AutoCAD
_progid_ = "AutoCAD.Application"
def get_running_app(progid):
try:
app = comtypes.client.GetActiveObject(_progid_)
except WindowsError, e:
print e
else:
return app
def get_running_acadapp():
return get_running_app(_progid_)
class DocSink:
def __init__(self):
self.doc = get_running_acadapp().ActiveDocument
def ObjectAdded(self, this, entity):
print "Object %s added in %s." % (str(entity), self.doc.Name)
print type(entity)
app = comtypes.client.GetActiveObject(_progid_)
doc = app.ActiveDocument
docSink = DocSink()
docAdvise = comtypes.client.GetEvents(doc, docSink, interface =
AutoCAD._DAcadDocumentEvents)
comtypes.client.PumpEvents(1000)
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
comtypes-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/comtypes-users