Mesh Settings

The surface mesh that is generated on an object can be controlled through these interfaces. Mesh settings are saved with the model data. The following object types support mesh settings interfaces:

  • Static Body

  • Immersed Body

  • Inlet outlet

  • Output Surface

The most common way of controlling the mesh output is by changing the Deflection and Angle inputs, as well as Min and Max element sizes. The other boolean options available usually do not need to be changed.

# Generate an example model with a sphere static body
model = mstar.Load()
body = model.AddComponent("Static")
body.AddGeometry("Sphere")

# change mesh algorithm to FastDiscrete
body.SetSurfaceMesher(mstar.Mesher.FastDiscrete)

# get the current settings and modify the Deflection to be 1mm
ops = body.GetFastDiscreteSettings()
ops.Deflection = 0.001
body.SetFastDiscreteSettings(ops)

# Rebuild the mesh after you change any settings
# This is only necessary if you need to use the data immediately, such as model export
body.RebuildMesh()

Note

Some configurations of mesh settings may be invalid and cause program instability. Limited support is provided when modifying the model through these interfaces.

class Mesher

Enum class with options

  • FastDiscrete: Fast meshing that produces meshes suitable for visualization purposes

  • ExpressMesh: Meshing algorithm that has more controls on mesh face element quality and size

class IMeshTools_MeshAlgoType

Enum type for fast discete mesh algorithm

  • IMeshTools_MeshAlgoType_DEFAULT

  • IMeshTools_MeshAlgoType_Watson

  • IMeshTools_MeshAlgoType_Delabella

class IMeshTools_Parameters

Mesh settings for fast discrete

property MeshAlgo: IMeshTools_MeshAlgoType
property Angle: float
property Deflection: float
property AngleInterior: float
property DeflectionInterior: float
property MinSize: float
property InParallel: bool
property Relative: bool
property InternalVerticesMode: bool
property ControlSurfaceDeflection: bool
property EnableControlSurfaceDeflectionAllSurfaces: bool
property CleanModel: bool
property AdjustMinSize: bool
property ForceFaceDeflection: bool
property AllowQualityDecrease: bool
class ExpressMeshSettings

Mesh settings for Express Mesh

property ExpressMeshToCheckSelfInter: bool
property ExpressMeshToCheckClosed: bool
property ExpressMeshToCheckMutualInter: bool
property ExpressMeshComputeQuadTreeOnly: bool
property ExpressMeshSetQuadTreeMinDepth: int
property ExpressMeshSetQuadTreeMaxDepth: int
property ExpressMeshSetAutoSize: float
property MinElemSize: float
property MaxElemSize: float
property DeviationAngle: float
property Deflection: float
property MeshElemType: int
property IsCheckDelaunay: bool
property IsCheckQuadInteriorForDeflection: bool
property MinElemSizeEnabled: bool
property MaxElemSizeEnabled: bool
property DeviationAngleEnabled: bool
property DeflectionEnabled: bool
static CreateScaled(model, dxMultiple)

Create settings based on the current model lattice spacing dx value and a multiple. Some notional values can recreate the coarse, medium, fine settings that are in the gui by setting dxMultiple to -

  • Coarse : 20

  • Medium : 10

  • Fine : 5

  • Ultrafine : 2

For example to create Fine settings:

model = mstar.Load()
fineSettings = mstar.ExpressMeshSettings.CreateScaled(model, 5)
class IMeshSettings

Mesh settings interface

GetSurfaceMesher()
Returns:

Surface mesh option

Return type:

Mesher

SetSurfaceMesher(meshOption)
Parameters:

meshOption (Mesher) – Mesh option

GetFastDiscreteSettings()
Returns:

Mesh settings

Return type:

IMeshTools_Parameters

SetFastDiscreteSettings(meshSettings)
Parameters:

meshSettings (IMeshTools_Parameters) – Mesh settings

GetExpressMeshSettings()
Returns:

Mesh settings

Return type:

ExpressMeshSettings

SetExpressMeshSettings(meshSettings)
Parameters:

meshSettings (ExpressMeshSettings) – Mesh settings

RebuildMesh()

Rebuild mesh after changing mesh parameters

class IMeshExportable

Mesh export interface.

GetMesh()