woodman78 Posted April 8, 2010 Posted April 8, 2010 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? ESS.lsp ESS.dcl CCC_Drainage.txt Quote
The Buzzard Posted April 8, 2010 Posted April 8, 2010 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: You have this: (defun C:ESS (/SIZE$ SIZE PT01 PT02 a b lw DEGREES RADIANS) You should have this: (defun C:ESS ([color=red]/ S[/color]IZE$ SIZE PT01 PT02 a b lw DEGREES RADIANS) Quote
The Buzzard Posted April 8, 2010 Posted April 8, 2010 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. Change this: (defun ESS_SAVE (/ SUS[color=red] SUCE SUOM SUSM SUAB SUAD SUCL SUCR[/color]) To this: (defun ESS_SAVE (/ SUS) Do not reinvent the wheel. Quote
The Buzzard Posted April 8, 2010 Posted April 8, 2010 Again, Add this so variables will be restored upon Cancel. (action_tile "cancel" "(done_dialog)(setq userclick nil)[color=red](ESS_RESTORE)[/color]") I have not gone over the whole routine as of yet. Please check all your functions. I will get back to you later. Quote
The Buzzard Posted April 8, 2010 Posted April 8, 2010 I checked further and found another problem. You have a quote after the variable. These quotes need to be removed, Its a variable. (setq a (strcat "CCC_DR_"SIZE[color=red]"[/color]) b (strcat "CCC_SERVICES_EXISTING_Drainage_Storm_Sewer_Concrete_"SIZE[color=red]"[/color]) lw 30) These are no longer in the program. Remove this: (defun C:ESS ([color=black]/ SIZE[/color]$ SIZE PT01 PT02 a b lw [color=red]DEGREES RADIANS[/color]) 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. ;////////////////////////////////////////////////////////////////////////// ; ; 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. Quote
dober Posted April 9, 2010 Posted April 9, 2010 I checked further and found another problem.You have a quote after the variable. These quotes need to be removed, Its a variable. (setq a (strcat "CCC_DR_"SIZE[color=red]"[/color]) b (strcat "CCC_SERVICES_EXISTING_Drainage_Storm_Sewer_Concrete_"SIZE[color=red]"[/color]) lw 30) These are no longer in the program. Remove this: (defun C:ESS ([color=black]/ SIZE[/color]$ SIZE PT01 PT02 a b lw [color=red]DEGREES RADIANS[/color]) 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. ;////////////////////////////////////////////////////////////////////////// ; ; 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. Quote
woodman78 Posted April 9, 2010 Author Posted April 9, 2010 Thanks Buzzard, there is no text in the linetypes for this lisp. In some others there are so it works very well. Thanks again Quote
The Buzzard Posted April 9, 2010 Posted April 9, 2010 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. ;////////////////////////////////////////////////////////////////////////// [color=red];[/color] [color=red]; Degrees to Radians Function[/color] [color=red];[/color] [color=red](defun ESS_DTR (DEGREES)[/color] [color=red](* pi (/ DEGREES 180.0)))[/color] [color=red];[/color] [color=red];//////////////////////////////////////////////////////////////////////////[/color] [color=red];[/color] [color=red]; Radians to Degrees Function[/color] [color=red];[/color] [color=red](defun ESS_RTD (RADIANS)[/color] [color=red] (* 180.0 (/ RADIANS pi)))[/color] [color=red];[/color] [color=red];//////////////////////////////////////////////////////////////////////////[/color] Quote
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.