Tool to rename the components with standard naming

Altair Forum User
Altair Forum User
Altair Employee
edited October 2020 in Community Q&A

I would like to make tool for post process. This need to perform the renaming Operation.

Here sample view of tool layout which I required.

 

img1.jpg
 

  

I will explain with example.

img2.jpg

The model having  there many Assembly ( Mesh_1,Mesh_2,Mesh_3_etc)

1.    When running this script. Pop window need to appear as per my sample layout.

2.    With select Assembly (button1), I can able to select the Assembly available in the model.

3.    After selecting the Assembly. The selected Assembly name should be appear in the list box including sub assembly components too.

4.    In the List Box I can able to select the multiple components for renaming.

5.    After selecting the components going for other option Name 2, Name 2, Name 3 .

6.    When I click SET button. All the components names to be renames as like below format.

                Comp_1   -->  Comp_1-Name1value-Name2value-Name3value

  Note : after click renaming operation happen then list reloaded with same selected assembly until click RESET buton

Name 1 drop down menu values :  value1, value1, value1.

Name 2 -  Check Box values : txt1, txt2, Other ( if select other drop down menu2 can be selected )

                drop down menu2 values : text3, txt4, txt5,

Name 3 -  Check Box values : txt1, txt2, txt3, txt4, txt5, txt6, Other ( if select other drop down menu2 can be selected )

                drop down menu3 values : None,txt3, txt4, txt5,( If selected value  None, The Name 3 should not include while remaining)

 

Kindly help to make this tool.

Answers

  • Q.Nguyen-Dai
    Q.Nguyen-Dai Altair Community Member
    edited August 2020

    Why you need the GUI?

    I think you can write this GUI with Tcl/Tk no problem. But it's better to test firstly with no-GUI script.

  • Adriano A. Koga
    Adriano A. Koga
    Altair Employee
    edited August 2020

    I agree. Start first with the core code, and then move to the GUI version.

    For the GUI you can find some hints if you launch a utility called HWTK (hw toolkit) from the Start Menu.

    There you will find a few examples for GUI.

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited August 2020

    Why you need the GUI?

    I think you can write this GUI with Tcl/Tk no problem. But it's better to test firstly with no-GUI script.

     

    I agree. Start first with the core code, and then move to the GUI version.

    For the GUI you can find some hints if you launch a utility called HWTK (hw toolkit) from the Start Menu.

    There you will find a few examples for GUI.


    /profile/43398-qnguyen-dai/?do=hovercard&referrer=https%253A%252F%252Fforum.altair.com%252Ftopic%252F40939-tool-to-rename-the-components-with-standard-naming%252F' href='<___base_url___>/profile/43398-qnguyen-dai/' style='background-color:transparent;color:#fa4616;' title='Go to Q.Nguyen-Dai's profile' rel=''>Q.Nguyen-Dai/profile/97129-adriano-a-koga/?do=hovercard&referrer=https%253A%252F%252Fforum.altair.com%252Ftopic%252F40939-tool-to-rename-the-components-with-standard-naming%252F' href='<___base_url___>/profile/97129-adriano-a-koga/' style='background-color:transparent;color:inherit;' title='Go to Adriano A. Koga's profile' rel=''>Adriano A. Koga . 
    Actually  i am not much aware about. TCL/TK.
    But i can understand the code little. if some one wrote.

    I want to make this tool. Actually GUI is not important. For easy understand purpose I  made. it. Can you help me to make this tool.
    Thanks in Advance.

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited September 2020

    I would like to make tool for post process. This need to perform the renaming Operation.

    Here sample view of tool layout which I required.

     


     

      

    I will explain with example.

     

    The model having  there many Assembly ( Mesh_1,Mesh_2,Mesh_3_etc)

    1.    When running this script. Pop window need to appear as per my sample layout.

    2.    With select Assembly (button1), I can able to select the Assembly available in the model.

    3.    After selecting the Assembly. The selected Assembly name should be appear in the list box including sub assembly components too.

    4.    In the List Box I can able to select the multiple components for renaming.

    5.    After selecting the components going for other option Name 2, Name 2, Name 3 .

    6.    When I click SET button. All the components names to be renames as like below format.

                    Comp_1   -->  Comp_1-Name1value-Name2value-Name3value

      Note : after click renaming operation happen then list reloaded with same selected assembly until click RESET buton

    Name 1 drop down menu values :  value1, value1, value1.

    Name 2 -  Check Box values : txt1, txt2, Other ( if select other drop down menu2 can be selected )

                    drop down menu2 values : text3, txt4, txt5,

    Name 3 -  Check Box values : txt1, txt2, txt3, txt4, txt5, txt6, Other ( if select other drop down menu2 can be selected )

                    drop down menu3 values : None,txt3, txt4, txt5,( If selected value  None, The Name 3 should not include while remaining)

     

    Kindly help to make this tool.

     

     

    Recently i have asked in this forum to develop Tool.
    I studied and  made the function successfully.

     but ,now  i am getting the components   by 

    set ::my_comps [hm_getmark comps 1] command

     

     But  i want to make list ( tree view) , So that i can select the component easily  for rename.

     

     Kindly any help me  to make GUI  Multi selection list box ( components tree view) with the below code.

    /profile/3195-tinh/?do=hovercard' data-mentionid='3195' href='<___base_url___>/profile/3195-tinh/' rel=''>@tinh /profile/43398-qnguyen-dai/?do=hovercard' data-mentionid='43398' href='<___base_url___>/profile/43398-qnguyen-dai/' rel=''>@Q.Nguyen-Dai /profile/97129-adriano-a-koga/?do=hovercard' data-mentionid='97129' href='<___base_url___>/profile/97129-adriano-a-koga/' rel=''>@Adriano A. Koga

     *createmarkpanel comps 1 'Select Component to Automation Renaming' set ::my_comps [hm_getmark comps 1]  toplevel .mwin wm title .mwin 'Tool Renaming ' wm geometry .mwin 200x200  # ------------------------------------- # ---- Create frame  # ------------------------------------- set mframe1 [ttk::frame .mwin.mframe1] pack $mframe1 -side top -fill x -expand true  set ::c1var value1 set ::c2var Value2 set ::c2var value3   set value1 { 	None txt1 txt2 txt3 	}  set value2 { 	None  val1 val2 val3 }  set value3 { 	None val11 val22 val33 }   set lf1 [ttk::labelframe .mwin.mframe1.lf1 -text 'Parameter 1'] set cb1 [hwtk::combobox .mwin.mframe1.lf1.cb1 -textvariable ::c1var -state readonly -values $value1]  set lf2 [ttk::labelframe .mwin.mframe1.lf2 -text 'Parameter 3'] set cb2 [hwtk::combobox .mwin.mframe1.lf2.cb2 -textvariable ::c2var -state readonly -values $value2]  set lf3 [ttk::labelframe .mwin.mframe1.lf3 -text 'Parameter 3'] set cb3 [hwtk::combobox .mwin.mframe1.lf3.cb3 -textvariable ::c3var -state readonly -values $value3]  pack $cb1 $cb2 $cb3 -pady 5 -padx 10 pack $lf1 $lf2 $lf3 -side top -pady 5 -padx 10     	# ----Give information in mframe6      set btn3 [ttk::button .mwin.mframe1.btn3 -text 'Apply' -command apply]     pack $btn3 -side right -anchor se   # ------------------------------ # make new name for components  # ------------------------------  proc apply {} {  	  foreach c $::my_comps {  	set na None  	set name [hm_getentityvalue comps $c name 1]   if { $::c1var == $na } {  	set new_name [format '%s-$::c2var-$::c3var' $name]  } elseif { $::c2var == $na } { 	set new_name [format '%s-$::c1var-$::c3var' $name] } elseif { $::c3var == $na } { 	set new_name [format '%s-$::c1var-$::c2var' $name] } else { 	set new_name [format '%s-$::c1var-$::c2var-$::c3var' $name] }   	eval *renamecollector components '$name' '$new_name'  }   *clearmark comps 1  destroy .mwin 	}

     

     

     

     

     

    Unable to find an attachment - read this blog

  • tinh
    tinh Altair Community Member
    edited September 2020

    Hi

    Use hwtk::selectlist

    Or hwtk::table

    Or hwtk::treectrl

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited September 2020

    Hi

    Use hwtk::selectlist

    Or hwtk::table

    Or hwtk::treectrl

      Thank you for the response.  But I did not know how to make  tree with all components. and when components are selected, how to get that in to mark components   ( set into  set ::my_comps [hm_getmark comps 1] )

  • tinh
    tinh Altair Community Member
    edited September 2020

    You should read examples in HWTK toolkit to know usage of above widgets, then you will know answer.