Using .bat to Launch AutoCAD 2015 and run script Crashes
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I have a .Net program that creates a drawing by reading a text file to get the drawing parameters.
The designers will use a web page to enter all of the drawing parameters. The web page will create a .bat file and execute it.
The .bat will have commands that create a script file, launch AutoCAD 2015 and then run the script it created.
The command the batch file uses is:
"C:\Program Files\Autodesk\AutoCAD 2015\acad.exe" /product ACAD /language "en-US" /b "C:\Heat Spreader\123456HS.scr"
The script is simply:
netload
"C:\\Program Files\\HeatSpreader\\HeatSpreader.dll"
hs
"C:\Heat Spreader\"
123456HS
hs = the command to launch the .Net program
C:\Heat Spreader\ = where the text file is
123456HS = the text file the program will read (C:\Heat Spreader\123456HS.txt)
So if I run the .bat file, it launches AutoCAD 2015, draws a couple weird objects that go on for infinity to the left and right, then gives me a JIT error:
Application does not support just-in-time (JIT)
debugging. See the end of this message for details.
************** Exception Text **************
Autodesk.AutoCAD.Runtime.Exception: eInvalidInput
at Autodesk.AutoCAD.DatabaseServices.Hatch.AppendLoop
at HeatSpreader.CreateSideView.drawSPL(Double sideViewOffset, Double lidBodyY, Double lidFootY, Double lidFootThickness, Double overallLidThickness, Double lidCavityY, Double lidCavityDepth, Double dwg_scale, Double dwgTextHeight, Double dwg_ratio, String libPath)
at HeatSpreader.amkrClass.HS()
If I just open AutoCAD 2015 and then run the script (on the command line use "scr" and select C:\Heat Spreader\123456HS.scr), it works as expected, no problems.
So is there a switch or something that is causing the error/crash when using the batch file? I don't understand why I can launch AutoCAD 2015, then run the exact same script and have it work.
This program was originally written in Visual Studio 2010 for AutoCAD 2010 and there was no problem running the .bat file and creating the drawing. Just the other day I opened it in Visual Studio 2012 as my company now moved to AutoCAD 2015.
In the program properties I changed the .Net Framework to 4.5 (used to be 3.5). I also changed the references to the 2015 ObjectARX and made them "False" to copy local.
Thanks
Mark