Challenge

Project - 2 - Generating the report for hypermesh file

Report Project - 2 - Generating the report for hypermesh file

Objective: finish Generating the report for hypermesh file

Problem Statement:

The final goal is 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 failed in all qualities or duplicates as discussed before

Tcl command explanation:

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

Conclusion: the 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.