Here is the code in entirety:
So I get 'nil' after selecting the button (since I changed the "layers" to "layer".. Although nothing happens to the layer that was selected. Also I have three issues that I hope someone can help me with.
1. I need to keep the dialog box open while it does the functions.... I usually don't work with Dialog Controls so I am needing additional guidance.
2. Where I populate the listbox I am trying to have it refresh while the user is working...
(setq layerlist nil)
(start_list "layerlist" 3)
(mapcar 'add_list txtlist); Adding the text to the layerlist box
(end_list); end list
using the variable "3" not sure where I am going wrong on thatone
3. I have the "convert" button that I would like to use to process the information when a button is clicked... (user selects the names of the layers to change in the list box then selects the function (i.e. change selected items to change to a layer(s)... convert.. "Ok" close dialog box...
I have things laid out and am having a hard time connecting the rest of the pieces of the puzzle...
Any help would be appreciated....
// DCL
//---------------------------------------------------------------------------------------------------------
// Architectural Layers Conversion Program - Dialog Box
//---------------------------------------------------------------------------------------------------------
dcl_test : dialog { //dialog name
label = "Architectural Layers Conversion Program - Alpha" ;//give it a label
:boxed_radio_column { //define radio column
label = "Architectural Layers Program" ; //give it a label
: button { //define radion button
key = "a-convert" ; //give it a name
label = "Convert Drawing to Architectural Layers " ; //give it a label
value = "1" ; //switch it on
} //end definition
}
: row {
: boxed_radio_column { //define radio column
label = "Architectural Layers Layers" ; //give it a label
key="RadCol";
: button { //define radio button
key = "a-col" ; //give it a name
label = "A-COL" ; //give it a label
value = "1" ; //switch it on
} //end definition
: button { //define radio button
key = "a-door" ; //give it a name
label = "A-DOOR" ; //give it a label
} //end definition
: button { //define radio button
key = "a-flor-strs" ; //give it a name
label = "A-FLOR-STRS" ; //give it a label
} //end definition
: button { //define radio button
key = "a-furn" ; //give it a name
label = "A-FURN" ; //give it a label
} //end definition
: button { //define radio button
key = "a-mod-pnl" ; //give it a name
label = "A-MOD-PNL" ; //give it a label
} //end definition
: button { //define radion button
key = "a-mod-wksf" ; //give it a name
label = "A-MOD-WKSF" ; //give it a label
}
//end definition
: button { //define radion button
key = "a-mod-wall" ; //give it a name
label = "A-WALL" ; //give it a label
} //end definition
: button { //define radion button
key = "a-mod-wind" ; //give it a name
label = "A-WIND" ; //give it a label
} //end definition
} //end radio column
: boxed_column { //define boxed column
label = "&Layers not converted"; //give it a label
: list_box { //define popup list
key = "layerlist"; //give it a name
height = 10;
width = 55;
multiple_select = true;
fixed_width_font = true;
allow_accept = true; //initial value
} //end list
} //end boxed column
} //end row
: row {
fixed_width = true;
label = "Progress Bar";
key = "br-label";
: row {
: button {
key = "convert";
label = "Convert";
mnemonic = "T";
is_cancel = true;
}
}
: row {
: button {
key = "delete";
label = "Delete Layer";
mnomonic = "E";
is_cancel = true;
}
}
: row {
: button {
key = "accept";
label = "Ok";
mnomonic = "k";
is_cancel = true;
}
}
: row {
: button {
key = "cancel";
label = "Cancel";
mnomonic = "a";
is_cancel = true;
}
}
: image {
key = "progbar";
fixed_width = 300;
height = 3;
}
/// This Tile may also be put below the OK_Cancel buttons
: row {
: errtile {
label = "";
key = "error";
width = 26;
}
}
}
: text_part { //define text
label = "Developed"; //give it some text
} //end text
: text_part { //define more text
label = "by Nobody in Particular"; //some more text
} //end text
} //end dialog
// LSP
//---------------------------------------------------------------------------------------------------------
// Architectural Test Program Program - Layer removal / deletion
//---------------------------------------------------------------------------------------------------------
(defun der ()
(command "-purge" "a" "" "n")
(command "-xref" "d" "*" "")
(command ".zoom" "e" "")
(setvar 'Clayer "0")
(cond ((not(member "laytrans.arx"(arx)))(arxload "laytrans")))
(repeat 4
(vla-purgeall
(setq aDoc (vla-get-ActiveDocument
(vlax-get-acad-object)))))
(vlax-for
itm
(vla-get-layers aDoc)
(if (and
(not (wcmatch
(setq name (vla-get-name itm))
"*|*"))
(not (eq name "0"))
(member name
'("E-A-ANNO-TEXT"
"Sunnyvale-bldg013_1st_dwg"
"RM NUMBERS"
"A-FURN-P-PNLS-TEXT2"
"SPECATTR"
"S-COL-INTER"
"S-COL-SMALL COLUMN NUMBERS"
"A-WALL-CNTR"
"A-FURN-P-POWR-TEXT3"
"A-FLOR-TRENCH"
"A-FURN-P-STOR-TEXT"
"A-FURN-P-SEAT-TEXT"
"A-FURN-P-WKSF-TEXT2"li
"A-FURN-P-SEAT-TEXT2"
"A-FURN-P-PNLS-TEXT"
"A-FURN-P-STOR-TEXT2"
"A-FURN-P-WKSF-TEXT"
"A-FURN-P-WKSF-ACC-TEXT"
"A-FURN-HAWORTH-ATT"
"A-WALL-PATT"
"A-AREA-IDEN"
"G-ANNO-TEXT"
"A-DETL-GENF"
"A-DETL-MEDM"
"A-AREA"
"S-GRID-EX"
"A-Anno-Dims-D"
"A-DEMO"
"A-Cols-Iden"
"A-MOD-WKSF"
"Furniture"
"A-ANNO-DIMS"
"A-Flor-Fnsh-D"
"A-Lite"
"A-Clng-E"
"A-Furn-D"
"A-Clng-Fire"
"M-Eqpm-M"
"SHEET TITLE"
"A-FURN-P-TEXT_UTEXT"
"Raised Floor Plan"
"B221_1 AS BUILT 09-16-08 w CRFS Mod - MACH_OFF"
"B221_1 AS BUILT 09-16-08 w CRFS Mod - WALL_INT"
"A-FURN-AIR-T"
"Border"
"A-FURN-P-FILE"
"A-FURN-P-WKSF-ACC"
"A-FURN-P-WKSF-SUPPORT"
"A-FURN-P-WKSF-SUPPORT"
"A-FURN-AIR"
"C-EQPT"
"ZAP1_B221$0$TEXT"
"A-FURN-P-WKSF-SUPPORT-TEXT3"
"FURN TEXT"
"ZAP1_B221$0$ROOM NO."
"A-FURN-P-FILE-TEXT3"
"ZAP1_B221$0$E-LITE"
"E-LITE-EMER"
"ZAP1_B221$0$E-LITE-D"
"A-FURN-P-FILE-TEXT4"
"Workstation Number"
"A-FURN-P-SEAT"
"F-FURN"
"A-FURN-P-POWR"
"ROOM_NO."
"A-Door-Iden"
"A-FURN-T"
"A-FURN-P-PHWL-38"
"A-KITCHEN-EQUIPMENT-E"
"A-FURN-P-FREE"
"A-FURN-P-STOR"
"A-FURN-P-PNLS-CON"
"A-FURN-P-TABLE"
"PSATTR"
"PLUMBING"
"A-FURN-P-PHWL-62"
"MILLWORK"
"A-ANNO-IDEN"
"A-FURN-P-PNLS"
"A-FURN-T"
"Elect"
"A-Equipment"
"A-FURN-P-ACSY"
"A-FURN-P-PEDS"
"NAMES"
"GRID"
"EQUIPMENT"
"A-GRID"
"Workstation No."
"FURN_TXT"
"A-GRID-IDEN"
"Workstation Tag Number"
"A-FURN-P-COMP-TEXT_UTEXT"
"A-ANNO-HIGHBAY"
"SQFTBOVOID"
"A-ANNO-NOTE"
"A-FLOR-PFIX"
"A-FURN-P-COMP-TEXT_UTEXT"
"COLUMN-MARKER"
"COLUMN MARKER"
"COLUMN_MARKER"
"NOTE"
"NOTE-NAME"
"NOTESF"
"A-ANNO-SYMB-REF"
"A-ANNO-TEXT"
"A-ANNO-REV"
"A-EQPM"
"TITLE"
"Title"
"TITLE1"
"A-FLOR-TPTN"
"PERIMETER"
"SQFTBO"
"KG1"
"M-TEXT"
"ROOFING NOTES"
"A-FLOR-PLMBG"
"S-GRID-IDEN"
"S-GRID"
"NOTE-MISC"
"COLUMN-MARKERBSMT"
"ROOM NO."
"P-FIXT"
"TEXT"
"CUBE NO."
"SHOP TOOL_TXT"
"B223_1 - NAMES"
"ELEC_PWR"
"MACH_OFF_TXT"
"A-FURN-E"
"A-FENC-E"
"FURN"
"A-FURN-TOOL-E"
"A-FURN-P-WKSF"
"MACH_OFF"
"FURN"
"NORTH"
"BORDER"
"ZAP1_B221$0$A-FURN"
"ELEC_SIGNAL"
"A-FURN-TEXT"
"LOGO"
"E-Eqpm-E"
"FIRE"
"HAZARD"
"SHOP TOOL"
"RAMP"
"HVAC"
"SEAT"
"PARTITION"
"CURRENT"
"A-FURN"
"E-A-ANNO-TEXT"
"S-GRID-EX"
"A-Anno-Dims-D"
"A-DEMO"
"A-MOD-PNL"
"A-Cols-Iden"
"A-MOD-WKSF"
"Furniture"
"A-ANNO-DIMS"
"A-Flor-Fnsh-D"
"A-Lite"
"A-Clng-E"
"A-Furn-D"
"A-Clng-Fire"
"M-Eqpm-M"
"SHEET TITLE"
"GRID"
"A-GRID"
"A-GRID-IDEN"
"A-ANNO-HIGHBAY"
"SQFTBOVOID"
"A-ANNO-NOTE"
"A-FLOR-PFIX"
"COLUMN-MARKER"
"COLUMN MARKER"
"COLUMN_MARKER"
"NOTE"
"NOTE-NAME"
"NOTESF"
"A-ANNO-SYMB-REF"
"A-ANNO-TEXT"
"A-ANNO-REV"
"A-EQPM"
"TITLE"
"Title"
"TITLE1"
"A-FLOR-TPTN"
"PERIMETER"
"SQFTBO"
"KG1"
"M-TEXT"
"ROOFING NOTES"
"A-FLOR-PLMBG"
"S-GRID-IDEN"
"S-GRID"
"NOTE-MISC"
"COLUMN-MARKERBSMT"
"ROOM NO."
"P-FIXT"
"TEXT"
"CUBE NO."
"SHOP TOOL_TXT"
"B223_1 - NAMES"
"ELEC_PWR"
"MACH_OFF_TXT"
"A-FURN-E"
"A-FENC-E"
"FURN"
"A-FURN-TOOL-E"
"A-FURN-P-WKSF"
"MACH_OFF"
"FURN"
"NORTH"
"BORDER"
"ZAP1_B221$0$A-FURN"
"ELEC_SIGNAL"
"A-FURN-TEXT"
"LOGO"
"E-Eqpm-E"
"FIRE"
"HAZARD"
"SHOP TOOL"
"EXIT TRAVEL PATH"
"DIM_ROOM"
"COLUMN_GRID"
"DIM"
"HAWORTH"
"RAMP"
"HVAC"
"SEAT"
"PARTITION"
"CURRENT"
"A-FURN"
"SQFTTEMP")))
(progn
(vla-put-lock itm :vlax-false)
(vl-cmdf "_.-laydel" "_N" name "" "_Y"))
)
)
(repeat 4 (vla-purgeall aDoc))
(princ)
(acet-laytrans "c:\\LSP\\master1.dws" (+ 1 2 4 8))
(acet-laytrans "c:\\LSP\\master2.dws" (+ 1 2 4 8))
;(acet-laytrans "c:\\LSP\\master3.dws" (+ 1 2 4 8))
;(acet-laytrans "c:\\LSP\\master4.dws" (+ 1 2 4 8))
;(acet-laytrans "c:\\LSP\\master5.dws" (+ 1 2 4 8))
;(acet-laytrans "c:\\LSP\\master6.dws" (+ 1 2 4 8))
)
(princ)
;(command "-layer" "n" "A-COL, A-DOOR, A-FLOR-STRS, A-FURN, A-MOD-PNL, A-MOD-WKSF, A-WALL, A-WIND" "")
//---------------------------------------------------------------------------------------------------------
// Architectural Test Program Layers Conversion Program - List Box Capture
//---------------------------------------------------------------------------------------------------------
(defun LL (/ lay)
(setq LLF (open "C:/LSP/layerlist.txt" "w"))
(while (setq lay (tblnext "layer" (not lay)))
(write-line (cdr (assoc 2 lay)) LLF)
); while
(close LLF)
)
//---------------------------------------------------------------------------------------------------------
// Architectural Test Program Layers Conversion Program - List Box Capture
//---------------------------------------------------------------------------------------------------------
(defun @layerlist (str / lst)
(foreach i (read (strcat "(" str ")"))
(setq lst (cons (nth i txtlist) lst))
)
(reverse lst)
)
//---------------------------------------------------------------------------------------------------------
// Architectural Test Program Layers Conversion Program - Create Layers
//---------------------------------------------------------------------------------------------------------
(defun c_layers (/)
(command "-layer" "n" "A-COL, A-DOOR, A-FLOR-STRS, A-FURN, A-MOD-PNL, A-MOD-WKSF, A-WALL, A-WIND" "")
)
//---------------------------------------------------------------------------------------------------------
// Architectural Test Program Layers Conversion Program - Load text file from creation
//---------------------------------------------------------------------------------------------------------
(defun c:archi ( / result dcl_id)
(setq txtlist (list))
(setq openfile (open "c:/lsp/layerlist.txt" "r")); reading the list
(while (setq line (read-line openfile))
(setq txtlist (append txtlist (list line)))
)
(close openfile)
//---------------------------------------------------------------------------------------------------------
// Architectural Test Program Layers Conversion Program - Load DCL Box for list
//---------------------------------------------------------------------------------------------------------
(setq dcl_id (load_dialog "DCR_PROGRAM.dcl")); loading the DCL
(if (not (new_dialog "dcl_test" dcl_id))
(progn
(alert "The DCR PROGRAM.dcl file could not be loaded!")
(exit)
)
)
(progn
(setq layerlist nil)
(start_list "layerlist" 3)
(mapcar 'add_list txtlist); Adding the text to the layerlist box
(end_list); end list
//---------------------------------------------------------------------------------------------------------
// Architectural Test Program Layers Conversion Program - Tile actions for conversion of selected text from list
//---------------------------------------------------------------------------------------------------------
(action_tile "a-convert" "(done_dialog)(setq result T)")
(action_tile "layerlist" "(setq layers (@layerlist $value))")
(action_tile "accept" "(done_dialog 1)")
(action_tile "cancel" "(done_dialog 0)")
(action_tile "delete" "(setq choice $key)")
(action_tile "a-flor-strs" "(setq choice $key)")
(action_tile "a-door" "(setq choice $key)")
(action_tile "a-col" "(setq choice $key)")
(action_tile "a-furn" "(setq choice $key)")
(action_tile "a-mod-pnl" "(setq choice $key)")
(action_tile "a-mod-wksf" "(setq choice $key)")
;(setq action (start_dialog))
;(cond
;((/= action 0)) ;; do nothing
;((= choice "delete")
;(command ".erase")
😉
😉
(action_tile "a-flor-strs" "(setq choice $key)")
(setq action (start_dialog))
(cond
((/= action 1)) ;; do nothing
((= choice "a-flor-strs")
(foreach layer layers
(and
(setq ss (ssget "X" (list (cons 8 layer))))
(vl-cmdf "_.chprop" ss "" "_LA" A-FLOR-STRS "")
)
)
)
)
(action_tile "a-door" "(setq choice $key)")
(setq action (start_dialog))
(cond
((/= action 1)) ;; do nothing
((= choice "a-door")
(foreach layer layers
(and
(setq ss (ssget "X" (list (cons 8 layer))))
(vl-cmdf "_.chprop" ss "" "_LA" A-DOOR "")
)
)
)
)
(action_tile "a-col" "(setq choice $key)")
(setq action (start_dialog))
(cond
((/= action 1)) ;; do nothing
((= choice "a-col")
(foreach layer layers
(and
(setq ss (ssget "X" (list (cons 8 layer))))
(vl-cmdf "_.chprop" ss "" "_LA" A-COL "")
)
)
)
)
(action_tile "a-furn" "(setq choice $key)")
(setq action (start_dialog))
(cond
((/= action 1)) ;; do nothing
((= choice "a-furn")
(foreach layer layers
(and
(setq ss (ssget "X" (list (cons 8 layer))))
(vl-cmdf "_.chprop" ss "" "_LA" A-FURN "")
)
)
)
)
(action_tile "a-mod-pnl" "(setq choice $key)")
(setq action (start_dialog))
(cond
((/= action 1)) ;; do nothing
((= choice "a-mod-pnl")
(foreach layer layers
(and
(setq ss (ssget "X" (list (cons 8 layer))))
(vl-cmdf "_.chprop" ss "" "_LA" A-MOD-PNL "")
)
)
)
)
(action_tile "a-mod-wksf" "(setq choice $key)")
(setq action (start_dialog))
(cond
((/= action 1)) ;; do nothing
((= choice "a-mod-wksf")
(foreach layer layers
(and
(setq ss (ssget "X" (list (cons 8 layer))))
(vl-cmdf "_.chprop" ss "" "_LA" A-MOD-WKSF "")
)
)
)
)
(action_tile "cancel" "(done_dialog 0)")
(action_tile "convert" "(setq choice $key)")
(setq action (start_dialog))
(cond
((/= action 1)) ;; do nothing
((= choice "convert")
(foreach layer layers (command "-laydel" "n" layer "" "y"))
)
)
(start_dialog)
(unload_dialog dcl_id)
(if result
(der)
)
)
)
;(unload_dialog dcl_id)
(princ)