+ Reply to Thread
Results 1 to 8 of 8

Thread: Lisp won't run

  1. #1
    Super Member
    Computer Details
    woodman78's Computer Details
    Operating System:
    Win XP
    Computer:
    Dell GX280
    Discipline
    Transport
    woodman78's Discipline Details
    Occupation
    Road Design Engineer
    Discipline
    Transport
    Details
    I work in a local authority design office with a staff of 13. We carry out road schemes ranging from overlays up to 2 km long new schemes.
    Using
    Civil 3D 2011
    Join Date
    Jul 2009
    Location
    Ireland
    Posts
    675

    Default Lisp won't run

    Registered forum members do not see this ad.

    Buzzard has been helping me with some of these over the last while. I have made some modifications. Can anyone tell me why this won't run?
    Attached Files

  2. #2
    Forum Deity
    Using
    AutoCAD 2009
    Join Date
    Oct 2008
    Posts
    2,112

    Default

    Quote Originally Posted by woodman78 View Post
    Buzzard has been helping me with some of these over the last while. I have made some modifications. Can anyone tell me why this won't run?
    woodman78,

    Put a space in as shown between the red marks:

    Code:
     
    You have this:
    (defun C:ESS (/SIZE$ SIZE PT01 PT02 a b lw DEGREES RADIANS)
     
    You should have this:
    (defun C:ESS (/ SIZE$ SIZE PT01 PT02 a b lw DEGREES RADIANS)

  3. #3
    Forum Deity
    Using
    AutoCAD 2009
    Join Date
    Oct 2008
    Posts
    2,112

    Default

    Also while your at it:
    This is a list placed in the variable SUS.
    Why do you have all these other variable names that are not being used.
    Code:
    Change this:
    (defun ESS_SAVE (/ SUS SUCE SUOM SUSM SUAB SUAD SUCL SUCR)
    To this:
    (defun ESS_SAVE (/ SUS)
    Do not reinvent the wheel.

  4. #4
    Forum Deity
    Using
    AutoCAD 2009
    Join Date
    Oct 2008
    Posts
    2,112

    Default

    Again,

    Add this so variables will be restored upon Cancel.

    Code:
    (action_tile "cancel" "(done_dialog)(setq userclick nil)(ESS_RESTORE)")
    I have not gone over the whole routine as of yet.
    Please check all your functions.
    I will get back to you later.

  5. #5
    Forum Deity
    Using
    AutoCAD 2009
    Join Date
    Oct 2008
    Posts
    2,112

    Default

    I checked further and found another problem.
    You have a quote after the variable.

    Code:
    These quotes need to be removed, Its a variable.
      (setq a  (strcat "CCC_DR_"SIZE")
            b  (strcat "CCC_SERVICES_EXISTING_Drainage_Storm_Sewer_Concrete_"SIZE")
            lw 30)
    These are no longer in the program.
    Code:
    Remove this:
    (defun C:ESS (/ SIZE$ SIZE PT01 PT02 a b lw DEGREES RADIANS)

    I also would like to point out that since you are using ACAD 2010 and it seems to me you have variables or commands not used in an earlier versions, There will be limits as to how much I would be able to test for you.
    I think and I am not so sure if I caught everything, But it seems to be OK for me although the text in the linetypes do not
    seem to be displaying. You will have to let me know on that.


    Here is the lisp with all the changes previously mentioned.
    Seems like you went for a record breaker here.
    Code:
    ;//////////////////////////////////////////////////////////////////////////
    ;
    ; Start-Up Function
    ;
    (defun C:ESS (/ SIZE$ SIZE PT01 PT02 a b lw)
      (ESS_SAVE)
      (princ))
    ;
    ;//////////////////////////////////////////////////////////////////////////
    ;
    ; Save User Settings Function.
    ;
    (defun ESS_SAVE (/ SUS)
      (setq SUS_LIST (list "cmdecho" "orthomode" "osmode" "blipmode" "clayer" "angbase" "angdir" "cecolor"))
      (setq TERR$ *error*)
      (setq *error* ESS_ETRAP)
      (ESS_MF)
      (princ))
    ;
    ;//////////////////////////////////////////////////////////////////////////
    ;
    ; Main Function
    ;
    (defun ESS_MF ()
      (or S:SIZE (setq S:IZE 0))
      (setq S1_list '( "1500mm"  "1350mm" "1200mm" "1050mm" "900mm" "750mm" "675mm" "600mm" "525mm" "450mm" "375mm" "300mm" "225mm" "150mm"))
      (setq dcl_id (load_dialog "ESS.dcl"))
      (if (not (new_dialog "ESS" dcl_id))
        (progn (ALERT "Can not find your dcl file")
          (exit)))
      (start_list "S1")
      (mapcar 'add_list S1_list)
      (end_list)
      (if SIZE:DEF (set_tile "S1" (itoa SIZE:DEF)))
      (action_tile "cancel" "(done_dialog)(setq userclick nil)(ESS_RESTORE)")
      (action_tile "accept"
        (strcat
         "(progn
          (setq S:IZE (atoi (get_tile \"S1\")) SIZE:DEF S:IZE)"
         "(done_dialog)(setq userclick T))"))
      (start_dialog)
      (unload_dialog dcl_id)
      (if userclick
        (ESS_VARIABLE))
      (princ))
    ;
    ;//////////////////////////////////////////////////////////////////////////
    ;
    ; ESS_VARIABLE Function
    ;
    (defun ESS_VARIABLE ()
      (progn 
        (setq SIZE$ (fix S:IZE))
        (setq SIZE$ (nth S:IZE S1_list))
        (cond
          ((= SIZE$ "1500mm")(setq SIZE$ "1500"))
          ((= SIZE$ "1350mm")(setq SIZE$ "1350"))
          ((= SIZE$ "1200mm")(setq SIZE$ "1200"))
          ((= SIZE$ "1050mm")(setq SIZE$ "1050"))
          ((= SIZE$  "900mm")(setq SIZE$  "900"))
          ((= SIZE$  "750mm")(setq SIZE$  "750"))
          ((= SIZE$  "675mm")(setq SIZE$  "675"))
          ((= SIZE$  "600mm")(setq SIZE$  "600"))
          ((= SIZE$  "525mm")(setq SIZE$  "525"))
          ((= SIZE$  "450mm")(setq SIZE$  "450"))
          ((= SIZE$  "375mm")(setq SIZE$  "375"))
          ((= SIZE$  "300mm")(setq SIZE$  "300"))
          ((= SIZE$  "225mm")(setq SIZE$  "225"))
          ((= SIZE$  "150mm")(setq SIZE$  "150"))))
      (setq SIZE SIZE$) 
      (ESS_OUTPUT)
      (princ))
    ;
    ;//////////////////////////////////////////////////////////////////////////
    ;
    ; ESS_OUTPUT Function
    ;
    (defun ESS_OUTPUT ()
      (if (null (tblsearch "STYLE" "CCC_Services"))
        (entmake
          (list
            (cons 0 "STYLE")
            (cons 100 "AcDbSymbolTableRecord")
            (cons 100 "AcDbTextStyleTableRecord")
            (cons 2 "CCC_Services")
            (cons 3 "Verdana.ttf")
            (cons 40 0)
            (cons 70 0))))
      (setq a  (strcat "CCC_DR_"SIZE)
            b  (strcat "CCC_SERVICES_EXISTING_Drainage_Storm_Sewer_Concrete_"SIZE)
            lw 30)
      (if (null (tblsearch "LTYPE" a))
        (command "_.-linetype" "_l" a "CCC_Drainage.lin" ""))
      (if (null (tblsearch "LAYER" b))
      (command "_.-layer" "_N" b "_M" b "_L" a b "_C" "84" b "_LW" "0.3" b "" ))
      (command "_-color"  "bylayer")
      (command "._-linetype"  "s"  "bylayer" "")    
      (setvar "cmdecho" 0)
      (setvar "angbase" 0.0000)
      (setvar "angdir"  0)
      (setvar "orthomode" 0)
      (setvar "osmode"    16383)
      (command "_.-layer" "_S" b "")
      (setvar "plinegen" 1)
      (command "._pline")
      (ESS_RESTORE)
      (princ))
    ;
    ;//////////////////////////////////////////////////////////////////////////
    ;
    ; Degrees to Radians Function
    ;
    (defun ESS_DTR (DEGREES)
     (* pi (/ DEGREES 180.0)))
    ;
    ;//////////////////////////////////////////////////////////////////////////
    ;
    ; Radians to Degrees Function
    ;
    (defun ESS_RTD (RADIANS)
      (* 180.0 (/ RADIANS pi)))
    ;
    ;//////////////////////////////////////////////////////////////////////////
    ;
    ; Restore User Settings Function.
    ;
    (defun ESS_RESTORE ()
      (setq *error* TERR$)
      (if SUS (mapcar 'setvar SUS_LIST SUS))
      (princ "\nProgram completed and will now restore the user settings and exit.")
      (princ))
    ;
    ;/////////////////////////////////////////////////////////////////////////////
    ;
    ; Error Trap Function.
    ;
    (defun ESS_ETRAP (ERRORMSG)
      (command nil nil nil)
      (if (not (member ERRORMSG '("console break" "Function cancelled")))
        (princ (strcat "\nError:" ERRORMSG)))
      (if SUS (mapcar 'setvar SUS_LIST SUS))
      (princ "\nAn *error* has occured!")
      (princ "\nThe program will now restore the user settings and exit.")
      (terpri)
      (setq *error* TERR$)
      (princ))
    ;
    ;//////////////////////////////////////////////////////////////////////////
    When you paste things into your program, Please check to make sure if anything does not belong there.

  6. #6
    Full Member
    Using
    AutoCAD 2010
    Join Date
    May 2009
    Posts
    47

    Default

    Quote Originally Posted by The Buzzard View Post
    I checked further and found another problem.
    You have a quote after the variable.

    Code:
    These quotes need to be removed, Its a variable.
      (setq a  (strcat "CCC_DR_"SIZE")
            b  (strcat "CCC_SERVICES_EXISTING_Drainage_Storm_Sewer_Concrete_"SIZE")
            lw 30)
    These are no longer in the program.
    Code:
    Remove this:
    (defun C:ESS (/ SIZE$ SIZE PT01 PT02 a b lw DEGREES RADIANS)
    I also would like to point out that since you are using ACAD 2010 and it seems to me you have variables or commands not used in an earlier versions, There will be limits as to how much I would be able to test for you.
    I think and I am not so sure if I caught everything, But it seems to be OK for me although the text in the linetypes do not
    seem to be displaying. You will have to let me know on that.


    Here is the lisp with all the changes previously mentioned.
    Seems like you went for a record breaker here.
    Code:
    ;//////////////////////////////////////////////////////////////////////////
    ;
    ; Start-Up Function
    ;
    (defun C:ESS (/ SIZE$ SIZE PT01 PT02 a b lw)
      (ESS_SAVE)
      (princ))
    ;
    ;//////////////////////////////////////////////////////////////////////////
    ;
    ; Save User Settings Function.
    ;
    (defun ESS_SAVE (/ SUS)
      (setq SUS_LIST (list "cmdecho" "orthomode" "osmode" "blipmode" "clayer" "angbase" "angdir" "cecolor"))
      (setq TERR$ *error*)
      (setq *error* ESS_ETRAP)
      (ESS_MF)
      (princ))
    ;
    ;//////////////////////////////////////////////////////////////////////////
    ;
    ; Main Function
    ;
    (defun ESS_MF ()
      (or S:SIZE (setq S:IZE 0))
      (setq S1_list '( "1500mm"  "1350mm" "1200mm" "1050mm" "900mm" "750mm" "675mm" "600mm" "525mm" "450mm" "375mm" "300mm" "225mm" "150mm"))
      (setq dcl_id (load_dialog "ESS.dcl"))
      (if (not (new_dialog "ESS" dcl_id))
        (progn (ALERT "Can not find your dcl file")
          (exit)))
      (start_list "S1")
      (mapcar 'add_list S1_list)
      (end_list)
      (if SIZE:DEF (set_tile "S1" (itoa SIZE:DEF)))
      (action_tile "cancel" "(done_dialog)(setq userclick nil)(ESS_RESTORE)")
      (action_tile "accept"
        (strcat
         "(progn
          (setq S:IZE (atoi (get_tile \"S1\")) SIZE:DEF S:IZE)"
         "(done_dialog)(setq userclick T))"))
      (start_dialog)
      (unload_dialog dcl_id)
      (if userclick
        (ESS_VARIABLE))
      (princ))
    ;
    ;//////////////////////////////////////////////////////////////////////////
    ;
    ; ESS_VARIABLE Function
    ;
    (defun ESS_VARIABLE ()
      (progn 
        (setq SIZE$ (fix S:IZE))
        (setq SIZE$ (nth S:IZE S1_list))
        (cond
          ((= SIZE$ "1500mm")(setq SIZE$ "1500"))
          ((= SIZE$ "1350mm")(setq SIZE$ "1350"))
          ((= SIZE$ "1200mm")(setq SIZE$ "1200"))
          ((= SIZE$ "1050mm")(setq SIZE$ "1050"))
          ((= SIZE$  "900mm")(setq SIZE$  "900"))
          ((= SIZE$  "750mm")(setq SIZE$  "750"))
          ((= SIZE$  "675mm")(setq SIZE$  "675"))
          ((= SIZE$  "600mm")(setq SIZE$  "600"))
          ((= SIZE$  "525mm")(setq SIZE$  "525"))
          ((= SIZE$  "450mm")(setq SIZE$  "450"))
          ((= SIZE$  "375mm")(setq SIZE$  "375"))
          ((= SIZE$  "300mm")(setq SIZE$  "300"))
          ((= SIZE$  "225mm")(setq SIZE$  "225"))
          ((= SIZE$  "150mm")(setq SIZE$  "150"))))
      (setq SIZE SIZE$) 
      (ESS_OUTPUT)
      (princ))
    ;
    ;//////////////////////////////////////////////////////////////////////////
    ;
    ; ESS_OUTPUT Function
    ;
    (defun ESS_OUTPUT ()
      (if (null (tblsearch "STYLE" "CCC_Services"))
        (entmake
          (list
            (cons 0 "STYLE")
            (cons 100 "AcDbSymbolTableRecord")
            (cons 100 "AcDbTextStyleTableRecord")
            (cons 2 "CCC_Services")
            (cons 3 "Verdana.ttf")
            (cons 40 0)
            (cons 70 0))))
      (setq a  (strcat "CCC_DR_"SIZE)
            b  (strcat "CCC_SERVICES_EXISTING_Drainage_Storm_Sewer_Concrete_"SIZE)
            lw 30)
      (if (null (tblsearch "LTYPE" a))
        (command "_.-linetype" "_l" a "CCC_Drainage.lin" ""))
      (if (null (tblsearch "LAYER" b))
      (command "_.-layer" "_N" b "_M" b "_L" a b "_C" "84" b "_LW" "0.3" b "" ))
      (command "_-color"  "bylayer")
      (command "._-linetype"  "s"  "bylayer" "")    
      (setvar "cmdecho" 0)
      (setvar "angbase" 0.0000)
      (setvar "angdir"  0)
      (setvar "orthomode" 0)
      (setvar "osmode"    16383)
      (command "_.-layer" "_S" b "")
      (setvar "plinegen" 1)
      (command "._pline")
      (ESS_RESTORE)
      (princ))
    ;
    ;//////////////////////////////////////////////////////////////////////////
    ;
    ; Degrees to Radians Function
    ;
    (defun ESS_DTR (DEGREES)
     (* pi (/ DEGREES 180.0)))
    ;
    ;//////////////////////////////////////////////////////////////////////////
    ;
    ; Radians to Degrees Function
    ;
    (defun ESS_RTD (RADIANS)
      (* 180.0 (/ RADIANS pi)))
    ;
    ;//////////////////////////////////////////////////////////////////////////
    ;
    ; Restore User Settings Function.
    ;
    (defun ESS_RESTORE ()
      (setq *error* TERR$)
      (if SUS (mapcar 'setvar SUS_LIST SUS))
      (princ "\nProgram completed and will now restore the user settings and exit.")
      (princ))
    ;
    ;/////////////////////////////////////////////////////////////////////////////
    ;
    ; Error Trap Function.
    ;
    (defun ESS_ETRAP (ERRORMSG)
      (command nil nil nil)
      (if (not (member ERRORMSG '("console break" "Function cancelled")))
        (princ (strcat "\nError:" ERRORMSG)))
      (if SUS (mapcar 'setvar SUS_LIST SUS))
      (princ "\nAn *error* has occured!")
      (princ "\nThe program will now restore the user settings and exit.")
      (terpri)
      (setq *error* TERR$)
      (princ))
    ;
    ;//////////////////////////////////////////////////////////////////////////
    When you paste things into your program, Please check to make sure if anything does not belong there.
    Super Lisp

    But it would be great if we could assign each layer has its own color.

  7. #7
    Super Member
    Computer Details
    woodman78's Computer Details
    Operating System:
    Win XP
    Computer:
    Dell GX280
    Discipline
    Transport
    woodman78's Discipline Details
    Occupation
    Road Design Engineer
    Discipline
    Transport
    Details
    I work in a local authority design office with a staff of 13. We carry out road schemes ranging from overlays up to 2 km long new schemes.
    Using
    Civil 3D 2011
    Join Date
    Jul 2009
    Location
    Ireland
    Posts
    675

    Default

    Thanks Buzzard, there is no text in the linetypes for this lisp. In some others there are so it works very well.

    Thanks again

  8. #8
    Forum Deity
    Using
    AutoCAD 2009
    Join Date
    Oct 2008
    Posts
    2,112

    Default

    Registered forum members do not see this ad.

    That's good, But I forgot to remove the Degrees to Radians & Radians to Degrees functions since they are not being used. If you get a chance, take them out.

    Remove this when you get time.
    Code:
    ;//////////////////////////////////////////////////////////////////////////
    ;
    ; Degrees to Radians Function
    ;
    (defun ESS_DTR (DEGREES)
    (* pi (/ DEGREES 180.0)))
    ;
    ;//////////////////////////////////////////////////////////////////////////
    ;
    ; Radians to Degrees Function
    ;
    (defun ESS_RTD (RADIANS)
     (* 180.0 (/ RADIANS pi)))
    ;
    ;//////////////////////////////////////////////////////////////////////////

Similar Threads

  1. a lisp to apply 3 different lisp to 3 obj types filtered from one selection
    By gilsoto13 in forum AutoLISP, Visual LISP & DCL
    Replies: 28
    Last Post: 5th Nov 2009, 05:28 am
  2. calling one lisp from within another lisp
    By chelsea1307 in forum AutoLISP, Visual LISP & DCL
    Replies: 5
    Last Post: 10th Jul 2009, 05:07 pm
  3. Running a lisp in another lisp??
    By neekcotrack in forum AutoLISP, Visual LISP & DCL
    Replies: 3
    Last Post: 26th Aug 2008, 04:02 am
  4. Lisp Call Lisp Problem
    By neekcotrack in forum AutoLISP, Visual LISP & DCL
    Replies: 1
    Last Post: 23rd Aug 2008, 12:56 pm
  5. problem, trying to running a list of lisp from within a lisp
    By twind2000 in forum AutoLISP, Visual LISP & DCL
    Replies: 4
    Last Post: 20th Aug 2007, 04:27 pm

Bookmarks

Posting Permissions

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