acaddoc not working

acaddoc not working

jogibson6PA7C
Contributor Contributor
292 Views
8 Replies
Message 1 of 9

acaddoc not working

jogibson6PA7C
Contributor
Contributor

so i made an acaddoc.lsp file and put it in the support folder, but whenever i open a new drawing, or an old one, it doesn't run the commands i put into it.  not sure if it's just me cutting out something important that it needs to run commands or what.  

 

(defun s::startup ()
(command "_annomonitor" 2)
(command "_fieldeval" 31)

 

and the reason i'm using commands instead of setvar is because setvar wasn't working either, i also want to see that the variables have been set in the command line every time i open a file.  

0 Likes
Accepted solutions (1)
293 Views
8 Replies
Replies (8)
Message 2 of 9

BlackBox_
Advisor
Advisor

In an open session, does pasting this to Command Line (findfile "acaddoc.lsp") show the correct file path to the file you're editing?


"How we think determines what we do, and what we do determines what we get."

Sincpac C3D ~ Autodesk Exchange Apps

Message 3 of 9

DGCSCAD
Collaborator
Collaborator

You don't need the s::startup in an acaddoc.lsp, so take that out and change your commands back to setvars.

 

A s::startup function is defined in an acad.lsp and is only loaded when AutoCAD starts, not when each drawing is opened. The acaddoc.lsp runs on each drawing when opened.

 

https://www.autodesk.com/support/technical/article/caas/sfdcarticles/sfdcarticles/Automatically-load...

AutoCad 2018 (full)
Win 11 Pro
Message 4 of 9

Kent1Cooper
Consultant
Consultant

@DGCSCAD wrote:

You don't need the s::startup in an acaddoc.lsp.....


... and even if that were the right way to go, it's missing the concluding right parenthesis.

Kent Cooper, AIA
Message 5 of 9

jogibson6PA7C
Contributor
Contributor
Accepted solution

No, it reads back as nil, and i'm really not sure why.  i didn't even add any new folders to the support file search path... Is there something I need to do outside of just adding the file to the folder in order for autocad to always run it? 

 

Okay, I figured it out.  I just had to add it to the startup suite is all. Not sure why I didn't think of that before, or why none of the guides I looked at to set this up didn't mention the startup suite... last time I did something with acaddoc my computer already had a working acaddoc file, so I guess something with it got changed between autocraft 2018 and 2022.

0 Likes
Message 6 of 9

BlackBox_
Advisor
Advisor

@jogibson6PA7C wrote:

No, it reads back as nil, and i'm really not sure why.  i didn't even add any new folders to the support file search path... Is there something I need to do outside of just adding the file to the folder in order for autocad to always run it? 

 

Okay, I figured it out.  I just had to add it to the startup suite is all. Not sure why I didn't think of that before, or why none of the guides I looked at to set this up didn't mention the startup suite... last time I did something with acaddoc my computer already had a working acaddoc file, so I guess something with it got changed between autocraft 2018 and 2022.


Okay, so AutoCAD cannot find it, which is why it's not being loaded. 

 

There's no need to add it to Startup Suite. 

 

You simply need the containing folder included in your Support Files Search Paths (SFSP). 

 

The reason I asked the return path from the findfile call, is that sometimes users have multiple acaddoc.lsp files, and AutoCAD will only load the first one it finds... meaning the highest path in SFSP that contains AcadDoc.lsp file.

 

Remove it from Startup Suite, place AcadDoc.lsp file in the top SFSP, or add a new path to where it is, and ensure that it at top of SFSP.

 

HTH


"How we think determines what we do, and what we do determines what we get."

Sincpac C3D ~ Autodesk Exchange Apps

0 Likes
Message 7 of 9

jogibson6PA7C
Contributor
Contributor


"...place AcadDoc.lsp file in the top SFSP, or add a new path to where it is, and ensure that it at top of SFSP."
I did both of these things (individually and together) and none of the 3 combinations worked.  I even tried putting it in different SFSP folders (both with multiple copies of the .lsp and it being the only acaddoc.lsp file on my computer) 

I do not know *why* it refused to work, maybe it has something to do with my organization's settings, but so far it works exactly as I want it to as an item in the startup suite. 

0 Likes
Message 8 of 9

Sea-Haven
Mentor
Mentor

 I have used the Startup suite for years rather than Acad.lsp etc. just find it easier to not have to go finding those files in so deep a directory add to. Also remember when starting CAD it looks for files and will stop looking once found so even if you make a new Acad.lsp and put it in a support path it may not load as the startup has found another copy 1st.  As mentioned need to check support path order. As part of an install lisp when doing CAD upgrades you can add support paths and add startup suite items also.

0 Likes
Message 9 of 9

BlackBox_
Advisor
Advisor

Here's more on the startup sequence, since then the Autoloader mechanism has been added: 

 

https://www.theswamp.org/index.php?topic=39112.msg443213#msg443213

 

A. CUI files loaded:
1. Enterprise
2. Main
3. Partials to Main
4. Partials to Enterprise

B. acad*.* files loaded:
1. Files listed in acad.rx
2. acad2009.lsp
3. acad.lsp  <--
4. acad2009doc.lsp
5. acaddoc.lsp
6. acad.dvb

C. CUI-associated MNL and LSP files loaded:
1. Enterprise named MNL
2. Enterprise loaded LSP and MNL
3. Main named MNL
4. Main loaded LSP and MNL
5. Partials to Main named MNLs
6. Partials to Main loaded LSPs and MNLs
7. Partials to Enterprise named MNLs
8. Partials to Enterprise loaded LSPs and MNLs

D. Startup suite files loaded

E. Startup routines run:
1. AcadStartup() called (AutoCAD startup)
2. AcadDocument_Activate() called (Drawing startup)
3. (S::STARTUP) called
4. SCR loaded from /b switch


"How we think determines what we do, and what we do determines what we get."

Sincpac C3D ~ Autodesk Exchange Apps

0 Likes