Results 1 to 8 of 8

Thread: Run Lisp Routine From Another Lisp Routine

  1. #1
    Active Member
    Join Date
    2000-12
    Posts
    56
    Login to Give a bone
    0

    Unhappy Run Lisp Routine From Another Lisp Routine

    In the attached lisp file I am trying to load and run the IB routine, but can't seem to get it to work.
    Any help would be appreciated.

    Thanks Mike
    Attached Files Attached Files

  2. #2
    I could stop if I wanted to
    Join Date
    2015-10
    Location
    Colorado Springs, CO
    Posts
    369
    Login to Give a bone
    0

    Default Re: Run Lisp Routine From Another Lisp Routine

    Code:
    (DEFUN C:MONO33()
    
    (COMMAND "UNDO" "M" )
    (command "expert" "2")
    (command "psetupin" "c:/wilson/proto/newnewproto-mono.dwt" "*")
    (command "expert" "0")
    (COMMAND "PSLTSCALE" "1" )
    (COMMAND "LTSCALE" 0.33 )
    (COMMAND "IMAGEFRAME" "0" )
    (COMMAND "LAYER" "ON" "*" "")
    (COMMAND "LAYER" "S" "4" "OFF" "4,*|4,99,*|99,*MIKE*,98,*|98,*ATT*,*|*ATT*,1000,*|1000,VPORT" "Y" "")
    (command "tilemode" "0")
    ;(COMMAND "UCS" "W")
    (load "IB.lsp")
    (COMMAND "mspace")
    (COMMAND "c:IB")
    (COMMAND "pspace")
    (initdia)
    (command "_plot")
    ;(COMMAND "UNDO" "B" )
    (princ)
    )
    I'm no expert... but just looking at this right quick I would say replace
    Code:
    (COMMAND "c:IB")
    with
    Code:
    (COMMAND "IB")
    I think I've only seen the c: during a defun statment. I.E (DEFUN C:MONO33()...

    The command that you run is then MONO33, not c:MONO33.

  3. #3
    Certifiable AUGI Addict
    Join Date
    2001-03
    Location
    Tallahassee, FL USA
    Posts
    3,685
    Login to Give a bone
    0

    Default Re: Run Lisp Routine From Another Lisp Routine

    Put the
    Code:
     (load "IB.lsp")
    as early as you can in the routine, it may choke if it's to close to the function call especially if the file is big. If
    Code:
     (defun c:IB ()
    is the function in the routine then the call is correct. If that doesn't do it you may need to attach IB.lsp as well.

    For setting system variables I'd use
    Code:
    (setvar 'PSLTSCALE 1)
    rather than
    Code:
    (COMMAND "PSLTSCALE" "1" )
    .

  4. #4
    AUGI Addict
    Join Date
    2008-02
    Posts
    1,141
    Login to Give a bone
    0

    Default Re: Run Lisp Routine From Another Lisp Routine

    Also, replace (COMMAND "c:IB") with (c:IB)

  5. #5
    Certifiable AUGI Addict
    Join Date
    2001-03
    Location
    Tallahassee, FL USA
    Posts
    3,685
    Login to Give a bone
    0

    Default Re: Run Lisp Routine From Another Lisp Routine

    Quote Originally Posted by alanjt View Post
    Also, replace (COMMAND "c:IB") with (c:IB)
    Opps! I've used the c: with functions calls many times, but missed it was in (COMMAND ""). On of those for the layer command should be enough.

  6. #6
    Active Member
    Join Date
    2000-12
    Posts
    56
    Login to Give a bone
    0

    Default Re: Run Lisp Routine From Another Lisp Routine

    Attached is the MONO33.lsp Revised, and the IB.lsp.
    What I am trying to do is push the image to the back, before plotting.

    Thanks Mike
    Attached Files Attached Files

  7. #7
    Certifiable AUGI Addict
    Join Date
    2001-03
    Location
    Tallahassee, FL USA
    Posts
    3,685
    Login to Give a bone
    0

    Default Re: Run Lisp Routine From Another Lisp Routine

    Try:
    Code:
     (DEFUN C:MONO33(/ *ERROR* expert PSLTSCALE LTSCALE IMAGEFRAME tilemode)
      (load "IB.lsp")
    
     (defun *ERROR* (s)                    ; If an error (such as CTRL-C) occurs
                                          ; while this command is active...
      (if (/= s "Function cancelled")
        (princ (strcat "\nError: " s))
      )
      (setvar 'expert expert)
      (setvar 'PSLTSCALE PSLTSCALE)
      (setvar 'LTSCALE LTSCALE)
      (setvar 'IMAGEFRAME IMAGEFRAME)
      (setvar 'tilemode tilemode)
      (princ)
     )
    
      (vl-cmdf "undo" "Mark")
      (setvar 'expert 2)
      (command "psetupin" "c:/wilson/proto/newnewproto-mono.dwt" "*")
      (setq expert (getvar 'expert)
          PSLTSCALE (getvar 'PSLTSCALE)
          LTSCALE (getvar 'LTSCALE)
          IMAGEFRAME (getvar 'IMAGEFRAME)
          tilemode (getvar 'tilemode)
      )
      (setvar 'expert 1)
      (setvar 'PSLTSCALE 1 )
      (setvar 'LTSCALE 0.33)
      (setvar 'IMAGEFRAME 0)
    ;  (vl-cmdf "LAYER" "ON" "*" "S" "4" "OFF" "4,*|4,99,*|99,*MIKE*,98,*|98,*ATT*,*|*ATT*,1000,*|1000,VPORT" "Y" "")
      (vl-cmdf "LAYER" "ON" "*" "S" "4" "OFF" "4,*|4,99,*|99,*MIKE*,98,*|98,*ATT*,*|*ATT*,1000,*|1000,VPORT" "") ; removed "Y"
      (setvar 'tilemode 0); puts you on Model Tab
    ;(COMMAND "mspace")  ** Command not allowed in Model Tab **
      (c:IB)
      (vl-cmdf "pspace")
      (initdia)
      (vl-cmdf "_plot")
      (setvar 'expert expert)
      (setvar 'PSLTSCALE PSLTSCALE)
      (setvar 'LTSCALE LTSCALE)
      (setvar 'IMAGEFRAME IMAGEFRAME)
      (setvar 'tilemode tilemode)
      (princ)
    )
    IB.LSP looks ok.
    Last edited by Tom Beauford; 2013-07-25 at 03:11 PM. Reason: removed "Y" option from Layer command sequence

  8. #8
    Active Member
    Join Date
    2000-12
    Posts
    56
    Login to Give a bone
    0

    Default Re: Run Lisp Routine From Another Lisp Routine

    here is part of the dialogue,

    Warning: layer "TABTEXT" is frozen. Will not display until thawed.
    Enter an option [?/Make/Set/New/Rename/ON/OFF/Color/Ltype/LWeight/TRansparency/MATerial/Plot/PStyle/Freeze/Thaw/LOck/Unlock/stAte/Description/rEconcile]: S
    Enter layer name to make current or <select object>: 4 Enter an option [?/Make/Set/New/Rename/ON/OFF/Color/Ltype/LWeight/TRansparency/MATerial/Plot/PStyle/Freeze/Thaw/LOck/Unlock/stAte/Description/rEconcile]: OFF
    Enter name list of layer(s) to turn off or <select objects>: 4,*|4,99,*|99,*MIKE*,98,*|98,*ATT*,*|*ATT*,1000,*|1000,VPORT Enter an option [?/Make/Set/New/Rename/ON/OFF/Color/Ltype/LWeight/TRansparency/MATerial/Plot/PStyle/Freeze/Thaw/LOck/Unlock/stAte/Description/rEconcile]: Y
    Invalid option keyword.
    Enter an option [?/Make/Set/New/Rename/ON/OFF/Color/Ltype/LWeight/TRansparency/MATerial/Plot/PStyle/Freeze/Thaw/LOck/Unlock/stAte/Description/rEconcile]:
    Command: Unknown command "BACK". Press F1 for help.
    pspace
    Already in paper space.

    Command: _plot Regenerating layout.
    Regenerating model.


    it seem to not like the back command

Similar Threads

  1. Calling up LISP routine from within another LISP
    By jimmy_goodall in forum AutoLISP
    Replies: 4
    Last Post: 2013-08-21, 05:56 AM
  2. NEED HELP WITH LISP ROUTINE - PURGE linetype lisp
    By ECASAOL350033 in forum AutoLISP
    Replies: 6
    Last Post: 2013-06-21, 01:13 AM
  3. Help with a lisp routine to add a 12" line to this routine
    By Orbytal.edge341183 in forum AutoLISP
    Replies: 3
    Last Post: 2012-11-14, 10:33 PM
  4. Combine three lisp routine into one routine.
    By BrianTFC in forum AutoLISP
    Replies: 1
    Last Post: 2012-02-08, 12:14 PM
  5. Replies: 9
    Last Post: 2012-01-21, 07:58 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •