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
Hi,
are you using methods like sendcommand or similar things? If so that could be a result of
- alfred -
Hi Alfred,
No, I'm not using any "Sendcommands" in my code. Maybe I'll put a delay in the bat file to give AutoCAD time to load before running the script. I'm just running out of ideas.
Thanks again,
Mark
are you able to manually netload and see what happens? or perhaps paste the code (if not too long) perhaps someone can see something wrong in there?
Hi,
The program runs great if AutoCAD is already open. You can run the script (which does the netload and applies the needed input) or you can manually do netload and enter the needed input. It's just when the batch file runs, creates the script, then launches AutoCAD and plays the script that it doesn't work.
Best regards,
Mark
Can't find what you're looking for? Ask the community or share your knowledge.