AutoCAD 2009 SP3 x86 Enu,
MS Visual Studio 2010,
Windows XP x86 SP3 Rus,
.Net Framework 3.5 SP1 x86
=======================
Why I get mistake (look code comments)?
public class Class1
{
[CommandMethod("q5", [color=red]CommandFlags.Session[/color])]
public void q5()
{
//Remember current drawing
Document dwg = acad.DocumentManager.MdiActiveDocument;
//Drawing for edition
string fileName = @"C:\Documents and Settings\andrey.bushman\My Documents\Drawing1++.dwg";
//Open drawing
Document dwg2 = acad.DocumentManager.Open(fileName); //[color=red]Instance not null![/color]
//set current drawing
acad.DocumentManager.MdiActiveDocument = dwg2;//[color=red]HERE I GET ERROR: eInvalidInput - WHY???...[/color]
//Modify drawing
dwg[color=red]2[/color].SendStringToExecute("_circle 0,0 50 _zoom _all ", true, [color=red]false[/color], true);
//Restore active drawing
acad.DocumentManager.MdiActiveDocument = dwg;
//Save & Close drawing
dwg2.CloseAndSave(fileName);
}
}