View Full Version : acaddoc.lsp how do you do it?
feargt
2008-12-12, 06:49 PM
Hi,
I am looking for some feedback on the use of acaddoc.lsp file
I am looking for ideas that I may be missing that would be worth putting into my acaddoc.lsp file.
If you have edited your acaddoc.lsp file to do several things to a drawing each time you open one, what does YOUR acaddoc.lsp file do for you?
looking forward to any comments.
Thanks in advance
kennet.sjoberg
2008-12-12, 08:24 PM
my file has more than 200 lines, but in main it does
setvar
autoload
load
arxload
: ) Happy Computing !
kennet
ccowgill
2008-12-12, 08:34 PM
mine loads discipline specific lisp routines depending on the user and what department/office they belong to.
The discipline specific lisp routines:
run setvar
autoload
load
run automation programs
dgorsman
2008-12-12, 08:45 PM
It doesn't do much aside from loading and executing the code that does what the acaddoc.lsp "normally" does. Why do it this way? Well, we have a large number of clients and applications which don't always do the same thing the same way. To have a non-standard start-up sequence the function just needs to be redefined in the proper folder (heavy use is made of the AutoCAD search path), which overrides any previous defun for that function. Makes for very simple drag'n'drop customizing, including program upgrades.
rkmcswain
2008-12-12, 10:57 PM
One thing we DO NOT do, is modify system variables. Any registry saved (or non-saved) sysvar that needs changed is done in "Acad.lsp" and drawing saved sysvars are not touched. This keeps DBMOD from being changed.
irneb
2008-12-14, 11:38 PM
Actually, even autoload could rather be placed in ACAD.LSP. You don't need to call that for each DWG you open. The only things truly needed in the ACADDOC.LSP are modifications / loading of routines that modify the DWG automatically.
And then as rkmcswain states, these would make each DWG edited (dbmod) whenever opened. So if you've got this type of thing inside the ACADDOC.LSP - you're always going to be asked if you want to save the DWG (even if you haven't done anything to it). There's ways of getting around this, but it's atrick and not very kosher:lol:.
feargt
2008-12-15, 08:44 PM
One thing we DO NOT do, is modify system variables. Any registry saved (or non-saved) sysvar that needs changed is done in "Acad.lsp" and drawing saved sysvars are not touched. This keeps DBMOD from being changed.
The approach of setting the variables in the acad.lsp is an interesting approach, might be something to consider in the future.
the DBMOD variable returns to 0 each time the drawing is saved........at least that is my understanding.
In what way is this variable useful? I'll guess from a programming point of view???
Thanks for all the comments so far.
Does anyyone use a drawing clean up lisp file? for example when a drawing is loaded all text is swept up and put on correct layer, dimensions hatching etc? if so how do you use it, woild you keep it as separate file? giving the user the option of running it?? or would you load it to run automatically
dgorsman
2008-12-15, 08:53 PM
There is a good reason to reset *certain* variables when a new drawing is opened. Lets say a not-very-well-written LISP is being used that sets FILEDIA to 0, but doesn't change it back to 1. Having the FILEDIA forced to 1 for every drawing file would be a good catch-all, I think.
As far as automatically processing a drawing simply by openeing it, I avoid that like the plague. Its far too easy for somebody to open the wrong file with the wrong application or client and blammo - hosed drawing. I do have standards control functions, but they are either invoked manually or called from other functions (such as getting the proper layer to put a new text on).
rkmcswain
2008-12-15, 11:29 PM
There is a good reason to reset *certain* variables when a new drawing is opened. Lets say a not-very-well-written LISP is being used that sets FILEDIA to 0, but doesn't change it back to 1. Having the FILEDIA forced to 1 for every drawing file would be a good catch-all, I think. That is a good exception. Granted, we don't run any lisp routines here that might do this, but that's not always the case everywhere. As long as you are changing a registry-saved or non-saved system variable - then no harm done...
rkmcswain
2008-12-15, 11:31 PM
The approach of setting the variables in the acad.lsp is an interesting approach, might be something to consider in the future. "acad.lsp" is loaded once per session. "Acaddoc.lsp" is loaded once per drawing. That is the only difference.
the DBMOD variable returns to 0 each time the drawing is saved........at least that is my understanding. Correct. But if you modify the drawing by changing a drawing-saved sysvar, then DBMOD gets changed from zero and so you could simply open a drawing, look at it, and try to close it and you will get prompted to save - even though you "didn't do anything" to it...
irneb
2009-01-05, 08:47 AM
"acad.lsp" is loaded once per session. "Acaddoc.lsp" is loaded once per drawing. That is the only difference.Unless you've changed this setting in Options/System tab "Load acad.lsp with every drawing". The sysvar is ACADLSPASDOC. If it's checked (i.e. set to 1) then there's no difference between acad.lsp & acaddoc.lsp (except that the one loads before the other).
rkmcswain
2009-01-05, 04:05 PM
Unless you've changed this setting in Options/System tab "Load acad.lsp with every drawing". The sysvar is ACADLSPASDOC.
But there is absolutely no reason to change this from it's default setting.
andrea.andreetti
2009-01-05, 05:40 PM
I don't use acaddoc.lsp.....but acad.lsp located on a network drive.
In this file I put some automatic utilities loading and default settings.
Acad.lsp search for department setting vs the office location vs the third party software vs the loginname user vs if it a laptop or DeskTop vs domain name vs Ip adress and load the appropriate settings configurations to allow good functionality. It switch the AutoCAD license automaticly from one server to another depending if the user move from department to another or Offices.
also, I have many program loading as default. One of these do a backup on network drive for all user confguration, exporting profile, acad.cui and menu backup, and PGP file backup. each 10 open session of AutoCAD.
I think some variable is important...
But I didn't put that on the Acad.lsp..
each departement load there own mnl file and put some default settings on it.
example:
(DEFUN Load_Command()
(setvar "INSUNITSDEFTARGET" 0)
(setvar "INSUNITSDEFSOURCE" 0)
(setvar "INSUNITS" 0)
(setvar "VISRETAIN" 1)
(setvar "LAYERNOTIFY" 4)
(setvar "ATTDIA" 0)
(setvar "ATTREQ" 1)
(setvar "CMDDIA" 1)
(setvar "COORDS" 1)
(setvar "FIELDDISPLAY" 1)
(setvar "FIELDEVAL" 31)
(setvar "FILEDIA" 1)
(setvar "MIRRTEXT" 0)
(setvar "PEDITACCEPT" 1)
(setvar "TEXTFILL" 1)
(setvar "UCSFOLLOW" 0)
(setvar "UCSICON" 1)
(setvar "XREFTYPE" 1)
(setvar "SNAPANG" 0)
(command "IMAGEFRAME" 2)
)
(Load_Command)
rkmcswain
2009-01-05, 06:54 PM
I don't use acaddoc.lsp.....but acad.lsp located on a network drive. So how are you loading drawing specific code? Do you have ACADLSPASDOC set to 1, and if so, why?
(DEFUN Load_Command()
(setvar "INSUNITSDEFTARGET" 0)
(setvar "INSUNITSDEFSOURCE" 0)
(setvar "INSUNITS" 0)
(setvar "VISRETAIN" 1)
(setvar "LAYERNOTIFY" 4)
(setvar "ATTDIA" 0)
(setvar "ATTREQ" 1)
(setvar "CMDDIA" 1)
(setvar "COORDS" 1)
(setvar "FIELDDISPLAY" 1)
(setvar "FIELDEVAL" 31)
(setvar "FILEDIA" 1)
(setvar "MIRRTEXT" 0)
(setvar "PEDITACCEPT" 1)
(setvar "TEXTFILL" 1)
(setvar "UCSFOLLOW" 0)
(setvar "UCSICON" 1)
(setvar "XREFTYPE" 1)
(setvar "SNAPANG" 0)
(command "IMAGEFRAME" 2)
)
(Load_Command)
Also, be aware that when you set drawing saved variables such as VISRETAIN, LAYERNOTIFY, MIRRTEXT, UCSFOLLOW, UCSICON, and SNAPANG, then you are changing DBMOD from zero, which causes the user to be prompted to save an otherwise unaltered drawing.
andrea.andreetti
2009-01-05, 08:14 PM
So how are you loading drawing specific code? Do you have ACADLSPASDOC set to 1, and if so, why?
ACADLSPASDOC set to 1, to load ACAD.LSP automaticly.
Code is loading depending the options mentionned.
Also, be aware that when you set drawing saved variables such as VISRETAIN, LAYERNOTIFY, MIRRTEXT, UCSFOLLOW, UCSICON, and SNAPANG, then you are changing DBMOD from zero, which causes the user to be prompted to save an otherwise unaltered drawing.
Yes, I know...but this is only an example of on of our MLN menu department.
User are very strict here.
thanks for the info ;-)
rkmcswain
2009-01-05, 08:19 PM
ACADLSPASDOC set to 1, to load ACAD.LSP automaticly.
Again, why?
By doing this, you are missing out on being able to load some code per session and other code per drawing. I'm surprised they have not retired ACADLSPASDOC by now...
Again, why?
By doing this, you are missing out on being able to load some code per session and other code per drawing. I'm surprised they have not retired ACADLSPASDOC by now...
It is too big of a clutch for many.
andrea.andreetti
2009-01-05, 08:48 PM
Again, why?
By doing this, you are missing out on being able to load some code per session and other code per drawing. I'm surprised they have not retired ACADLSPASDOC by now...
I'm surprised that acaddoc still,
what is your suggestion when the acaddoc is must be unloaded ?
many of our client applications have conflict with other..
so by using Acad.lsp this allow us (cad Manager) to fix easier the problem.
Also, acaddoc.lsp file have diffrent name for many versions of AutoCAD.
eg: acad2008doc.lsp, acad2008.lsp, acaddoc2008.lsp.
depending the version and language pack.
I've 24 years experience in AutoCAD and never see acad.lsp renamed.
by putting this file on a network drive....you can manage all user instantly
and save time !
I manage over 600 drafters here.
dgorsman
2009-01-05, 08:54 PM
It is too big of a clutch for many.
Tell me about it. It took a major version upgrade and a complete start-up redesign here for me to change our system to separate acad/acaddoc.lsp files. I looked at doing it before the upgrade and it wasn't worth the time required.
I'm surprised that acaddoc still,
what is your suggestion when the acaddoc is must be unloaded ?
many of our client applications have conflict with other..
so by using Acad.lsp this allow us (cad Manager) to fix easier the problem.
Also, acaddoc.lsp file have diffrent name for many versions of AutoCAD.
eg: acad2008doc.lsp, acad2008.lsp, acaddoc2008.lsp.
depending the version and language pack.
I've 24 years experience in AutoCAD and never see acad.lsp renamed.
by putting this file on a network drive....you can manage all user instantly
and save time !
I manage over 600 drafters here.
The acad200x.lsp and acaddoc200x.lsp are Autodesk supplied files. Any upgrade may modify or remove any of your customization you have done in either of these two files. Instead, AutoCAD allows for a user created acad.lsp and acaddoc.lsp. These two files are controlled by the user and are not changed during an update / upgrade of the software.
It has been discussed on these boards numerous times. A search should bring some of the discussions up.
rkmcswain
2009-01-05, 09:18 PM
Also, acaddoc.lsp file have diffrent name for many versions of AutoCAD.
eg: acad2008doc.lsp, acad2008.lsp, acaddoc2008.lsp.
No. "acaddoc.lsp" is a user defined file. This has not changed since it was introduced almost 10 years ago.
You are talking about the autodesk supplied files. Those files are not for consumer use anyway so the naming in not an issue.
by putting this file on a network drive....you can manage all user instantly
and save time !
Right, we keep both "acad.lsp" and "Acaddoc.lsp" on the network, in the TOP support path, for the same reason.
andrea.andreetti
2009-01-05, 09:44 PM
No. "acaddoc.lsp" is a user defined file. This has not changed since it was introduced almost 10 years ago.
You are talking about the autodesk supplied files. Those files are not for consumer use anyway so the naming in not an issue.
Sorry but not True.
We have over an houndred of licence network file...and don't remember how many stand-alone. In many version on diffrent language.
acaddoc.lsp don't have the same name. I think it was after the 2000i version...AutoCAD rename each file....
autocad 2002i and - acaddoc.lsp,
autocad 2004 and + acad2004doc.lsp
and follow the version year until acad2009doc.lsp
so this will be a little handy when time is come to change/modify this MAIN lsp file..
rkmcswain
2009-01-05, 10:12 PM
Sorry but not True.
No. You are mistaken. Once again, "...you are talking about the autodesk supplied files."
AutoCAD comes with files named
* acad20xx.lsp
* acad20xxdoc.lsp
(where xx is the version of AutoCAD, such as 04, 05, 06, etc.)
These are the files that you DO NOT use. They belong to the application.
"acad.lsp" and "acaddoc.lsp" are user defined files that do NOT come with AutoCAD.
It has been this way since May 1999 when AutoCAD 2000 came out.
See: http://usa.autodesk.com/getdoc/id=TS21336 (published in July of 1999)
Sorry but not True.
We have over an houndred of licence network file...and don't remember how many stand-alone. In many version on diffrent language.
acaddoc.lsp don't have the same name. I think it was after the 2000i version...AutoCAD rename each file....
autocad 2002i and - acaddoc.lsp,
autocad 2004 and + acad2004doc.lsp
and follow the version year until acad2009doc.lsp
so this will be a little handy when time is come to change/modify this MAIN lsp file..
Try this article (http://usa.autodesk.com/adsk/servlet/ps/item?siteID=123112&id=2897258&linkID=9240617) on Autodesk.com. It is written for 2000, but should be appropriate for all recent versions.
andrea.andreetti
2009-01-05, 11:07 PM
Oh !!?..
so what where is the acaddoc.lsp now ? is it replaced with the acadxxxdoc.lsp ?
Oh !!?..
so what where is the acaddoc.lsp now ? is it replaced with the acadxxxdoc.lsp ?
No. It is in addition to the acadxxxxdoc.lsp.
From the linked article:
Note: AutoCAD 2000 is not supplied with the user defined startup file acaddoc.lsp; you create and maintain the file yourself.
andrea.andreetti
2009-01-05, 11:25 PM
so you tell that acaddoc.lsp is loading every time autocad is started and on each drawing if it found ? but not acad.lsp if the variable ACADLSPASDOC not set to 1 ?
also,..where the acaddoc.lsp is located in AutoCAD installation ?
so you tell that acaddoc.lsp is loading every time autocad is started and on each drawing if it found ? but not acad.lsp if the variable ACADLSPASDOC not set to 1 ?
also,..where the acaddoc.lsp is located in AutoCAD installation ?
You are to place it (once created) somewhere within your Support File Search Path, which RK has suggested placing it at the top (or first) folder in that list.
andrea.andreetti
2009-01-06, 01:31 AM
You are to place it (once created) somewhere within your Support File Search Path, which RK has suggested placing it at the top (or first) folder in that list.
Ok, so if I realy understand, this seem to be similar to acad.lsp.
the difference between each. is:
acad.lsp
It load each time on each drawing if ACADLSPASDOC is set to 1
acaddoc.lsp
It load each time on each drawing event if ACADLSPASDOC is set to 0
Both of these need to be top of AutoCAD search path directory to assure that it get the good file.
so far so good...
Now see what happen when you need to start AutoCAD WITHOUT using:
acad.lsp
just set the variable ACADLSPDOC to 0
acaddoc.lsp
Remove or rename the acaddoc.lsp file before opening a new drawing oh..even that, you need to restart AutoCAD depending if there any variable environnement set and than...if you have write access on thi folder. OR by removing the path containing the acaddoc.lsp in the AutoCAD search pat directory. that affect user profiles, so we need to be sure to re-add the path before closing AutoCAD or re-import the profile. (If saved)
please tell me if i'm wrong...but if it's not...I prefer to continue using acad.lsp.
Tell me about it. It took a major version upgrade and a complete start-up redesign here for me to change our system to separate acad/acaddoc.lsp files. I looked at doing it before the upgrade and it wasn't worth the time required.
I need to reevaluate mine as well. I just haven't the time to do it at the moment. I'm hoping to have it done for the 2010 release.
irneb
2009-01-06, 07:34 AM
acad.lsp
It load each time on each drawing if ACADLSPASDOC is set to 1Yes, but as rkmcswain states: if set to 0 then this acts only once per ACAD session.
acaddoc.lsp
It load each time on each drawing event if ACADLSPASDOC is set to 0Yes, this is ALWAYS loaded for each DWG irrespective of ACADLSPASDOC's setting. This works exacly as your ACAD.LSP with ACADLSPASDOC=1, but it ignores ACADLSPASDOC's setting.
Both of these need to be top of AutoCAD search path directory to assure that it get the good file.Neither acad.lsp nor acaddoc.lsp are standard acad files. They are simple filenames that ACAD searches for at specific times, if found thewn it loads them at those times. The standard versions of these are named acad200#.LSP and acad200#doc.LSP - they you must never change because any update, hotfix or service pack may overwrite these and you'll then loose your changes. That's why acad.lsp & acaddoc.lsp are given to you. It's ensured never to be changed by any update, hotfix or service pack. They're usually not even created with a new install - so you have to make these yourself. Also they can be anywhare in the support paths, the 1st one found will be loaded. You can even place an ACADDOC.LSP in the same folder as the DWG and this will be loaded before any other - so if a specific folder full of DWG's need special settings you can do this. However, note that only the 1st found is loaded (this caused some headaches for me previously). You need to manually search for any others in the support paths if you want them to also load.
acad.lsp
just set the variable ACADLSPDOC to 0That's perfect, you now only change settings saved in the registry not in the DWG. This way everything not part of the DWG is set correctly everytime you start ACAD.
acaddoc.lsp
Remove or rename the acaddoc.lsp file before opening a new drawing oh..even that, you need to restart AutoCAD depending if there any variable environnement set and than...if you have write access on thi folder. OR by removing the path containing the acaddoc.lsp in the AutoCAD search pat directory. that affect user profiles, so we need to be sure to re-add the path before closing AutoCAD or re-import the profile. (If saved)No ... you need not do this ... you can do exactly the same as you did with the acad.lsp file. As long as this file is somewhere on the support paths, the ACAD program folder, the DWG's folder, or any of the project specific support folders it will be loaded - as discussed before, try ensuring there's only one version found in the search paths (otherwise only the 1st will be loaded).
What I'd suggest is placing anything to change in registry which is also common to all departments in the ACAD.LSP file on a network folder in the support path. The do the rest as you did in your ACAD.LSP file but place it in an ACADDOC.LSP file. Very simple change for you would be to simply rename your existing ACAD.LSP file to ACADDOC.LSP - ensuring this loads for every DWG no matter the ACADLSPDOC setting.
You could even have department specific folders with their own ACAD.LSP / ACADDOC.LSP files. Then with some manipulation of the (getenv "ACAD") registry setting - this is the support paths saved in registry as a semi-colon separated string - you can prefix the relevant department's folder.
irneb
2009-01-06, 09:19 AM
To make life simpler for myself, I've created a load command to load all, the 1st n, or the nth file found in the support paths:(vl-load-com)
;;; Function to load different versions of a file as found in support paths
;| Usage:
(loadsearch "acad.lsp" nil) ;Works the same as (load "acad.lsp") - only 1st found is loaded
(loadsearch "acad.lsp" T) ;Loads all "acad.lsp" files found in support paths
(loadsearch "acad.lsp" 1) ;Loads the 2nd "acad.lsp" file found in the support paths
(loadsearch "acad.lsp" -4) ;Loads the 1st 4 "acad.lsp" files found in the support paths
|;
(defun loadsearch (fname check / paths result str n m)
(if check
(if (= check 0) ;If only 1st is to be loaded
(setq result (load fname 0)) ;Load normally
(progn
;; Get the support folders in list form
(setq str (strcat ";"
(vl-string-trim " \t\n;" (getvar "ACADPREFIX"))
) ;_ end of strcat
n 1
m 0
paths nil
) ;_ end of setq
(while (< (+ n m) (strlen str))
;; Check if start of folder
(if (= ";" (substr str n 1)) ;Semi-colon found
(setq m (1+ m)) ;Increment end counter
;;Else
(setq n (1+ n) ;Increment start counter
m 1 ;Set end counter to zero
) ;_ end of setq
) ;_ end of if
;; Check if end of folder
(if (or (= ";" (substr str (+ n m) 1)) ;Semi-colon found
(= (+ n m) (strlen str)) ;Or end of string
) ;_ end of or
(progn
;;Add to paths list
(if (= (+ n m) (strlen str))
(setq paths (cons (vl-string-trim
" \t\n;"
(substr str (1+ n) m)
) ;_ end of vl-string-trim
paths
) ;_ end of cons
) ;_ end of setq
(setq paths (cons (vl-string-trim
" \t\n;"
(substr str (1+ n) (1- m))
) ;_ end of vl-string-trim
paths
) ;_ end of cons
) ;_ end of setq
) ;_ end of if
;;Set counters for next
(setq n (+ n m)
m 1
) ;_ end of setq
) ;_ end of progn
) ;_ end of if
) ;_ end of while
(setq paths (reverse paths)) ;Set paths in correct order
;; Step through to load nth
(setq result 0
n 0
) ;_ end of setq
(if (= (type check) 'SYM)
(setq check (- 0 (length paths)))
) ;_ end of if
(if (and (< check 0) (setq check (abs check)))
(foreach str paths
(if
(and (< result check) (findfile (strcat str "\\" fname)))
(progn
(load (strcat str "\\" fname) 0)
(setq result (1+ result))
) ;_ end of progn
) ;_ end of if
) ;_ end of foreach
(foreach str paths
(if (= result 0)
(if (findfile (strcat str "\\" fname))
(progn
(if (= n check)
(progn
(load (strcat str "\\" fname) 0)
(setq result (1+ result))
) ;_ end of progn
) ;_ end of if
(setq n (1+ n))
) ;_ end of progn
) ;_ end of if
) ;_ end of if
) ;_ end of foreach
) ;_ end of if
) ;_ end of progn
) ;_ end of if
(setq result (load fname 0)) ;Load normally
) ;_ end of if
result
) ;_ end of defunOh! and BTW if you only want to get the support paths you can use (getvar "ACADPREFIX") - this is readonly. If you want to change them you have to use (setenv "ACAD" "1st path;2nd paths;....") - note "ACAD" is case sensitive here.
andrea.andreetti
2009-01-06, 03:34 PM
Thanks...
some questions:
No ... you need not do this ... you can do exactly the same as you did with the acad.lsp file
You mean to put ACADLSPASDOC set to 0 ?
but you said:
Yes, this is ALWAYS loaded for each DWG irrespective of ACADLSPASDOC's setting. This works exacly as your ACAD.LSP with ACADLSPASDOC=1, but it ignores ACADLSPASDOC's setting.
??
I don't want to load the acad.lsp or acaddoc.lsp each time.
this will interfer directly with some clients program settings !! and I can not put any condition on this file for it. it is more complicated as you thought. Special settings programs need to be set to allow good functionality and compatibility. over 600 drafters technicien and engineer here.
So if acaddoc.lsp load each time.....this is not what i need.
Thanks for the showing the code example very nice.!
the acad.lsp loading is interesting but as I've said..some client programs run here,
example:
one of these programs change path configuration on search directory depending the function used...(bad programming). It give me head hake..
Also, You make me think about something interesting...
to remove Network user write access creating acaddoc.lsp and acad.lsp on project folders.
thanks.
irneb
2009-01-06, 04:27 PM
You mean to put ACADLSPASDOC set to 0 ?
but you said:All I meant was that the ACADDOC.LSP file acts exactly as your ACAD.LSP file does when ACADLSPASDOC=1. You need not rename it - there's no need, it will always load for each DWG opened. Sorry, I might have worded it incorrectly.
I don't want to load the acad.lsp or acaddoc.lsp each time.Then I'm unsure what this whole discussion's about. If you only want it loaded once per session, place it in the ACAD.LSP file and ensure ACADLSPASDOC=0 (as per default). Only place the stuff you want to change for each DWG in the ACADDOC.LSP file. As rkmcswain said: "But there is absolutely no reason to change this from it's default setting." I.e. ACADLSPASDOC=1. I just mentioned it to show that this can run differently, but I agree with rkmcswain - there's absolutely no reason to have ACADLSPASDOC=1. If you need to set it to 1 then rather just move the stuff you're changing in ACAD.LSP to ACADDOC.LSP - would have the same effect but still allows you to run ACAD.LSP only once per session. If you have ACADLSPASDOC=1 then ACAD.LSP & ACADDOC.LSP are in effect the same type of file and both will load for each DWG opened.
this will interfer directly with some clients program settings !! and I can not put any condition on this file for it. it is more complicated as you thought. Special settings programs need to be set to allow good functionality and compatibility. over 600 drafters technicien and engineer here.
So if acaddoc.lsp load each time.....this is not what i need.I've got a similar scenario here, some projects need special settings overriding the defaults, so I place these in an ACADDOC.LSP on in a folder where the DWG's reside. But then I have to load the defaults first otherwise only the overrides are loaded - none of the standard stuff.
Thanks for the showing the code example very nice.!
the acad.lsp loading is interesting but as I've said..some client programs run here,
example:
one of these programs change path configuration on search directory depending the function used...(bad programming). It give me head hake..You're welcome. That does seem to be a problem, in which case I'd suggest trying to change that prog not not interfere with the search paths ... but that may become difficult if you didn't personally make that prog. If your method works for your instance, then why change? My explanation is simply for normal scenarios - if you've got an add-on which breaks the normal running then you need to somehow sort it out differently. I'm assuming yours works correctly the way you've got it at present?
Also, You make me think about something interesting...
to remove Network user write access creating acaddoc.lsp and acad.lsp on project folders.Yep! That is a danger, if someone places a ACADDOC.LSP file in one of the DWG folders this loads instead of your normal one. That was the headaches I had previously, some folders do need this, but instead of making an entire copy of the standard one and changing as per the differences or extras: I used the function in my previous post to load the standard ACADDOC.LSP first before overwriting only the specific settings. Then if I update the normal ACADDOC.LSP file it's only one file to change instead of hundreds all over the entire server.
BTW, rereading my earlier post ... I seem to have made an error. I don't think the ACAD.LSP would work the same way in DWG folders as the ACADDOC.LSP (if ACADLSPASDOC=0). Since this only loads once per session it won't notice that the current DWG folder has changed if you open a DWG. Unsure if it does happen with project support paths (as in the PROJECTNAME sysvar), but I don't think so either - this is saved per drawing.
andrea.andreetti
2009-01-06, 06:31 PM
Thanks for All your explaination..and taking time to answer.
BTW, rereading my earlier post ... I seem to have made an error. I don't think the ACAD.LSP would work the same way in DWG folders as the ACADDOC.LSP (if ACADLSPASDOC=0). Since this only loads once per session it won't notice that the current DWG folder has changed if you open a DWG. Unsure if it does happen with project support paths (as in the PROJECTNAME sysvar), but I don't think so either - this is saved per drawing.
As i've tested,...acad.lsp load the first found in the acad search path directory as acaddoc.lsp. If it is present in project Folder...this one have priority.
Last question..
For my own..I'll stay with Acad.lsp for same reason mentionned.
But what is your vue point to having advantage using acaddoc.lsp vs acad.lsp ?
rkmcswain
2009-01-06, 06:50 PM
But what is your vue point to having advantage using acaddoc.lsp vs acad.lsp ?
Put things in "acad.lsp" that only need loaded once per session.
As an example, I have code that sets the names of the license servers in the Windows Environment. Doing this once per AutoCAD session is overkill, but doing it once per drawing would really be overkill... Same for setting the support file search paths (and printer paths, template paths, etc.). This is done when AutoCAD starts and that it is. Doing it each time a drawing is opened would be a bit much... Lastly, for the forced loading of ARX files. They only need loaded once per session.
Put things in "acaddoc.lsp" that need loaded once per drawing.
Basically all lisp functions that need to be available during this drawing session should be loaded here. Also for setting registry saved and non-saved system variables (not drawing saved ones).
andrea.andreetti
2009-01-06, 08:10 PM
Thank you very much Mr. McSwain..
that confirm what i've thought .
;-)
andrea.andreetti
2009-01-06, 08:11 PM
or maybe Mss. McSwain ?
RobertB
2009-01-07, 09:42 PM
Thank you very much Mr. McSwain..
that confirm what i've thought .
;-)
Put things in "acad.lsp" that only need loaded once per session.
As an example, I have code that sets the names of the license servers in the Windows Environment. Doing this once per AutoCAD session is overkill, but doing it once per drawing would really be overkill... Same for setting the support file search paths (and printer paths, template paths, etc.). This is done when AutoCAD starts and that it is. Doing it each time a drawing is opened would be a bit much... Lastly, for the forced loading of ARX files. They only need loaded once per session.
Put things in "acaddoc.lsp" that need loaded once per drawing.
Basically all lisp functions that need to be available during this drawing session should be loaded here. Also for setting registry saved and non-saved system variables (not drawing saved ones).I'm constantly surprised that this discussion still occurs after a decade.
Andrea, don't you realize the using AcadLspAsDoc=1 is exactly the same as renaming Acad.lsp to AcadDoc.lsp? While, at the same time, removing the flexibility of using Acad.lsp to execute instructions only once at the beginning of the AutoCAD session.
So rename your existing Acad.lsp to AcadDoc.lsp, set AcadLspToDoc=0 (the default), and then you are free to create an Acad.lsp (when needed) to execute stuff only at the beginning of the session.
As far the modified drawing issue: use (acad-dbmod-push) at the beginning of AcadDoc.lsp and (acad-dbmod-pop) near the end of (S::Startup) to reduce the "modified" new drawing issue. As long as DbMod=0 at the beginning of AcadDoc's execution the end result will be an unmodified drawing no matter how many changes were made to it during the startup.
I think the dead horse is beat :p
RobertB
2009-01-08, 02:11 AM
I think the dead horse is beat :pWhich is why I added the bit about (acad-dbmod-push/pop). At least a bit of positive post. :mrgreen:
feargt
2009-01-09, 01:22 PM
Thank you very much to all who contributed to this thread, it certainly made for some interesting reading and gave food for thought.
Thanks again
Feargt
vBulletin® v3.6.7, Copyright ©2000-2009, Jelsoft Enterprises Ltd.