Open drawing in Autocad 2013 with VB.net and set as active
I am working on a routine in AuoCAD 2013using VB.net:
open a template drawing from reference folder > Save to out folder > create entities on the drawing.
The problem I am facing is that when I open the drawing it does remain activated. I can see the template being opened. but as soon as it opens it hides behind the default drawing "Drawing1.dwg".
Can some one guide me to solve this issue.
Re: Open drawing in Autocad 2013 with VB.net and set as active
Hi, welcome to augi.
It would be helpful if you psoted your code. Please wrap it in <CODE> tags. To do this, click on Go Advanced at the bottom of the reply window and then click on the <#> button.
Re: Open drawing in Autocad 2013 with VB.net and set as active
You should have shown your code, so that others may spot error in the code easier. I'll do my guess here:
if you open the drawing with Application.DocumentManager.Open([FilePathName],...), the opened drawing may or may not become active drawing in AutoCAD edior, depending on the context the code runs - Document context, or application context. In your case, if you want the newly opened drawing to become active one, the CommandMethod that runs your code should set CommandFlags.Session flag, that is:
Code:
[CommandMethod("OpenMyDwg", CommandFlags.Session)]
public static void OpenDrawing()
{
var newDwg=Application.DocumentManager.Open(......);
}