Jump to content

Add a .DLL Command into your Startup Lisp Routine


Recommended Posts

Posted

I want to add the DGNLSPURGE.DLL command to my AutoCAD 2012 start-up lisp so I don’t have to keep typing NETLOAD and manually adding it each time I need to use it.

 

I found this on the net which makes total sense although I can’t get it work.

 

If you want to incorporate the NETLOAD of the DGNLSPURGE.DLL command into your start up lisp routine so it loads on every workstation once you’ve rolled out the DBX file firm-wide, you can add the following code to your acad2014.lsp (or acad2013.lsp) as it runs the first time AutoCAD is launched and will allow you to run the DGNPURGE command without manually loading the DLL first.

 

Sample Code: (command “netload” “C:\\Program Files\\Autodesk\\AutoCAD 2014\\DgnLsPurge.dll”)

 

My Code: (command “netload” “C:\\Program Files\\Autodesk\\AutoCAD 2012 - English\\DGN Hotfix\\DgnLsPurge.dll”)

 

Where about would the code go inside the acad2012.lsp file, right at the very bottom?

Posted

do not edit the acad2xxx.lsp file. (it is not good practice. If autocad releases a new sercvicepack for a product they may replace this file for what ever reason then you will simply lose any custom code you put in there.

 

create your own acaddoc.lsp file and put your code in there. save in one of the support folders for your Autocad. AutoCAD will automatically load the first acaddoc.lsp file it finds in the support folders in each drawing.

Posted
do not edit the acad2xxx.lsp file. (it is not good practice. If autocad releases a new sercvicepack for a product they may replace this file for what ever reason then you will simply lose any custom code you put in there.

 

create your own acaddoc.lsp file and put your code in there. save in one of the support folders for your Autocad. AutoCAD will automatically load the first acaddoc.lsp file it finds in the support folders in each drawing.

 

Agreed - Here is some more information on the acaddoc.lsp file:

 

The ACADDOC.lsp File

Information on the loading order of AutoCAD Startup files

 

As for the code, I would suggest something along the lines of:

(
   (lambda ( / dll )
       (if (setq dll (findfile "DgnLsPurge.dll"))
           (command "_.netload" dll)
           (princ "\nDgnLsPurge.dll not found.")
       )
       (princ)
   )
)

Posted (edited)

What everyone else said, except I use "acad.lsp" since the .dll file only needs to be loaded once per session, not for every drawing.

 

Also to add what feargt said, since AutoCAD will load the first "acad.lsp" and "Acaddoc.lsp" it finds (by searching the support file search path from top to bottom) - I always recommend creating your own directory (something like C:\CADSTUFF) and putting your custom files in there, then add that path to the TOP of your support file search path. When you upgrade, or get a new machine or want to take your custom stuff home or share with a friend, all you have to do it copy that directory and add the path to AutoCAD.

Edited by rkmcswain
add more info
Posted

Thanks for the replies, I will have a go and let you know.

Posted

So I’ve added a folder called "CADSTUFF" to the C: drive (C:\CADSTUFF) and made a copy of the "acad.lsp" file and pasted it in this directory.

 

I’ve opened the lsp file and deleted all the information and then copied the code that Lee Mac suggested:

 

..............................................................................

(

(lambda ( / dll )

(if (setq dll (findfile "DgnLsPurge.dll"))

(command "_.netload" dll)

(princ "\nDgnLsPurge.dll not found.")

)

(princ)

)

)

..............................................................................

 

Where does the "DgnLsPurge.dll" file need to be for that code to find it, in the CADSTUFF directory or in the "C:\Program Files\Autodesk\AutoCAD 2012 - English\Support" directory?

 

I’ve also added the custom directory (C:\CADSTUFF) to the top of the support file search path within AutoCAD.

Posted (edited)

It seems to be working now.

 

Its picking up the "DgnLsPurge.dll" file from the "C:\Program Files\Autodesk\AutoCAD 2012 - English\Support" directory.

 

Also I thought i could rename the "acad.lsp" file to something else (custom name) but it wouldn't find the .dll file when doing this.

Edited by Bobzy20

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...