Author Topic: acaddoc and S::STARTUP  (Read 15306 times)

0 Members and 2 Guests are viewing this topic.

zride91

  • Guest
acaddoc and S::STARTUP
« on: January 31, 2012, 02:04:19 PM »
I've gone through multiple references, and they all make this seem so easy...
I am re-doing my acaddoc.lsp because I just found out it has not been running correctly because I did not include the S::STARTUP function
It appears that lines 2-7 work OK, but I can not tell if the items in the S::STARTUP are working.  The AutoCAD output seem to throw all the commands into one line, and the startup.scr that should be run in line 14 is not running.
Below is the acaddoc.lsp so far:
Code - Auto/Visual Lisp: [Select]
  1. ;;acaddoc.lsp to run with every file opened in AutoCAD Civil 3D
  2. (autoload "LaunchGrading.lsp" '("LaunchGrading")) ;;load lisp for toolpalette
  3. (autoload "LaunchUtility.lsp" '("LaunchUtility")) ;;load lisp for toolpalette
  4. (autoload "LaunchDS.lsp" '("LaunchDS")) ;;load lisp for toolpalette
  5. (load "disablenavcube.lsp" "disablenavcube FAILED to load") ;;loads lisp to disable viewcube in 2D display styles
  6. (setvar "layereval" 0) ;;turns off evaluation for unreconciled layers
  7. (setvar "proxygraphics" 1) ;;saves proxy image with drawing
  8. (defun-q BAstartupLD ( / userpref userpref1)
  9.         (command "._purge" "r" "*" "_n") ;;purge regapps
  10.         (command "-scalelistedit" "_r" "_y" "_e");;reset scale list
  11.         (command "._AeccConvertVBARulesToDotNet" "_y") ;;converts VBA pipe networks and structures to .NET
  12.         (c:disablenavcube) ;;runs lisp to disable viewcube in 2D display styles
  13.         (setq userpref (strcat (getvar "ROAMABLEROOTPREFIX") "SUPPORT\\")) ;;defines userpref variable for use in next line
  14.         (if (setq userpref1 (findfile (strcat userpref "Startup.scr")))(command "_.script" (strcat userpref "Startup.scr"))) ;;if found, will run user startup script
  15.         (princ)
  16.         )
  17. (setq S::STARTUP (append S::STARTUP BAstartupLD))
  18. ;;;acaddoc.lsp end
  19.  

Below is the simple script I have as startup.scr just to see if it works (it should just draw a circle, which it is not):
_.circle 0,0,0 5

Below is the output I get in AutoCAD when opening a new file, which is concerning:
Regenerating model.

AutoCAD menu utilities loaded.
AutoCAD menu utilities loaded.._purge r * _n -scalelistedit _r _y _e
._AeccConvertVBARulesToDotNet _y _.script
C:\Users\dwahl\AppData\Roaming\Autodesk\C3D 2011\enu\SUPPORT\Startup.scr

When the script is run manually it runs fine.  As shown above, it appears to be loading the script OK, but it doesn't actually produce the circle.

Any suggestions??

Thank you!

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: acaddoc and S::STARTUP
« Reply #1 on: January 31, 2012, 03:22:11 PM »
Make sure you have only one acaddoc.lsp file in your system.

AND there is only one Startup.scr
« Last Edit: January 31, 2012, 03:25:32 PM by CAB »
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

zride91

  • Guest
Re: acaddoc and S::STARTUP
« Reply #2 on: January 31, 2012, 03:48:59 PM »
Thanks CAB.  The script is being called with full file path, there is only one startup.scr in that location being called, it's all verified in the AutoCAD output.  I have multiple acaddoc.lsp files on our network (one for each AutoCAD version we use (Civil 3D, AutoCAD, and MEP)).  The 2nd support path in AutoCAD is pointing to the appropriate acaddoc.lsp file (there are no acaddoc.lsp file in 1st path).  When I modify the acaddoc.lsp file, the output in autoCAD changes accordingly, which would indicate things are pointing to the right files I think.  It just seems AutoCAD isn't treating the lines in the S::STARTUP function as individual commands.  Would AutoCAD normally throw everything together in the output as I showed above?  I feel like I'm just missing a space or extra line break or something.  I've tried all sorts of things, just couldn't get the circle to come in...  the navcube goes away so I know the acaddoc.lsp is working at least through line 5 and the variable set also verify that things are OK up to the S::STARTUP function.  I've tried simplifying line 14 to just:
Code - Auto/Visual Lisp: [Select]
  1. (command "_.script" (strcat userpref "Startup.scr"))
I get same results.

BlackBox

  • King Gator
  • Posts: 3770
Re: acaddoc and S::STARTUP
« Reply #3 on: January 31, 2012, 04:07:05 PM »
I'm not sure what you have within your Script file, but consider temporarily renaming it, and create a new (with original name), and put something simple to confirm the Script is in fact loading/executing properly:

Code: [Select]
(princ "\n** Script is working normally ** ")

This will allow you to rule in/out if the Script is the source of your problem or not.
"How we think determines what we do, and what we do determines what we get."

zride91

  • Guest
Re: acaddoc and S::STARTUP
« Reply #4 on: January 31, 2012, 04:12:20 PM »
RenderMan, thank you.  I do have the script somethign very simple just to verify it works:

_.circle 0,0,0 5

That's all that is in the file.  The script works fine when run manually, I get a circle.  I do not get a circle automatically when opening a file.

I can try more specifically with the line of code that you provided, but I believe it's actually MORE complicated that what I already have :)

zride91

  • Guest
Re: acaddoc and S::STARTUP
« Reply #5 on: January 31, 2012, 04:23:56 PM »
Yeah, it's still not loading the script, I tried as suggested.  New script file with new name with the line you provided.

Below is the updated acaddoc.lsp:
Code - Auto/Visual Lisp: [Select]
  1. ;;acaddoc.lsp to run with every file opened in AutoCAD Civil 3D
  2. (autoload "LaunchGrading.lsp" '("LaunchGrading")) ;;load lisp for toolpalette
  3. (autoload "LaunchUtility.lsp" '("LaunchUtility")) ;;load lisp for toolpalette
  4. (autoload "LaunchDS.lsp" '("LaunchDS")) ;;load lisp for toolpalette
  5. (load "disablenavcube.lsp" "disablenavcube FAILED to load") ;;loads lisp to disable viewcube in 2D display styles
  6. (setvar "layereval" 0) ;;turns off evaluation for unreconciled layers
  7. (setvar "proxygraphics" 1) ;;saves proxy image with drawing
  8. (defun-q BAstartupLD ( / scrloc scrloc1)
  9.         (command "._purge" "r" "*" "_n") ;;purge regapps
  10.         (command "-scalelistedit" "_r" "_y" "_e");;reset scale list
  11.         (command "._AeccConvertVBARulesToDotNet" "_y") ;;converts VBA pipe networks and structures to .NET
  12.         (c:disablenavcube) ;;runs lisp to disable viewcube in 2D display styles
  13.         (setq scrloc (strcat (getvar "ROAMABLEROOTPREFIX") "SUPPORT\\")) ;;defines scrloc variable for use in next line
  14.         (if (setq scrloc1 (findfile (strcat scrloc "TESTSCRIPT.scr")))(command "_.script" (strcat scrloc "TESTSCRIPT.scr"))) ;;if found, will run user startup script
  15.         (princ)
  16.         )
  17. (setq S::STARTUP (append S::STARTUP BAstartupLD))
  18. ;;;acaddoc.lsp end
  19.  

Below is AutoCAD output when first launching (it's still trying to load AutoCAD menus after running the S::STARTUP function):
Quote
Loading AEC Base...
Loading AEC Base Extended...
Loading AEC Base UI...
Loading AEC Project Base...
Loading AEC Base GUI...
Loading AEC Schedule Data...
Loading AEC Project UI...
Loading AEC Utilities...

Customization file loaded successfully. Customization Group: BA_CUSTOM
Customization file loaded successfully. Customization Group: CIVIL
Customization file loaded successfully. Customization Group: ACAD
Customization file loaded successfully. Customization Group: TOOLBASEDRIBBON
Customization file loaded successfully. Customization Group: TASKBASEDRIBBON
Customization file loaded successfully. Customization Group: EXPRESS
Loading AECC Base...

Initializing....
There are no valid MS Jet providers installed......Done.
Loading AECC Land...
Loading AECC Subentity Selection...

Loading Modeler DLLs.
Loading AECC Pipe Part...
Loading AECC QTO......
Loading AECC Pipe Network...
Loading AECC Roadway...
Loading AECC Survey...
Loading AEC Schedule...
Loading AECC Plan Production...
Loading AECC Building Site...
Loading AECC Point Cloud...
Regenerating model.
*Cancel*
Loading AECC Hydrology...
Loading AECC Base UI...
Loading AECC Event Viewer...
Loading AECC Land UI...
Loading AECC QTO UI...
Loading AECC Pipe Network UI...
Loading AECC Roadway UI...
Loading AECC Survey UI...
Loading AECC Plan Production UI...
Loading AECC Publish UI...
Loading AECC AeccUiHydrology...
Loading AECC Mapcheck...
Loading AECC Mapcheck UI...
Loading AECC Building Site UI...
Loading AECC Point Cloud UI...
Loading AECC Management UI...
Loading AECC Model UI...

Customization file loaded successfully. Customization Group: BA_CUSTOM
Customization file loaded successfully. Customization Group: CIVIL

Customization file loaded successfully. Customization Group: ACAD
Customization file loaded successfully. Customization Group: TOOLBASEDRIBBON
Customization file loaded successfully. Customization Group: TASKBASEDRIBBON
Customization file loaded successfully. Customization Group: EXPRESS
Loading AECC Land Manager Items...
Loading AECC Pipe Network Manager Items...
Loading AECC Roadway Manager Items...
Loading AECC Survey Manager Items...
Loading AECC Plan Production Manager Items...
Loading AECC Building Site Manager Items...
Loading AECC Point Cloud Manager Items...
_.filedia
1
_.pickfirst
1
_.proxynotice
0
_.proxyshow
1
_.backgroundplot
0
_.attdia
1
_.attreq
1

AutoCAD menu utilities loaded.
AutoCAD menu utilities loaded.._purge
r
*
_n
-scalelistedit
_r
_y
_e
._AeccConvertVBARulesToDotNet
_y
_.script
C:\Users\dwahl\AppData\Roaming\Autodesk\C3D 2011\enu\SUPPORT\TESTSCRIPT.scr

AutoCAD menu utilities loaded.*Cancel*


Command: _RIBBON

Command: COMMANDLINE

Command: TOOLPALETTES

Command: Toolspace

Command:

Below is the AutoCAD output when opening a new file:
Quote
Regenerating model.

AutoCAD menu utilities loaded.
AutoCAD menu utilities loaded.._purge r * _n -scalelistedit _r _y _e
._AeccConvertVBARulesToDotNet _y _.script
C:\Users\dwahl\AppData\Roaming\Autodesk\C3D 2011\enu\SUPPORT\TESTSCRIPT.scr
« Last Edit: January 31, 2012, 04:27:38 PM by zride91 »

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: acaddoc and S::STARTUP
« Reply #6 on: January 31, 2012, 05:12:52 PM »
You may want to try this:
and if you catch the error then try to catch each command cal to get the offender.
Code: [Select]
(autoload "LaunchGrading.lsp" '("LaunchGrading")) ;;load lisp for toolpalette
(autoload "LaunchUtility.lsp" '("LaunchUtility")) ;;load lisp for toolpalette
(autoload "LaunchDS.lsp" '("LaunchDS")) ;;load lisp for toolpalette
(load "disablenavcube.lsp" "disablenavcube FAILED to load") ;;loads lisp to disable viewcube in 2D display styles
(setvar "layereval" 0) ;;turns off evaluation for unreconciled layers
(setvar "proxygraphics" 1) ;;saves proxy image with drawing
(defun-q BAstartupLD ( / scrloc scrloc1 err)
   (vl-load-com)
   (setq err (vl-catch-all-apply
    '(lambda ()
(command "._purge" "r" "*" "_n") ;;purge regapps
(command "-scalelistedit" "_r" "_y" "_e");;reset scale list
(command "._AeccConvertVBARulesToDotNet" "_y") ;;converts VBA pipe networks and structures to .NET
(c:disablenavcube) ;;runs lisp to disable viewcube in 2D display styles
(setq scrloc (strcat (getvar "ROAMABLEROOTPREFIX") "SUPPORT\\")) ;;defines scrloc variable for use in next line
(if (setq scrloc1 (findfile (strcat scrloc "TESTSCRIPT.scr")))(command "_.script" (strcat scrloc "TESTSCRIPT.scr"))) ;;if found, will run user startup script

)))
(if (vl-catch-all-error-p err) ; yes, error
   (princ (strcat "\n" (vl-catch-all-error-message err)))
)
         
         (princ)
)
(setq S::STARTUP (append S::STARTUP BAstartupLD))
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

zride91

  • Guest
Re: acaddoc and S::STARTUP
« Reply #7 on: February 01, 2012, 04:45:03 PM »
Thank you CAB.

I ran this as my acaddoc, and I am getting the same results, no more, or no less.

I did open VLIDe and opened my acaddoc while opening a new file in AutoCAD, and I was presented with the following Question:
assignment to protected symbol: C:AI_MOLC Enter break loop?

Lee Mac

  • Seagull
  • Posts: 12937
  • London, England
Re: acaddoc and S::STARTUP
« Reply #8 on: February 01, 2012, 05:22:39 PM »
I did open VLIDe and opened my acaddoc while opening a new file in AutoCAD, and I was presented with the following Question:
assignment to protected symbol: C:AI_MOLC Enter break loop?

http://www.theswamp.org/index.php?topic=16779

zride91

  • Guest
Re: acaddoc and S::STARTUP
« Reply #9 on: February 02, 2012, 08:28:25 AM »
Thank you Lee Mac.  Glad this has nothing to do with the lisp.

TimSpangler

  • Water Moccasin
  • Posts: 2010
  • CAD Naked!!
Re: acaddoc and S::STARTUP
« Reply #10 on: February 02, 2012, 12:25:02 PM »
We use something like this:

Code - Auto/Visual Lisp: [Select]
  1. ;;acaddoc.lsp to run with every file opened in AutoCAD Civil 3D
  2. (autoload "LaunchGrading.lsp" '("LaunchGrading")) ;;load lisp for toolpalette
  3. (autoload "LaunchUtility.lsp" '("LaunchUtility")) ;;load lisp for toolpalette
  4. (autoload "LaunchDS.lsp" '("LaunchDS")) ;;load lisp for toolpalette
  5. (load "disablenavcube.lsp" "disablenavcube FAILED to load") ;;loads lisp to disable viewcube in 2D display styles
  6. (setvar "layereval" 0) ;;turns off evaluation for unreconciled layers
  7. (setvar "proxygraphics" 1) ;;saves proxy image with drawing
  8. (defun  S::STARTUP ( / scrloc scrloc1)
  9.         (command "._purge" "r" "*" "_n") ;;purge regapps
  10.         (command "-scalelistedit" "_r" "_y" "_e");;reset scale list
  11.         (command "._AeccConvertVBARulesToDotNet" "_y") ;;converts VBA pipe networks and structures to .NET
  12.         (c:disablenavcube) ;;runs lisp to disable viewcube in 2D display styles
  13.         (setq scrloc (strcat (getvar "ROAMABLEROOTPREFIX") "SUPPORT\\")) ;;defines scrloc variable for use in next line
  14.         (if (setq scrloc1 (findfile (strcat scrloc "TESTSCRIPT.scr")))(command "_.script" (strcat scrloc "TESTSCRIPT.scr"))) ;;if found, will run user startup script
  15.         (princ)
  16.         )
  17. ;;;acaddoc.lsp end
  18.  
ACA 2015 - Windows 7 Pro
All Comments and Content by TimSpangler, Copyright © 2016

zride91

  • Guest
Re: acaddoc and S::STARTUP
« Reply #11 on: February 06, 2012, 12:31:03 PM »
Hi Tim,

Does your version work OK for you?

I'm just trying to set some corprate wide items, then run a script if it exists that the user can edit for user specific items if they want to do anythign of the such.

Thanks,

Dave

GDF

  • Water Moccasin
  • Posts: 2085
Re: acaddoc and S::STARTUP
« Reply #12 on: February 06, 2012, 02:13:31 PM »
FYI     This is what I use:

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Following is a list of AutoCAD, Express Tools, and user-defined files in
;;; the order they are loaded when you first start the program. Go to AutoCAD
;;; Help and search for "support file loading" (including quotes) and the
;;; top result is "Order of support file loading" which nets the following:
;;;      <File For:>       <Use By:>
;;;      acad2000.lsp       AutoCAD
;;;      acad.rx          User
;;;      acad.lsp       User
;;;      acad2000doc.lsp       AutoCAD
;;;      acetutil.fas       Express Tools
;;;      acaddoc.lsp       User
;;;      mymenu.mnc       User
;;;      mymenu.mnl       User
;;;      acad.mnc       AutoCAD
;;;      acad.mnl       AutoCAD
;;;      acetmain.mnc       Express Tools
;;;      acetmain.mnl       Express Tools
;;;      s::startup       User
;;; Note: If the user-defined function S::STARTUP is included in the acad.lsp or
;;; acaddoc.lsp file or a MNL file, the function is called when you enter a new
;;; drawing or open an existing drawing. Thus, you can include a definition of
;;; S::STARTUP in the LISP startup file to perform any setup operations. For more
;;; information about the s::startup function, refer to the Customization Guide.
;;;
;;; It should be noted that Autodesk's website is misleading about the load order.
;;; The menus load in the order they were initially loaded in, and *not* always
;;; the user menu first. The only way the user menu loads first is if all menus
;;; were removed and the user's menu was loaded first, then the other menus
;;; subsequently. In most cases people tend to leave Acad's menu there, then
;;; Express Tools (if installed), and then finally the user's menu.
;;; This can be verified by watching the menu load prompts:
;;; AutoCAD menu utilities loaded.
;;;
;;; Key files to needed to run this program:
;;; (1.) The "ACAD.lsp" file sets the path for the arch program along with the saved autocad
;;;     environment settings for a clean restore to generic autocad when the arch program
;;;     is unloaded. This is the only file that must be located at each workstation within
;;;     the autocad support directory. It only loads at AutoCAD startup.
;;; (2.) The "ACADDOC.lsp" loads the "ARCH_INITIALIZE.fas" file.
;;; (3.) The "ARCH_INITIALIZE.fas" initialize the setup.
;;; (4.) Custom settings are controled by the "custom_xxx.lsp" file.
;;; (5.) The "ARCH.mnc" loads the "ARCH.mnl" file automatically which contains many
;;;     misc functions required to operate this program.
;;; (6.) The "ARCH_SUBROUTINES.fas" contains all of the subfunctions.
;;; (7.) All bitmaps for the toolbars are compiled in the "ARCH.dll" which is loaded
;;;     automatically.
;;; (8.) The "ARCH.dcl" file must be located in the acad support file search path
;;;     it contains all of the dialog box widgets for the arch program.
;;;     @include "..\\ARCH.dcl"
;;;
;;;
;;; General Rule is to NOT edit the acad200Xdoc.lsp file because it is an Autocad file
;;; that CAN and WILL be replaced if you install patches. I would suggest using the
;;; acaddoc.lsp for the code. Following is a list of AutoCAD, Express Tools, and
;;; user-defined files in the order they are loaded when you first start the program.
;;;
;;; File         For use by:   
;;; acad200X.lsp AutoCAD   
;;; acad.rx         User   
;;; acad.lsp User   
;;; acad200Xdoc.lsp AutoCAD   
;;; acetutil.fas Express Tools   
;;; acaddoc.lsp User   
;;; mymenu.mnc User   
;;; mymenu.mnl User   
;;; acad.mnc AutoCAD   
;;; acad.mnl AutoCAD   
;;; acetmain.mnc Express Tools   
;;; acetmain.mnl Express Tools   
;;; s::startup User
;;;
;;; To make sure you are pulling the correct acaddoc.lsp copy and paste the following
;;; line to the command line (findfile "acaddoc.lsp") You should get the path returned
;;; and if it is not where you think the file is installed you have more than one file.
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Why is there never enough time to do it right, but always enough time to do it over?
BricsCAD 2020x64 Windows 10x64

zride91

  • Guest
Re: acaddoc and S::STARTUP
« Reply #13 on: February 06, 2012, 02:31:22 PM »
I don't know... 

Logically it all seems to make sense.

I did read this in the Customization Guide:

NoteVBA and AutoLISP® scripts that run at startup should check for whether the AutoCAD process is visible or invisible. If the process is invisible, the script should not execute, because the process may be performing background plotting or publishing operations. To check for whether the AutoCAD process is visible or invisible, you can use the Visible property of the Application object in the AutoCAD Object Model.

I don't really understand it, but the rest of my afternoon will hopefully involve getting more info to this as it sounds like a possibility of what is going on.

Thanks for all resopnses so far.

BlackBox

  • King Gator
  • Posts: 3770
Re: acaddoc and S::STARTUP
« Reply #14 on: February 06, 2012, 04:54:23 PM »
Code - Auto/Visual Lisp: [Select]
  1.     ;; <-- Load/run your script
  2.  )
  3.  
« Last Edit: February 06, 2012, 04:57:55 PM by RenderMan »
"How we think determines what we do, and what we do determines what we get."

zride91

  • Guest
Re: acaddoc and S::STARTUP
« Reply #15 on: February 07, 2012, 09:00:35 AM »
Thank you Renderman.  The script still shows up, so that would mean AutoCAD is visible.

I tried simplifying things more by getting rid of everything within the S::STARTUP function except drawing a circle.  It is not even doing that...  I am missing something stupid here, time to go back over the S::STARTUP function.  It's odd though because I had the S::STARTUP function run the lisp to disable the nav cube, and that seemed to be working, it's just the simpler commands that do not seem to be working within the S::STARTUP function, which is what I thought the S::STARTUP function was intended for.

TimSpangler

  • Water Moccasin
  • Posts: 2010
  • CAD Naked!!
Re: acaddoc and S::STARTUP
« Reply #16 on: February 07, 2012, 12:24:37 PM »
Maybe I missed something.  What are you trying to do exactly.  Do you want something to run code based on the user?  What does this script do? Is there dedicated space on a server for each user to have there own folder?

For instance, We have a mapped drive that has all of the company customization.  The folder is similar to the standard Autocad folder tree.  In there is a folder called "Users".  In that folder is a folder for each user.  In this folder there are files called User.xxx.  There is a User.lsp, .cui, and .mnl, etc.  Each of these files are empty but can be utilized by the user for what ever purpose.  The User.lsp can be called from the acaddoc.lsp, and will execute what ever is in that file.

This type of structure allows for easy migration to new versions.  Maybe you are looking for something like this?
ACA 2015 - Windows 7 Pro
All Comments and Content by TimSpangler, Copyright © 2016

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: acaddoc and S::STARTUP
« Reply #17 on: February 07, 2012, 12:59:57 PM »
So this is not working?
Code: [Select]
(defun  S::STARTUP ()
  (command "._circle" "_non" "0,0,0" "10")
  (princ)
)
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

zride91

  • Guest
Re: acaddoc and S::STARTUP
« Reply #18 on: February 07, 2012, 01:52:29 PM »
No, it does not.
I get the following output in AutoCAD as it recognizes the actual text int the function, but it is not performing the command, no circle in the file...

Quote
Regenerating model.

AutoCAD menu utilities loaded.._circle _non 0,0,0 10

I was just about to abandon the whole circle command, as I reverted back to what Render man had INITIALLY suggested, where having a text reply IS NOW working (not 100% sure at this point why it's working now where it was not before).

I generally will not have users adding circles to the drawing, so I was going to try experementing with other commands now that I finally have a text response.

zride91

  • Guest
Re: acaddoc and S::STARTUP
« Reply #19 on: February 07, 2012, 02:39:32 PM »
Hi Tim,

The basic of what I am trying to do is:

- Run a set of commands and set drawing saved variables on a corperate level
- Run a set of user defined commands and user variables

I was looking to accomplish this with the acad.lsp and the acaddoc.lsp, then have a startup.scr file for the user to use if he/she wishes to have anything automatically set everytime a drawing is opened.

I am still pretty green to the lisp world, so I may be approaching this in the not-so ideal way.  Using the acad.lsp and acaddoc.lsp seemed to be what is suggested after spending a lot of time researching this on the web.  I feel I had things working well at one point, but as I stated I was not previously using teh S::STARTUP function, which I have recently read is needed if running a command in the acaddoc.lsp.

Specifically as you may see in my original post containing my acaddoc.lsp, I am looking to do the following:
- Autoload (3) lisp files to be used in our standard toolpalette
- Set variables to save proxy images so we do not have errors when submitting to clients and to turn off layer evaluation so we do not keep getting the layer reconciliation warnings.
- load a lisp to disable the navcube in 2D view displays
- Command specific items include:
  *running a lisp to disable the navcube in 2D view displays
  *purge all regapps
  *reset the scale list to rid us of the XREF scale issue
  *convert all VBA pipe networks and structures from older projects done in 2008 to .NET so we do not have to use the VBA object enabler which was giving us issues.
  *If the user has defined a setup.scr file in the specified location on their C drive ((getvar "ROAMABLEROOTPREFIX") "SUPPORT\\"), I want their script to run

I'd rather keep the user fiel a .scr rather than a .lsp because most of them will prefer the simpler sintax of the script:
Quote
circle
0,0,0
10

I am running all these in the acaddoc because the above either sets drawing specific variables, or it's a maintenance item I want run on every drawing so the user doesn't have to do it.

zride91

  • Guest
Re: acaddoc and S::STARTUP
« Reply #20 on: February 07, 2012, 04:05:29 PM »
Ok, this is what I have so far, I'm getting close:

Code - Auto/Visual Lisp: [Select]
  1. ;;acaddoc.lsp to run with every file opened in AutoCAD Civil 3D
  2. (autoload "LaunchGrading.lsp" '("LaunchGrading")) ;;load lisp for toolpalette
  3. (autoload "LaunchUtility.lsp" '("LaunchUtility")) ;;load lisp for toolpalette
  4. (autoload "LaunchDS.lsp" '("LaunchDS")) ;;load lisp for toolpalette
  5. (load "disablenavcube.lsp" "disablenavcube FAILED to load") ;;loads lisp to disable viewcube in 2D display styles
  6. (setvar "layereval" 0) ;;turns off evaluation for unreconciled layers
  7. (setvar "proxygraphics" 1) ;;saves proxy image with drawing
  8. (defun-q BAstartupLD ( )
  9. (command "._purge" "r" "*" "_n") ;;purge regapps
  10. (princ "\nRegapps Purged\n")
  11. (command "-scalelistedit" "_r" "_y" "_e");;reset scale list
  12. (princ "\nScale List Reset\n")
  13. (command "._AeccConvertVBARulesToDotNet" "_y") ;;converts VBA pipe networks and structures to .NET
  14. (princ "\nConverted applicable VBA piep networks and structures to .NET\n")
  15. (disablenavcube) ;;runs lisp to disable viewcube in 2D display styles
  16. (princ "\nDisabled viewcube in 2D display styles\n")
  17. (command "._script" (strcat (getvar "ROAMABLEROOTPREFIX") "Support\\Startup.scr"))
  18. (princ "\nStartup script finished\n")
  19. )
  20. (setq S::STARTUP (append S::STARTUP BAstartupLD))
  21. ;;;acaddoc.lsp end
  22.  

It looks like everything runs EXCEPT the .scr.

I get the below out of AutoCAD upon opening a new file:

Quote
Regenerating model.

AutoCAD menu utilities loaded.._purge r * _n
Regapps Purged
-scalelistedit _r _y _e
Scale List Reset
._AeccConvertVBARulesToDotNet _y
Converted applicable VBA piep networks and structures to .NET

Disabled viewcube in 2D display styles
._script C:\Users\dwahl\AppData\Roaming\Autodesk\C3D
2011\enu\Support\Startup.scr
Startup script finished

Below is what is in the Startup.scr:
Code - Auto/Visual Lisp: [Select]
  1. (princ "\n** Script RAN!!! ** ")

As you can see in the AutoCAD output, it's not running the script even though it's finding it.  Maybe I just can't run scripts in the S::STARTUP?  Maybe this is just loading the script and not running it.