Week - 9 - Reflecting the geometry
OBJECTIVE:
- Create a macro that will reflect the given multicomponent FE part with ease.
- It should be independent of the deck
- The only inputs allowed are, original CAD comp, reflected CAD comp and original FE comps.
- The name of the reflect component should also be taken as input from the user. Also, ask the user to suffix the name with an “_” by displaying a help string.
PROCEDURE:
- First, ask the user to input the component name followed by an underscore.
- Then ask the user to select the geometry to reflect.
- Then ask the user to select the target geometry.
- Now ask the user to select the target fea entities to reflect.
- Determine the solver being used and create component and property cards for the new fea entities.
- Now reflect the entities and hide the other entities
CODE:
proc optistruct {n t} {
*createmark comps 1 $n
if {[hm_entityinfo exist comps $n] !=0} {
tk_messageBox -message "The Component already exists" -icon warning -type ok -title Message
} else {
*createentity comps cardimage=Part includeid=0 name=$n;
*createmark comps 1 $n
set compid [hm_getmark comps 1]
*createentity props cardimage=PSHELL includeid=0 name=$n;
*createmark props 2 $n
set propid [hm_getmark props 2]
*setvalue props id=$propid STATUS=1 95=$t;
*setvalue comps id=$compid propertyid={props $propid};
}
}
proc radioss {n t} {
*createmark comps 1 $n
if {[hm_entityinfo exist comps $n] !=0} {
tk_messageBox -message "The Component already exists" -icon warning -type ok -title Message
} else {
*createentity comps cardimage=Part includeid=0 name=$n;
*createmark comps 1 $n
set compid [hm_getmark comps 1]
*createentity props cardimage=P1_SHELL includeid=0 name=$n;
*createmark props 2 $n
set propid [hm_getmark props 2]
*setvalue props id=$propid STATUS=1 431=$t;
*setvalue comps id=$compid propertyid={props $propid};
}
}
proc reflect {} {
*clearmarkall 1; *clearmarkall 2;
set name [hm_getstring Component_Name "Enter name of reflect component followed by _"]
*createmarkpanel comps 1 "Select the component containing original geometry to be reflected"
set o_geom [hm_getmark comp 1]
*createmarkpanel comps 1 "Select the component containing target geometry"
set t_geom [hm_getmark comp 1]
*createmarkpanel comps 1 "Select the FE components you want to reflect"
set o_fea [hm_getmark comps 1]
set profile [hm_getsolver]
foreach i $o_fea {
set t [hm_getthickness comps $i]
set old_n [hm_entityinfo name comps $i]
set n $name$t
if {$profile == "radioss" ||$profile == "optistruct"} {
$profile $n $t
} else {tk_messageBox -message "Solver not available in the student version" -icon warning -type ok -title Message}
*createmark elements 1 $old_n
*copymark elements 1 $n
*displaycollectorwithfilter components "off" "$old_n" 1 0
}
*createmark comps 2 "displayed"
*autocolorwithmark components 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 node 2 -1
set o_node [hm_getmark node 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 node 2 -1
set t_node [hm_getmark node 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_node_info [hm_nodevalue $m_node];
*clearmarkall 1;
*createmark elements 1 "displayed"
*createplane 1 [lindex $intercepts 1] [lindex $intercepts 2] [lindex $intercepts 3] [lindex $m_node_info 0 0] [lindex $m_node_info 0 1] [lindex $m_node_info 0 2]
*reflectmarkwithoption elements 1 1 0;
*clearmarkall 1; *clearmarkall 2;
*createmark component 1 "displayed"
*equivalence components 1 0.01 1 0 0
}
reflect;
CONCLUSION:
- Learned to reflect entities using tcl/tk.