Arbitrary body subdivision
Greetings,
I have an arbitrarily shape solid in an .iges format file. I would like to know how to divide its smallest dimension
into n parts (n = 2,3, ...) in HyperMesh prior to the mesh generation process.
Thanks in advance,
Best Answer
-
1) I suppose you could use the API for rotating a cutting plane about a point and place that into the script after selecting a point.
2) As long as you know the API for tetrameshing you can enter that into the script to.
Easiest way to find the API is to execute the feature in HyperMesh, and then open the command.tcl file in your working directory and you'll see the API used to perform the operation. Then look into our help documentation for more details on the API.
0
Answers
-
Sometime ago I found this script which can partition a solid in n divisions in the x,y,z directions (thus 3 inputs). I only works as good as HyperMesh's solid editing APIs. You might be able to modify the number of the cuts into a dimension...
Here is what the script looks like:
#####################################################################################
# File : josh_scprit.tcl
# Date : June 27 2016
# Purpose : cube solid for hex meshing
# HyperMesh v14.0
#####################################################################################
#####################################################################################catch { namespace delete ::delima }
namespace eval ::delima {
}#Main Procedure
proc ::delima::main {} {
#DIMENSION BODY
*createmark comps 1 all
foreach {minx miny minz maxx maxy maxz} [hm_getboundingbox comps 1 2 0 0] {}#X - USER INPUT OF DIVISIONS
set nb_planesX [hm_getint "Number of Cuts X = " "Select the number of parallel cuts in the X direction"]
set dist_apartX [expr abs($maxx-$minx)/($nb_planesX+1)]#Y - USER INPUT OF DIVISIONS
set nb_planesY [hm_getint "Number of Cuts Y = " "Select the number of parallel cuts in the Y direction"]
set dist_apartY [expr abs($maxy-$miny)/($nb_planesY+1)]#Z - USER INPUT OF DIVISIONS
set nb_planesZ [hm_getint "Number of Cuts Z = " "Select the number of parallel cuts in the Z direction"]
set dist_apartZ [expr abs($maxz-$minz)/($nb_planesZ+1)]#X - SOLID PLANE CUT
for {set i 1} {$i <= $nb_planesX} {incr i} {
*createmark solids 1 "all"
set a [expr $minx+$i*$dist_apartX]
*createplane 1 1 0 0 $a 0 0
*body_splitmerge_with_plane solids 1 1
#}#Y - SOLID PLANE CUT
for {set i 1} {$i <= $nb_planesY} {incr i} {
*createmark solids 1 "all"
set b [expr $miny+$i*$dist_apartY]
*createplane 1 0 1 0 0 $b 0
*body_splitmerge_with_plane solids 1 1
}#Z - SOLID PLANE CUT
for {set i 1} {$i <= $nb_planesZ} {incr i} {
*createmark solids 1 "all"
set c [expr $minz+$i*$dist_apartZ]
*createplane 1 0 0 1 0 0 $c
*body_splitmerge_with_plane solids 1 1
#}hm_markclearall 1
}#Running Main Procedure
::delima::main2 -
Thank you very much, Joshua. I will certainly check out. Some additional issues:
1) What if the body is not aligned with x,y and z directions?
2) The same script could also be used to generate tetrahedral meshes?
Thanks in advance and best regards.
Ricardo Azevedo
0 -
1) I suppose you could use the API for rotating a cutting plane about a point and place that into the script after selecting a point.
2) As long as you know the API for tetrameshing you can enter that into the script to.
Easiest way to find the API is to execute the feature in HyperMesh, and then open the command.tcl file in your working directory and you'll see the API used to perform the operation. Then look into our help documentation for more details on the API.
0 -
Ok, I will do this.
Thanks for clarifying.
0