Setting up BatchProcessing With AcCoreConsole and ScriptPro (AutoCAD .net)
This can be difficult and extremely frustrating if you get it wrong, because AcCoreConsole is not the most user friendly interface out there – but, it is extremely fast. If AutoDesk combines AcCoreConsole with some kind of super fast in memory cache like Redis then operations will be an order of magnitude faster; and even better than that would be if the.NET API is changed to incorporate the smart GraphQL query specifications that I am pretty sure will leave behand Restful APIs in its wake. I digress.
How to Set Up Bacth Processing With AcCoreConsole and ScriptPro
1. Ensure your DLL is in a trusted location.
Anything in the AutoCAD exe folder should be a trusted location. Or alternatively, You can add trusted location paths to AutoCAD like so:
(Warning: this potentially has security implications.):
- Click on the ‘File’ or ‘Home’ button – it’s actually the main button at the top left of the screen with the fancy AutoCad logo on it.
- Then click the options button at the botton.
- Then in the “files” tab look for the “Trusted Locations” node. When you’ve found that,
- Hit the “Add” button.
- Then add the location and you are done!
2. Next thing you need to do is to set up your Script File.
;Loading the .Net module
NETLOAD
"C:\Users\Koshy\Documents\Visual Studio 2013\Projects\Useful Solutions (do not Delete)\QRCode - PanelStatusProject\QRCode1\bin\Debug\QRCode1.dll"
; Run the command
QRBatchProcessedVersion
(command "save")
; keep one line space as yes
; keep one line free above
** Change the above folder locations, of course.
** Warning: If AutoCAD changes the FileDia
mode then you’ll can revert that change by typing in the “FILEDIA” command and changing the variable to either a 1 or a zero.
** Warning: If your script is netloading a dll, please make sure that the DLL does NOT have a reference to the AcMgd.dll. Why is this the case? AutoDesk originally had the assemblies required for the .net API contained in two assemblies. Now the boffins at AutoDesk decided that all the core logic should be separated from the UserInterface logic. Accordingly, there are now 3 dlls that developers can refer to in their plug in: AcMgd, AcCoreMgd and AcDbMgd. The AcCoreMgd dll doesn’t have classes which allow for complex graphical user interactions.
Once you’ve loaded your dll, fire up script pro and batch process your drawings.
3. Run Script Pro and check your results.