See the top rated post in this thread. Click here

Page 1 of 2 12 LastLast
Results 1 to 10 of 17

Thread: How do I use acaddoc.lsp during startup?

  1. #1
    Woo! Hoo! my 1st post
    Join Date
    2014-06
    Posts
    1
    Login to Give a bone
    0

    Question How do I use acaddoc.lsp during startup?

    Hi all,

    Chasing a bit of help with this one. I use LISP files fairly routinely but generally rely on the CUI and the startup suite to load my routines - however, lately, the startup suite doesn't load ALL of my lisp routines. Seems to be all of my newer ones it doesn't like.

    After a bit of research online, it looks like acaddoc.lsp is the way to go in terms of startup. I've found my existing acad2012doc.lsp file in Program Files. Can anyone walk me through what the best way to use this is? Do I copy and paste the text from all of my individual lisp routines into this one file?

    Cheers.

    Kenny.

  2. #2
    Administrator rkmcswain's Avatar
    Join Date
    2004-09
    Location
    Earth
    Posts
    9,803
    Login to Give a bone
    0

    Default Re: How do I use acaddoc.lsp during startup?

    "acad2012doc.lsp" and "acaddoc.lsp" are two different files.
    Do not modify the former, only use the latter (create it if it does not exist)

    Back to your question. I prefer to use "acaddoc.lsp" to load other lisp files, or in some cases "autoload" them.

    Code:
    ;;; Example
    (load "mylisp")
    (load "mylisp2")
    (load "mylisp3")
    (autoload "less_used_func" '("foo"))
    But I do have some complete routines in there also, usually small routines that are only a few lines long.

    Code:
    ;;; Example
    (defun c:ld ()(princ "Macro: Lengthen Dynamic ")(command "._lengthen" "_dynamic")(princ))
    (defun c:p0 ()(princ "Macro: Pasteclip to 0,0,0 ")(command "._pasteclip" (list 0.0 0.0 0.0)))
    (defun c:cop:qp ()
      (if (not (member "ploihtf.19.x64.arx" (arx)))
        (arxload (strcat SERVER_NAME "\\cad\\lisp\\ploihtf.19.x64.arx"))
      )
    )
    I also have other code in an .MNL file that corresponds to our company menu file. (company.cuix, company.mnl)
    This can be treated the same as acaddoc.lsp, but it only loads when the menu by the same name is loaded.
    R.K. McSwain | CAD Panacea |

  3. #3
    Certifiable AUGI Addict tedg's Avatar
    Join Date
    2005-06
    Location
    in the upper right corner
    Posts
    3,505
    Login to Give a bone
    0

    Default Re: How do I use acaddoc.lsp during startup?

    To add to RK's great examples for loading routines, etc., Acaddoc.lsp is also great for setting (and re-setting) variables in the drawings when you open them, helps in case some bad cad user has set them to something different or you want to assure certain variables:
    Code:
    ;;ACADDOC.LSP ;;FOR TED'S COOL STUFF
    (defun-q MYSTARTUP ()
            (SETVAR "OSMODE" 703)
    	(SETVAR "REGENMODE" 1)
    	(SETVAR "GRIDMODE" 0)
    	(SETVAR "SNAPMODE" 0)
    	(SETVAR "LIMCHECK" 0)
    	(SETVAR "BLIPMODE" 0)
    	(SETVAR "PLINEGEN" 1)
    	(SETVAR "UCSICON" 1)
    	(SETVAR "MIRRTEXT" 0)
    	(SETVAR "BINDTYPE" 1)
    	(SETVAR "DIMASSOC" 1)
    	(SETVAR "VISRETAIN" 1)
    	(SETVAR "FILEDIA" 1)
    	(SETVAR "ATTDIA" 1)
    	(SETVAR "ATTREQ" 1)
    	(SETVAR "INSBASE" (list 0.0 0.0 0.0))
    	(SETVAR "HPASSOC" 1)
    	(SETVAR "SAVETIME" 15)
    	(SETVAR "XREFNOTIFY" 1)
    	(SETVAR "LAYERNOTIFY" 0)
    	(SETVAR "LAYEREVAL" 0)
    	(PRINC)
    
    [my lisp routines are loaded here]
    
    (setq S::STARTUP (append S::STARTUP MYSTARTUP))

  4. #4
    Administrator rkmcswain's Avatar
    Join Date
    2004-09
    Location
    Earth
    Posts
    9,803
    Login to Give a bone
    2

    Default Re: How do I use acaddoc.lsp during startup?

    It should be noted that some changes made at startup will cause a change to the sysvar DBMOD. When DBMOD /= 0, then "Drawing1.dwg" will not close when you open another drawing, and if/when you do close "Drawing1.dwg", you will be prompted to save it.

    Whether or not you choose to do this is purely personal preference. Some people like a clean startup that does not alter the DWG, for others it does not matter.

    Either way, I just wanted to mention it.
    R.K. McSwain | CAD Panacea |

  5. #5
    Certifiable AUGI Addict tedg's Avatar
    Join Date
    2005-06
    Location
    in the upper right corner
    Posts
    3,505
    Login to Give a bone
    0

    Default Re: How do I use acaddoc.lsp during startup?

    Quote Originally Posted by rkmcswain View Post
    It should be noted that some changes made at startup will cause a change to the sysvar DBMOD. When DBMOD /= 0, then "Drawing1.dwg" will not close when you open another drawing, and if/when you do close "Drawing1.dwg", you will be prompted to save it.

    Whether or not you choose to do this is purely personal preference. Some people like a clean startup that does not alter the DWG, for others it does not matter.

    Either way, I just wanted to mention it.
    Yes good point, I never thought of that.

    That's exactly what happens for me, I have that drawing that opens using my default template on startup.
    My default template has layers and blocks (etc) that I use all the time.
    I sometimes use it for a spare work space to pull in layers or blocks etc I don't want to bring in another real drawing.

    And I get prompted to save when I close out, which I usually don't.

    Thanks for the tip.

  6. #6
    Certifiable AUGI Addict
    Join Date
    2001-03
    Location
    Tallahassee, FL USA
    Posts
    3,658
    Login to Give a bone
    0

    Default Re: How do I use acaddoc.lsp during startup?

    Quote Originally Posted by tedg View Post
    Yes good point, I never thought of that.

    That's exactly what happens for me, I have that drawing that opens using my default template on startup.
    My default template has layers and blocks (etc) that I use all the time.
    I sometimes use it for a spare work space to pull in layers or blocks etc I don't want to bring in another real drawing.

    And I get prompted to save when I close out, which I usually don't.

    Thanks for the tip.
    AutoCAD includes a cheat around that. http://knowledge.autodesk.com/suppor...E813F-htm.html
    (acad-push-dbmod) at the start of acaddoc.lsp before modifying anything and
    (acad-pop-dbmod) at the end when you're done modifying.

  7. #7
    Board of Director
    Join Date
    2003-03
    Location
    Bielefeld, Deutschland
    Posts
    188
    Login to Give a bone
    0

    Default Re: How do I use acaddoc.lsp during startup?

    Hi,

    please take a look at:
    http://adndevblog.typepad.com/autoca...reload-au.html.

    For some reasons (maybe security reason) user should not been creating or editing them.

    From above Link.
    acad20xx.lsp and acad20xxdoc.lsp were supposed to be for AutoCAD internal use only, so users should not have been creating/editing them.
    Regards Jürgen
    Gruß Jürgen
    Softwareentwicklung .Net / Autodesk Forge Spezialist / Trainer

    mailto:Juergen.Becker@CAD-Becker.de
    https://www.cad-becker.de
    CAD-Blog: http://www.CAD-Becker.de/Blog

  8. #8
    Administrator rkmcswain's Avatar
    Join Date
    2004-09
    Location
    Earth
    Posts
    9,803
    Login to Give a bone
    0

    Default Re: How do I use acaddoc.lsp during startup?

    Quote Originally Posted by Juergen Becker View Post
    For some reasons (maybe security reason) user should not been creating or editing them.
    You can edit them all day, and your edits will work, but at the risk of those edits being lost during a repair, reinstall, application of a service pack, etc.
    However there is no reason to edit them because the user files acad.lsp and acaddoc.lsp will never be touched by AutoCAD.
    R.K. McSwain | CAD Panacea |

  9. #9
    Board of Director
    Join Date
    2003-03
    Location
    Bielefeld, Deutschland
    Posts
    188
    Login to Give a bone
    0

    Default Re: How do I use acaddoc.lsp during startup?

    Hi,

    of course, you can do so.
    But in the newer versions of AutoCAD you should use the new loading technologies because of security reasons. Use a bundle path in the ApplicationPlugin path.

    To load a Lisp file you also can use the "vl-load-all" function to load in all drawings, new and old drawings.

    Regards Jürgen
    Gruß Jürgen
    Softwareentwicklung .Net / Autodesk Forge Spezialist / Trainer

    mailto:Juergen.Becker@CAD-Becker.de
    https://www.cad-becker.de
    CAD-Blog: http://www.CAD-Becker.de/Blog

  10. #10
    Certifiable AUGI Addict
    Join Date
    2001-03
    Location
    Tallahassee, FL USA
    Posts
    3,658
    Login to Give a bone
    1

    Default Re: How do I use acaddoc.lsp during startup?

    Quote Originally Posted by Juergen Becker View Post
    Hi,

    of course, you can do so.
    But in the newer versions of AutoCAD you should use the new loading technologies because of security reasons. Use a bundle path in the ApplicationPlugin path.

    Regards Jürgen
    There's less security issues with acad.lsp and acaddoc.lsp now that we have the Support File Search Path. While bundling a plug-in for an Exchange App makes sense, it doesn't make sense to me for managing office settings and lisp. If there's something I'm missing let me know.

Page 1 of 2 12 LastLast

Similar Threads

  1. How can I make a startUp Exe for Startup AutoCAD
    By 740176597380946 in forum ARX
    Replies: 6
    Last Post: 2013-05-24, 05:36 AM
  2. 64 bit and Acaddoc.lsp
    By CadDog in forum AutoCAD General
    Replies: 7
    Last Post: 2010-10-12, 06:27 PM
  3. ACADDOC.LSP
    By dbrownson in forum AutoLISP
    Replies: 20
    Last Post: 2008-02-06, 04:52 AM
  4. acaddoc.lsp?
    By Spanky in forum AutoLISP
    Replies: 24
    Last Post: 2008-01-27, 01:30 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •