.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Creating a AcCoreConsole.exe .NET addin

8 REPLIES 8
Reply
Message 1 of 9
Anonymous
1299 Views, 8 Replies

Creating a AcCoreConsole.exe .NET addin

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

8 REPLIES 8
Message 2 of 9
augusto.goncalves
in reply to: Anonymous

Try import this namespace

Autodesk.AutoCAD.ApplicationServices.Core

Regards,



Augusto Goncalves
Twitter @augustomaia
Autodesk Developer Network
Message 3 of 9
augusto.goncalves
in reply to: Anonymous

And yes, you cannot include reference to AcMgd.dll if you plan to run the addin on AutoCAD Console.

 

Regards,



Augusto Goncalves
Twitter @augustomaia
Autodesk Developer Network
Message 4 of 9
Anonymous
in reply to: augusto.goncalves

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

Message 5 of 9
augusto.goncalves
in reply to: Anonymous

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.

Regards,



Augusto Goncalves
Twitter @augustomaia
Autodesk Developer Network
Message 6 of 9
Anonymous
in reply to: augusto.goncalves

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

Message 7 of 9
augusto.goncalves
in reply to: Anonymous

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?

Regards,



Augusto Goncalves
Twitter @augustomaia
Autodesk Developer Network
Message 8 of 9
Anonymous
in reply to: augusto.goncalves

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

Message 9 of 9
augusto.goncalves
in reply to: Anonymous

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....

Regards,



Augusto Goncalves
Twitter @augustomaia
Autodesk Developer Network

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost