*Expert Elite*
Posts: 959
Registered: ‎04-27-2009
Message 11 of 12 (79 Views)

Re: How a DWG is opened

09-17-2013 06:53 AM in reply to: StormyC

If you only want to run some code once on each drawing, you can hook up DoucmentActivated or DocumentBecameCurrent event when your IExtesionApplication assenbly is loaded on AutoCAD startup. Then, I'd use Document.UserData to flag it. Something like:


void DocumentBecameCurrent (....)


    bool processd=false;







    if (!processed)



        e.Document.SendStringToExecute("MyCustomCommand "....)



Valued Contributor
Posts: 76
Registered: ‎11-19-2010
Message 12 of 12 (77 Views)

Re: How a DWG is opened

09-17-2013 07:15 AM in reply to: norman.yuan
Again many thanks for taking the time to reply.

I will try that out and post back, will not be for a while though...

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community