.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Closing a document with a running command.

2 REPLIES 2
Reply
Message 1 of 3
jbooth
316 Views, 2 Replies

Closing a document with a running command.

Is it possible to close the active document while a managed .NET command (defined with the CommandMethod attribute) is still running?

Background:
Part of my application's workflow is to "close" the currently active drawing, while opening a new one based on our template (this is prior to our automatic entity generation from an input file).

If the drawing is currently open, it needs to be closed or the program can not save the new document. This behaviour will work only if the user did not have the target document open as the active document.

I tried once to apply the CommandFlags.Session flag to my entry point, but the drawing would not close because it still had a command running.

Currently if this is the case I am taking the active document's database and deleting all modelspace/paperspace entities and block definitions. I obviously don't want this to be my solution.

Any help would be appreciated.
JB
2 REPLIES 2
Message 2 of 3
NathTay
in reply to: jbooth

I have successfully used the CloseAndDiscard method on the document the command started in using the CommandFlags.Session flag.

Regards - Nathan
Message 3 of 3
Anonymous
in reply to: jbooth

Only if the command has the CommandFlags.Session
command flag in its CommandMethod attribute.

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2008
Supporting AutoCAD 2000 through 2008
http://www.acadxtabs.com

wrote in message news:5671225@discussion.autodesk.com...
Is it possible to close the active document while a managed .NET command (defined with the CommandMethod attribute) is still running?

Background:
Part of my application's workflow is to "close" the currently active drawing, while opening a new one based on our template (this is prior to our automatic entity generation from an input file).

If the drawing is currently open, it needs to be closed or the program can not save the new document. This behaviour will work only if the user did not have the target document open as the active document.

I tried once to apply the CommandFlags.Session flag to my entry point, but the drawing would not close because it still had a command running.

Currently if this is the case I am taking the active document's database and deleting all modelspace/paperspace entities and block definitions. I obviously don't want this to be my solution.

Any help would be appreciated.
JB

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost