TK GUI FOR FINAL PROCESS
TK GUI FOR FINAL PROCESS
OBJECTIVE:
To create a Graphics User Interface to complete final pre-process work like removing unwanted geometry, unused entities and re-order elements and components.
PROCEDURE:
DELETE GEOMETRY:
- Temp nodes, lines, points and solids get selected and deleted.
- A procedure is created to delete entities and buttons command procedure to delete according to user selection.
UNUSED/EMPTY:
- Un assigned properties, materials are get selected by using command hm_getunusedoremptyentities and those entities get deleted.
- Empty components and assemblies are also get by the above said command (by changing mode) and deleted accordingly.
RENUMBER:
- Elements, nodes and components was arranged with respect to current specification.
REORDER:
- Components are ordered with respect to name or ID as per user input.
MASTER PROCESS:
Master process will do all the above said operations in order. Final result will doesn’t have temp nodes, lines, solids, unused properties, materials, empty assembly and components. This will also renumber elements, nodes and components. Final components list will be arranged according to its name.
TCL COMMAND:
#Window name
set new .window
catch {destroy $new}
toplevel $new -class TopClass
#Window name
wm title $new "name"
wm geometry $new 720x310+500+500
#Procedure
#DELETE GEOMETRY
proc delete {a} {
*deleteelementsmode 0
*createmark surf 2 "displayed"
*maskmark surf 2
*createmark $a 1 "displayed"
set va [hm_getmark $a 1]
set val [string compare $a nodes]
if {$val==0 && $va!=0} {
*nodemarkcleartempmark 1
} elseif {$va>0} {
*deletemark $a 1
} else {puts "NOTHING TO DELETE"}
*unmaskall2
*deleteelementsmode 3
}
#DELETE UNUSED ENTITY
proc unused {b} {
set num1 [hm_getunusedoremptyentities mode=unused type=$b outputmark=2]
if {$num1>=0} {*deletemark $b 2}}
#DELETE EMPTY ENTITY
proc empty {c} {
set num2 [hm_getunusedoremptyentities mode=empty type=$c outputmark=2]
if {$num2>0} {*deletemark $c 2}}
#RENUMBER ENTITY
proc renumber {d} {
*createmark $d 1 "displayed"
set valc [hm_getmark $d 1]
if {$valc>0} {*renumbersolverid $d 1 1 1}
}
#REORDER COMPONENT
proc reorder {id} {
*createmark comps 1 "all"
set num3 [hm_getmark comps 1]
if {$num3>0} {*collectormarkmove comps 1 1 $id}
}
#MASTER PROGRAM
proc master {} {
delete nodes; puts "node"
delete points;puts "points"
delete solids; puts "solids"
delete lines; puts "lines"
empty assems; puts "assem"
empty comps
unused props
unused mats
renumber nodes
renumber elems
renumber comps
reorder 1
}
#Buttons
#Button dimentions
set w 130
button $new.00 -text "TEMPnNODES" -font {times 10 bold} -command {delete nodes}; place $new.00 -x 160 -y 10 -height 40 -width $w
button $new.01 -text "POINTS" -font {times 10 bold} -command {delete points}; place $new.01 -x 300 -y 10 -height 40 -width $w
button $new.02 -text "LINES" -font {times 10 bold} -command {delete lines}; place $new.02 -x 440 -y 10 -height 40 -width $w
button $new.03 -text "SOLIDS" -font {times 10 bold} -command {delete solids}; place $new.03 -x 580 -y 10 -height 40 -width $w
button $new.10 -text "ASSEMBLY" -font {times 10 bold} -command {empty assems}; place $new.10 -x 160 -y 70 -height 40 -width $w
button $new.11 -text "COMPONENTS" -font {times 10 bold} -command {empty comps}; place $new.11 -x 300 -y 70 -height 40 -width 130
button $new.12 -text "PROPERTY" -font {times 10 bold} -command {unused props}; place $new.12 -x 440 -y 70 -height 40 -width $w
button $new.13 -text "MATERIAL" -font {times 10 bold} -command {unused mats}; place $new.13 -x 580 -y 70 -height 40 -width $w
button $new.20 -text "NODES" -font {times 10 bold} -command {renumber nodes}; place $new.20 -x 160 -y 140 -height 40 -width $w
button $new.21 -text "ELEMENTS" -font {times 10 bold} -command {renumber elems}; place $new.21 -x 300 -y 140 -height 40 -width $w
button $new.22 -text "COMPONENTS" -font {times 10 bold} -command {renumber comps}; place $new.22 -x 440 -y 140 -height 40 -width 130
button $new.30 -text "BY NAME" -font {times 10 bold} -command {reorder 1}; place $new.30 -x 160 -y 200 -height 40 -width $w
button $new.31 -text "BY ID" -font {times 10 bold} -command {reorder 2}; place $new.31 -x 300 -y 200 -height 40 -width $w
button $new.40 -text "MASTER CLEANUP" -bg red -font {times 10 bold} -command {master}; place $new.40 -x 160 -y 260 -width 200 -height 40
#Labels
label $new.90 -text "DeletenGeoms" -font {times 10 bold}; place $new.90 -x 10 -y 10 -height 40 -width 120
label $new.91 -text "DeletenUnused/Empty" -font {times 10 bold}; place $new.91 -x 10 -y 70 -height 40 -width 120
label $new.92 -text "Re-number" -font {times 10 bold}; place $new.92 -x 10 -y 140 -height 40 -width 120
label $new.93 -text "REORDERnCOMPONENTS" -font {times 10 bold};place $new.93 -x 10 -y 200 -height 40 -width 120
TCL COMMAND AND EXPLANATION:
string compare -Compare 2 strings and return 0 if values are same.
*nodemarkcleartempmark -Clear/Delete temp nodes.
*deleteelementsmode -Topology revision method.(2-Keep mesh, 4-Advanced remesh)
hm_getunusedoremptyentities mode -Gets unused/empty (respect to mode selected) entities in entity edito
*renumbersolverid ?entity 1 a b c d -Renumber selected entity.[a-Initial value ,b-incremental value, c-offset mode, d-offset value)
*collectormarkmove comps 1 a b -Arrange components by name or ID. [a-Front/Back, b-By name/id]
button -Display button and excute command while pressed
*createmark -Create mark or select entities
SAMPLE IMAGES:
IMPORTED GEOM AND ENTITY:

FINAL GEOM AND ENTITY:


RESULT:
Here GUI is created for final pre-processing, individual and whole functions have been checked and verified.