Greetings,
I apologise if this question has been asked and answered previoiusly, if so, please provide a link to the thread.
Using interop, running autocad from another custom application, is it possible to somehow use the core - to process data in the DWG without displaying the DWG?
Thx,
Kevin.
Solved! Go to Solution.
Solved by norman.yuan. Go to Solution.
By "somehow use the core", if you mean accoreconsole.exe, then you cannot automate it via COM API: it does not support COM API.
You can use your app to manipulate an AutoCAD script file and then use Process.Start to start accoreconsole.exe with proper arguments. so that drawing can be processed with accoreconsole.exe by the instruction of the AutoCAD script.
If you want to use COM API interop to process drawing without opening it in AutoCAD editor, you can use ObjectDBX.AxDbDocument instead of AcadDocument. Opening ObjectDBX.AxDbDocument is to read the dwg file into AutoCAD's memory, not in AutoCAD's editor. However, you need an running AutoCAD instance. Something like:
// Start an AutoCAD instance
AcadApplication acad=new AcadApplicationClass()
MessageBox.Show("AutoCAD started!");
//Open an AxDbDocument
object obj=acad.getInterfaceObject("ObjectDBX.AxDbDocument.20"); //Acad2015
AxDbDocument doc=obj as AxDbDocument
if (doc==null)
{
MessageBox.Show("Cannot open AxDbDocument for some reason!");
return;
}
//Get drawing information
MessageBox.Show("Entities in ModelSpace: " + doc.ModelSpace.Count);
//You can make changes to the entities in AxDbDocument and save the changes back to the drawing file.
doc.Save();
Norman Yuan
Superb code Norman.. Thank you.. you have opened up a whole new adventure for me ... wishing you all the best ...