Challenge

Project - 2 - Generating the report for hypermesh file

OBJECTIVE:

To create an ergonomic and visually appealing excel (.xlsm) report that contains the 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

PROCEDURE:

  • Firstly, set to open a file named Challenge14.csv in the write mode.
  • Now print the computer name on the file by using the command env(COMPUTERNAME).
  • Similarly, print the date and time using the command [clock format [clock second]].
  • Get the current solver used using the hm_getsolver command and then print it in the file.
  • Now using the llength command compute the number of each entities present in the hypermesh file and then print it in the .csv file.
  • Similarly, compute for the number of empty and unused entities by using the commands *EntityPreviewEmpty and *EntityPreviewUnused.
  • Now look for the failed elements in the hypermesh file using *elementtest command for all the quality criteria. Then print it in the .csv file

CODE:

set filechannelid [open Challenge14.csv w]



#PART 1

puts $filechannelid "COMPUTER NAME , $env(COMPUTERNAME)"
puts $filechannelid [clock format [clock seconds]] 

#PART 2:
set profile [ hm_getsolver]
puts $filechannelid "The Current Profile/Deck is , $profile"

*createmark comp 1 "all"
set comp [hm_getmark comp 1]
set nu_of_comp [llength $comp]
puts $filechannelid "No of Components is , $nu_of_comp "

*createmark prop 1 "all"
set prop [hm_getmark prop 1]
set nu_of_prop [llength $prop]
puts $filechannelid "No of Properties , $nu_of_prop "

*createmark mat 1 "all"
set mat [hm_getmark mat 1]
set nu_of_mat [llength $mat]
puts $filechannelid "No of Materials , $nu_of_mat "

*createmark elems 1 "all"
set ele [hm_getmark elems 1]
set nu_of_elems [llength $ele]
*createmark elems 1 "by config" quad4
set nu_of_quad [hm_marklength elems 1]
*createmark elems 1 "by config" tria3
set nu_of_tria [hm_marklength elems 1]
puts $filechannelid "No of QUAD Elements , $nu_of_quad "
puts $filechannelid "No of TRIA Elements , $nu_of_tria "
puts $filechannelid "TOtal No of Elements , $nu_of_elems "


#PART 3:
*EntityPreviewEmpty comps 1
set COMPS_EM [hm_marklength comps 1]
puts $filechannelid "NUMBER OF EMPTY COMPONENTS , $COMPS_EM"

*EntityPreviewUnused prop 1
set PRP_C [hm_marklength prop 1]
puts $filechannelid "NUMBER OF UNUSED PROPERTY CARDS , $PRP_C"

*EntityPreviewUnused mat 1
set MAT_C [hm_marklength mat 1]
puts $filechannelid "NUMBER OF UNUSED MATERIAL CARDS , $MAT_C"

#PART 4:

set w 15
set asp 3
set min_l 2
set max_l 8
set skew 45
set jacobian 0.7
set tria_min_angle 20
set tria_max_angle 120
set quad_min_angle 45
set quad_max_angle 135


*createmark elements 1 "all" 
*elementtestwarpage elements 1 $w 2 2 0 " 2D Warpage "
set w_fail [hm_marklength elems 2]

*createmark elements 1 "displayed"
*elementtestaspect elements 1 $asp 2 2 0 " 2D Aspect Ratio "
set asp_fail [hm_marklength elems 2]

*createmark elems 1 "all"
*elementtestlength elems 1 $min_l 2 1 2 0 "2D Min Length"
set min_len_fail [hm_marklength elems 2]

*createmark elems 1 "all"
*elementtestlength elems 1 $max_l 2 0 2 0 "2D Max Length"
set max_len_fail [hm_marklength elems 2]

*createmark elems 1 "all"
*elementtestskew elements 1 $skew 2 2 0 " Skew "
set skew_fail [hm_marklength elems 2]

*createmark elems 1 "all"
*elementtestjacobian elements 1 $jacobian 2 2 0 " Jacobian "
set jacobian_fail [hm_marklength elems 2]

*createmark elems 1 "all"
*elementtestinterangle elements 1 $tria_min_angle 1 2 1 2 0 " Tria Min Angle "
set tria_min_fail [hm_marklength elems 2]

*createmark elems 1 "all"
*elementtestinterangle elements 1 $tria_max_angle 1 2 0 2 0 " Tria Max Angle "
set tria_max_fail [hm_marklength elems 2]

*createmark elems 1 "all"
*elementtestinterangle elements 1 $quad_min_angle 0 2 1 2 0 " 2D Quad Min Angle "
set quad_min_fail [hm_marklength elems 2]

*createmark elems 1 "all"
*elementtestinterangle elements 1 $quad_max_angle 0 2 0 2 0 " 2D Quad Max Angle "
set quad_max_fail [hm_marklength elems 2]


puts $filechannelid "Element Quality , Number of Failed Elements , Percentage of Failed Elements"
puts $filechannelid "2D Warpage , $w_fail of $nu_of_elems , $[expr $w_fail/$nu_of_elems*100]"
puts $filechannelid "Aspect Ratio , $asp_fail of $nu_of_elems , $[expr $asp_fail/$nu_of_elems*100]"
puts $filechannelid "Minimum length , $min_len_fail of $nu_of_elems , $[expr $min_len_fail/$nu_of_elems*100]"
puts $filechannelid "Maximum length , $max_len_fail of $nu_of_elems , $[expr $max_len_fail/$nu_of_elems*100]"
puts $filechannelid "Skew , $skew_fail of $nu_of_elems , $[expr $skew_fail/$nu_of_elems*100]"
puts $filechannelid "Jacobian , $jacobian_fail of $nu_of_elems , $[expr $jacobian_fail/$nu_of_elems*100]"
puts $filechannelid "Min Tria Angle , $tria_min_fail of $nu_of_tria , $[expr $tria_min_fail/$nu_of_elems*100]"
puts $filechannelid "Max Tria Angle , $tria_max_fail of $nu_of_tria , $[expr $tria_max_fail/$nu_of_elems*100]"
puts $filechannelid "Min Quad Angle , $quad_min_fail of $nu_of_quad , $[expr $quad_min_fail/$nu_of_elems*100]"
puts $filechannelid "Max Quad Angle , $quad_max_fail of $nu_of_quad , $[expr $quad_max_fail/$nu_of_elems*100]"

close $filechannelid

CONCLUSION:

Generated the report for the hypermesh file using the tcl script.

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.