Challenge

Week - 6 - Creating the GUI for final checks

OBJECTIVE

Create a tk GUI for all the final checks/operations:

These include

  • Create buttons to delete displayed geometric entities
  • 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 the above scripts in the proper order to keep only the FEA entities. Name the button master

CODE

*EntityPreviewUnused this command is used to mark the unused entities and store it in mark temporarily

*EntityPreviewEmpty this command is used to mark the unused entities and store it in mark temporarily

*collectormarkmove this command is used to reorder the entity by name, id.

set a .finalcheck
catch {destroy $a}
toplevel $a
wm deiconify $a
wm title $a "FINAL CHECKS"
wm geometry $a 300x350+250+250
wm resizable $a 0 0
proc delete {} {
	*createmark surfaces 1 "displayed"
	if {[hm_marklength surfaces 1]!= 0} {*deletemark surfaces 1}
}
proc unused {} {
set b {material property loadcollector  }
foreach x $b {
*EntityPreviewUnused $x 2
if {[hm_marklength $x 2] != 0} {*deletemark $x 2
} else {tk_messageBox -message "zero unused $x " -icon info
}
}
}
proc Empty {} {
set c { component assembly }
foreach y $c {
*EntityPreviewEmpty $y 1
if {[hm_marklength $y 1] != 0} {*deletemark $y 1
} else {tk_messageBox -message "zero unused $y " -icon info
}
}
}

proc reorder_n_renumber {} {
set c {component assembly material property loadcollector}
foreach x $c {
*createmark $x 1 "all"
if {[hm_marklength $x 1]!= 0} {*collectormarkmove $x 1 1 1}
}
} 

proc all {} {
delete
unused
Empty
reorder_n_renumber
}

button $a.01 -text "Delete surfaces" -command {delete}
place $a.01 -x 10 -y 10 -width 135 -height 75
button $a.02 -text "Empty Entities" -command {Empty}
place $a.02 -x 145 -y 10 -width 135 -height 75
button $a.03 -text "Unused Entities" -command {unused}
place $a.03 -x 10 -y 95 -width 135 -height 75
button $a.04 -text "REORDERnRENUMBER" -command {reorder_n_renumber}
place $a.04 -x 145 -y 95 -width 135 -height 75
button $a.05 -text "MASTER" -background red -command {all}
place $a.05 -x 67.5 -y 190 -width 135 -height 75

OUTPUT

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.

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.