Load a lisp from within another lsp file

C_Wilms
edited October 2022 in LISP
Can I load a lsp from within another lsp file just as in AutoCAD
In Acad i used: (load"LayerDirectorV1-1.lsp")
This gives an error in BricsCAD: ; error : LOAD failed: 'LayerDirectorV1-1.lsp'
Does Anybody know if it is possible or what the correct comand would be?


Added: I know the APPLOAD comand but I need it without dialog box

Thanks

Comments

  • Solved it after some fiddling around:
    I need to include the location
    (load"J:\\BricsCAD\\Lisp\\Viewportlock.lsp")
  • Anthony Apostolaros
    edited October 2022
    Or you could add that "BricsCAD/Lisp" folder to your SRCHPATH setting.

    Have you seen the online Lisp help?
    Developer Reference > LISP > AutoLISP Standard Functions > L > load
  • Yes I did see that but "load lisp.lsp" didn't work in BricsCAD (It did in autoCAD) as mentioned in my original message.
    In BricsCAD I need to add the complete location.
  • Dear C_Wilm,

    > Or you could add that "BricsCAD/Lisp" folder to your SRCHPATH setting.
    as Anthony mentioned - (load) function can load the Lisp file, if it can find the file :-)
    a) either by adding full path specification
    or
    b) by adding your folder "J:/BricsCAD/Lisp" to SRCHPATH setting

    you can test with
    (findfile "Viewportlock.lsp")
    at commandline, to see if the file can be found ... if so, it can be loaded.
    :smile:

    many greetings !
  • Anthony Apostolaros
    edited October 2022
    or
    c) by opening a .dwg file that's in the same folder as the .lsp file
  • you can test with
    (findfile "Viewportlock.lsp")
    at commandline, to see if the file can be found ... if so, it can be loaded.
    :smile:

    many greetings !

    I know the findfile command but It is a cloud installation and "findfile"does not work if the files are somewhere in our cloud
  • You can also obtain your loaded source file location with (vl-list-loaded-lisp) and extract directory path.