- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi everyone, I have a peculiar problem which I've been scratching my head over for too long now...
I am writing an .scr script which I would like to use to open a dwg, load an autolisp routine and the run a command from that routine before saving and closing the drawing:
_.open "PATHTODRAWING" (load LISPFILE) (c:LISPCOMMAND) _.qsave _.close
I have verified that the drawing opens, and I have verified that the commands work correctly when the lisp routine is loaded correctly, however I am having problems loading the lisp routine.
Here's where it gets interesting. If I put the full path to the lisp in the load function, it works fine:
_.open "PATHTODRAWING" (load "\\\\tsclient\\I\\Drawings - Documents\\2 - Clients\\CONFIDENTIAL\\CONFIDENTIAL\\1 Motor Schematic Diagrams 100\\3 Reference\\Templates\\TestGeneration\\00_Complete\\Update\\Autogen_LISP\\Autogen_LISP\\Scripts\\Autogen.lsp") (c:Autogen root_directory data_file) _.qsave _.close
However, based on how this software is going to be used, we don't want the full path to the lisp routine and instead want to use the relative path.
I can get the path in two different ways (I haven't written the full code for how here) and both of them give me the correct path, which is the exact same path which works if pasted directly into the load function. I've even verified this by copying the path they output, and setting it as the full path in the script, which ends up working.
Method 1:
Command: (LM:findfile "Autogen.lsp" scripts_path)
Returns
"\\\\tsclient\\I\\Drawings - Documents\\2 - Clients\\CONFIDENTIAL\\CONFIDENTIAL\\1 Motor Schematic Diagrams 100\\3 Reference\\Templates\\TestGeneration\\00_Complete\\Update\\Autogen_LISP\\Autogen_LISP\\Scripts\\Autogen.lsp"
Method 2:
Command: (setq autogen_path (strcat scripts_path "Autogen.lsp"))
Returns:
"\\\\tsclient\\I\\Drawings - Documents\\2 - Clients\\CONFIDENTIAL\\CONFIDENTIAL\\1 Motor Schematic Diagrams 100\\3 Reference\\Templates\\TestGeneration\\00_Complete\\Update\\Autogen_LISP\\Autogen_LISP\\Scripts\\Autogen.lsp"
But, when I replace the full path with either of these two commands, the routine doesn't load and nothing happens.
_.open "PATHTODRAWING" (load (LM:findfile "Autogen.lsp" scripts_path)) (c:Autogen root_directory data_file) _.qsave _.close
_.open "PATHTODRAWING" (load autogen_path) (c:Autogen root_directory data_file) _.qsave _.close
I have also tested the syntax for (load (LM:findfile "Autogen.lsp" scripts_path)) in another lisp routine and it worked just fine, so I'm at a loss as to what is going on here.
Any advice would be appreciated!
Solved! Go to Solution.