.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

NETLOAD command does not work with full path to Library

5 REPLIES 5
Reply
Message 1 of 6
DMadhuri
1892 Views, 5 Replies

NETLOAD command does not work with full path to Library

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);

 

5 REPLIES 5
Message 2 of 6
Alfred.NESWADBA
in reply to: DMadhuri

Hi,

 

within LISP statements you should use the forward-slash "/" instead of the backslash "\" as directory separator.

 

HTH, - alfred -

------------------------------------------------------------------------------------
Alfred NESWADBA
Ingenieur Studio HOLLAUS ... www.hollaus.at ... blog.hollaus.at ... CDay 2024
------------------------------------------------------------------------------------
(not an Autodesk consultant)
Message 3 of 6
AubelecBE
in reply to: DMadhuri

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+).

 

 

Message 4 of 6
DMadhuri
in reply to: AubelecBE

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

 

Message 5 of 6
norman.yuan
in reply to: DMadhuri

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

Drive CAD With Code

EESignature

Message 6 of 6
DMadhuri
in reply to: 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.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost