All Courses
All Courses
Courses by Software
Courses by Semester
Courses by Domain
Tool-focused Courses
Machine learning
POPULAR COURSES
Success Stories
Aim: To create a code that performs reflecting the geometry Objective: Create a macro that will reflect given multicomponent FE part with ease It should be independent of deck The inputs should be original CAD comp, reflected CAD comp and original FE comps …
Akash M
updated on 07 Dec 2021
Aim:
To create a code that performs reflecting the geometry
Objective:
Create a macro that will reflect given multicomponent FE part with ease
It should be independent of deck
The inputs should be 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.
Code:
proc optistruct {c t} {
set opti [hm_getsolver]
if {$opti == "optistruct"} {
set n $c
set m $t
*createmark comps 1 $n
if {[hm_entityinfo exist comps $n] !=0} {
puts [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 {c t} {
set radi [hm_getsolver]
if {$radi == "radioss"} {
set n $c
set m $t
*createmark comps 1 $n
if {[hm_entityinfo exist comps $n] !=0} {
puts [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_info templatetype]
foreach i $o_fea {
set t [hm_getthickness comps $i]
set old_n [hm_entityinfo name comps $i]
set n $name$t
$profile $n $t
*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;
Procedure and code explanation:
In order to create components and property create a procedure called optistruct
set opti [hm_getsolver] command is used to find the solver deck
if {$opti == "optistruct"} command is used if the deck is optstruct then you can proceed with further commands
*createmark comps 1 $n is the command that is used to store the components into a mark id 1
if {[hm_entityinfo exist comps $n] !=0} is used to find the exists component with the same name. If there are any tk_messageBox -message "The Component already exists" -icon warning -type ok -title Message command is used to dispay the message box with warning of "The Component already exists"
*createentity comps cardimage=Part includeid=0 name=$n is the command that is used to create a component with the specified name.
*createentity props cardimage=PSHELL includeid=0 name=$n is the command that is used to create a property with the specified name.
*setvalue props name=$n STATUS=1 95=$t is the command used to assign thickness with the specified value.
Using this procedure, create another procedure called radioss or you can create any solver deck.
To select the parent component and target component *createmarkpanel is used. It will open the particular entity panel to choose. using this command parent component, target component and the FE component is selected.
foreach loop is used for every component 'i' present in the list 'o_fea'. The thickness of the compoent 'i' is stored in variable 't' and name of the component 'i' stored in 'old_n'.
A new variable 'n' has the concatenation of 'name' and 't'. This creates the respective component and property to which the reflected elements will be added.
A mark is created for all the elements in component 'old_n'and these are copied to the component 'n'.
Then the components 'old_n' are turned off and the foreach loop is ended.
Then a mark is created with all surfaces in 'o_geom'. The centroid for target and original geometries is created and stored in 'o_cog' and 't_cog' respectively. A node is created at each centroid named 'o_node' and 't_node' respectively.
A mark is created with all displayed elements and a intercept is created at intercept value and centre point between the centroids.
Then the elements are reflected with the created plane as refenrence. Then the equivalence is checked and corrected for the torelence value of 0.01 by using the command *equivalence components 1 0.01 1 0 0.
Output:
Conclusion:
Sucessfully created a macro for auto reflecting in hypermesh and the elemnts got reflected.
Leave a comment
Thanks for choosing to leave a comment. Please keep in mind that all the comments are moderated as per our comment policy, and your email will not be published for privacy reasons. Please leave a personal & meaningful conversation.
Other comments...
Project - 2 - Generating the report for hypermesh file
Aim: To generate the report for hypermesh file Objective: To create an ergonomic and visually appealing excel (.xlsm) report that contains following information about your model: User name, date, time Profile/deck; count of component, prop, material, elements Count of empty comp/prop/mats Elements…
20 Dec 2021 07:48 AM IST
Project 1- Building a Master TCL/TK Macro
Aim: To create a master TCL/TK macro that performs several operations such as finding and correcting normals, final checks, creating components, reflecting geometry, creating connections and identify identical components. Objective: It should contain buttons that will call all utilities created as assignments during…
10 Dec 2021 05:13 AM IST
Week - 9 - Reflecting the geometry
Aim: To create a code that performs reflecting the geometry Objective: Create a macro that will reflect given multicomponent FE part with ease It should be independent of deck The inputs should be original CAD comp, reflected CAD comp and original FE comps …
07 Dec 2021 03:01 PM IST
Week - 12 - Creating the locator, writing and reading the node data
Aim: To create a code that performs connections, identify the identical components and reading nodes from a file. Objective: Create a macro that builds a GUI containing 4 buttons. Component creator, weld, xloc, yloc, zloc. Upon pressing the buttons corresponding 1D element must be created…
07 Dec 2021 12:35 PM IST
Related Courses
0 Hours of Content
Skill-Lync offers industry relevant advanced engineering courses for engineering students by partnering with industry experts.
© 2025 Skill-Lync Inc. All Rights Reserved.