Model.mm_align#
- Model.mm_align(command, entitycollection=Collection(), aligntype='MID', base=hwTriple(0.000000, 0.000000, 0.000000), axis=hwTriple(1.000000, 0.000000, 0.000000), normal=hwTriple(1.000000, 0.000000, 0.000000), side0Surfs=hwIntList(), side1Surfs=hwIntList(), uniformOffsetSurfs=hwIntList(), offset=0.000000, radius=0.000000, copy=0, fuseEdge0=hwIntList(), fuseEdge1=hwIntList(), merge=True, guideSurfs=hwIntList(), alignUnder=hwIntList(), remesh=True, savedentities=False)#
Edits or aligns the midmesh. Also provides the method to initialize the required data object and clean it after the performed operation.
- Parameters:
command (hwString) –
The command that needs to be executed. Valid values are:
correct_extrusions - Automatically align and simplify the midmesh of extruded models.
edit - Edit the definition of midmesh surfaces or lines.
collapse - Fuse a pair of edge chains, collapsing the common faces.
entitycollection (Collection) – The collection containing the input component or surface entities.
aligntype (hwString) – The type of alignment to be performed to a midmesh surface. Valid values are mid, cylinder, and plane. The argument is valid only when
commandis set to edit and theentitycollectioncontains surface entities.base (hwTriple) – The coordinates of the base point of a cylinder or a plane. Valid only when
aligntypeis set to cylinder or plane.axis (hwTriple) – The components of the vector of axis of cylinder. Valid only when
aligntypeis set to cylinder.normal (hwTriple) – The components of the vector of normal of plane. Valid only when
aligntypeis set to plane.side0Surfs (hwIntList) – The solid surfaces that guide a midmesh surface, provided as a list of entity IDs. Valid only when
aligntypeis set to mid.side1Surfs (hwIntList) – The solid surfaces that guide a midmesh surface, provided as a list of entity IDs. Valid only when
aligntypeis set to mid.uniformOffsetSurfs (hwIntList) – A single side of solid surfaces that guide a midmesh surface, provided as a list of entity IDs. Must be accompanied by offset value. Valid only when
aligntypeis set to offset.offset (double) – The offset value to align midmesh surfaces against solid surfaces provided in
uniformOffsetSurfs. Valid only whenaligntypeis set to offset.radius (double) – The radius value of cylinder. Valid only when
aligntypeis set to cylinder.copy (unsigned int) – Edit input surfaces by copying the
aligntypeand definitions of target surface with given ID. Valid only whenentitycollectioncontains surface entities.fuseEdge0 (hwIntList) – The lists denoting the two chains of midmesh edges that need to be fused. Valid only when
aligntypeis set to collapse.fuseEdge1 (hwIntList) – The lists denoting the two chains of midmesh edges that need to be fused. Valid only when
aligntypeis set to collapse.merge (bool) – Applicable only when
commandis set to correct_extrusions. If set toTrue, small surfaces are merged with neighboring larger surfaces, and minor edges are suppressed.guideSurfs (hwIntList) – The list of IDs of solid surfaces to align a boundary midmesh edge against. Valid only when
entitycollectioncontains line entities.alignUnder (hwIntList) – The list of IDs of solid lines under which to align a midmesh edge. Valid only when
entitycollectioncontains line entities.remesh (bool) – Perform remesh of the affected faces at the end of any alignment operation.
savedentities (bool) – Rretrieve saved entities to use as input instead of using
entitycollection.
Example#
Automatically correct an extruded midmesh#import hm import hm.entities as ent model = hm.Model() displayed_surfs = hm.CollectionByDisplayed(model,ent.Surface) model.mm_align(command="correct_extrusions",entitycollection=displayed_surfs)
Align the given surfaces with ID 19212, 19221, and 19231 into the middle of surface with ID 17774 on one side and surfaces with ID 18244 and 18511 on the other, merging equivalent faces and avoiding remeshing the result#import hm import hm.entities as ent model = hm.Model() surf_col = hm.Collection(model,ent.Surface,[19212,19221,19231]) model.mm_align( command="align", entitycollection=surf_col, aligntype="mid", side0Surfs=[17774], side1Surfs=[18244,18511], merge=True, remesh=False )
Copy the definition of surface with ID 608 onto surfaces with ID 602 and 609 and correct them and merge with surface ID 608#import hm import hm.entities as ent model = hm.Model() surf_col = hm.Collection(model, ent.Surface, [602, 609]) model.mm_align( command="edit", entitycollection=surf_col, aligntype="mid", copy=608, merge=True, )
Make surfaces with ID 614 and 638 cylindrical with axis passing through (3.5, 2.4, -4.1) and point to x axis, with radius 10.0#import hm import hm.entities as ent model = hm.Model() surf_col = hm.Collection(model, ent.Surface, [614, 638]) model.mm_align( command="edit", entitycollection=surf_col, aligntype="cylinder", base=[3.5, 2.4, -4.1], axis=[1, 0, 0], radius=10.0 )
Make surfaces with IDs 603-607 uniformly offset from solid surface with ID 76 with offset 4.0#import hm import hm.entities as ent model = hm.Model() surf_col = hm.Collection(model, ent.Surface, [603, 604, 605, 606, 607]) model.mm_align( command="edit", entitycollection=surf_col, aligntype="offset", offset=4.0, uniformOffsetSurfs=[76] )
Fuse edges with ID 1693 and 1647#import hm import hm.entities as ent model = hm.Model() model.mm_align( command="collapse", fuseEdge0=[1693], fuseEdge1=[1647] )
Change surface with ID 747 into a plane with base at (410.5, 57, -60.0) and normal axis (0.000000, 0.406738, 0.913545)#import hm import hm.entities as ent model = hm.Model() surf_col = hm.Collection(model,ent.Surface,[747]) model.mm_align( command="edit", entitycollection=surf_col, aligntype="plane", base=[410.5, 57, -60.0], axis=[0.000000, 0.406738, 0.913545] )
Extend line with ID 1736 on to the solid to meet surface with ID 504#import hm import hm.entities as ent model = hm.Model() line_col = hm.Collection(model,ent.Line,[1736]) model.mm_align( command="edit", entitycollection=line_col, guideSurfs=[504] )
Align edges saved by the user (using save selection) under the solid edge with ID 1085#import hm import hm.entities as ent model = hm.Model() model.mm_align( command="edit", savedentities=True, alignUnder=[1085] )
Automatically correct an extruded midmesh without merging small surfaces to neighbors#import hm import hm.entities as ent model = hm.Model() surf_col = hm.Collection(model, ent.Surface, [1, 2]) model.mm_align( command="correct_extrusions", merge=False )