Challenge

Project - 2 - Generating the report for hypermesh file

OBJECTIVE:-

This project will test you on the 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 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

Code:

1. 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]]

2. 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 "

3.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"

4.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

TCL COMMAND 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 the saved items
opening thefile name excel as output.csv and writing
systerm name as environement variables
printing username in file
printing 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 templatetype and matching with variable
printing profile name in file
checking how many comps and linking with variable
printing the number of components in the file
checking how many props and linking with variable
printing the number of properties in the file
checking how many mats and linking with variable
printing the number of materials in the file
checking total number of elements
number of quads present in model
number of trias present in model
printing total number of elements , quads trias in 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 empty comps
saving those comps as variable
printing no of empty comps in file
checking unused props
saving those props as variable
printing no of unused props in file
checking unused materials
saving those mats as variable
printing no of unused materials in 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 min length
saving the failed elements count and linking in variable
before count total elements
printing no of elements failed out of total elements
checking max length
saving the failed elements count and linking in variable
before count total elements
printing no of elements failed out of total elements
checking skew
saving the failed elements count and linking in variable
before count total elements
printing no of elements failed out of total elements
checking jacobian
saving the failed elements count and linking in variable
before count total elements
printing no of elements failed out of total elements
checking min length
saving the failed elements count and linking in variable
before count total elements
printing no of elements failed out of total elements
checking max length
saving the failed elements count and linking in variable
before count total elements
printing no of elements failed out of total elements
checking skew
saving the failed elements count and linking in variable
before count total elements
printing no of elements failed out of total elements
checking triamin angle
saving the failed elements count and linking in variable
before count trias
printing no of elements failed out of total tria elements
checking triamax angle
saving the failed elements count and linking in variable
before count trias
printing no of elements failed out of total tria elements

checking quad min angle
saving the failed elements count and linking in variable
before count quads
printing no of elements failed out of total quad elements

checking quad max angle
saving the failed elements count and linking in variable
before count quads
printing no of elements failed out of total quad elements

printing element quality checks in file

CONCLUSION:-

Thus, I am generated the report for hypermesh file by using the Tool Command language

1 comment
  1. Rolandojos Torres SáNchezIn TCL there is no widget that is a spreadsheet, but with input fields embedded in text or on a canvas you can build a look very much like excel sheets.
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.