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.
You need to set CommandFlags.Session in your command method where your code gets started from.
Norman Yuan
Perhaps
http://lmgtfy.com/?q=CommandFlags.Session
// Called Kerry in my other life.
Everything will work just as you expect it to, unless your expectations are incorrect.
class keyThumper<T> : Lazy<T>; another Swamper
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.
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();
}
}
Norman Yuan
Can't find what you're looking for? Ask the community or share your knowledge.