Challenge

Week - 6 - Creating the GUI for final checks

Aim-

   To create a GUI for all the final checks.

Objective-

  • Create buttons to delete displayed geometric entities (be careful about advanced remesh).
  • Create buttons to delete empty entities.
  • Create button to re-order and re-number entities by name.
  • Create a master button in red that will execute all above scripts in proper order to keep only the fea entities. Name the button master.

Procedure-

Open notepad++ and create a dummy.tcl file

   set a .window is the command. .window is the window name or path by which it will be referred saved in.

   catch {destroy $a} is the command where catch is used to hide errors and destroy is used to close any previously existing window by same name.

   toplevel $a -class TopLevel is the command that builds the window.

   wm title $a "Final Check" is the command that is used to create title of the window.

  wm geometry $a 500x650+100+50 is the command that is used to create dimension of the window. 500x650 is width and height of the window. +100+50 is the origin of the hypermesh window where the windoe shoud be placed.

   wm resizable $a 0 0 is the command that is used to fix the window means we can not resize the window by dragging. If you put 1 0, you can drag or resize the window on x axix, if you put 0 1, you can drag or resize it on y axix and if you put 1 1, you can drag and resize on both axis.

   wm deiconify $a is the command that is used to make the window as active window.

   And then we have to create label called "Delete Geometric entities". The syntax for create label is label $windowpath -text "Label" -bg grey -font {times 20 bold} ;   place $windowpath -x value -y value -width value -height value. Using this syntax the label is created. 

   We have to create four buttons called 'Delete Solids', 'Delete Surfaces', 'Delete points', 'Delete Lines'. The syntax for create button is button $windowpath -text "text" -command {something};  place $windowpath -x value -y value -width value - height value. Using these syntax buttons are created. To execute commands we have to create procedure.

   Create procedure for delete displayed entities and also use null case for not getting any error if the user not selected any entities. 

   Using the above procedure create labels and buttons for delete empty and unused entities and re-order and re-number entities. Here, the entities could be assemblies, components, materials, properties. Use procedure for all these buttons.

  Also create a master button in red and create one procedure and assign all the commands into these procedure. So, that all the above operations can be performed at one click.

Code-

 set a .window

catch {destroy $a}

toplevel $a -class TopLevel

wm title $a "Final Check"

wm geometry $a 500x650+100+50; update

wm resizable $a 0 0

wm deiconify $a

label $a.01 -text "Delete Geometric entities" -bg grey -font {times 10 bold};        place $a.01 -x 20 -y 20 -width 450 -height 50

button $a.02 -text "Delete Solids" -command "delete solids" -bg white -font {times 10 bold}; place $a.02 -x 20 -y 80 -width 200 -height 30

button $a.03 -text "Delete Surfaces" -command "delete surfaces" -bg white -font {times 10 bold}; place $a.03 -x 250 -y 80 -width 200 -height 30 

button $a.04 -text "Delete Points" -command "delete points" -bg white -font {times 10 bold}; place $a.04 -x 20 -y 120 -width 200 -height 30 

button $a.05 -text "Delete Lines" -command "delete lines" -bg white -font {times 10 bold}; place $a.05 -x 250 -y 120 -width 200 -height 30

proc delete {a} {

*createmark $a 1 "displayed"

if {[hm_marklength $a 1] !=0} {*deletemark $a 1}

}

label $a.06 -text "Delete Empty and unused entities" -bg grey -font {times 10 bold};        place $a.06 -x 20 -y 160  -width 450 -height 50

button $a.07 -text "Delete Assemblies" -command "empty assemblies" -bg white -font {times 10 bold}; place $a.07 -x 20 -y 220 -width 200 -height 30

button $a.08 -text "Delete Components" -command "empty components" -bg white -font {times 10 bold}; place $a.08 -x 250 -y 220 -width 200 -height 30 

button $a.09 -text "Delete Materials" -command "unused materials" -bg white -font {times 10 bold}; place $a.09 -x 20 -y 260 -width 200 -height 30 

button $a.10 -text "Delete Properties" -command "unused properties" -bg white -font {times 10 bold}; place $a.10 -x 250 -y 260 -width 200 -height 30

proc empty {b} {

*EntityPreviewEmpty $b 1

if {[hm_marklength $b 1] !=0} {*deletemark $b 1}

}

proc unused {c} {

*EntityPreviewUnused $c 1

if {[hm_marklength $c 1] !=0} {*deletemark $c 1}

}

label $a.11 -text "Re-order and Re-number entities" -bg grey -font {times 10 bold};        place $a.11 -x 20 -y 300  -width 450 -height 50

button $a.12 -text "Reorder Assemblies" -command "reorder assemblies" -bg white -font {times 10 bold}; place $a.12 -x 20 -y 360 -width 200 -height 30

button $a.13 -text "Reorder Components" -command "reorder components" -bg white -font {times 10 bold}; place $a.13 -x 250 -y 360 -width 200 -height 30 

button $a.14 -text "Reorder Materials" -command "reorder materials" -bg white -font {times 10 bold}; place $a.14 -x 20 -y 400 -width 200 -height 30 

button $a.15 -text "Reorder Properties" -command "reorder properties" -bg white -font {times 10 bold}; place $a.15 -x 250 -y 400 -width 200 -height 30

proc reorder {d} {

*createmark $d 1 "all"

if {[hm_marklength $d 1] !=0} {*collectormarkmove $d 1 1 1}

}

button $a.16 -text "Renumber Assemblies" -command "renumber assemblies" -bg white -font {times 10 bold}; place $a.16 -x 20 -y 440 -width 200 -height 30

button $a.17 -text "Renumber Components" -command "renumber components" -bg white -font {times 10 bold}; place $a.17 -x 250 -y 440 -width 200 -height 30 

button $a.18 -text "Renumber Materials" -command "renumber materials" -bg white -font {times 10 bold}; place $a.18 -x 20 -y 480 -width 200 -height 30 

button $a.19 -text "Renumber Properties" -command "renumber properties" -bg white -font {times 10 bold}; place $a.19 -x 250 -y 480 -width 200 -height 30

proc renumber {e} {

*createmark $e 1 "all"

if {[hm_marklength $e 1] !=0} {*renumbersolverid components 1 1 1 0 0 0 0 0}

}

button $a.20 -text "MASTER" -command "master" -bg red -font {times 15 bold}; place $a.20 -x 150 -y 520 -width 150 -height 50

proc master {} {

delete solids

delete surfaces

delete points

delete lines

empty assemblies

empty components

unused materials

unused properties

reorder assemblies

reorder components

reorder materials

reorder properties

renumber assemblies

renumber components

renumber materials

renumber properties

}

Result-

Conclusion-

Sucessfully created buttons to delete displayed geometric entities, delete empty entities, re-order and re-number entities by name and also created a master button in red that will execute all the above operations.

Your portfolio, next

Ship work like this
in your own course.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.