Using Civil 3D 2015 via console

By Augusto Goncalves

Since release 2013, we can use AutoCAD in console mode. This is intended to developers, there is no graphical interface and only the command line is available through the console window or via programming.

Back on Autodesk University 2012, this class covered the basics on how use and automate AutoCAD Console, including how to load custom .NET applications. Is this possible on Civil 3D? Yes!

To use the console with Civil 3D 2015 .NET API we just need to launch the console and load an additional .NET assembly: AeccDbMgd.dll. After that, a custom .NET DLL should work. The image below show the result. Note how we NETLOAD the AeccDbMgd, then NETLOAD a custom DLL C3D_2015_CS.dll that contains a simple command that count alignment styles.

Of course the AutoCAD Console was not designed to be used like this (via Windows Console), this is just a test. To take full advantage, you can use .bat files (simplest approach) or a full .NET application that will manage and control instances of it. As mentioned above, the AU class show several samples and ideas, just need to include the additional NETLOAD AeccDbMgd.

original 

Tip: AutoCAD is now blocking DLLs that are not on the trusted folders. On the UI we can simply include our folders on the trusted path list. Via console this can take extra time, that’s why I copied my custom DLL to Program Files folder (which is trusted by default).

The console approach can significantly reduce batch processing time and, as you can launch one instance per drawing, also improve error handling (if one instance freeze, just kill the process and start again). In summary, at least consider and evaluate this option!


Comments

4 responses to “Using Civil 3D 2015 via console”

  1. Norman Yuan Avatar
    Norman Yuan

    Since AutoCAD Map 3D is subset of AutoCAD Civil 3D, does that mean that after “NETLOADING” AeccDbMgd.dll, the Civil 3D console can also be used with AutoCAD Map 3D API?
    I have tried the console with AutoCAD Map 2014 installation with Map API: code based on MAP API does not run in the console. However, I may have to do similar thing as you described here: NETLOADING some MAP specific managed assemblies first?

  2. Since AutoCAD Map3D is a subset included AutoCAD Civil3D, does that mean that after NETLOADING AeccDbMgd.dll, MAP API is also available as Civil3D API?
    I have tried to use MAP API in console with AutoCAD Map 2014 installation and failed. Have not tried it with Map 2015/16.
    Also, since AutoCAD I/O services are the online version of console, does that mean Civil API (or other vertical AutoCAD products, for that matter) is/will be available with AutoCAD I/O?

  3. Norman,
    The trick was to NETLOAD the API assemblies (aeccdbmgd.dll) to ensure it’s loaded. I haven’t tried with Map (don’t have it installed), have you trie NETLOADing them?
    In fact the Console is an AutoCAD feature, that’s why I used this workaround (NETLOAD the API DLLs).
    Also, this approach is improving on newer versions. Not sure if was working fine on 2014.
    Regards,
    Augusto Goncalves

  4. Norman,
    AutoCAD I/O does not yet support C3D specific assemblies. When we use it locally we’re actually using all C3D files installed locally, but I/O is a vanilla AutoCAD.
    Regards,
    Augusto Goncalves

Leave a Reply

Discover more from Autodesk Developer Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading