All Courses
All Courses
Courses by Software
Courses by Semester
Courses by Domain
Tool-focused Courses
Machine learning
POPULAR COURSES
Success Stories
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…
Akash M
updated on 20 Dec 2021
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:
Code:
set filechannelid [open output.csv w]
puts $filechannelid "Username,$env(USERNAME)"
set systemTime [clock seconds]
puts $filechannelid "Time,[clock format $systemTime -format %H:%M:%S]"
puts $filechannelid "Date,[clock format $systemTime -format %D]"
# Profile/deck
set profile [hm_info templatetype]
puts $filechannelid "Profile,$profile"
# Components
*createmark components 1 "all"
set comp [hm_getmark components 1]
set no_of_comp [llength $comp]
puts $filechannelid "Total number of components,$no_of_comp"
*createmark elements 1 "all"
set elem [hm_getmark elements 1]
set no_of_elems [llength $elem]
puts $filechannelid "Total number of elements,$no_of_elems"
*createmark properties 1 "all"
set prop [hm_getmark properties 1]
set no_of_prop [llength $prop]
puts $filechannelid "Total number of properties,$no_of_prop"
*createmark materials 1 "all"
set mat [hm_getmark materials 1]
set no_of_mat [llength $mat]
puts $filechannelid "Total number of materials,$no_of_mat"
*createmark elements 1
# Unused and Empty
*EntityPreviewEmpty comps 1
set empty_comp [hm_marklength comps 1]
puts $filechannelid "No.of.empty components,$empty_comp"
*EntityPreviewUnused properties 1
set unused_prop [hm_marklength properties 1]
puts $filechannelid "No.of.unused properties,$unused_prop"
*EntityPreviewUnused materials 1
set unused_mat [hm_marklength materials 1]
puts $filechannelid "No.of.unused materials,$unused_mat"
#_________________________________________________________________#
puts $filechannelid "Quality Criteria,Failed Elements"
*clearmarkall 1
*createmark elements 1 "all"
*elementtestlength elements 1 2 2 1 2 0 " 2D Min Length "
*maskentitymark elements 2 0
*maskreverse elements
*createmark elements 1 "displayed"
set n_minl [hm_marklength elements 1]
*unmaskall2
puts $filechannelid "Minimum Length,$n_minl"
*clearmarkall 1
*createmark elements 1 "all"
*elementtestlength elements 1 8 2 0 2 0 " 2D Min Length "
*maskentitymark elements 2 0
*maskreverse elements
*createmark elements 1 "displayed"
set n_maxl [hm_marklength elements 1]
*unmaskall2
puts $filechannelid "Maximum Length,$n_maxl"
*clearmarkall 1
*createmark elements 1 "all"
*elementtestaspect elements 1 5 2 2 0 " 2D Aspect Ratio "
*maskentitymark elements 2 0
*maskreverse elements
*createmark elements 1 "displayed"
set n_asp [hm_marklength elements 1]
*unmaskall2
puts $filechannelid "Aspect Ratio,$n_asp"
*clearmarkall 1
*createmark elements 1 "all"
*elementtestskew elements 1 45 2 2 0 " 2D Skew "
*maskentitymark elements 2 0
*maskreverse elements
*createmark elements 1 "displayed"
set n_skew [hm_marklength elements 1]
*unmaskall2
puts $filechannelid "Minimum Length,$n_skew"
*clearmarkall 1
*createmark elements 1 "all"
*elementtestwarpage elements 1 10 2 2 0 " 2D Warpage "
*maskentitymark elements 2 0
*maskreverse elements
*createmark elements 1 "displayed"
set n_war [hm_marklength elements 1]
*unmaskall2
puts $filechannelid "Warpage,$n_war"
*clearmarkall 1
*createmark elements 1 "all"
*elementtestjacobian elements 1 0.7 2 2 0 " 2D Jacobian "
*maskentitymark elements 2 0
*maskreverse elements
*createmark elements 1 "displayed"
set n_jac [hm_marklength elements 1]
*unmaskall2
puts $filechannelid "Jacobian,$n_jac"
*clearmarkall 1
*createmark elements 1 "all"
*elementtestinterangle elements 1 45 0 2 1 2 0 " 2D Quad Min Angle "
*maskentitymark elements 2 0
*maskreverse elements
*createmark elements 1 "displayed"
set n_min_qa [hm_marklength elements 1]
*unmaskall2
puts $filechannelid " Minimum Quad Angle,$n_min_qa"
*clearmarkall 1
*createmark elements 1 "all"
*elementtestinterangle elements 1 135 0 2 0 2 0 " 2D Quad Max Angle "
*maskentitymark elements 2 0
*maskreverse elements
*createmark elements 1 "displayed"
set n_max_qa [hm_marklength elements 1]
*unmaskall2
puts $filechannelid "Maximum Quad Angle,$n_max_qa"
*clearmarkall 1
*createmark elements 1 "all"
*elementtestinterangle elements 1 20 1 2 1 2 0 " 2D Tria Min Angle "
*maskentitymark elements 2 0
*maskreverse elements
*createmark elements 1 "displayed"
set n_min_ta [hm_marklength elements 1]
*unmaskall2
puts $filechannelid "Minimum Tria Angle,$n_min_ta"
*clearmarkall 1
*createmark elements 1 "all"
*elementtestinterangle elements 1 120 1 2 0 2 0 " 2D Tria Max Angle "
*maskentitymark elements 2 0
*maskreverse elements
*createmark elements 1 "displayed"
set n_max_ta [hm_marklength elements 1]
*unmaskall2
puts $filechannelid "Maximum Tria Angle,$n_max_ta"
puts $filechannelid "Component_id,Component_name,Thickness,Property,Material"
*clearmarkall 1
*createmark components 1 "all"
set compid [hm_getmark components 1]
foreach info $compid {
*createmark elements 1 1 "by collector id" $info
set comp_name [hm_entityinfo name components $info]
set thickness [hm_getthickness components $info]
set prop_name [hm_getvalue component id=$info dataname=property.name]
set mat_name [hm_getvalue component id=$info dataname=material.name]
puts $filechannelid "$info,$comp_name,$thickness,$prop_name,$mat_name"
}
close $filechannelid
Procedure and code explanation:
[open output.csv w] is used to open new .csv or .xlsm files. 'w' represents write mode since we generating the report.
$env(USERNAME) is used get the username of the system. puts $filechannelid is the command that actually prints all the given information in the file.
[clock seconds] command has been used to get the time and date. It updtaes date and time every time you run the code.
clock format $systemTime -format %H:%M:%S is the command used to get times in HH:MM:SS format, i.e. hours, minutes and seconds. clock format $systemTime -format %D is the command used to get date in DD:MM:YY format.
hm_info templatetype is used to get the profile/deck.
To get the component count, hm_getmark command is used and store those values in a variables. llength command is used tp get the total number of components. Then use this procedure to get the total number of properties, materials and elements.
*EntityPreviewEmpty command is used to get the empty component and *EntityPreviewUnused command is used to get unused properties and materials and hm_marklength command is used to get the number of empty components and unsed properties, materials.
*createmark elements 1 "all"
*elementtest(quality) entity_type mark_id value output_mark_id dimension contour " title" (change as per quality type)
*maskentitymark elements 2 0
*maskentitymark elements 2 0 elements
*createmark elements 1 "displayed"
set variable_name [hm_marklength elements 1]
*unmaskall2
*maskentitymark command is used to mask entities and *maskentitymark command is unsed reversing the masked entities and *unmaskall2 command is unmask all the entities.
*createmark elements 1 1 "by collector id" command is used to get all the components by its id.
hm_entityinfo name components $info command is used get the component names. $info is the variable name where all the components are stored.
hm_getthickness components $info command is used to the component thickness.
hm_getvalue component id=$info dataname=property.name command is used to get the property names.
hm_getvalue component id=$info dataname=material.name command is used to get the material names.
close $filechannelid is used to close the file.
Output:
Conclusion:
Sucessfully generated the report for hypermesh file that contains username, date, time, no.of.components, properties, materials and properties, no.of,empty components. no.of.unused properties and materials, no.of.failed elements.
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.