Dj_T_Rex2002 Posted December 14, 2015 Share Posted December 14, 2015 Good morning. I have a question. There is a guy here at work that created a LISP Routine in order to insert a text length for rafters. The command is "RFS" and it loads the following before I can select the pitch ... Command: rfs -style Enter name of text style or [?] : standard Existing style. Specify font name or font filename (for SHX) : Specify height of text or [Annotative] : 0 Specify width factor : Specify obliquing angle : Display text backwards? [Yes/No] : Display text upside-down? [Yes/No] : "Standard" is now the current text style. Command: layer Current layer: "ROOF-TEXT" Enter an option [?/Make/Set/New/Rename/ON/OFF/Color/Ltype/LWeight/TRansparency/MATerial/Plot/Freeze/Thaw/LOck/Unlock/stAte/Description/rEconcile]: t Enter name list of layer(s) to thaw: ROOF-TEXT Enter an option [?/Make/Set/New/Rename/ON/OFF/Color/Ltype/LWeight/TRansparency/MATerial/Plot/Freeze/Thaw/LOck/Unlock/stAte/Description/rEconcile]: on Enter name list of layer(s) to turn on: ROOF-TEXT Enter an option [?/Make/Set/New/Rename/ON/OFF/Color/Ltype/LWeight/TRansparency/MATerial/Plot/Freeze/Thaw/LOck/Unlock/stAte/Description/rEconcile]: s Enter layer name to make current or : ROOF-TEXT Enter an option [?/Make/Set/New/Rename/ON/OFF/Color/Ltype/LWeight/TRansparency/MATerial/Plot/Freeze/Thaw/LOck/Unlock/stAte/Description/rEconcile]: Enter Roof Pitch: 4 Enter Rafter Size: 6 I am trying to write a LISP that can load this LISP with 4 selected as the pitch and then 6 for the Rafter size with the command RFS4 and is as followed (DEFUN C:RFS4 () (COMMAND "RFS") (COMMAND PAUSE) (COMMAND "4") (COMMAND "6"))[code] Sorry I don't know how to post the above in a box for code and I clicked on the Wrap [code] tags around the text ... the command doesn't work, it just says Unknown command "RFS". Please help. Quote Link to comment Share on other sites More sharing options...
broncos15 Posted December 14, 2015 Share Posted December 14, 2015 To post the code properly just add a / before the code at the end like this [/code]. Also, you can't use a LISP routine like you can an AutoCAD command and use pauses. Instead, access it either by (c:rfs). Your fix seems pretty easy, but you will need to post the RFS code for us to look at to help. Quote Link to comment Share on other sites More sharing options...
Dj_T_Rex2002 Posted December 14, 2015 Author Share Posted December 14, 2015 Oh ok my bad. Well I don't think I can load the code because he has it as a .fas file ... so I'm guessing without it there's nothing to write a code to run it and enter the numbers automatically? Quote Link to comment Share on other sites More sharing options...
broncos15 Posted December 14, 2015 Share Posted December 14, 2015 Oh ok my bad. Well I don't think I can load the code because he has it as a .fas file ... so I'm guessing without it there's nothing to write a code to run it and enter the numbers automatically?I mean it is really hard to know how to edit it and/or just use the original code without looking at it. A .fas file is encrypted for security and to ease loading, so you can't just post it. I would ask the person that created it to see if you can have the original code and have his permission to post it (he has to have the original somewhere). Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted December 14, 2015 Share Posted December 14, 2015 You could try something like this as a workaround: (defun c:rfs4 ( / des scr ) (if (boundp 'c:rfs) (if (setq scr (strcat (getvar 'tempprefix) "rfs4tmp.scr") ;; Use something likely to be unique des (open scr "w") ) (progn (write-line "RFS 4 6" des) (close des) (command "_.script" scr) ) ) (princ "\nc:rfs function not defined.") ) (princ) ) Quote Link to comment Share on other sites More sharing options...
Dj_T_Rex2002 Posted December 15, 2015 Author Share Posted December 15, 2015 Ok so I tried to the do the above thing like you showed me but for some reason it didn't work on this code / (DEFUN C:PNA ( / ) (COMMAND "TA") (COMMAND "ZOOM" "E") (COMMAND "-PURGE" "A" "" "N") (COMMAND "AUDIT" "Y") (COMMAND "QSAVE") (COMMAND "QSAVE") (COMMAND "CLOSE") ) [/code] The TA is basically a LISP that thaws all the layers including wall hatch but I don't know how to use it with what you showed me. Quote Link to comment Share on other sites More sharing options...
Dj_T_Rex2002 Posted December 15, 2015 Author Share Posted December 15, 2015 Ok I tried to put it in the code box but I guess I'm so stupid I don't know where the [/code] goes Quote Link to comment Share on other sites More sharing options...
broncos15 Posted December 15, 2015 Share Posted December 15, 2015 Ok I tried to put it in the code box but I guess I'm so stupid I don't know where the [/code] goes Put code in brackets before your code, and then [/code] after. Are you wanting to run TA through a technique like Lee showed, or do you just want to run all of the TA lisp routine? If you want to run all of it, look at my first post (c:TA). Quote Link to comment Share on other sites More sharing options...
Dana W Posted December 16, 2015 Share Posted December 16, 2015 This is how it works. This BRACKETthe word codeBRACKET goes in front of all the code, and this BRACKET SLASH the word code BRACKETgoes at the end, after the code. The words in all caps are these symbols. "/", and "[", and "]". It is hard to explain in print on the forum, because typing the series causes them to become code tags and thus invisible. Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted December 16, 2015 Share Posted December 16, 2015 Code tags should be used in the following way: [highlight][noparse] [/noparse][/highlight]Your Code Here[highlight][noparse] [/noparse][/highlight] Quote Link to comment Share on other sites More sharing options...
Dj_T_Rex2002 Posted December 16, 2015 Author Share Posted December 16, 2015 Ok I'll try again ... sorry ahead of time (DEFUN C:PNA ( / DES SCR ) (IF (BOUNDP 'C:TA) (IF (SETQ SCR (STRCAT (GETVAR 'TEMPPREFIX) "TA.SCR") DES (OPEN SCR "W") ) (PROGN (WRITE-LINE "TA" DES) (CLOSE DES) (COMMAND "_.SCRIPT" SCR) ) ) (PRINC "\NC:TA FUNCTION NOT DEFINED.") ) (PRINC) (COMMAND "ZOOM" "E") (COMMAND "-PURGE" "A" "" "N") (COMMAND "AUDIT" "Y") (COMMAND "QSAVE") (COMMAND "QSAVE") (COMMAND "CLOSE") ) The TA is a LISP routine that thaws all layers but it doesn't do it. It Purges, Audits, saves twice, and closes but doesn't turn it all on. The TA was created because of the walls that were setup here at work. Quote Link to comment Share on other sites More sharing options...
broncos15 Posted December 16, 2015 Share Posted December 16, 2015 Ok I'll try again ... sorry ahead of time (DEFUN C:PNA ( / DES SCR ) (IF (BOUNDP 'C:TA) (IF (SETQ SCR (STRCAT (GETVAR 'TEMPPREFIX) "TA.SCR") DES (OPEN SCR "W") ) (PROGN (WRITE-LINE "TA" DES) (CLOSE DES) (COMMAND "_.SCRIPT" SCR) ) ) (PRINC "\NC:TA FUNCTION NOT DEFINED.") ) (PRINC) (COMMAND "ZOOM" "E") (COMMAND "-PURGE" "A" "" "N") (COMMAND "AUDIT" "Y") (COMMAND "QSAVE") (COMMAND "QSAVE") (COMMAND "CLOSE") ) The TA is a LISP routine that thaws all layers but it doesn't do it. It Purges, Audits, saves twice, and closes but doesn't turn it all on. The TA was created because of the walls that were setup here at work. No worries. It doesn't sound like you need to put any inputs into TA, so just do (c:TA) . You could also just thaw all layers in the code by doing this: (command-s "._layer" "_T" "*" "") Quote Link to comment Share on other sites More sharing options...
Dj_T_Rex2002 Posted December 16, 2015 Author Share Posted December 16, 2015 I did it the way you said: (DEFUN C:PNA (/) (C:TA) (COMMAND "ZOOM" "E") (COMMAND "-PURGE" "A" "" "N") (COMMAND "AUDIT" "Y") (COMMAND "QSAVE") (COMMAND "QSAVE") ) And it worked ... is the "( / )" to put multiple commands? Thanks so much for your help Quote Link to comment Share on other sites More sharing options...
broncos15 Posted December 16, 2015 Share Posted December 16, 2015 I did it the way you said: (DEFUN C:PNA (/) (C:TA) (COMMAND "ZOOM" "E") (COMMAND "-PURGE" "A" "" "N") (COMMAND "AUDIT" "Y") (COMMAND "QSAVE") (COMMAND "QSAVE") ) And it worked ... is the "( / )" to put multiple commands? Thanks so much for your help No worries. And no, the / is used to localize variables. You should take it out of your routine because you don't have any variables. Look at either Lee Mac's website or afralisp about variable localization. They are both excellent tutorials and very informative. I would also add this line in before you run TA, just in case TA doesn't get loaded. (load "TA" "") Also, as a good practice, it is better to put an if statement into your code before you run an outside lisp, that way it prevents your code from crashing if a lisp routine isn't loaded, gets renamed, etc. Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted December 16, 2015 Share Posted December 16, 2015 Ok so I tried to the do the above thing like you showed me but for some reason it didn't work on this code The TA is basically a LISP that thaws all the layers including wall hatch but I don't know how to use it with what you showed me. Please note that the method that I suggested earlier was only applicable to your other program for which you required user input and did not have access to the program source code - the use of a temporary Script to issue user input is convoluted and not a method which should be implemented as standard unless absolutely necessary. Quote Link to comment Share on other sites More sharing options...
Dj_T_Rex2002 Posted December 16, 2015 Author Share Posted December 16, 2015 Oh ok. Man LISPs has many rules. I really want to learn programming though thanks guys. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.