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

Problem statement:-

reflect of the comps that which user selects, we need to select the cad, relect position cad and original fe comps with inputs of name

Code

proc abaqus {a t1} {
set n [concat $a$t1]
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=SHELLSECTION 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 111=$t1 color=$clr
*setvalue comps id=$compid propertyid ={props $propid}}
}
proc Reflect {} {
*clearmarkall 1 ; *clearmarkall 2
set name [hm_getstring Component_Name "Enter the reflect component name ends with _"]
*createmarkpanel comps 1 "Select the reflect component"
set o_geom [hm_getmark comps 1]
*createmarkpanel comps 1 "Select the target geometry Component"
set t_geom [hm_getmark comps 1]
*createmarkpanel comps 1 "Select the reflect FE components"
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 u [string index $t 0]
set v [string index $t 2]
set p p
set Ts $u$p$v
set n [concat $name$Ts]
$profile $name $Ts
*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_nodeinfo [hm_nodevalue $m_node]
*clearmarkall 1
*createmark elems 1 "displayed"
*createplane 1 [lindex $intercepts 1] [lindex $intercepts 2] [lindex $intercepts 3] [lindex $m_nodeinfo 0 0] [lindex $m_nodeinfo 0 1] [lindex $m_nodeinfo 0 2]
*reflectmarkwithoption elems 1 1 0
*clearmarkall 1; *clearmarkall 2
*createmark comps 1 "displayed"
*equivalence comps 1 0.01 1 0 0
}
Reflect;

TCL command explanation:-

in Proc Abaqus it will check for two variables name as a and thickness t1 , name concatenation of name and thickness. it will check for name for duplicates. if exists. its show messagebox. while creating component ids and property ids , it saves the ids for assigning command

proc abaqus {a t1} {
set n [concat $a$t1]
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=SHELLSECTION 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 111=$t1 color=$clr
*setvalue comps id=$compid propertyid ={props $propid}}
}

here in the reflect procedure it will asks cad of reflecting cad with specific name and the originals fea and reflecting position cad as a input

it will take input as name and thickness from the existing fea such that it will store for each comp and reflect the same elements create with the concatenation command of given name and saved thickness of specific collector and display offs the selected feas

proc Reflect {} {
*clearmarkall 1 ; *clearmarkall 2
set name [hm_getstring Component_Name "Enter the reflect component name ends with _"]
*createmarkpanel comps 1 "Select the reflect component"
set o_geom [hm_getmark comps 1]
*createmarkpanel comps 1 "Select the target geometry Component"
set t_geom [hm_getmark comps 1]
*createmarkpanel comps 1 "Select the reflect FE components"
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 u [string index $t 0]
set v [string index $t 2]
set p p
set Ts $u$p$v
set n [concat $name$Ts]
$profile $name $Ts
*createmark elems 1 $old_n
*copymark elems 1 $n
*displaycollectorwithfilter comps "off" "$old_n" 1 0
}

by using hm_get cog, it gets cog of selected cads and using the nodes it creates the centre nodes and intercepts . by using these it will create a plane and run the reflect option

*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_nodeinfo [hm_nodevalue $m_node]
*clearmarkall 1
*createmark elems 1 "displayed"
*createplane 1 [lindex $intercepts 1] [lindex $intercepts 2] [lindex $intercepts 3] [lindex $m_nodeinfo 0 0] [lindex $m_nodeinfo 0 1] [lindex $m_nodeinfo 0 2]
*reflectmarkwithoption elems 1 1 0
*clearmarkall 1; *clearmarkall 2
*createmark comps 1 "displayed"
*equivalence comps 1 0.01 1 0 0
}
Reflect;

Conclusion:-

Thus Reflect the geometry by using the Tool Command Language

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.