how to start LSP.files automaticly

How to start LSP.files automaticly

All my lisp-files are placed in (which also is the route in my "support file search path"):

C:\Documents and Settings\peter\Application Data\Bricsys\Bricscad\V10\en_US\support\On_start.lsp;

and On_start.lsp for each doc has been selected in the option-folder.

Although these settings I have to load in each new drawing my lisp-files.

What is going wrong??

Regards.
Peter

Comments

  • Please clarify: you say that you have placed lisp-files inside On_start.lsp, does this mean that you have a folder named On_start.lsp containing lisp-files?

  • Yes, indeed. That's wrong??

    Regards.

    Peter

  • Yes, that is wrong. on_start.lsp should be a lisp-file and not a folder. There are two main options:

    1.
    Put all your lisp-routines inside on_start.lsp.

    2.
    Use on_start.lsp to load seperate lisp-files. Your on_start.lsp could then look like this:

     

    (load "MyLispA") ; MyLispA.lsp should be in the search path
    (load "MyLispB") ; MyLispB.lsp should be in the search path
    ; etc.

     

    Or this:

     

    (autoload "MyLispA" '("MyCommandA1" "MyCommandA2")) ; MyLispA.lsp should be in the search path and contains functions c:MyCommandA1 and c:MyCommandA2
    (autoload "MyLispB" '("MyCommandB1")) ; MyLispB.lsp should be in the search path and contains function c:MyCommandB1

    You should also be aware of on_doc_load.lsp... You are now using on_start.lsp instead of on_doc_load.lsp. This is possible, but why not set up things the way they were intended:
    Do not load on_start.lsp with every drawing, but only at start-up and use it for things you want to do once at the beginning of every drawing session. And use on_doc_load.lsp for things that you want to do for every drawing.

     

  • If all settings is Ok and still it not work, check if you don't have one of this file created here with zero size.

    c:\Program Files\Bricsys\Bricscad V10\on_start.lsp
    c:\Program Files\Bricsys\Bricscad V10\on_doc_load.lsp

    If yes, delete it. Time to time BC or "who" create here (in Bricscad V10 folder) this file...

  • As Juraj mentioned, if there are multiple files
    "on_statrt.lsp" and/or "on_doc_load.lsp", it is easy
    to verify which one is loaded :

    (findfile "on_start.lsp")
    resp.
    (findfile "on_doc_load.lsp")

    will show which file is finally used for loading.

  • I'm having difficuly invoking lisp routines from pulldown menus. The tried and trusted syntax


    [Horizontal]^C^C(if(not c:forcehor)(load"c:/data/lisp/forcehor");+
    (princ "Already loaded.."));forcehor

    should display the pulldown "Horizontal" ( which it does), then  load (which it does not)  and run  forcehor.lsp.

    Also, how do I add onto the default Bricscad menu ? As far as I know I need a .mnu
    file onto which I can add my custom menus. I managed to load an entire .mnu
    file, but then the default Bricscad menu items disppear. I wish to retain them
    and just augment.

     

  • I don't know if this is still necessary, but I think the file path should read like this
    (load "c:\\data\\lisp\\forcehor.lsp"). Maybe, a better solution would be to include
    "C:data" in your search path right away -> Settings -> Program options -> Files ->
    Support file search path, you can add "C:data" there and dispense with the need to
    include the file path in your code.
    For adding your menu -> Tools -> Customize -> File (in top left corner) -> load partial cui file,
    you can then load your menu and it will be appended to the main BC menu.

  • @ Hennie Maartens:
    There is a mistake in your trusted syntax: the first semicolon is in the middle of some lisp code...

    Try this (HorizontalAlt has nicer echoes):

    ***MENUGROUP=Test

    ***POP1
    [&Test]
    [Horizontal]^C^C(if(not c:forcehor)(load"c:/data/lisp/forcehor")(princ"Already loaded.."));forcehor;
    [HorizontalAlt]^C^C(if(not c:forcehor)(progn(load"c:/data/lisp/forcehor")(princ"\r"))(princ"\rAlready loaded.."))(princ);forcehor;
  • @ Roy, Juraj and Torsten,

    Thanks a lot for your answers, it's working !! 

    ('have learned a lot this weekend)

     

    Best regards.

    Peter

     

     

  • It doesn't matter that lisps are loaded each time they are run, does it? The form for all of mine is [XXX]^c^c^c(load"xxx") xxx.

    Bcad is set to start in the parent directory for all my dwgs (named C:\dwgs) and all the lisps are there including on_doc_load, so I never have to wonder about the path or include it with every new menu lisp addition.

This discussion has been closed.