Active Contributor
Posts: 35
Registered: ‎08-30-2010
Message 1 of 2 (201 Views)

Topmost Drawing Not Active for SendStringToExecute

201 Views, 1 Replies
02-19-2013 10:40 AM

If there is a better way of going about this I would be happy to hear it, but for now this is the only course of action I have figured out.


I am importing a dgn into autocad by using the SendStringToExecute method with the 'Import' command.  My problem is that once I have the dgn imported I want to do some modification and then save the drawing, but setting a new dim to the current mdiactivedocument still gives me the initial document and not the one opened by the import command as I had thought it would.


How can I switch the mdiactivedocument over to the newly opened document?



Valued Mentor
Posts: 370
Registered: ‎05-06-2012
Message 2 of 2 (178 Views)

Re: Topmost Drawing Not Active for SendStringToExecute

02-19-2013 07:14 PM in reply to: JasonSelf

If you're doing that from the handler of a registered command, the CommandMethod attribute needs to have the CommandFlags.Session flag set.  That allows the command to run in the application context.


If a command doesn't run in the application context, it's execution is suspended when the document that it was issued in is deactivated, and will not resume until the document is activated again.


When you define a command with CommandFlags.Session, you also must lock/unlock any document you work with.

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