Project - 2 - Generating the report for hypermesh file
Objective:
This project will test you on following abilities.
- Your expertise in the commands that have been taught to you
- Your ability to research for commands that will do what you intend to do
- Your skills in excel
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
Code:
# User name, date, time
*clearmarkall 1
*clearmarkall 2
set filename [open Output.csv w]
set systemname "$env(COMPUTERNAME)"
puts $filename "USERNAME-$systemname"
puts $filename [clock format [clock seconds]]
# Profile/deck; count of component, prop, material, elements
set profile [ hm_info templatetype]
puts $filename "Current Profile = $profile"
*createmark comp 1 "all"
set comp [hm_getmark comp 1]
set n_comp [llength $comp]
puts $filename "No of Components = $n_comp "
*createmark prop 1 "all"
set prop [hm_getmark prop 1]
set n_prop [llength $prop]
puts $filename "No of Properties = $n_prop "
*createmark mat 1 "all"
set mat [hm_getmark mat 1]
set n_mat [llength $mat]
puts $filename "No of Materials = $n_mat "
*createmark elems 1 "all"
set elems [hm_getmark elems 1]
set n_elems [llength $elems]
*createmark elems 1 "by config" quad4
set n_quad [hm_marklength elems 1]
*createmark elems 1 "by config" tria3
set n_tria [hm_marklength elems 1]
puts $filename "No of QUAD Elements t $n_quad "
puts $filename "No of TRIA Elements t $n_tria "
puts $filename "TOtal No of Elements t $n_elems "
# Count of empty comp/prop/mats
*EntityPreviewEmpty comps 1
set comp1 [hm_marklength comps 1]
set a1 [hm_getmark comps 1]
puts $filename "No of Empty Comps - $comp1"
*EntityPreviewUnused prop 1
set p1 [hm_marklength prop 1]
set b1 [hm_getmark prop 1]
puts $filename "No of Unused Properties - $p1"
*EntityPreviewUnused mat 1
set m1 [hm_marklength mat 1]
set c1 [hm_getmark mat 1]
puts $filename "No of Unused Materials - $m1"
# ElementQuality
set minlength {2}
*createmark elems 1 "all"
*elementtestlength elems 1 $minlength 2 1 2 0 "2D length <"
set minfail [hm_marklength elems 2]
set maxlength {8}
*createmark elems 1 "all"
*elementtestlength elems 1 $maxlength 2 0 2 0 "2D length >"
set maxfail [hm_marklength elems 2]
set skew {60}
*createmark elems 1 "all"
*elementtestskew elements 1 $skew 2 2 0 " 2D Skew "
set skewe [hm_marklength elems 2]
set jacobian {0.5}
*createmark elems 1 "all"
*elementtestjacobian elements 1 $jacobian 2 2 0 " 2D Jacobian "
set jacobiane [hm_marklength elems 2]
set triaminangle {20}
*createmark elems 1 "all"
*elementtestinterangle elements 1 $triaminangle 1 2 1 2 0 " 2D Tria Min Angle "
set triamine [hm_marklength elems 2]
set triamaxangle {120}
*createmark elems 1 "all"
*elementtestinterangle elements 1 $triamaxangle 1 2 0 2 0 " 2D Tria Max Angle "
set triamaxe [hm_marklength elems 2]
set quadminangle {45}
*createmark elems 1 "all"
*elementtestinterangle elements 1 $quadminangle 0 2 1 2 0 " 2D Quad Min Angle "
set quadmine [hm_marklength elems 2]
set quadmaxangle {135}
*createmark elems 1 "all"
*elementtestinterangle elements 1 $quadmaxangle 0 2 0 2 0 " 2D Quad Max Angle "
set quadmaxe [hm_marklength elems 2]
puts $filename "Element Quality Checks"
puts $filename "Minimum length - $minfail of $n_elems"
puts $filename "Maximum length - $maxfail of $n_elems"
puts $filename "Skew - $skewe of $n_elems"
puts $filename "Jacobian - $jacobiane of $n_elems"
puts $filename "Min Tria Angle - $triamine of $n_tria"
puts $filename "Max Tria Angle - $triamaxe of $n_tria"
puts $filename "Min Quad Angle - $quadmine of $n_quad"
puts $filename "Max Quad Angle - $quadmaxe of $n_quad"
close $filename
Explanation:
# User name, date, time
*clearmarkall 1
*clearmarkall 2
set filename [open Output.csv w]
set systemname "$env(COMPUTERNAME)"
puts $filename "USERNAME-$systemname"
puts $filename [clock format [clock seconds]]
#clearing of the previous saved items and saved in 1
#clearing of the previous saved items and saved in 2
#open the excel file named as output.csv and writing
#set the system name as required variables
#printing the username in the file
#print the clock in file
# Profile/deck; count of component, prop, material, elements
set profile [ hm_info templatetype]
puts $filename "Current Profile = $profile"
*createmark comp 1 "all" -- #
set comp [hm_getmark comp 1]
set n_comp [llength $comp]
puts $filename "No of Components = $n_comp "
*createmark prop 1 "all"
set prop [hm_getmark prop 1]
set n_prop [llength $prop]
puts $filename "No of Properties = $n_prop "
*createmark mat 1 "all"
set mat [hm_getmark mat 1]
set n_mat [llength $mat]
puts $filename "No of Materials = $n_mat "
*createmark elems 1 "all"
set elems [hm_getmark elems 1]
set n_elems [llength $elems]
*createmark elems 1 "by config" quad4
set n_quad [hm_marklength elems 1]
*createmark elems 1 "by config" tria3
set n_tria [hm_marklength elems 1]
puts $filename "No of QUAD Elements t $n_quad "
puts $filename "No of TRIA Elements t $n_tria "
puts $filename "TOtal No of Elements t $n_elems "
#checking for the template type and matching with the variables
#printing of profile name in the file
#checking for how many components and linked with variables
#printing the total number of components in the file
#how many props are linked with variables are checked
#printing the total number of properties in the file.
#how many materials are linked with variables are checked
#printing the total number of materials in the file
#checking of the total number of elements
#Number of quads present in the model
#Number of trias present in the model
#printing of total elements of quads and trias in the model
# Count of empty comp/prop/mats
*EntityPreviewEmpty comps 1
set comp1 [hm_marklength comps 1]
set a1 [hm_getmark comps 1]
puts $filename "No of Empty Comps - $comp1"
*EntityPreviewUnused prop 1
set p1 [hm_marklength prop 1]
set b1 [hm_getmark prop 1]
puts $filename "No of Unused Properties - $p1"
*EntityPreviewUnused mat 1
set m1 [hm_marklength mat 1]
set c1 [hm_getmark mat 1]
puts $filename "No of Unused Materials - $m1"
#checking of the empty components
#saving of the checked components as variables
#printing the number of components in a file
#checking for the unused properties
#saving of the unused checked props as variables
#printing the number of props in a file
#checking for the unused materials
#saving of the unused checked mat as varaible
#printing the number of materials in a file
# ElementQuality
set minlength {2}
*createmark elems 1 "all"
*elementtestlength elems 1 $minlength 2 1 2 0 "2D length <"
set minfail [hm_marklength elems 2]
set maxlength {8}
*createmark elems 1 "all"
*elementtestlength elems 1 $maxlength 2 0 2 0 "2D length >"
set maxfail [hm_marklength elems 2]
set skew {60}
*createmark elems 1 "all"
*elementtestskew elements 1 $skew 2 2 0 " 2D Skew "
set skewe [hm_marklength elems 2]
set jacobian {0.5}
*createmark elems 1 "all"
*elementtestjacobian elements 1 $jacobian 2 2 0 " 2D Jacobian "
set jacobiane [hm_marklength elems 2]
set triaminangle {20}
*createmark elems 1 "all"
*elementtestinterangle elements 1 $triaminangle 1 2 1 2 0 " 2D Tria Min Angle "
set triamine [hm_marklength elems 2]
set triamaxangle {120}
*createmark elems 1 "all"
*elementtestinterangle elements 1 $triamaxangle 1 2 0 2 0 " 2D Tria Max Angle "
set triamaxe [hm_marklength elems 2]
set quadminangle {45}
*createmark elems 1 "all"
*elementtestinterangle elements 1 $quadminangle 0 2 1 2 0 " 2D Quad Min Angle "
set quadmine [hm_marklength elems 2]
set quadmaxangle {135}
*createmark elems 1 "all"
*elementtestinterangle elements 1 $quadmaxangle 0 2 0 2 0 " 2D Quad Max Angle "
set quadmaxe [hm_marklength elems 2]
puts $filename "Element Quality Checks"
puts $filename "Minimum length - $minfail of $n_elems"
puts $filename "Maximum length - $maxfail of $n_elems"
puts $filename "Skew - $skewe of $n_elems"
puts $filename "Jacobian - $jacobiane of $n_elems"
puts $filename "Min Tria Angle - $triamine of $n_tria"
puts $filename "Max Tria Angle - $triamaxe of $n_tria"
puts $filename "Min Quad Angle - $quadmine of $n_quad"
puts $filename "Max Quad Angle - $quadmaxe of $n_quad"
close $filename
#checking for the min length
saving of the failed elements and linking with variable
before count total elements
printing no of elements failed out of total elements
#checking for the max length
saving of the failed elements and linking with variable
before count total elements
printing no of elemenst failed out of total elements
#checking for the skewness
saving of the failed elements and linking with variable
before count total elements
printing no of elemenst failed out of total elements
# checking for the jacobian
saving of the failed elements and linking with variable
before count total elements
printing no of elemenst failed out of total elements
#checking for the min tria angle
saving of the failed elements and linking with variable
before count total elements
printing no of elemenst failed out of total elements
#checking for the max tria angle
saving of the failed elements and linking with variable
before count total elements
printing no of elemenst failed out of total elements
#checking for the min quad angle
saving of the failed elements and linking with variable
before count total elements
printing no of elemenst failed out of total elements
#checking for the max quad angle
saving of the failed elements and linking with variable
before count total elements
printing no of elemenst failed out of total elements
#printing element quality checks in a file
Conclusion:
As a result, the hypermesh report was illustrated.