Another newbie question...
I am trying to switch "control" to an EXISTING document that I will open in read-only mode. Here are the steps:
1. I do a netload of the class library containing the code I am going to execute.
2. From autocad, in a NEW drawing, I type in TEST1 which executes below opening an EXISTING drawing:
[CommandMethod("TEST1")]
public void test1()
{
string fileName = "C:\\room.dwg"; // EXISTING drawing I wish to manipulate
openAndActivateDocument(fileName);
}
public void openAndActivateDocument(string filename)
{
Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;
DocumentCollection docs = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager;
Document doc;
// Open Dwg File
try
{
// Open File
doc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.Open(filename, true);
}
catch (System.Exception ex)
{
ed.WriteMessage("\nError: {0}", ex.Message);
return;
}
// Call next command to continue process in newly activated document
doc.SendStringToExecute("StartExtraction" + Char13 + Char27, false, true, true);
// Activate Document
if (docs.MdiActiveDocument != doc)
{
docs.MdiActiveDocument = doc;
}
}
[CommandMethod("StartExtraction")]
public void startExtraction()
{
...
// WE NEVER GET TO THIS METHOD
...
3. At this point it switches to the new document. I have another method called "StartExtraction" (as you can see I am calling it above from the new document). But, it never hits the breakpoint in the code.
My question is how do I succesfully switch control to the new document. It looks like the issues has something to do with the fact that I used netload from another document. One of the requirements is that I do this from a new drawing as above and then switch control over to an existing drawing.
Thanks Before Hand.