I developed a .net plugin that works fine both interactively any via a .scr file in a 32 bit environment. It was build in Win7 X64 environment with VS2008 and .net 3.5. But it fails to load the command when run from a script in my x64 environment.
I then built a sample project using the AutoCAD .net Wizard and get the same results using the "mycommand" and "MySessionCmd". It runs the script and commands correctly from VS debug mode with both dlls.
From my searching it appears multiple threads are involved or its a .net 3.5 issue. First error I recieved after reinstalling 2011 was the thread issue that was resolved by adding "CommandFlagsession"
"Process Explorer" shows the dll loaded twice either interactively or via script run.
See notes below. Any assistance would be much appreciated.
// Application Session Command with localized name
CommandMethod("MyGroup", "MySessionCmd", "MySessionCmdLocal", CommandFlags.Modal | CommandFlags.Session)]
publicvoid MySessionCmd() // This method can have any name
String str = "Hello - MySessionCmd";
// Put your command code here
MySessionCmd delay FILEDIA 1 _QUIT N
C:\Progra~1\Autodesk\ACADM2~1\acad.exe /b "C:\Work\myprg\135788-0-23.scr"
Loading Mechanical modules.....
Loading Modeler DLLs.
Loader application completed Regenerating model.
AutoCAD menu utilities loaded. Command: FILEDIA
Enter new value for FILEDIA <0>: 0 Enter BACKSPACE to interrupt script.
Enter new value for PICKADD <1>: 1
Enter new value for PICKAUTO <0>: 0
Enter new value for CMDDIA <0>: 0
Command: netload Assembly file name: C:\Work\PDF_Batch\PDF_Creator\bin\Debug\PDF_Creato
Command: MySessionCmd Unknown command "MYSESSIONCMD". Press F1 for help.
Solved! Go to Solution.
Why don't you have the DLL load on startup via registry flag.
Then skip the script thing. If you have the dll loaded twice yikes? that just sounds messy. No clue why.
I know whenever I have problems with commands not loading it's been one of two things.
The DLL was erroring out on a line somewhere in the startup or it's been a duplicate named command.
Put a editor.writemessage statement to make sure your DLL is loading properly.
Public Sub Initialize() Implements Autodesk.AutoCAD.Runtime.IExtensionApplication.Ini
tialize editor.WriteMessage("<<[Finished Initializing] ClassAutocad2011.dll is Successful >>" & Environment.NewLine) end Sub
No expert here, may be out of my league. But I thought I'd chime in here and get the conversation going.
Thanks for the quick response.
I just tried adding the message. It does display but then same result. I really want to run my command in a batch mode from the command line and not interactively. Is there a better way than the script calling the .net command.
I have loaded before on startup. no joy there either.
Assembly file name: C:\Work\PDF_Batch\PDF_Creator\bin\Debug\PDF_Creato
<<[Finished Initializing] MyCommand.dll is Successful >>
Unknown command "MYCOMMAND". Press F1 for help.
the problem sounds vaguely familiar and i recall watching autodesk's intro on .net programming a milllion times. in there was a mentioning of the different command names and values depending on the different sections of autodesk's .net plug-in, which i understand you're using. in vs, double click mycommands.vb/mycommands.resx in the solution explorer to have a look and possibly change any values of the associated command names.
slightly embarassing that now after telling you about it, i can't actually find the lab, not without downloading the corresponding .zip files anyway, but i think it was one of the two under 'autocad .net labs' here http://usa.autodesk.com/adsk/servlet/index?siteID=
i might be completely wrong with regards to your problem, but perhaps you find the labs interesting, if nothing else.
I tried that link. Was not found and took me to main AutoCad page.
I found a bunch of references to uninstalling .net and re-installing from autoCAD media. Was that it.
i apologise, i tried the link i posted and get the same result, 'page not found'. after many frustrating tries, i think the reason is that the punctuation at the end of my sentence has somehow become part of the addess and corrupted the link. this should work better: http://usa.autodesk.com/adsk/servlet/index?siteID=
Thanks. Got them. Will review. Loaded trial copy on different system same results.
Do you ever try and batch process with AutoCAD without GUI. Best way?
i haven't actually come across batch processing at all. (the bottom line in your initial post reminded me of problems i encountered when i used the plug-in template for the first time, always with the manual 'netload' though.)
I have found a workaround. If I run my script throught ScriptPro via its command line options. It finds the .net command and runs it. Will need to see how ScriptPro is able to manage the threads and find the command.
But even a lisp routine I was given to use as a base failed when initiated from a script in x64 Win 7.
All work fine in Win 32 environments.
Thanks for all your help.