Challenge

Week - 9 - Reflecting the geometry

Report week 9 Reflecting the geometry

Objective: finish reflecting the geometry task

Problem Statement:

  • Create a macro that will reflect given multicomponent FE part with ease.
  • It should be independent of deck
  • Only inputs allowed are, original CAD comp, reflected CAD comp and original FE comps.
  • 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.

Tcl command explanation:

proc optistruct {c_name T} {
*createentity comps includeid=0 name= $c_name
*createentity props cardimage=PSHELL includeid=0 name=$c_name
*setvalue props name=$c_name STATUS=1 95=$T
*createmark components 1 "$c_name"
*propertyupdate components 1 "$c_name"
}
proc radioss {c_name T} {
*createentity comps cardimage=Part includeid=0 name=$c_name
*createentity props cardimage=P1_SHELL includeid=0 name=$c_name
*setvalue props name=$c_name STATUS=1 431=$T
*createmark components 1 "$c_name"
*propertyupdate components 1 "$c_name"
}
proc reflect {} {
# Inputs
set name [hm_getstring Componentname "Enter the component name followed by_ "]
*createmarkpanel comps 1 "Select the Parent component that to be reflected"
set p_comp [hm_getmark comps 1]
*createmarkpanel comps 1 "Select the Target component "
set T_comp [hm_getmark comps 1]
*createmarkpanel comps 1 "Select the component with FE"
set Fe_comp [hm_getmark comps 1]
set profile [hm_info templatetype]
set ii 1
# component name_duplicating_elems
foreach i $Fe_comp {
set T [hm_getthickness comps $i]
set c_name $name$T
$profile $c_name $T
set oc_name [hm_entityinfo name comps $i]
*createmark elems 1 $oc_name
set E [hm_marklength elems 1 ]
if {$E == 0} {
tk_messageBox -message "no elements were in the selected FE component" -icon info -type ok
set ii 0
break
}
*copymark elems 1 $c_name
*displaycollectorwithfilter comps "off" "$oc_name" 1 0
}

if {$ii==1} {
puts a
*createmark elems 2 "displayed"
*autocolorwithmark comps 2

#centroid
*clearmark 1 *clearmark 2
*createmark surfaces 1 "by collector" $p_comp
set p_cog [hm_getcentroid surfaces 1]
*createnode [lindex $p_cog 0] [lindex $p_cog 1] [lindex $p_cog 2]
*createmark node 1 -1
set p_node [hm_getmark node 1]
*createmark surfaces 1 "by collector" $T_comp
set T_cog [hm_getcentroid surfaces 1]
*createnode [lindex $T_cog 0] [lindex $T_cog 1] [lindex $T_cog 2]
*createmark node 1 -1
set T_node [hm_getmark node 1]
*clearmarkall 1

#Defining Plane LCS
set plane [hm_getdistance nodes $p_node $T_node 0]
#baseNode
*createnodesbetweennodes $p_node $T_node 1
*createmark node 1 -1
set B_node [hm_getmark node 1]
set B_node_lcs [hm_nodevalue $B_node]

#Reflect
*clearmarkall 1
*createmark elems 1 "displayed"
*createplane 1 [lindex $plane 1] [lindex $plane 2] [lindex $plane 3] [lindex $B_node_lcs 0 0] [lindex $B_node_lcs 0 1] [lindex $B_node_lcs 0 2]
*reflectmarkwithoption elems 1 1 0
}
}

Conclusion: task is finished by above code

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.