Jump to content

Waiting for LISP to finish


Dj_T_Rex2002

Recommended Posts

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

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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).
Link to comment
Share on other sites

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)
)

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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).
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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" "*" "")

Link to comment
Share on other sites

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 :D ... is the "( / )" to put multiple commands? Thanks so much for your help :)

Link to comment
Share on other sites

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 :D ... 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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...