Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Help with Lisp Routine

4 REPLIES 4
Reply
Message 1 of 5
mmccomb
146 Views, 4 Replies

Help with Lisp Routine

I'm modifying a lisp routine from a former employee.
Below is the lisp code located in the acad2007doc.lsp
I'm not sure why there's multiple \\\\ slashes between file name.

This lisp is supposed to load the latest page setups from our template, everytime I open a drawing.
I'm mapped to the K:
The only thing I've changed is the file path (I've checked spelling 100 times).


;
(cond
((= (getvar "loginname") "TW")(command "-PSETUPIN" "K:\\\\Software\\\\Building Systems\\\\ThermalTech Drawing Template\\\\TE Standard-Mich - BS2007.dwt"))
((= (getvar "loginname") "DB")(command "-PSETUPIN" "K:\\\\Software\\\\Building Systems\\\\ThermalTech Drawing Template\\\\TE Standard-Mich - BS2007.dwt"))
((= (getvar "loginname") "CTY")(command "-PSETUPIN" "K:\\\\Software\\\\Building Systems\\\\ThermalTech Drawing Template\\\\TE Standard-Mich - BS2007.dwt"))
((= (getvar "loginname") "KRH")(command "-PSETUPIN" "K:\\\\Software\\\\Building Systems\\\\ThermalTech Drawing Template\\\\TE Standard-Mich - BS2007.dwt"))
((= (getvar "loginname") "RD")(command "-PSETUPIN" "K:\\\\Software\\\\Building Systems\\\\ThermalTech Drawing Template\\\\TE Standard-Mich - BS2007.dwt"))
((= (getvar "loginname") "MDM")(command "-PSETUPIN" "K:\\\\Software\\\\Building Systems\\\\ThermalTech Drawing Template\\\\TE Standard-Mich - BS2007.dwt"))
((= (getvar "loginname") "BW")(command "-PSETUPIN" "K:\\\\Software\\\\Building Systems\\\\ThermalTech Drawing Template\\\\TE Standard-Mich - BS2007.dwt"))
((= (getvar "loginname") "CPK")(command "-PSETUPIN" "K:\\\\Software\\\\Building Systems\\\\ThermalTech Drawing Template\\\\TE Standard-Mich - BS2007.dwt"))
(T (command "-PSETUPIN" "P:\\CAD\\TEMPLATES\\TE STANDARD.DWT"))
);end cond
4 REPLIES 4
Message 2 of 5
Anonymous
in reply to: mmccomb

> I'm not sure why there's multiple \\\\ slashes between file name.
That makes 2 of us. There should only be two slashes. Four slashes will result in 2 slashes. Such as K:\\Software\\Blah blah
blah... Refer to the next to last line of your code: P:\\CAD\\TEMPLATES\\TE STANDARD.DWT

I like to use a forward slash instead. I.E. K:/Software/Blah blah blah... This way you only need one. I'm not sure if one way is
better than the other (\\ vs. /)

Give it a shot with two backslashes or one forward slash.

--
Matt W
"That's my only real motivation is not to be hassled, that, and the fear of losing my job. But you know, Bob, that will only make
someone work just hard enough not to get fired."

wrote in message news:5374033@discussion.autodesk.com...
I'm modifying a lisp routine from a former employee.
Below is the lisp code located in the acad2007doc.lsp
I'm not sure why there's multiple \\\\ slashes between file name.

This lisp is supposed to load the latest page setups from our template, everytime I open a drawing.
I'm mapped to the K:
The only thing I've changed is the file path (I've checked spelling 100 times).


;
(cond
((= (getvar "loginname") "TW")(command "-PSETUPIN" "K:\\\\Software\\\\Building Systems\\\\ThermalTech Drawing Template\\\\TE
Standard-Mich - BS2007.dwt"))
((= (getvar "loginname") "DB")(command "-PSETUPIN" "K:\\\\Software\\\\Building Systems\\\\ThermalTech Drawing Template\\\\TE
Standard-Mich - BS2007.dwt"))
((= (getvar "loginname") "CTY")(command "-PSETUPIN" "K:\\\\Software\\\\Building Systems\\\\ThermalTech Drawing Template\\\\TE
Standard-Mich - BS2007.dwt"))
((= (getvar "loginname") "KRH")(command "-PSETUPIN" "K:\\\\Software\\\\Building Systems\\\\ThermalTech Drawing Template\\\\TE
Standard-Mich - BS2007.dwt"))
((= (getvar "loginname") "RD")(command "-PSETUPIN" "K:\\\\Software\\\\Building Systems\\\\ThermalTech Drawing Template\\\\TE
Standard-Mich - BS2007.dwt"))
((= (getvar "loginname") "MDM")(command "-PSETUPIN" "K:\\\\Software\\\\Building Systems\\\\ThermalTech Drawing Template\\\\TE
Standard-Mich - BS2007.dwt"))
((= (getvar "loginname") "BW")(command "-PSETUPIN" "K:\\\\Software\\\\Building Systems\\\\ThermalTech Drawing Template\\\\TE
Standard-Mich - BS2007.dwt"))
((= (getvar "loginname") "CPK")(command "-PSETUPIN" "K:\\\\Software\\\\Building Systems\\\\ThermalTech Drawing Template\\\\TE
Standard-Mich - BS2007.dwt"))
(T (command "-PSETUPIN" "P:\\CAD\\TEMPLATES\\TE STANDARD.DWT"))
);end cond
Message 3 of 5
mmccomb
in reply to: mmccomb

I've switched some things around a little.
I'm getting two errors while opening a drawing.

Errors:
; error: misplaced dot on input
; error: syntax error

Updated Code:
(cond
((= (getvar "loginname") "BW") (command "-PSETUPIN" "K:\\Software\\Building Systems\\ThermalTech Drawing Template\\TE Standard-Mich - BS2007.dwt" "*"))
((= (getvar "loginname") "CPK") (command "-PSETUPIN" "K:\\Software\\Building Systems\\ThermalTech Drawing Template\\TE Standard-Mich - BS2007.dwt" "*"))
((= (getvar "loginname") "CTY") (command "-PSETUPIN" "K:\\Software\\Building Systems\\ThermalTech Drawing Template\\TE Standard-Mich - BS2007.dwt" "*"))
((= (getvar "loginname") "DB") (command "-PSETUPIN" "K:\\Software\\Building Systems\\ThermalTech Drawing Template\\TE Standard-Mich - BS2007.dwt" "*"))
((= (getvar "loginname") "JAH") (command "-PSETUPIN" "K:\\Software\\Building Systems\\ThermalTech Drawing Template\\TE Standard-Mich - BS2007.dwt" "*"))
((= (getvar "loginname") "JJB") (command "-PSETUPIN" "K:\\Software\\Building Systems\\ThermalTech Drawing Template\\TE Standard-Mich - BS2007.dwt" "*"))
((= (getvar "loginname") "JPS") (command "-PSETUPIN" "K:\\Software\\Building Systems\\ThermalTech Drawing Template\\TE Standard-Mich - BS2007.dwt" "*"))
((= (getvar "loginname") "KRH") (command "-PSETUPIN" "K:\\Software\\Building Systems\\ThermalTech Drawing Template\\TE Standard-Mich - BS2007.dwt" "*"))
((= (getvar "loginname") "MDM") (command "-PSETUPIN" K:\\Software\\Building Systems\\ThermalTech Drawing Template\\TE Standard-Mich - BS2007.dwt" "*"))
((= (getvar "loginname") "RD") (command "-PSETUPIN" "K:\\Software\\Building Systems\\ThermalTech Drawing Template\\TE Standard-Mich - BS2007.dwt" "*"))
((= (getvar "loginname") "TW") (command "-PSETUPIN" "K:\\Software\\Building Systems\\ThermalTech Drawing Template\\TE Standard-Mich - BS2007.dwt" "*"))
(T (command "-PSETUPIN" "K:\\Software\\Building Systems\\ThermalTech Drawing Template\\TE Standard-Mich - BS2007.dwt" "*"))
);end cond
Message 4 of 5
Anonymous
in reply to: mmccomb

The following line is missing the " before K:\\Software...

((= (getvar "loginname") "MDM") (command "-PSETUPIN" K:\\Software\\Building Systems.....

Add the " and give it a whirl!!

--
Matt W
Message 5 of 5
Anonymous
in reply to: mmccomb

[Pardon my curiosity, but I'm wondering what this whole thing is for. It
looks to me as though it will do exactly the same (command) function, using
the same drawing template, whether the 'loginname' value is one of those
listed or not (the T line at the end covers any other possible value for
'loginname', including no value at all). If that's really the case, you
could skip the (cond) part and all the multiplicity of lines of repetitive
code, and just do the (command) function on one line and be done with it.
If it's supposed to be doing the same thing for any of those users, you
could simplify it by putting their loginnames into one list and doing a
simpler (if) function with a (member) check for the loginname, again with
the (command) function needed only once.
But in either approach, shouldn't it do something *different* if 'loginname'
isn't right, instead of doing the same thing no matter what? Otherwise
what's the point of checking 'loginname'?
--
Kent Cooper]


wrote...
I've switched some things around a little.
I'm getting two errors while opening a drawing.

Errors:
; error: misplaced dot on input
; error: syntax error

Updated Code:
(cond
((= (getvar "loginname") "BW") (command "-PSETUPIN"
"K:\\Software\\Building Systems\\ThermalTech Drawing Template\\TE
Standard-Mich - BS2007.dwt" "*"))
((= (getvar "loginname") "CPK") (command "-PSETUPIN"
"K:\\Software\\Building Systems\\ThermalTech Drawing Template\\TE
Standard-Mich - BS2007.dwt" "*"))
((= (getvar "loginname") "CTY") (command "-PSETUPIN"
"K:\\Software\\Building Systems\\ThermalTech Drawing Template\\TE
Standard-Mich - BS2007.dwt" "*"))
((= (getvar "loginname") "DB") (command "-PSETUPIN"
"K:\\Software\\Building Systems\\ThermalTech Drawing Template\\TE
Standard-Mich - BS2007.dwt" "*"))
((= (getvar "loginname") "JAH") (command "-PSETUPIN"
"K:\\Software\\Building Systems\\ThermalTech Drawing Template\\TE
Standard-Mich - BS2007.dwt" "*"))
((= (getvar "loginname") "JJB") (command "-PSETUPIN"
"K:\\Software\\Building Systems\\ThermalTech Drawing Template\\TE
Standard-Mich - BS2007.dwt" "*"))
((= (getvar "loginname") "JPS") (command "-PSETUPIN"
"K:\\Software\\Building Systems\\ThermalTech Drawing Template\\TE
Standard-Mich - BS2007.dwt" "*"))
((= (getvar "loginname") "KRH") (command "-PSETUPIN"
"K:\\Software\\Building Systems\\ThermalTech Drawing Template\\TE
Standard-Mich - BS2007.dwt" "*"))
((= (getvar "loginname") "MDM") (command "-PSETUPIN"
K:\\Software\\Building Systems\\ThermalTech Drawing Template\\TE
Standard-Mich - BS2007.dwt" "*"))
((= (getvar "loginname") "RD") (command "-PSETUPIN"
"K:\\Software\\Building Systems\\ThermalTech Drawing Template\\TE
Standard-Mich - BS2007.dwt" "*"))
((= (getvar "loginname") "TW") (command "-PSETUPIN"
"K:\\Software\\Building Systems\\ThermalTech Drawing Template\\TE
Standard-Mich - BS2007.dwt" "*"))
(T (command "-PSETUPIN" "K:\\Software\\Building Systems\\ThermalTech
Drawing Template\\TE Standard-Mich - BS2007.dwt" "*"))
);end cond

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost