Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

System Variable for acaddoc.lsp

18 REPLIES 18
Reply
Message 1 of 19
jonesw
2687 Views, 18 Replies

System Variable for acaddoc.lsp

Is there a system variable that controls when AutoCAD runs the acaddoc.lsp file that is located in the support folder (and/or trusted locations folder)? "SECURELOAD" doesn't seem to have anything to do with it once it is in a supported location and "ACADLSPASDOC" is only for the acad.lsp file.

 

BTW, I am running 2014...

Tags (1)
18 REPLIES 18
Message 2 of 19
hmsilva
in reply to: jonesw


@jonesw wrote:

Is there a system variable that controls when AutoCAD runs the acaddoc.lsp file that is located in the support folder (and/or trusted locations folder)? "SECURELOAD" doesn't seem to have anything to do with it once it is in a supported location and "ACADLSPASDOC" is only for the acad.lsp file.

 

BTW, I am running 2014...


No, the acaddoc.lsp file is loaded every time you open a drawing or start a new drawing...

 

Henrique

EESignature

Message 3 of 19
rkmcswain
in reply to: jonesw

...and only the first found copy of it is loaded - in case there are multiple copies in the SFSP

R.K. McSwain     | CADpanacea | on twitter
Message 4 of 19
hillrunner
in reply to: rkmcswain

So when you publish drawings, why doesn't it run the acaddoc.lsp file if you turn off background plotting? What type of session is opened when the publish command is run?

Message 5 of 19
aqdam1978
in reply to: hillrunner

Hi Hillrunner,

 

I think there is something wrong! did you try it yourself or not.

acad.lsp and acaddoc.lsp have not any system variables to active or deactive.

------------------------------------------------------------------------------------------------------------

The acad.lsp file is intended to be used for application-specific startup routines,
all functions and variables defined in an acad.lsp file are only available in the first drawing.
You will probably want to move routines that should be available in all documents from your acad.lsp file into the acaddoc.lsp file.
The recommended functionality of acad.lsp and acaddoc.lsp can be overridden with the ACADLSPASDOC system variable.
If the ACADLSPASDOC system variable is set to 0 (the default setting), the acad.lsp file is loaded just once: upon application startup.
If set to 1, the acad.lsp file is reloaded when a new drawing is created or an existing drawing file is opened.

------------------------------------------------------------------------------------------------------------

The acaddoc.lsp file is intended to be associated with each document (or drawing) initialization.
This file is useful if you want to load a library of AutoLISP routines to be available every time you start a new drawing (or open an existing drawing).
Each time a drawing opens, AutoCAD searches the library path for an acaddoc.lsp file.
If it finds one, it loads the file into memory.
The acaddoc.lsp file is always loaded with each drawing regardless of the settings of ACADLSPASDOC.

 

Thanks,

Abbas

 

Message 6 of 19
hillrunner
in reply to: aqdam1978

Yes, I work for the same company as jonesw and we've tried those settings and it still doesn't work.

Message 7 of 19
pbejse
in reply to: hillrunner


@Anonymous wrote:

So when you publish drawings, why doesn't it run the acaddoc.lsp file if you turn off background plotting? What type of session is opened when the publish command is run?


 

Not sure what acaddoc.lsp have anything to do with Publish, All you have to do us specify a named  "page setup" with the prefered toggle for background plotting. 

 

EDIT: 

Looking at the post again, Are you wanting to change the layer state prior to printing ? meaning set the prefered Layer States then publish in one go? Hitting two birds with one stone 

 

 

Message 8 of 19
fenton.webb
in reply to: pbejse

As you mention SECURELOAD in this thread, I'm posting this white paper for you guys to checkout http://adndevblog.typepad.com/autocad/2013/07/all-you-need-to-know-about-autocad-secureload-au.html




Fenton Webb
AutoCAD Engineering
Autodesk

Message 9 of 19
jonesw
in reply to: fenton.webb

Fenton-

There is a lot of great information on that page. Thanks for sharing!

The specific issue we are having is during a publish (batch plot). Our acaddoc.lsp routine worked during a publish in the background in pre-2012 releases of AutoCAD, but does not work in our current 2014 version. My hunch is that the system variable for /nolisp is invoked as part of the silent open of all of the drawings during publish. I just can't find any documentation of that. We would like to find a solution to this as we need to utilize a lisp command during a publish to restore specific layer states prior to printing.

Let me know if you have any advice on how the publish routine is affected by the changes from 2012 on.

Thanks!

- Wes
Message 10 of 19
fenton.webb
in reply to: jonesw

(from experience) it going to be difficult for me to really get to grips with this issue, however, I can give you a tip - if you want to find out the command line parameters being used for a background plot, simply start the Windows Task manager,  goto processes and select columns - next select Command Line - then sit back and watch what appears when you do the plot




Fenton Webb
AutoCAD Engineering
Autodesk

Message 11 of 19
jonesw
in reply to: pbejse

pbejse-

Yes, we have a custom lsp routine that restores specified layer states when the drawing is opened (reads a text file containing the layer state name, then implements). We can make changes to xref'd base files that affect a number of sheets, then when the sheet is opened, it automatically restores to the correct look. This is really handy when you need to batch plot after changing base files because you don't need to open and save the drawings to get them to come out of the printer correctly (big time saver for us).

- Wes
Message 12 of 19
jonesw
in reply to: fenton.webb

Fenton-

I followed you up to the point where you "select columns". I'm not seeing that as an available choice. Can you clarify?

Thanks,

Wes
Message 13 of 19
jonesw
in reply to: jonesw

Fenton-

 

Nevermind, I found it. Gonna try it out and see what I find...

 

- Wes

Message 14 of 19
jonesw
in reply to: jonesw

Fenton-

 

Here is what came up:

 

"C:\Program Files\Autodesk\AutoCAD 2014\acad.exe" -pl -b C:\Users\jonesw\appdata\local\temp\BGPLOT~1\BGPlot.scr

 

I assume this is a background plot script, but it doesn't look like it has any switches set to turn off lisp when AutoCAD is opened or otherwise ignore the acaddoc.lsp file. Still a mystery why it doesn't load during a publish...

Message 15 of 19
fenton.webb
in reply to: jonesw

Next, use procmon.exe to see where acaddoc.lsp is being loaded from, if anywhere...




Fenton Webb
AutoCAD Engineering
Autodesk

Message 16 of 19
dbroad
in reply to: jonesw

jonesw and hillrunner,

Thanks for asking these questions. I had never considered that acad/doc.lsp/fas/vlx/dvb would run when drawings were published in the background. I assumed that the background processes would be disabling such behavior.

 

This is not an answer to your problem but may be an option to pursue if you cannot get your legacy behavior back. Instead of turning off background plotting in acaddoc.lsp, turn it off in your profile with the options command. That might enable the acaddoc.lsp loads. Instead of relying on a lisp to set layer states, xref model view drawings into sheet drawings. Set visretain to 1. Leave the sheet files alone. The sheet set manager is a good tool (if it fits your workflow).

If none of those is suitable, you might consider rewriting the publish command to pre-process your drawings before plotting or create a publish script to do it.

 

Fenton,

Thanks for sharing the white paper and process diagnostics.

Architect, Registered NC, VA, SC, & GA.
Message 17 of 19
jonesw
in reply to: jonesw

Okay, using procmon.exe we were able to confirm that acaddoc.lsp is loaded during a normal drawing open, however it is nowhere to be found during a publish routine. The drawings that are published are apparently opened a little differently by AutoCAD.

 

- Wes

Message 18 of 19
dgorsman
in reply to: jonesw

Can you check the publish report dialog when the publish is finished, specifically for the profile name used?  I've seen circumstances where the profile name in the publish report is *not* the active one, which lead to things like "missing" CTB files during the publish.  The first run it was the active profile, on subsequent runs it changed to the dfeault one.

----------------------------------
If you are going to fly by the seat of your pants, expect friction burns.
"I don't know" is the beginning of knowledge, not the end.


Message 19 of 19
jonesw
in reply to: jonesw

Well, we have now confirmed that in post-2011 releases of AutoCAD, the publish routine was substantially modified to not run in a session of AutoCAD. Thus, a LISP routine cannot be executed via the acaddoc.lsp for each drawing opened and plotted during a publish. This improvement was made to speed up the plotting process.

 

Guess we'll need to look into another means of publishing drawings if we want to maintain the legacy behavior of LISP during a batch plot.

 

Thanks for all the help!

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

Post to forums  

Autodesk Design & Make Report

”Boost