hexagon logo

I have a dialogue box created where I am setting number of design variables. I want to display set variable values into respective fields upon displaying that dialogue box whenever I open model next time. What would be proper cmd command

I have a dialogue box created where I am setting number of design variables.
I want to display set variable values into respective fields upon displaying that dialogue box whenever I open model next time. What would be proper cmd command
Parents
  • Hello Skaka,
     
    I do not have anything like that in hand. To initialize all fields in dbox I usually use following code - note the commands are in double quotes since it is an excerpt from start_commands block:
     
              "!--- Initialize Fields to zero", &
              "for var=$_Self.loop obj=(eval(db_children($_topgui.tabcont_1.cont_general,\"Graphic_Interface_Field\")))", &
              " interface field set field=(eval($_self.loop)) str=\"0.0\" ", &
              "end", &
     
    I hope you could elaborate on that with expanding those lines.
     
    Eventually you could make a list of variables with matching field object names so you could do something as below (macro code):
    var set var=$_self.model_obj obj=(eval(db_default(.system_defaults,\"model\")))
     
    !--- create list of variables
    variable set variable_name=$_topgui.var_list &
     string="var_01", &
         "var_02", &
         "var_03"
     
     
    !--- Make loop over all variables
    for var=$_self.loop start_value=1 end_value=(ROWS($_self.var_list))
     
     interface field set field=(eval($_topgui//$_self.var_list.string_value[$_self.loop]) )  data=(eval($_self.var_list.string_value[$_self.loop]) )", &
     
    end !--- End loop over variables
     
    Disclaimer: This code is not tested at all so it most probably does not work out of the box, please play around with string syntax to make Adams happy :)
     
    Hope that helps.
    Jan
Reply
  • Hello Skaka,
     
    I do not have anything like that in hand. To initialize all fields in dbox I usually use following code - note the commands are in double quotes since it is an excerpt from start_commands block:
     
              "!--- Initialize Fields to zero", &
              "for var=$_Self.loop obj=(eval(db_children($_topgui.tabcont_1.cont_general,\"Graphic_Interface_Field\")))", &
              " interface field set field=(eval($_self.loop)) str=\"0.0\" ", &
              "end", &
     
    I hope you could elaborate on that with expanding those lines.
     
    Eventually you could make a list of variables with matching field object names so you could do something as below (macro code):
    var set var=$_self.model_obj obj=(eval(db_default(.system_defaults,\"model\")))
     
    !--- create list of variables
    variable set variable_name=$_topgui.var_list &
     string="var_01", &
         "var_02", &
         "var_03"
     
     
    !--- Make loop over all variables
    for var=$_self.loop start_value=1 end_value=(ROWS($_self.var_list))
     
     interface field set field=(eval($_topgui//$_self.var_list.string_value[$_self.loop]) )  data=(eval($_self.var_list.string_value[$_self.loop]) )", &
     
    end !--- End loop over variables
     
    Disclaimer: This code is not tested at all so it most probably does not work out of the box, please play around with string syntax to make Adams happy :)
     
    Hope that helps.
    Jan
Children
No Data