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

About Document.CloseAndDiscard()

5 REPLIES 5
Reply
Message 1 of 6
huaxiamengqing
535 Views, 5 Replies

About Document.CloseAndDiscard()

Hi,Everyone. The other day,I come into a trouble about Document.closeAnddiscard() . I used it to shut the active document, But,it always prompt that CAD was busy. Are you clear about what i say. eager for some help,Thank you all.

5 REPLIES 5
Message 2 of 6

You need to set CommandFlags.Session in your command method where your code gets started from.

Message 3 of 6

Can you show me some simple code?
Message 4 of 6
kdub_nz
in reply to: huaxiamengqing

Perhaps

http://lmgtfy.com/?q=CommandFlags.Session

//

Everything will work just as you expect it to, unless your expectations are incorrect.

class keyThumper<T> : Lazy<T>;      another  Swamper

Message 5 of 6
huaxiamengqing
in reply to: kdub_nz

Sorry,It's hard for me to Search code from the English pages. In our country few people use CADnet so the information is few with Chinese language. In a word, My english is not very good. Thank you for your help.

Message 6 of 6

Something like this:

 

public class MyClass

{

    [CommandMethod("MyOpenClose", CommandFlags.Session]

    public static void OpenFileForSomething()

    {

        DocumentCollection docMng=Application.DocumentManager;

        Document dwg=docMng.Open("C:\MyFolder\MyDrawing.dwg", true);

        DoSomethingWithTheDrawing(dwg);

        dwg.CloseAndDiscard();

    }

}

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