sorry for the poor image quality.
samp4 : dialog {
label = "Structural Holes";
: row {
: radio_column {
key = "flange";
label = "Flange";
: radio_button {key = "fla_wn"; label = "Welding Neck";}
: radio_button {key = "fla_sw"; label = "Socket Weld";}
: radio_button {key = "fla_so"; label = "Slip-on";}
: radio_button {key = "fla_scr"; label = "Screwed";}
: radio_button {key = "fla_bl"; label = "Blind";}
}
: boxed_radio_column {
key = "face";
label = "Face";
: radio_button {key = "fac_rjt"; label = "RTJ";}
: radio_button {key = "fac_rf"; label = "RF";}
: radio_button {key = "fac_ff"; label = "Flat Face";}
}
: boxed_radio_column {
key = "schedule";
label = "Schedule";
: radio_button {key = "sch_5"; label = "5";}
: radio_button {key = "sch_10"; label = "10";}
: radio_button {key = "sch_20"; label = "20";}
: radio_button {key = "sch_30"; label = "30";}
: radio_button {key = "sch_40"; label = "40";}
}
: boxed_radio_column {
key = "class";
label = "Class";
: radio_button {key = "cla_150"; label = "150";}
: radio_button {key = "cla_300"; label = "300";}
: radio_button {key = "cla_400"; label = "400";}
: radio_button {key = "cla_600"; label = "600";}
: radio_button {key = "cla_900"; label = "900";}
}
}
ok_cancel;
: row {
: image {key = "img"; aspect_ratio = 1.0; fixed_height = true; fixed_width = true; height = 2.0;}
: paragraph {
: text_part {value = "Designed and Created by Kenny Ramage";}
: text_part {value = "Revised and updated by Roy_043";}
}
}
}
;Find and open data file, *.dim
(defun OPEN_DIM_FILE ()
(if (= NEWTILE "wnrf")
(setq DIM_FILE (open (findfile "wnrf.dim") "r"))
) ;_ end of if
) ;end OPEN_DIM_FILE
I see in your lisp that you have used (done_dialog 0) for the Cancel button and (done_dialog 1) for the OK button.See this line in the code:
Can you explain the reasoning behind this please
(setq fnm
(strcat
(substr (get_tile "flange") 5) ; "flange" is key of radio column, get_tile returns key of selected radio button.
"_"
(substr (get_tile "face") 5)
"_"
(get_tile "schedule")
"_"
"#"
(substr (get_tile "class") 5)
"_"
".dim"
)
); end setq
: boxed_radio_column {
key = "face";
label = "Face";
: radio_button {key = "fac_rjt"; label = "RTJ";}
spacer_1 ;
: radio_button {key = "fac_rf"; label = "RF";}
spacer_1 ;
: radio_button {key = "fac_ff"; label = "Flat Face";}
}
: boxed_radio_column {
label = "Face" ;
: radio_button { key = "rb21" ; label = "RTJ"; is_enabled = false;}
spacer;
: radio_button { key = "rb22" ; label = "RF" ; is_enabled = false;}
spacer;
: radio_button { key = "rb23" ; label = "Flat Face" ; is_enabled = false;}
spacer;
spacer;
spacer;
spacer;
spacer;
}
That is purely cosmetic reallyI disagree. There are no DCL buttons that stay pushed in (unless you create your own), so basically with the buttons solution there is no visual feedback for the user.
(defun L3_ON ()
(mode_tile "rb21" 0)
(mode_tile "rb22" 0)
(mode_tile "rb23" 0)
)
(defun L3_CLEAR ()
(set_tile "rb21" "0")
(set_tile "rb22" "0")
(set_tile "rb23" "0")
)
Then call as required:)
[code] (action_tile "s1" ;toggle Fitting options
(strcat
"(RESET_VARS)" "(L1_ON)" "(L2_OFF)" "(L3_OFF)" "(L4_OFF)" "(L5_OFF)"
"(L1_CLEAR)" "(L2_CLEAR)" "(L3_CLEAR)" "(L4_CLEAR)" "(L5_CLEAR)"
); end strcat
); END ACTION TILE
[/code](defun OPEN_DIM_FILE ()
; (setq DIM_FILE (open (findfile 'fname) "r")) ;need variable 'fname' value here
; (setq DIM_FILE (open (findfile (getvar fname)) "r")) ;need variable 'fname' value here
(setq DIM_FILE (open (findfile "wn_rf_sch_20_#300_.dim") "r")) ;need variable 'fname' value here
) ;end OPEN_DIM_FILE
setq fname (strcat ftg flg fce sch clss ".dim"
(setq fname (strcat ftg flg fce sch clss ".dim"))
(princ (strcat "\nFilename = " fname " "))
Placed in a couple of locations in the code it appears that NONE of the variables are inheriting (?) their selected values until after the 'OK' button has been pressed. (defun F_NAME ()
(setq fname (strcat ftg flg fce sch clss ".dim"))
) end F_NAME
(defun OPEN_DIM_FILE ()
(if (= NEWTILE "rb41") ;
; (setq DIM_FILE (open (findfile "wnrf.dim") "r")) ;need variable 'fname' value here
(setq DIM_FILE (open (findfile fname) "r")) ;need variable 'fname' value here
; (setq DIM_FILE (open (findfile "wn_rf_sch_20_#300_.dim") "r")) ;need variable 'fname' value here
) ;_ end of if
) ;end OPEN_DIM_FILE
(action_tile "rb41"
(strcat
"(RB41_FLAG)" "(READ_DIM_FILE)" "(F_NAME)"
); end strcat
); END ACTION TILE
(defun F_NAME ()
(setq fname (strcat ftg flg fce sch clss ".dim"))
) end F_NAME
(princ (strcat "\nFilename after F_NAME = " fname " "))
(defun OPEN_DIM_FILE ()
; (if (= NEWTILE "rb41") ;
; (setq DIM_FILE (open (findfile fname) "r")) ;need variable 'fname' value here
(setq DIM_FILE (open (findfile "wn_rf_sch_20_#300_.dim") "r")) ;need variable 'fname' value here
; ) ;_ end of if
) ;end OPEN_DIM_FILE
(princ (strcat "\nFilename after open_dim_file = " fname " "))
Filename after F_NAME =[/size]
Filename after open_dim_file =
Command: samp4
Filename after unload_dialog = wn_rf_sch_20#300.dim
Even for a person with limited Lisp knowledge it should be obvious why your code fails.
Then modified a radio button (the schedule)You have started out with code from www.afralisp.net, I advise you to follow more of their tutorials, you need more Lisp skills to finish this project.Code: [Select](action_tile "rb41"
(strcat
"(RB41_FLAG)" "(READ_DIM_FILE)" "(F_NAME)"
); end strcat
); END ACTION TILE
but this does not work :(
dcl_settings : default_dcl_settings { audit_level = 3; }
(found on https://www.autolisp-exchange.com/)*** DCL semantic audit of samp4.dcl***
Warning in "samp4". (widget type = text, key = "n1")
Text widgets need a 'label' or a 'width'.
Warning in "samp4". (widget type = text, key = "n6")
Text widgets need a 'label' or a 'width'.
Warning in "samp4". (widget type = text, key = "n7")
Text widgets need a 'label' or a 'width'.
Warning in "samp4". (widget type = text, key = "n2")
Text widgets need a 'label' or a 'width'.
Warning in "samp4". (widget type = text, key = "n3")
Text widgets need a 'label' or a 'width'.
Warning in "samp4". (widget type = text, key = "n5")
Text widgets need a 'label' or a 'width'.
Warning in "samp4". (widget type = text, key = "n4")
Text widgets need a 'label' or a 'width'.
Warning in "samp4". (widget type = text, key = "n8")
Text widgets need a 'label' or a 'width'.
you need more Lisp skills to finish this project.Oh so painfully true!
Code: [Select](action_tile "rb41"
"(RB41_FLAG)(F_NAME)(READ_DIM_FILE)"
); END ACTION TILE
But you do have to call the F_NAME function before using the filename in READ_DIM_FILE.
And when using strcat to compose the filename the variables used have to contain strings, so you have to either initialize default string values or determine all of them by checking the current state of the dialog.
(defun RB41_FLAG ()In this case when radio button 41 is selected the string "sch_5" is stored as the current value for the variable sch
(setq sch "sch_5") ;store schedule rating
);end rb41_flag
(defun RB41_FLAG ()
(setq sch "sch_5") ;store schedule rating
);end rb41_flag
(defun RB41_FLAG ()
(setq sch "sch_5_") ;store schedule rating
);end rb41_flag
(action_tile "rb31" ;toggle #300 option
"(L5_ON)(RB31_FLAG)"
); END ACTION TILE
(action_tile "rb31" ;toggle #300 option
"(setq newtile $key)(RB31_FLAG)(F_NAME)(READ_DIM_FILE)"
); END ACTION TILE
(defun RB11_FLAG ()
(setq flg "wn_") ;store flange type
);end rb11_flag
(action_tile "rb31" ;toggle #150 option
(if
(= flg wn_) ;if variable weldneck flange selected do this
(progn
(L5_ON)
(RB31_FLAG)
);end progn
;---------------------------;
; ;otherwise if ANY of bl/so/scr/sl are set do this
(progn
(setq newtile $key)
(RB31_FLAG)
(F_NAME)
(READ_DIM_FILE)
);end progn
) ;_ end of if
); END ACTION TILE