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

0 Members and 1 Guest are viewing this topic.

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.