Model.interactiveremeshsurf#
- Model.interactiveremeshsurf(collection, elementsize, elem_type, elem_type2, forcing, size_control, skew_control)#
Brings a surface into the automeshing module and prepares it for processing, enabling the use of all the restricted module functions. All elements previously attached to this collection are deleted. The
Model.ameshclearsurface()function should always be used at the end of the sequence of meshing functions in order to free the memory.- Parameters:
collection (Collection) – The collection containing the surface entities to be meshed.
elementsize (double) – The default element edge size used to calculate element densities along the edges (where necessary).
elem_type (int) –
Flag indicating the elements generated for mapped meshing algorithms. Valid values are:
0 - trias
1 - quads
2 - mixed
3 - right trias
4 - quads only
elem_type2 (int) –
Flag indicating the elements generated for free meshing algorithms. Valid values are:
1 - quads
2 - mixed
3 - right trias
4 - quads only
forcing (int) – If nonzero, any saved surface parameters generated previously with the automesher are ignored.
size_control (int) –
Determines if uniform size elements in mapping algorithms should be created. Valid values are:
0 - No
1 - Yes
skew_control (int) –
Determines if optimal shape elements in mapping algorithms should be created. Valid values are:
0 - No
1 - Yes
Example#
In this example, the automeshing module processes a surface with four faces and ten edges. To generate a mesh for each group, the automeshing module sets up values for the element densities and biasing with theModel.set_meshedgeparams()function. Automeshing parameters for each group are specified with theModel.set_meshfaceparams()function. Prior to meshing, parameters for the first group were changed. This required additional setedgeparams calls for four edges. Each group of elements is sent to theModel.automesh()function so it can determine the appropriate meshing algorithm and create an all-quads mesh. Two meshes are then saved to the HyperMesh database. TheModel.ameshclearsurface()function clears from the memory any information regarding the current surface so that a new surface can be processed.#import hm import hm.entities as ent model = hm.Model() model.surfacemode(mode=1) # Create a collection of one surface with ID 1 and prepare it for automeshing input_surface = hm.Collection(model, ent.Surface, [1]) model.interactiveremeshsurf( collection=input_surface, elementsize=1.0, elem_type=1, elem_type2=1, forcing=1, size_control=0, skew_control=0, ) # Automeshing for face 0 model.set_meshedgeparams( edge_index=2, elem_density=5, alg_type=0, bias_style=0, bias=0.0, min_size=0.0, max_size=0.0, chordal_dev=0.0, max_angle=0.0, ) model.set_meshedgeparams( edge_index=2, elem_density=5, alg_type=0, bias_style=0, bias=0.0, min_size=0.0, max_size=0.0, chordal_dev=0.0, max_angle=0.0, ) model.set_meshedgeparams( edge_index=0, elem_density=2, alg_type=0, bias_style=0, bias=0.0, min_size=0.0, max_size=0.0, chordal_dev=0.0, max_angle=0.0, ) model.set_meshedgeparams( edge_index=1, elem_density=6, alg_type=0, bias_style=0, bias=0.0, min_size=0.0, max_size=0.0, chordal_dev=0.0, max_angle=0.0, ) model.set_meshedgeparams( edge_index=5, elem_density=3, alg_type=0, bias_style=0, bias=0.0, min_size=0.0, max_size=0.0, chordal_dev=0.0, max_angle=0.0, ) model.set_meshfaceparams( face_index=0, shape_type=1, elem_type=1, alg_type=0, elem_size=0, smooth_method=0, smooth_tol=0.1, size_control=0, skew_control=0, ) model.automesh(face_index=0, algorithm=1, elem_type=1) # Automeshing for face 1 model.set_meshedgeparams( edge_index=2, elem_density=5, alg_type=0, bias_style=0, bias=0.0, min_size=0.0, max_size=0.0, chordal_dev=0.0, max_angle=0.0, ) model.set_meshedgeparams( edge_index=11, elem_density=3, alg_type=0, bias_style=0, bias=0.0, min_size=0.0, max_size=0.0, chordal_dev=0.0, max_angle=0.0, ) model.set_meshedgeparams( edge_index=3, elem_density=4, alg_type=0, bias_style=0, bias=0.0, min_size=0.0, max_size=0.0, chordal_dev=0.0, max_angle=0.0, ) model.set_meshedgeparams( edge_index=4, elem_density=4, alg_type=0, bias_style=0, bias=0.0, min_size=0.0, max_size=0.0, chordal_dev=0.0, max_angle=0.0, ) model.set_meshfaceparams( face_index=1, shape_type=1, elem_type=1, alg_type=0, elem_size=0, smooth_method=0, smooth_tol=0.1, size_control=0, skew_control=0, ) model.automesh(face_index=1, algorithm=1, elem_type=1) # Automeshing for face 2 model.set_meshedgeparams( edge_index=8, elem_density=6, alg_type=0, bias_style=0, bias=-2.0, min_size=0.0, max_size=0.0, chordal_dev=0.0, max_angle=0.0, ) model.set_meshedgeparams( edge_index=5, elem_density=3, alg_type=0, bias_style=0, bias=0.0, min_size=0.0, max_size=0.0, chordal_dev=0.0, max_angle=0.0, ) model.set_meshedgeparams( edge_index=6, elem_density=5, alg_type=0, bias_style=0, bias=2.0, min_size=0.0, max_size=0.0, chordal_dev=0.0, max_angle=0.0, ) model.set_meshedgeparams( edge_index=7, elem_density=8, alg_type=0, bias_style=0, bias=0.0, min_size=0.0, max_size=0.0, chordal_dev=0.0, max_angle=0.0, ) model.set_meshfaceparams( face_index=2, shape_type=1, elem_type=1, alg_type=0, elem_size=0, smooth_method=0, smooth_tol=0.1, size_control=0, skew_control=0, ) model.automesh(face_index=2, algorithm=1, elem_type=1) # Automeshing for face 3 model.set_meshedgeparams( edge_index=8, elem_density=6, alg_type=0, bias_style=0, bias=-2.0, min_size=0.0, max_size=0.0, chordal_dev=0.0, max_angle=0.0, ) model.set_meshedgeparams( edge_index=9, elem_density=2, alg_type=0, bias_style=0, bias=0.0, min_size=0.0, max_size=0.0, chordal_dev=0.0, max_angle=0.0, ) model.set_meshedgeparams( edge_index=10, elem_density=7, alg_type=0, bias_style=0, bias=2.0, min_size=0.0, max_size=0.0, chordal_dev=0.0, max_angle=0.0, ) model.set_meshedgeparams( edge_index=11, elem_density=3, alg_type=0, bias_style=0, bias=0.0, min_size=0.0, max_size=0.0, chordal_dev=0.0, max_angle=0.0, ) model.set_meshfaceparams( face_index=3, shape_type=1, elem_type=1, alg_type=0, elem_size=0, smooth_method=0, smooth_tol=0.1, size_control=0, skew_control=0, ) model.automesh(face_index=3, algorithm=1, elem_type=1) # Smoothing model.smoothelements(faceindex=0, smoothmethod=1, iterations=10) model.smoothelements(faceindex=1, smoothmethod=1, iterations=10) model.smoothelements(faceindex=2, smoothmethod=1, iterations=10) model.smoothelements(faceindex=3, smoothmethod=1, iterations=10) # Changing mesh of face 2 model.rejectmesh(faceindex=2) model.set_meshedgeparams( edge_index=8, elem_density=6, alg_type=0, bias_style=0, bias=-2.0, min_size=0.0, max_size=0.0, chordal_dev=0.0, max_angle=0.0, ) model.set_meshedgeparams( edge_index=5, elem_density=3, alg_type=0, bias_style=0, bias=0.0, min_size=0.0, max_size=0.0, chordal_dev=0.0, max_angle=0.0, ) model.set_meshedgeparams( edge_index=6, elem_density=5, alg_type=0, bias_style=0, bias=2.0, min_size=0.0, max_size=0.0, chordal_dev=0.0, max_angle=0.0, ) model.set_meshedgeparams( edge_index=7, elem_density=8, alg_type=0, bias_style=0, bias=0.0, min_size=0.0, max_size=0.0, chordal_dev=0.0, max_angle=0.0, ) model.set_meshfaceparams( face_index=2, shape_type=1, elem_type=1, alg_type=0, elem_size=0, smooth_method=0, smooth_tol=0.1, size_control=0, skew_control=0, ) model.automesh(face_index=2, algorithm=1, elem_type=1) model.storemeshtodatabase(elemstosurfcomp=0) # Clearing memory model.ameshclearsurface()