Startup File Confusion - LISP

Startup File Confusion - LISP

JohnC_ISM
Collaborator Collaborator
557 Views
11 Replies
Message 1 of 12

Startup File Confusion - LISP

JohnC_ISM
Collaborator
Collaborator

ive read and read about where/which file to edit to add stuff to automatically change system variables when autocad is opened. 

 

it still doesnt work. 

 

as far as i know you add script into acad2022doc.lsp correct? does it matter where you put it?  below is an example of code ive added and it wont change anything i end up doing a whole drawing thinking my lines are at 0elv and they arent. 

;;;;; Auto-Ortho OFF
(setvar "orthomode" 0)
(princ "Ortho-Mode OFF)



;;;; Osnap Set to 0

(defun ai_entsnap (msg osmode / entpt)
(while (not entpt)
(setq entpt (last (entsel msg)))
)
(if osmode
(setq entpt (osnap entpt osmode))
)
entpt
)
(setvar "OSNAPZ" 1)

 

 

ive also tried to change the system variables for settings in autocad thru the system variable dialog box and some stuff saves but other stuff wont like the osnapz and mirrtext. so im confused as to why or whats causing this. 


(setvar "OSNAPZ" 1)

0 Likes
558 Views
11 Replies
Replies (11)
Message 2 of 12

pendean
Community Legend
Community Legend
0 Likes
Message 3 of 12

ВeekeeCZ
Consultant
Consultant

No. Do not modify acad2022doc.lsp

 

Create acaddoc.lsp and put your stuff there. Use your Support file path.

 

You can definitely have osnapz there with no issues.

(setvar 'osnapz 1)

 

 

 

0 Likes
Message 4 of 12

paullimapa
Mentor
Mentor

Save your lisp file in a support search location and trusted location then put that in the startup suite

https://help.autodesk.com/view/ACD/2019/ENU/?guid=GUID-B38F610B-51FB-4938-BDEC-A0A737F5DB6C


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 5 of 12

Kent1Cooper
Consultant
Consultant

@JohnC_ISM wrote:

....

ive also tried to change the system variables for settings in autocad thru the system variable dialog box and some stuff saves but other stuff wont .....


Read about the System Variables you care about in Help -- it tells you whether they are saved separately in each drawing or otherwise.  Those saved in the Registry would be different the next time you open a given drawing, if they have been set differently from some other drawing.  Those that are "not saved" will revert to the initial default next time you open a drawing, no matter what you have set them to before.

 

For SV's that are saved individually in each drawing that you want always the same in all drawings, you can have them set that way in acaddoc.lsp, which will "fix" them in drawings that have gotten the wrong settings, but also just set them that way in all your drawing template files, so that all new drawings will have them as you want.

Kent Cooper, AIA
0 Likes
Message 6 of 12

JohnC_ISM
Collaborator
Collaborator
Everything else says to modify the one I mentioned not to touch the one you mentioned though
0 Likes
Message 7 of 12

ВeekeeCZ
Consultant
Consultant

If you're so sure, why did you ask? Do what everyone does. It must be good, right?

0 Likes
Message 8 of 12

JohnC_ISM
Collaborator
Collaborator
Its more of me wondering why its different every time I look. You don't have to answer either.
0 Likes
Message 9 of 12

pbejse
Mentor
Mentor

@JohnC_ISM wrote:

ive read and read about where/which file to edit to add stuff to automatically change system variables when autocad is opened. 

...


You can create your own add-in bundle, way better than editing/adding the out-of-box AutoCAD program.

Autodesk Autoloader White Paper 

0 Likes
Message 10 of 12

ВeekeeCZ
Consultant
Consultant

Read THIS if you don't trust me. That's from a respectful developer. 

Or the one that pendean gave you. It's an official ADSK help file.

 

Message 11 of 12

Sea-Haven
Mentor
Mentor

When adding to acaddoc etc if more than one exists Autocad stops looking once the 1st is found, that maybe was the problem early on as to why loading was not working. I have a file Autoload.lsp saved in the Appload, Start up suite, it has multi defuns 23, 20 autoloads plus more so leaves the acaddoc etc as is. Plus some lisps that get loaded on start up.

Message 12 of 12

paullimapa
Mentor
Mentor

@JohnC_ISM and as @ВeekeeCZ link shows that the load order places files in the Startup Suite 2nd to the end. Which means these will override any other’s loaded previously except for (s::startup)


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes