I have a plugin that I have finished developing with C#.NET. Because I have multiple plugins that I want AutoCAD to load on startup I use a Lisp script that loads all my plugins with one function call. Since this is my first of many planned .NET plugins I'm using a lisp program to load each DLL file. The function for that is
(defun C:LoadDLL ()
(command "NETLOAD" "ShowHideLayers.dll")
)
where the lisp file containing that function and ShowHideLayers.dll are both in the .bundle folder in AutoCAD's roaming data.
However, when I start up AutoCAD and call LoadDLL I get an error and have no idea why:
NETLOAD Assembly file name: ShowHideLayers.dll Unable to load ShowHideLayers.dll assembly.
I can't determine the cause of the error
Solved! Go to Solution.
Solved by karunakaran1991. Go to Solution.
Hi,
Opening a drawing or starting a new drawing, AutoCAD will search all listed support paths including the working directory for a file with the filename: ACADDOC.lsp. If one or more such files are found, AutoCAD will proceed to load the first file found.
With this knowledge you can edit or create an ACADDOC.lsp to include any AutoLISP expressions to be evaluated upon startup.
Things get a little complicated should there exist more than one ACADDOC.lsp file, so, to check if such a file already exists in the support paths for eg:'C:\Users\karan\appdata\roaming\autodesk\c3d 2014\enu\support'
Open the ACADDOC.lsp and include the following sample code and specify the '.dll' file location with a single forwrd slash (/) or two backslashes (\\) as directory delimiters. The use of full path is recommended.
(command "netload" "D:\\karan\\lisp\\Sample.dll" )
Now you u can open the Autocad and check if it works.
If you wish to load by lisp not at startup use the following sample code with file location as said above.
(defun C:LoadDLL ()
(command "netload" "D:\\karan\\lisp\\Sample.dll" ))
Hope you got it.
Regards,
karuna
Consider using something like this :
(defun _NetLoadStuff (QualifiedFilePath / fn) (if (setq fn (findfile QualifiedFilePath)) (command "netload" fn) ;; else (alert (strcat "Unable to find\n" QualifiedFilePath)) ) (princ) ) (defun C:LoadDLL-02 () (_NetLoadStuff "K:\\myCadStuff\\Support\\Sample002.dll" ) ) (defun C:LoadDLL-03 () (_NetLoadStuff "K:\\myCadStuff\\Support\\Sample003.dll" ) )
(defun C:LoadDLL-11 ()
(_NetLoadStuff "Sample011.dll" )
)
Also, be aware that Trusted Locations may affect file loading.
Check system variables SECURELOAD and TRUSTEDPATHS
Regards,
Kerry
Everything will work just as you expect it to, unless your expectations are incorrect.
class keyThumper<T> : Lazy<T>; another Swamper