The Siemens Community Catalyst program was co-created with our community to acknowledge technology leaders who consistently contribute to the Siemens Community. Nominations are accepted on a rolling basis.
Dear All,
I have a list of components with one surface each.
I need to calculate the total area of these surfaces.
Do you have any idea on how I could fix this task in tcl/tk code?
Thanks a lot in advance,
Fabio
Seems like there must me a command to do this for multiple surfaces but all I found was one that does it for one surface so you would have to use expr to add them mainly after getting the area for each surface.
Help page for hm_getareaofsurface
https://2022.help.altair.com/2022.1/hwdesktop/hwd/topics/reference/hm/hm_getareaofsurface.htm?zoom_highlight=get+surface+area
So something like this should work for you:
set totalArea 0.0
foreach surfID $surfList {
set totalArea [expr {$totalArea + [hm_getareaofsurface surfs $surfID]}]
}
*createmarkpanel comps 1 "Please select components"set comp_id_list [hm_getmark comps 1]set total_surf_area 0foreach comp_id $comp_id_list { *createmark surfs 1 "by comp id" $comp_id set surf_id_list [hm_getmark surfs 1] foreach surf_id $surf_id_list { set surf_area [hm_getareaofsurface surfs $surf_id] set total_surf_area [expr {$total_surf_area+$surf_area}] }}tk_messageBox -message "The total area is ${total_surf_area}"
I used this code and it works perfectly!
Thanks a lot All for your help!
Regards,
Join us for a Community Conversation where we'll discuss practical approaches to analyzing complex electromagnetic models using hybrid solver techniques. This session will provide a general overview of how different computational methods can be combined within a single simulation to address models containing varied…
Join us for a community conversation to explore how different modeling approaches in Simcenter PSIM can help engineers simulate power electronics systems while balancing accuracy, simulation speed, and design insight. What you'll learn: Power transistor modeling : Thermal and high fidelity models Protection component…