Challenge

TCL/TK PROJECT 1: Creating a master GUI for Hypermesh

AIM: To create a master GUI which includes all the macros created in previous assignments such as quality checks, creating welds, auto reflecting, etc using TCL/TK.

PROCEDURE: The code for creating the master GUI is given below:

*clearmarkall 1; *clearmarkall 2
*setnormalsdisplaytype 1
*setsurfacenormalsdisplaytype 1

proc normon {} {*createmark elems 1 "displayed"; if {[hm_marklength elems 1]!=0} {*normalsdisplay elems 1 1}}

proc normoff {} {*createmark elems 1 "displayed"; if {[hm_marklength elems 1]!=0} {*normalsoff}}

proc revnorm {} {*createmarkpanel elems 1 "Select elements for reversing normal"
	if {[hm_marklength elems 1]!=0} {*normals elems 2}; *normalsoff}

proc del_linpoint {a} {*createmark $a 1 "displayed"
	*createmark elems 2 "displayed"
	if {[hm_marklength elements 2] ==0} {if {[hm_marklength $a 1]!=0} {*deletemark $a 1}}}

proc del_entity {g} {*createmark $g 1 "displayed"; if {[hm_marklength $g 1]!=0} {*deletemark $g 1}}

proc del_empty {b} {*EntityPreviewEmpty $b 1; if {[hm_marklength $b 1]!=0} {*deletemark $b 1}}

proc del_unused {c} {*EntityPreviewUnused $c 1; if {[hm_marklength $c 1]!=0} {*deletemark $c 1}}

proc del_all {f} {*createmark $f 1 "all"; if {[hm_marklength $f 1]!=0} {*deletemark $f 1}}

proc reord {d} {*createmark $d 1 "all"; if {[hm_marklength $d 1]!=0} {*collectormarkmove $d 1 1 1}}

proc renum {e} {*createmark $e 1 "all"; if {[hm_marklength $e 1]!=0} {*renumbersolverid $e 1 1 1 0 0 0 0 0}}

proc disp_edges {} {*setdisplayattributes 4 1
	*createmark elems 1 "displayed"
	if {[hm_marklength elems 1]!=0} {*equivalence elements 1 0.01 0 0 0}
	*createmark elements 1 "displayed"
	if {[hm_marklength elems 1]!=0} {*equivalence elements 1 0.01 3 0 0}
	*createmark nodes 1 "retrieve"
	if {[hm_marklength nodes 1]!=0} {*nodemarkaddtempmark 1}
	if {[hm_entityinfo exist components tedge]==0} {
		if {[hm_marklength elems 1]!=0} {*findedges1 elements 1 1 0 0 30}
		if {[hm_entityinfo exist components ^edges]==1} {
		set a [hm_getvalue components name="^edges" dataname=id]
		*setvalue components id=$a name=tedge}} 
	if {[hm_entityinfo exist components tedge]==1} {*createmark components 1 "tedge"
		*setvalue components mark=1 color=#00ffff
		*setcomponentdisplayattributes "tedge" 2 1}
	*createmark elements 1 "displayed"
	if {[hm_marklength elems 1]!=0} {*findedges1 elements 1 0 0 0 30}
	if {[hm_entityinfo exist components ^edges]!=0} {*setcomponentdisplayattributes "^edges" 2 1}}

proc master {} { del_all solids; del_entity surfaces; del_linpoint points; del_linpoint lines
	del_empty components; del_empty elems; del_empty assemblies; del_unused properties 
	del_unused materials; reord components; reord materials; reord properties
	reord assemblies; renum elems; renum components; renum materials; renum properties; renum assemblies
		}

proc reorder {} {reord components; reord materials; reord properties; reord assemblies} 

proc renumber {} {renum elems; renum components; renum materials; renum properties; renum assemblies}

proc del_edge {} {*setdisplayattributes 2 0
if {[hm_entityinfo exist components tedge]==1} {*createmark components 1 "tedge";*deletemark components 1}
if {[hm_entityinfo exist components ^edges]==1} {*createmark components 1 "^edges";*deletemark components 1}
}

proc free_edge {} {
*clearmarkall 1
*setdisplayattributes 4 1
*createmark elems 1 "displayed"
*equivalence elements 1 0.01 0 0 0
*createmark elements 1 "displayed"
*equivalence elements 1 0.01 3 0 0
*createmark nodes 1 "retrieve"
*nodemarkaddtempmark 1
if {[hm_entityinfo exist components tedge]==0} {
	*findedges1 elements 1 1 0 0 30
	if {[hm_entityinfo exist components ^edges]==1} {
		set a [hm_getvalue components name="^edges" dataname=id]
		*setvalue components id=$a name=tedge}} 
if {[hm_entityinfo exist components tedge]==1} {*createmark components 1 "tedge"
	*setvalue components mark=1 color=#00ffff
	*setcomponentdisplayattributes "tedge" 2 1}
*createmark elements 1 "displayed"
*findedges1 elements 1 0 0 0 30
*setcomponentdisplayattributes "^edges" 2 1
}

proc hide_temp_nodes {} {*createmark nodes 1 "displayed"
*nodemarkcleartempmark 1}

proc nastran {a t1} {
	set n [concat $a $t1 "mm"]
	if {[hm_entityinfo exist comps $n]==0} {
		*createentity comps name=$n
		*createmark comps 1 $n
		set compid [hm_getmark comps 1]} else {puts "Entity already exists"}
	if {[hm_entityinfo exist props $n]==0} {
		*createentity props cardimage=PSHELL includeid=0 name=$n
		*createmark properties 2 $n
		set propid [hm_getmark props 2]
		set clr [hm_getvalue comps name=$n dataname=color]
		*setvalue props id=$propid STATUS=1 95=$t1 color=$clr
		*setvalue comps id=$compid propertyid ={props $propid}}
	}

proc radioss {b t2} {
	set m [concat $b $t2 "mm"]
	if {[hm_entityinfo exist comps $m]==0} {
		*createentity comps cardimage=Part includeid=0 name=$m
		*createmark comps 1 $m
		set compid [hm_getmark comps 1]} else {puts "Entity already exists"}
	if {[hm_entityinfo exist props $m]==0} {
		*createentity props cardimage=P1_SHELL includeid=0 name=$m
		*createmark properties 1 $m
		set propid [hm_getmark props 1]
		set clr2 [hm_getvalue comps name=$m dataname=color]
		*setvalue props id=$propid STATUS=1 431=$t2 color=$clr2
		*createmark comps 1 $m
		*propertyupdate comps 1 $m}
	}

proc reflect {} {
	*clearmarkall 1
	*clearmarkall 2
	set name [hm_getstring Component_Name "Enter the name of the reflect component followed by _"]
	*createmarkpanel comps 1 "Please select the component to be reflected"
	set o_geom [hm_getmark comps 1]
	*createmarkpanel comps 1 "Please select the component containing target geometry"
	set t_geom [hm_getmark comps 1]
	*createmarkpanel comps 1 "Please select the FE components to be reflected"
	set o_fea [hm_getmark comps 1]
	set profile [hm_info templatetype]
	foreach i $o_fea {
		set t [hm_getthickness comps $i]
		set old_n [hm_entityinfo name comps $i]
		set n [concat $name $t "mm"]
		$profile $name $t
		*createmark elems 1 $old_n
		*copymark elems 1 $n
		*displaycollectorwithfilter comps "off" "$old_n" 1 0
		}
	*createmark comps 2 "displayed"
	*autocolorwithmark comps 2
	*clearmarkall 1
	*clearmarkall 2
	
	*createmark surfaces 1 "by collector" $o_geom
	set o_cog [hm_getcentroid surfaces 1]
	*createnode [lindex $o_cog 0] [lindex $o_cog 1] [lindex $o_cog 2] 0
	*createmark nodes 2 -1
	set o_node [hm_getmark nodes 2]
	*createmark surfaces 1 "by collector" $t_geom
	set t_cog [hm_getcentroid surfaces 1]
	*createnode [lindex $t_cog 0] [lindex $t_cog 1] [lindex $t_cog 2] 0
	*createmark nodes 2 -1
	set t_node [hm_getmark nodes 2]	
	
	set intercepts [hm_getdistance nodes $o_node $t_node 0]
	*clearmarkall 1
	*createnodesbetweennodes $o_node $t_node 1
	*createmark nodes 1 -1
	set m_node [hm_getmark nodes 1]
	set m_value [hm_nodevalue $m_node]
	
	*clearmarkall 1
	*createmark elems 1 "displayed"
	*createplane 1 [lindex $intercepts 1] [lindex $intercepts 2] [lindex $intercepts 3] [lindex $m_value 0 0] [lindex $m_value 0 1] [lindex $m_value 0 2]
	*reflectmarkwithoption elems 1 1 0
	*clearmarkall 1; *clearmarkall 2
	*createmark comps 1 "displayed"
	*equivalence comps 1 0.01 1 0 0
	*clearmarkall 1
	*createmark comps 1 "all"
	}

proc mid_line {} {
	*clearmarkall 1; *clearmarkall 2
	*createlistbypathpanel lines 1 "Select source lines by path"
	set source [hm_getlist lines 1]
	*createlistbypathpanel lines 2 "Select destination lines by path"
	set target [hm_getlist lines 2]
	*createlist nodes 1
	*createlist nodes 2
	set mid_list ""
	foreach i $source j $target {
		*createlist lines 1 $i
		*createlist lines 2 $j
		*linescreatemidline 1 1 2 2
		*createmark lines 1 -1
		set mid [hm_getmark lines 1]
		lappend mid_list $mid}
	set y [llength $mid_list]
	*linecombine [lindex $mid_list 0] [lindex $mid_list 1]
	*createmark lines 1 -1
	set k [hm_getmark lines 1]
	set x 2
	while {$x<[expr $y]} {
		*linecombine [lindex $mid_list $x] $k 0
		*createmark lines 1 -1
		set k [hm_getmark lines 1]
		incr x}
}

proc warpage {a} {
	*clearmarkall 1; *clearmarkall 2
	*createmark elems 1 "displayed"
	*createmark elems 2 
	if {[hm_marklength elems 1] !=0} {*elementtestwarpage elems 1 $a 2 2 0 "2D Warpage"
	*maskentitymark elems 2 0
	*maskreverse elems 
	*createmark nodes 1 "displayed"
	*nodemarkaddtempmark 1
	*unmaskall2}}

proc min_len_2d {b} {
	*clearmarkall 1; *clearmarkall 2
	*createmark elems 1 "displayed"
	*createmark elems 2 
	if {[hm_marklength elems 1] !=0} {*elementtestlength elems 1 $b 2 1 2 0 "Minimum edge length"
	if {[hm_marklength elems 2] !=0} {
	*maskentitymark elems 2 0
	*maskreverse elems 
	*createmark nodes 1 "displayed"
	*nodemarkaddtempmark 1
	*unmaskall2}}}

proc min_len_3d {b} {
	*clearmarkall 1; *clearmarkall 2
	*createmark elems 1 "displayed"
	*createmark elems 2 
	if {[hm_marklength elems 1] !=0} {*elementtestlength elems 1 $b 2 1 4 0 "Minimum edge length"
	if {[hm_marklength elems 2] !=0} {
	*maskentitymark elems 2 0
	*maskreverse elems 
	*createmark nodes 1 "displayed"
	*nodemarkaddtempmark 1
	*unmaskall2}}}

proc max_len_2d {c} {
	*clearmarkall 1; *clearmarkall 2
	*createmark elems 1 "displayed"
	*createmark elems 2 
	if {[hm_marklength elems 1] !=0} {*elementtestlength elems 1 $c 2 0 2 0 "Maximum edge length"
	if {[hm_marklength elems 2] !=0} {
	*maskentitymark elems 2 0
	*maskreverse elems 
	*createmark nodes 1 "displayed"
	*nodemarkaddtempmark 1
	*unmaskall2}}}

proc aspect {d} {
	*clearmarkall 1; *clearmarkall 2
	*createmark elems 1 "displayed"
	*createmark elems 2 
	if {[hm_marklength elems 1] !=0} {*elementtestaspect elems 1 $d 2 2 0 "Aspect Ratio"
	if {[hm_marklength elems 2] !=0} {
	*maskentitymark elems 2 0
	*maskreverse elems 
	*createmark nodes 1 "displayed"
	*nodemarkaddtempmark 1
	*unmaskall2}}}

proc skew_2d {e} {
	*clearmarkall 1; *clearmarkall 2
	*createmark elems 1 "displayed"
	*createmark elems 2 
	if {[hm_marklength elems 1] !=0} {*elementtestskew elems 1 $e 2 2 0 "2D Skew"
	if {[hm_marklength elems 2] !=0} {
	*maskentitymark elems 2 0
	*maskreverse elems 
	*createmark nodes 1 "displayed"
	*nodemarkaddtempmark 1
	*unmaskall2}}}

proc skew_3d {e} {
	*clearmarkall 1; *clearmarkall 2
	*createmark elems 1 "displayed"
	*createmark elems 2 
	if {[hm_marklength elems 1] !=0} {*elementtestskew elems 1 $e 2 4 0 "Volumetric Skew"
	*maskentitymark elems 2 0
	*maskreverse elems 
	*createmark nodes 1 "displayed"
	*nodemarkaddtempmark 1
	*unmaskall2}}


proc jacobian {f} {
	*clearmarkall 1; *clearmarkall 2
	*createmark elems 1 "displayed"
	*createmark elems 2 
	if {[hm_marklength elems 1] !=0} {*elementtestjacobian elems 1 $f 2 2 0 "Jacobian"
	if {[hm_marklength elems 2] !=0} {
	*maskentitymark elems 2 0
	*maskreverse elems 
	*createmark nodes 1 "displayed"
	*nodemarkaddtempmark 1
	*unmaskall2}}}

proc min_tria_2d {g} {
	*clearmarkall 1; *clearmarkall 2
	*createmark elems 1 "displayed"
	*createmark elems 2 
	if {[hm_marklength elems 1] !=0} {*elementtestinterangle elems 1 $g 1 2 1 2 0 "Minimum length Tria"
	if {[hm_marklength elems 2] !=0} {
	*maskentitymark elems 2 0
	*maskreverse elems 
	*createmark nodes 1 "displayed"
	*nodemarkaddtempmark 1
	*unmaskall2}}}

proc min_tria_3d {g} {
	*clearmarkall 1; *clearmarkall 2
	*createmark elems 1 "displayed"
	*createmark elems 2 
	if {[hm_marklength elems 1] !=0} {*elementtestinterangle elems 1 $g 1 2 1 4 0 "Minimum length Tria"
	if {[hm_marklength elems 2] !=0} {
	*maskentitymark elems 2 0
	*maskreverse elems 
	*createmark nodes 1 "displayed"
	*nodemarkaddtempmark 1
	*unmaskall2}}}

proc max_tria_2d {h} {
	*clearmarkall 1; *clearmarkall 2
	*createmark elems 1 "displayed"
	*createmark elems 2 
	if {[hm_marklength elems 1] !=0} {*elementtestinterangle elems 1 $h 1 2 0 2 0 "Maximum length Tria"
	if {[hm_marklength elems 2] !=0} {
	*maskentitymark elems 2 0
	*maskreverse elems 
	*createmark nodes 1 "displayed"
	*nodemarkaddtempmark 1
	*unmaskall2}}}

proc max_tria_3d {h} {
	*clearmarkall 1; *clearmarkall 2
	*createmark elems 1 "displayed"
	*createmark elems 2 
	if {[hm_marklength elems 1] !=0} {*elementtestinterangle elems 1 $h 1 2 0 4 0 "Maximum length Tria"
	if {[hm_marklength elems 2] !=0} {
	*maskentitymark elems 2 0
	*maskreverse elems 
	*createmark nodes 1 "displayed"
	*nodemarkaddtempmark 1
	*unmaskall2}}}


proc min_quad_2d {i} {
	*clearmarkall 1; *clearmarkall 2
	*createmark elems 1 "displayed"
	*createmark elems 2 
	if {[hm_marklength elems 1] !=0} {*elementtestinterangle elems 1 $i 0 2 1 2 0 "Minimum quad length"
	if {[hm_marklength elems 2] !=0} {
	*maskentitymark elems 2 0
	*maskreverse elems 
	*createmark nodes 1 "displayed"
	*nodemarkaddtempmark 1
	*unmaskall2}}}


proc min_quad_3d {i} {
	*clearmarkall 1; *clearmarkall 2
	*createmark elems 1 "displayed"
	*createmark elems 2 
	if {[hm_marklength elems 1] !=0} {*elementtestinterangle elems 1 $i 0 2 1 4 0 "Minimum quad length"
	if {[hm_marklength elems 2] !=0} {
	*maskentitymark elems 2 0
	*maskreverse elems 
	*createmark nodes 1 "displayed"
	*nodemarkaddtempmark 1
	*unmaskall2}}}


proc max_quad_2d {j} {
	*clearmarkall 1; *clearmarkall 2
	*createmark elems 1 "displayed"
	*createmark elems 2 
	if {[hm_marklength elems 1] !=0} {*elementtestinterangle elems 1 $j 0 2 0 2 0 "Maximum quad length"
	if {[hm_marklength elems 2] !=0} {
	*maskentitymark elems 2 0
	*maskreverse elems 
	*createmark nodes 1 "displayed"
	*nodemarkaddtempmark 1
	*unmaskall2}}}

proc max_quad_3d {j} {
	*clearmarkall 1; *clearmarkall 2
	*createmark elems 1 "displayed"
	*createmark elems 2 
	if {[hm_marklength elems 1] !=0} {*elementtestinterangle elems 1 $j 0 2 0 4 0 "Maximum quad length"
	if {[hm_marklength elems 2] !=0} {
	*maskentitymark elems 2 0
	*maskreverse elems 
	*createmark nodes 1 "displayed"
	*nodemarkaddtempmark 1
	*unmaskall2}}}


proc tet_collapse {k} {
	*clearmarkall 1; *clearmarkall 2
	*createmark elems 1 "displayed"
	*createmark elems 2 
	if {[hm_marklength elems 1] !=0} {*elementtesttetracollapse elems 1 $k 2 0 "Tet Collapse"
	if {[hm_marklength elems 2] !=0} {
	*maskentitymark elems 2 0
	*maskreverse elems 
	*createmark nodes 1 "displayed"
	*nodemarkaddtempmark 1
	*unmaskall2}}}

set min_2d 2
set max_2d 8
set asp 5
set warp 30
set sk_2d 45
set jacob 0.6
set min_tria_2 20
set max_tria_2 120 
set min_quad_2 45
set max_quad_2 135
set min_3d 2
set sk_3d 45
set min_tria_3 20
set max_tria_3 120
set min_quad_3 45
set max_quad_3 135
set tet 0.15

proc identifier {} {
	*clearmarkall 1; *clearmarkall 2
	*createmark comps 1 "all" 
	if {[hm_marklength comps 1]!=0} {set comp_list [hm_getmark comps 1]
	set comp_length ""
	
	foreach i $comp_list {
		*clearmarkall 1
		*createmark surfaces 1 "by collector" $i
		lappend comp_length [hm_marklength surfaces 1]
		}
	
	*createmarkpanel comps 2 "Select target component"
	set targ_comp [hm_getmark comps 2]
	*isolateentitybymark 2
	*createmark surfs 1 "displayed"
	set targ_length [hm_marklength surfs 1]
	set matches [lsearch -all $comp_length $targ_length]
	
	
	foreach j $matches {
		*clearmarkall 1
		set comp_id [lindex $comp_list $j]
		set comp_name [hm_entityinfo name comps $comp_id]
		*displaycollectorwithfilter comps "on" "$comp_name" 0 1
		}}
	
}

proc spider_weld {} {
	*clearmarkall 1; *clearmarkall 2
	*currentcollector components "spider_welds"
	*createmarkpanel nodes 1 "Select nodes to create weld"
	*rigidlinkinodecalandcreate 1 0 0 123456
}

proc x_loc {} {
	*clearmarkall 1; *clearmarkall 2
	*currentcollector components "x_loc"
	*createmarkpanel nodes 1 "Select source nodes"
	set source [hm_getmark nodes 1]
	*createmarkpanel nodes 2 "Select destination nodes"
	set destination [hm_getmark nodes 2]
	*rigid $source $destination 156
}

proc y_loc {} {
	*clearmarkall 1; *clearmarkall 2
	*currentcollector components "y_loc"
	*createmarkpanel nodes 1 "Select source nodes"
	set source [hm_getmark nodes 1]
	*createmarkpanel nodes 2 "Select destination nodes"
	set destination [hm_getmark nodes 2]
	*rigid $source $destination 246
}

proc z_loc {} {
	*clearmarkall 1; *clearmarkall 2
	*currentcollector components "z_loc"
	*createmarkpanel nodes 1 "Select source nodes"
	set source [hm_getmark nodes 1]
	*createmarkpanel nodes 2 "Select destination nodes"
	set destination [hm_getmark nodes 2]
	*rigid $source $destination 345
}

proc comp_creator {} {
	if {[hm_entityinfo exist comps "spider_welds"] ==0} {*createentity comps name=spider_welds color=3}
	if {[hm_entityinfo exist comps "x_loc"] ==0} {*createentity comps name=x_loc color=56}
	if {[hm_entityinfo exist comps "y_loc"] ==0} {*createentity comps name=y_loc color=5}
	if {[hm_entityinfo exist comps "z_loc"] ==0} {*createentity comps name=z_loc color=6}
}

proc spot_weld {n k l} {
	*clearmarkall 1; *clearmarkall 2
	set name [hm_getstring "Weld name" "Give name for the weld component"]
	*createlistbypathpanel nodes 1 "Select source nodes by path"
	set source [hm_getlist nodes 1]
	*createlistbypathpanel nodes 2 "Select destination nodes by path"
	set target [hm_getlist nodes 2]
	*elementtype 5 1
	*createentity comps includeid=0 name=$n
	foreach i $k j $l {
		*rigid $i $j 123456}}

set win .window
catch {destroy $win}
toplevel $win -class TopClass
wm title $win "Master GUI"
wm geometry $win 650x860+200+200
wm resizable $win 0 0
wm deiconify $win 

label $win.01 -text "2D Element Quality" -bg grey -font {times 20 bold}
place $win.01 -x 10 -y 10 -width 300 -height 32

label $win.02 -text "3D Element Quality" -bg grey -font {times 20 bold}
place $win.02 -x 310 -y 10 -width 300 -height 32

button $win.03 -text "Min Edge Length" -font {times 10 bold} -command {min_len_2d $min_2d} 
place $win.03 -x 10 -y 60 -width 140 -height 32

entry $win.04 -textvariable min_2d -font {times 10 bold} -justify right
place $win.04 -x 160 -y 60 -width 140 -height 32

button $win.05 -text "Max Edge Length" -font {times 10 bold} -command {max_len_2d $max_2d}
place $win.05 -x 10 -y 110 -width 140 -height 32

entry $win.06 -textvariable max_2d -font {times 10 bold} -justify right
place $win.06 -x 160 -y 110 -width 140 -height 32

button $win.07 -text "Warpage" -font {times 10 bold} -command {warpage $warp}
place $win.07 -x 10 -y 160 -width 140 -height 32

entry $win.08 -textvariable warp -font {times 10 bold} -justify right
place $win.08 -x 160 -y 160 -width 140 -height 32

button $win.09 -text "Aspect Ratio" -font {times 10 bold} -command {aspect $asp}
place $win.09 -x 10 -y 210 -width 140 -height 32

entry $win.10 -textvariable asp -font {times 10 bold} -justify right
place $win.10 -x 160 -y 210 -width 140 -height 32

button $win.11 -text "2D Skew" -font {times 10 bold} -command {skew_2d $sk_2d}
place $win.11 -x 10 -y 260 -width 140 -height 32

entry $win.12 -textvariable sk_2d -font {times 10 bold} -justify right
place $win.12 -x 160 -y 260 -width 140 -height 32

button $win.13 -text "Jacobian" -font {times 10 bold} -command {jacobian $jacob}
place $win.13 -x 10 -y 310 -width 140 -height 32

entry $win.14 -textvariable jacob -font {times 10 bold} -justify right
place $win.14 -x 160 -y 310 -width 140 -height 32

button $win.15 -text "Min Tria Angle" -font {times 10 bold} -command {min_tria_2d $min_tria_2}
place $win.15 -x 10 -y 360 -width 140 -height 32

entry $win.16 -textvariable min_tria_2 -font {times 10 bold} -justify right
place $win.16 -x 160 -y 360 -width 140 -height 32

button $win.17 -text "Max Tria Angle" -font {times 10 bold} -command {max_tria_2d $max_tria_2}
place $win.17 -x 10 -y 410 -width 140 -height 32

entry $win.18 -textvariable max_tria_2 -font {times 10 bold} -justify right
place $win.18 -x 160 -y 410 -width 140 -height 32

button $win.19 -text "Min Quad Angle" -font {times 10 bold} -command {min_quad_2d $min_quad_2}
place $win.19 -x 10 -y 460 -width 140 -height 32

entry $win.20 -textvariable min_quad_2 -font {times 10 bold} -justify right
place $win.20 -x 160 -y 460 -width 140 -height 32

button $win.21 -text "Max Quad Angle" -font {times 10 bold} -command {max_quad_2d $max_quad_2}
place $win.21 -x 10 -y 510 -width 140 -height 32

entry $win.22 -textvariable max_quad_2 -font {times 10 bold} -justify right
place $win.22 -x 160 -y 510 -width 140 -height 32

button $win.23 -text "Min Edge Length" -font {times 10 bold} -command {min_len_3d $min_3d}
place $win.23 -x 320 -y 60 -width 140 -height 32

entry $win.24 -textvariable min_3d -font {times 10 bold} -justify right
place $win.24 -x 470 -y 60 -width 140 -height 32

button $win.25 -text "3D Skew" -font {times 10 bold} -command {skew_3d $sk_3d}
place $win.25 -x 320 -y 110 -width 140 -height 32

entry $win.26 -textvariable sk_3d -font {times 10 bold} -justify right
place $win.26 -x 470 -y 110 -width 140 -height 32

button $win.27 -text "Min Tria Angle" -font {times 10 bold} -command {min_tria_3d $min_tria_3}
place $win.27 -x 320 -y 160 -width 140 -height 32

entry $win.28 -textvariable min_tria_3 -font {times 10 bold} -justify right
place $win.28 -x 470 -y 160 -width 140 -height 32

button $win.29 -text "Max Tria Angle" -font {times 10 bold} -command {max_tria_3d $max_tria_3}
place $win.29 -x 320 -y 210 -width 140 -height 32

entry $win.30 -textvariable max_tria_3 -font {times 10 bold} -justify right
place $win.30 -x 470 -y 210 -width 140 -height 32

button $win.31 -text "Min Quad Angle" -font {times 10 bold} -command {min_quad_3d $min_quad_3}
place $win.31 -x 320 -y 260 -width 140 -height 32

entry $win.32 -textvariable min_quad_3 -font {times 10 bold} -justify right
place $win.32 -x 470 -y 260 -width 140 -height 32

button $win.33 -text "Max Quad Angle" -font {times 10 bold} -command {max_quad_3d $max_quad_3}
place $win.33 -x 320 -y 310 -width 140 -height 32

entry $win.34 -textvariable max_quad_3 -font {times 10 bold} -justify right
place $win.34 -x 470 -y 310 -width 140 -height 32

button $win.35 -text "Tet Collapse" -font {times 10 bold} -command {tet_collapse $tet}
place $win.35 -x 320 -y 360 -width 140 -height 32

entry $win.36 -textvariable tet -font {times 10 bold} -justify right
place $win.36 -x 470 -y 360 -width 140 -height 32

label $win.37 -text "Normals" -font {times 20 bold} -bg grey
place $win.37 -x 320 -y 410 -width 300 -height 32

button $win.38 -text "Normals On" -font {times 10 bold} -command {normon}
place $win.38 -x 320 -y 460 -width 140 -height 32

button $win.39 -text "Normals Off" -font {times 10 bold} -command {normoff}
place $win.39 -x 470 -y 460 -width 140 -height 32

button $win.40 -text "Reverse Normals" -font {times 10 bold} -command {revnorm}
place $win.40 -x 395 -y 510 -width 140 -height 32

label $win.41 -text "Auto Reflect Tool" -font {times 20 bold} -bg grey
place $win.41 -x 320 -y 560 -width 300 -height 32

button $win.42 -text "Auto Reflect" -font {times 10 bold} -command {reflect}
place $win.42 -x 395 -y 610 -width 140 -height 32

label $win.43 -text "Delete Entities" -font {times 20 bold} -bg grey
place $win.43 -x 10 -y 560 -width 300 -height 32

button $win.44 -text "Delete Empty Components" -font {times 10 bold} -command {del_empty comps}
place $win.44 -x 75 -y 610 -width 200 -height 32

button $win.45 -text "Delete Empty Elements" -font {times 10 bold} -command {del_empty elems}
place $win.45 -x 75 -y 660 -width 200 -height 32

button $win.46 -text "Delete Empty Assemblies" -font {times 10 bold} -command {del_empty assembs}
place $win.46 -x 75 -y 710 -width 200 -height 32

button $win.47 -text "Delete Unused Properties" -font {times 10 bold} -command {del_unused props}
place $win.47 -x 75 -y 760 -width 200 -height 32

button $win.48 -text "Delete Unusued Materials" -font {times 10 bold} -command {del_unused materials}
place $win.48 -x 75 -y 810 -width 200 -height 32

label $win.49 -text "Display Free and T edges" -font {times 15 bold} -bg grey
place $win.49 -x 320 -y 660 -width 300 -height 32

button $win.50 -text "Display edges" -font {times 10 bold} -command {disp_edges}
place $win.50 -x 320 -y 710 -width 140 -height 32

button $win.51 -text "Hide edges" -font {times 10 bold} -command {del_edge}
place $win.51 -x 470 -y 710 -width 140 -height 32

button $win.52 -text "Isolate Identical Components" -font {times 10 bold} -command {identifier}
place $win.52 -x 355 -y 760 -width 230 -height 32

button $win.53 -text "Reorder entities" -font {times 10 bold} -command {reorder}
place $win.53 -x 320 -y 810 -width 140 -height 32

button $win.54 -text "Renumber entities" -font {times 10 bold} -command {renumber}
place $win.54 -x 470 -y 810 -width 140 -height 32

The procedures created do the following things:

PROCEDURE

DESCRIPTION

normon

Display normals

normoff

Hide normals

revnorm

Reverse normals of selected elements

reord

Reorder selected entities

renum

Renumber selected entities

disp_edges

Display T and free edges

reflect

Reflect selected elements

warpage

Add temp nodes to elements that failed warpage criteria

min_len_2d

Add temp nodes to 2D elements that failed minimum length criteria

min_len_3d

Add temp nodes to 3D elements that failed minimum length criteria

max_len_2d

Add temp nodes to 2D elements that failed maximum length criteria

aspect

Add temp nodes to elements that failed aspect ratio criteria

skew_2d

Add temp nodes to 2D elements that failed skewness criteria

skew_3d

Add temp nodes to 3D elements that failed skewness criteria

jacobian

Add temp nodes to elements that failed jacobian criteria

min_tria_2d

Add temp nodes to 2D elements that failed minimum tria angle criteria

min_tria_3d

Add temp nodes to 3D elements that failed minimum tria angle criteria

max_tria_2d

Add temp nodes to 2D elements that failed maximum tria angle criteria

max_tria_3d

Add temp nodes to 3D elements that failed maximum tria angle criteria

min_quad_2d

Add temp nodes to 2D elements that failed minimum quad angle criteria

min_quad_3d

Add temp nodes to 3D elements that failed minimum quad angle criteria

max_quad_2d

Add temp nodes to 2D elements that failed maximum quad angle criteria

max_quad_3d

Add temp nodes to 3D elements that failed maximum quad angle criteria

tet_collapse

Add temp nodes to elements that failed tet collapse criteria

identifier

Identify identical components and isolate

The GUI is shown below:

CONCLUSION: The required master GUI was successfully created using TCL/TK.

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.