Hi,
I'm attempting to create a .NET addin running in AcCoreConsole.exe. In this project I've removed the reference to AcMgd.dll and replaced it with AcCoreMgd.dll. Is it correct that i cannot use the AcMgd.dll if I am to run my .NET addin from within AcCoreConsole.exe?
If so, how do access the DocumentManager?
For instance:
DocumentCollection ^acDocMgr = Autodesk::AutoCAD::ApplicationServices::Application::DocumentManager;
gives the error:
error C2039: 'DocumentManager' : is not a member of 'Autodesk::AutoCAD::ApplicationServices'
Is there a replacement in the AcCoreMgd.dll for the DocumentManager?
Regards,
Bjørn Egil Jenssen
Try import this namespace
Autodesk.AutoCAD.ApplicationServices.Core
And yes, you cannot include reference to AcMgd.dll if you plan to run the addin on AutoCAD Console.
Thanks, that did the trick 🙂
But what about extension methods?
DocumentExtension::CloseAndSave(acDoc, dwgfile);
Document ^acDoc = DocumentCollectionExtension::Add(acDocMgr, strTemplatePath);
How would I go about replacing the functionality of these two methods using only AcCoreMgd?
Reg,
Bjørn
Some commands will not apply to the console...
Ideally, you should open one console for each document passing the file you want to process. The main reason for that is to avoid memory fragmentation and process on hold.
I see. In my application I need to create new files (not open existing ones), and fill them with geometry. I've now been able to compile and run my application with all its functionality, except creating new files.
Is there any workaround to create a new DWG file from a template file using the AcCoreConsole.exe? Either through .NET code, or by using console commands?
Regards,
Bjørn
I would say that you can start the console, draw what you need with a .NET custom command, then call AutoCAD built-in SAVE command passing the file path.
Do you think that can work?
This works, however, my application needs to create several DWG's in one "go". So after calling the SAVE command, I need to create a new file, or close the recently saved file, on order to continue on to the next.
It would be possible to close the entire console and restart it to continue where I left of, but it would be more elegant if I could create mutiple files in one go.
I've tried the NEW command in the console, but it doesnt seem to do anything.
Are there any ways to either close the "active" file, or create a new file from the AcCoreConsole.exe?
Reg.
Bjørn
Note that opening many drawings on the same session will cause memory fragmentation, and use one session for each drawing is one of the great advantages of the console.
That said, one you launch the console passing one file and one script, you can only get the result, and you're not able to interact with it on the fly....