Automatically load lisp programs on program startup

I've searched for a straightforward answer to this question.  Found some that apply to Windows, but not to Mac.  Can anyone tell me how to do this?  Shouldn't BCAD have something like ACAD's startup suite in the appload window?

Comments

  • APPLOAD is available with BricsCAD, but you need to run each time you want to load an application, which is similar to the way older versions of AutoCAD worked. You could try raising a support request on getting this feature added.

    There are two LISP files that are loaded automatically by BricsCAD if they're present:
    1. on_start.lsp is loaded once on startup of BricsCAD. Equivalent to AutoCAD's acad.lsp
    2. on_doc_load.lsp is loaded each time a drawing is opened. Equivalent to AutoCAD's acaddoc.lsp
    The folders these files are kept in need to be on your support file search path (SRCHPATH) for BricsCAD to find them.

    You can use the LOAD or AUTOLOAD functions to load your LISP apps
    [code](load "mylisp.lsp")[/code]

    [code](autoload "MyLisp.lsp" '("MyCmd01" "MyCmd02"))[/code]

    Regards,
    Jason Bourhill

  • Jason,
    I've searched for those two files, but haven't found them.  OSX locates files in different places than the Windows version.  They are not in the BricsCAD V16.app/Contents folder.  Do I need to create them myself?  Where should they be stored, and what would be the format for adding my .lsp programs?
    Sorry if these seem like dumb questions, I know just enough about this stuff to get myself in trouble.
  • Hi Jeff,

    You need to create these files yourself if they don't already exist. They aren't included with the BricsCAD installation. Its best to create your own folder(s) for your customisation. This keeps your files separate from the ones included with BricsCAD (avoids confusion), and in a known location. You need to add this folder(s) to BricsCAD's support file search path, which you can do by going into SETTINGS and looking for SRCHPATH.

    The format for adding your LISP is per my previous post. As you are likely to want these loaded with each drawing, you would want to create and use the on_doc_load.lsp file.

    Regards,
    Jason Bourhill

  • Jason,
    I created the .lsp file "on_doc_load.lsp", and saved it to my support folder.
    the file contains:
    (load "breakline.lsp")

    When I start BCAD, I get the error message:
    ; —— Error around expression ——
    (LOAD |BREAKLINE.LSP|)
    ;
    ; error : bad argument type ; expected at [load]

    I tried it without the " around the .lsp and got:
    ; —— Error around expression ——
    (LOAD BREAKLINE.LSP)
    ;
    ; error : bad argument type ; expected at [load]

    I realize this is simple lsp stuff, and I spent some time searching for an answer to my error but no luck.  If I use appload the lsp works fine.  Can you tell me what is wrong with the code?
  • Hi Jeff,

    It looks like BricsCAD is interpreting your speech marks incorrectly. It could be that you're using the wrong type of double quotes, or It could be an encoding issues.  I believe LISP needs to be encoded in ANSI/ASCII format. You could check the application you're using to create your lsp file to see what it is set to.

    You could try dragging and dropping your breakline.lsp from its folder onto the drawing area of the BricsCAD application. This should cause it to load automatically. Essentially BricsCAD types the load function in for you. If you up arrow after loading, then you could copy this line from BricsCAD out to your text editor.

    Just in case this doesn't work, I also attach a simple on_doc_load example that includes a call to load your lisp. This was created and tested on Windows.

    Regards,
    Jason Bourhill

    on_doc_load-test.lsp

  • dragging and dropping the breakline file doesn't run it.  But when I load it with appload it runs fine.
    The text editor for OSX is set to use plain text.
    Were you going to attach that sample file?  Maybe I will see what the file is missing.
    thanks for your help,
    Jeff
  • Sample was included with my previous post.

    Regards,
    Jason Bourhill
  • duh, yes you did.
    I tried the code and got this message:

    ; —— Error around expression ——
    (PRINC)
    ;
    ; error : malformed list on input at [read] : File


  • Most common reason for a malformed list is a missing or extra speech mark in the code. I would check that if you've edited the file I posted. If you haven't edited the file I posted, then I would raise a support request and include the file. I checked the file I posted in BricsCAD (Windows) and didn't have any issues. Don't currently have access to check on a mac.

    Regards,
    Jason Bourhill

This discussion has been closed.