Hi ,
I am trying to call the NETLOAD command from the click of a button and passing the path of the class libray as below:
Now I observe that the NETLOAD command is looking only at User docs path for the dl and not the fullpath that is specifed.
Any ideas or thoughts on this ??
CommandParameter="(command "NETLOAD" "C:\Users\UserName\AppData\Roaming\Autodesk\ApplicationPlugins\DLL ")"; doc.SendStringToExecute( button.CommandParameter.ToString(), true, false, true);
Hi,
within LISP statements you should use the forward-slash "/" instead of the backslash "\" as directory separator.
HTH, - alfred -
Hi.. for info, with AUTOCAD 2013 - 2014 you have to add the path in the option of acad for bypass the security of application. (if you use acad v2013+).
Hi AubelecBE ,
Thanks for the quick reply but can you please provide an example or point to any refernces that provides an example in .NET
1. The code is C#, right? How can you "observe that the NETLOAD..."? Because, to me, the code should not even be compliled. purely by syntex (in order to be compiled):
CommandParameter="(command "NETLOAD" "C:\Users\UserName\AppData\Roaming\Autodesk\ApplicationPlugins\DLL ")";
Should be
CommandParameter="(command \"NETLOAD\" \"C:\\Users\\UserName\\AppData\\Roaming\\Autodesk\\ApplicationPlugins\DLL \")";
because you need to escape the quote (") and the backslash (\) when they are inside a literal string.
2. Then, since this command string is an lisp command, you need to double the backslash in the file path, or use "/" instead, as Alfred pointed out. Therefore, the lien of code should be:
CommandParameter="(command \"NETLOAD\" \"C:/Users/UserName/AppData/Roaming/Autodesk/ApplicationPlugins/DLL ")";
3. Are you should you want to NETLOAD a DLL file, named as "DLL" (without file extension "dll")? If the file is oddly enough named as DLL.dll, then the code should be:
CommandParameter="(command \"NETLOAD\" \"C:/Users/UserName/AppData/Roaming/Autodesk/ApplicationPlugins/DLL.dll ")";
4. If you are using AutoCAd2014, you must make sure the folder of this Dll.dll is trusted, as the other reply pointed out.
5. Lastly, since your app is already NETLOADed .NET app, you do not have to call Document.SendStringToExecute() to NETLOAD a .NET assembly, since it runs asynchly, and if your next line relies on the assembly to be loaded, then you may run into issue. You can use System.reflection.Assembly.Load()/LoadFromFile(). This, of course also suject to the trusted path issue, if you are using Acad2014.
Norman Yuan
Hi Norman,
Thanks for the real good explaination.
Yes the code is in C#. As said I am using the char(34) to handle escaping of double quote.
I only posted the snippet of the tring to give an idea.
When I tried with Assembly.Load() with the full path (from Program Files ) crashes ACAD but works from any ther location.
Can you shed some light on as I am newbie into Acad programming.
Thanks in advance.