woodman78 发表于 2022-7-6 09:29:45

Initializing...; error: AutoCA

I am getting this on the following code and I can't se why.Can anyone help?
 

;//////////////////////////////////////////////////////////////////////////;; Start-Up Function;(defun C:Walls_Fences () (Walls_Fences_MF) (princ));;//////////////////////////////////////////////////////////////////////////;; Main Function;(defun Walls_Fences_MF (/ SIZE$ SIZE SUCESUOMSUSM SUAB SUAD MIDPT PLEN PT01PT02 a b COLR) (setq SUCE (getvar "cmdecho")) (setq SUOM (getvar "orthomode")) (setq SUSM (getvar "osmode")) (setq SUAB (getvar "angbase")) (setq SUAD (getvar "angdir")) (setq SUCL (getvar "clayer")) (setq SUCR (getvar "cecolor")) (setq temperr *error*) (setq *error* ETRAP_Walls_Fences) (setq S1_list'("Existing Blockwork Wall" "Existing Concrete Post and Mesh Fence"    "Existing Concrete Post and Rail Fence" "Existing Pallisade Fence"    "Existing Reinforced Concrete Wall""Existing Sod and Stone Ditch"    "Existing Stone Faced Blockwork Wall""Existing Stone Faced Reinforced Concrete Wall"   "Existing Stone Wall" "Existing Timber Post and Rail Fence"      "Existing Timber Post and Wire Fence" "-----------------------------------"    "Proposed Blockwork Wall" "Proposed Concrete Post and Mesh Fence"    "Proposed Concrete Post and Rail Fence" "Proposed Pallisade Fence"    "Proposed Reinforced Concrete Wall""Proposed Sod and Stone Ditch"    "Proposed Stone Faced Blockwork Wall""Proposed Stone Faced Reinforced Concrete Wall"   "Proposed Stone Wall" "Proposed Timber Post and Rail Fence"      "Proposed Timber Post and Wire Fence"    ) ) (setq dcl_id (load_dialog "Walls_Fences.dcl")) (if   (not   (new_dialog "Walls_Fences" 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)" ) (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   (VARIABLE_Walls_Fences) ) (princ));;//////////////////////////////////////////////////////////////////////////;; Variable Function;(defun VARIABLE_Walls_Fences () (progn    (setq SIZE$ (fix S:IZE))   (setq SIZE$ (nth S:IZE S1_list))   (cond   ((= SIZE$ "Existing Blockwork Wall")(setq SIZE$ "EXISTING_Blockwork_Wall")(setq LTYP "01")(setq COLR "31,127,0"))   ((= SIZE$ "Existing Concrete Post and Mesh Fence")(setq SIZE$ "EXISTING_Concrete_Post_and_Mesh_Fence")(setq LTYP "01")(setq COLR "46,255,255"))   ((= SIZE$ "Existing Concrete Post and Rail Fence")(setq SIZE$ "EXISTING_Concrete_Post_and_Rail_Fence")(setq LTYP "01")(setq COLR "0,127,255"))   ((= SIZE$ "Existing Pallisade Fence")(setq SIZE$ "EXISTING_Pallisade_Fence")(setq LTYP "01")(setq COLR "124,165,0"))   ((= SIZE$ "Existing Reinforced Concrete Wall")(setq SIZE$ "EXISTING_Reinforced_Concrete_Wall")(setq LTYP "01")(setq COLR "255,87,255"))   ((= SIZE$ "Existing Sod and Stone Ditch")(setq SIZE$ "EXISTING_Sod_and_Stone_Ditch")(setq LTYP "01")(setq COLR "124,0,165"))   ((= SIZE$ "Existing Stone Faced Blockwork Wall")(setq SIZE$ "EXISTING_Stone_Faced_Blockwork_Wall")(setq LTYP "01")(setq COLR "61,61,61"))   ((= SIZE$ "Existing Stone Faced Reinforced Concrete Wall")(setq SIZE$ "EXISTING_Stone_Faced_Reinforced_Concrete_Wall")(setq LTYP "01")(setq COLR "230,99,0"))   ((= SIZE$ "Existing Stone Wall")(setq SIZE$ "EXISTING_Stone_Wall")(setq LTYP "01")(setq COLR "3,55,99"))   ((= SIZE$ "Existing Timber Post and Rail Fence")(setq SIZE$ "EXISTING_Timber_Post_and_Rail_Fence")(setq LTYP "01")(setq COLR "97,48,0"))   ((= SIZE$ "Existing Timber Post and Wire Fence")(setq SIZE$ "EXISTING_Timber_Post_and_Wire_Fence")(setq LTYP "01")(setq COLR "127,95,0"))   ((= SIZE$ "Proposed Blockwork Wall")(setq SIZE$ "PROPOSED_Blockwork_Wall")(setq LTYP "02")(setq COLR "31,127,0"))   ((= SIZE$ "Proposed Concrete Post and Mesh Fence")(setq SIZE$ "PROPOSED_Concrete_Post_and_Mesh_Fence")(setq LTYP "02")(setq COLR "46,255,255"))   ((= SIZE$ "Proposed Concrete Post and Rail Fence")(setq SIZE$ "PROPOSED_Concrete_Post_and_Rail_Fence")(setq LTYP "02")(setq COLR "0,127,255"))   ((= SIZE$ "Proposed Pallisade Fence")(setq SIZE$ "PROPOSED_Pallisade_Fence")(setq LTYP "02")(setq COLR "124,165,0"))   ((= SIZE$ "Proposed Reinforced Concrete Wall")(setq SIZE$ "PROPOSED_Reinforced_Concrete_Wall")(setq LTYP "02")(setq COLR "255,87,255"))   ((= SIZE$ "Proposed Sod and Stone Ditch")(setq SIZE$ "PROPOSED_Sod_and_Stone_Ditch")(setq LTYP "02")(setq COLR "124,0,165"))   ((= SIZE$ "Proposed Stone Faced Blockwork Wall")(setq SIZE$ "PROPOSED_Stone_Faced_Blockwork_Wall")(setq LTYP "02")(setq COLR "61,61,61"))   ((= SIZE$ "Proposed Stone Faced Reinforced Concrete Wall")(setq SIZE$ "PROPOSED_Stone_Faced_Reinforced_Concrete_Wall")(setq LTYP "02")(setq COLR "230,99,0"))   ((= SIZE$ "Proposed Stone Wall")(setq SIZE$ "PROPOSED_Stone_Wall")(setq LTYP "02")(setq COLR "3,55,99"))   ((= SIZE$ "Proposed Timber Post and Rail Fence")(setq SIZE$ "PROPOSED_Timber_Post_and_Rail_Fence")(setq LTYP "02")(setq COLR "97,48,0"))   ((= SIZE$ "Proposed Timber Post and Wire Fence")(setq SIZE$ "PROPOSED_Timber_Post_and_Wire_Fence")(setq LTYP "02")(setq COLR "127,95,0"))   ) ) (setq SIZE SIZE$)(OUTPUT_Walls_Fences) (princ));;//////////////////////////////////////////////////////////////////////////;; Output Function;(defun OUTPUT_Walls_Fences () (setq a (strcat "CCC_WF_"LTYP)       b (strcat "CCC_LAYOUT_"SIZE) ) (if   (not   (tblsearch "LTYPE" a)   )   (command "_.-linetype" "_l" a "CCC_Walls_Fences.lin" "") ) (command "_.-layer" "_N" b "_M" b "_L" a b "_C" "_T" COLR b "_LW" "0.6" b "" ) (command "_-color""bylayer") (command "._-linetype""s""bylayer" "") (setvar "angbase" 0.0000) (setvar "angdir"0) (setvar "orthomode" 0) (setvar "osmode"    16383) (setvar "plinegen" 1)   (setvar "osmode" 0)   (command "_.pline")   (setvar "osmode" 16383)) (setq *error* temperr) (setvar "cmdecho" SUCE) (setvar "orthomode" SUOM) (setvar "osmode" SUSM) (setvar "angbase" SUAB) (setvar "angdir" SUAD) (setvar "clayer" SUCL) (setvar "cecolor" SUCR) (princ));;//////////////////////////////////////////////////////////////////////////;; Error Trap Function;(defun ETRAP_Walls_Fences (errmsg) (command nil nil nil) (if   (not   (member errmsg '("console break" "Function Cancelled"))   )   (princ (strcat "\nError:" errmsg)) ) (setvar "cmdecho" SUCE) (setvar "orthomode" SUOM) (setvar "osmode" SUSM) (setvar "angbase" SUAB) (setvar "angdir" SUAD) (princ "\nError, Restoring Variables.") (terpri) (setq *error* temperr) (princ));;//////////////////////////////////////////////////////////////////////////
 

Walls_Fences : dialog {                                 //*dialog name      label = "Walls and Fences";         //*give it a label: row {                                    //*define row             : paragraph {                        //*define paragraph            : text_part {                        //*define more text                label = " ";         //*some more text            }                                    //*end text            }                                    //*end paragraph      }                                          //*end row      : row {                                    //*define row          : boxed_column {                         //*define boxex_column            label = "Choose a Type";               //*give it a label             : popup_list {                         //*define popup_list            key = "S1";                        //*give it a name            label = "Size";                      //*give it a label               edit_width=40;                        //*edit_width            alignment = right;                   //*alignment            }                                    //*end popup_list            : spacer {                           //*define spacer            height = 0;                        //*height            }                                    //*end spacer          }                                        //*end boxed_column      }                                          //*end row      : row {                                    //*define row          : column {                               //*define column            ok_cancel ;                            //*predifined OK/Cancel            : paragraph {                        //*define paragraph               : text_part {                        //*define more text                label = "CCC NNRDO   v1.0.24.07.2009";         //*some more text            }                                    //*end text            }                                    //*end paragraph          }                                        //*end column      }                                          //*end row      }                                          //*end dialog

Ahankhah 发表于 2022-7-6 09:52:16

You call OUTPUT_Walls_Fences before Walls_Fences_MF, so the value of SUCE is nil.

JohnM 发表于 2022-7-6 10:04:21

You have a parentheses issue where the code resets the setvars below the OUTPUT_Walls_Fences function

Ahankhah 发表于 2022-7-6 10:07:47

Perhaps the paranthesis after line: (setvar "osmode" 16383) is extra, simply remove it.

woodman78 发表于 2022-7-6 10:23:07

John M & Ahankhah,
It was a paranthesis issue so now my cmdecho error is gone but when the code runs the none of the layer info is carried through.All I get is a black line on layer "0".
 
Any ideas?

woodman78 发表于 2022-7-6 10:29:56

I just moved my this part of the code:
 

(setq SUCE (getvar "cmdecho")) (setq SUOM (getvar "orthomode")) (setq SUSM (getvar "osmode")) (setq SUAB (getvar "angbase")) (setq SUAD (getvar "angdir")) (setq SUCL (getvar "clayer")) (setq SUCR (getvar "cecolor")) (setq temperr *error*)
 
up to the first part of the code and that did the job.Thanks for your help.I appreciate it.
页: [1]
查看完整版本: Initializing...; error: AutoCA