Challenge

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 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

CODE

  • First, in order to create components and property and to assign respective property to the component, I have used (*createentity, *setvalue, *propertyupdate) in two different procedures in the name of solver profile.

  • Then parent component and target componet is marked using (*createmarkpanel comp)
  • The elements are copied into the user-defined component using (*copymark)
  • The centroid of the target component and parent component found using (hm_centroid ) command which gives an output of coordinates of centroid then the node is added to the centroid of the component using (*createnode)
  • The two nodes in between two centroid node are created using (*createnodebetweennodescreate)
  • The plane is created using (*createplane )command with obtained plane coordinate obtained previously in a mark id
  • And Then the elements were reflected using the (*reflectmarkwithoption)
  • Then the null condition is defined if there are no elements in parent component using if condition with an popup say that there is no elements in the selected component using (tk_messagebox) command

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
}
}


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.