The Mesh
object provides an API for the
Mesh tree object.
To access the Mesh
object:
mesh = Model.Mesh
The Mesh
object exposes several convenient methods to add
mesh controls. For example, you can create a meshing control that applies a
patch-independent algorithm to the mesh by calling the method
AddAutomaticMethod
.
mesh_method = mesh.AddAutomaticMethod()
Mesh control
objects often require a valid scoping. You can
satisfy this requirement by setting the Location
property:
my_selection = ExtAPI.SelectionManager.CreateSelectionInfo(SelectionTypeEnum.GeometryEntities) my_selection.Ids = [16] mesh_method.Location = my_selection
For the above mesh control, accessible properties include:
mesh_method.Method = MethodType.AllTriAllTet mesh_method.Algorithm = MeshMethodAlgorithm.PatchIndependent mesh_method.MaximumElementSize = Quantity("0.05 [m]") mesh_method.FeatureAngle = Quantity("12.000000000000002 [degree]") mesh_method.MeshBasedDefeaturing = True mesh_method.DefeaturingTolerance = Quantity("0.0001 [m]") mesh_method.MinimumSizeLimit = Quantity("0.001 [m]") mesh_method.NumberOfCellsAcrossGap = 1 mesh_method.CurvatureNormalAngle = Quantity("36 [degree]") mesh_method.SmoothTransition = True mesh_method.TetraGrowthRate = 1
Weld allows scripting. Weld scripting allows you to view and edit the erroring welds easily when working with complex models. The Weld control functions can be accessed as follows:
To access Weld control, you should enable Batch Connections.
To enable Batch Connections:
mesh.MeshBasedConnection = True #Enables the Batch Connections.
To insert Weld control:
weld = mesh.AddWeld() #Adds the weld control.
To access the Weld options:
weld.ControlType = WeldType.Seam #Sets the Weld Type as Continuous Seam (Seam). The other option available for Weld Type is Intermittent Seam (Skip). weld.Source = WeldSource.Geometry #Sets the Weld Source as Geometry. The other option available for Weld Source is Mesh. weld.ModeledAs = WeldModeledAs.TentAndExtension #Sets the WeldModeledAs as Normal and Angled (Tent and Extension). The other option available for WeldModeledAs is Normal (Tent), Angled (Extension), Rigid_1D (1D), Parent Bodies Connections (available only when Source is Geometry). weld.CreateUsing = WeldCreateUsing.Curves #Sets the WeldCreateUsing as Curves. This option is only available when the Source is Mesh. The other option available for WeldCreateUsing is Curves and Bodies, Curves and Faces, Edges, Edges and Bodies, Edges and Faces. Weld.TentDirection = WeldTentDirection.Normal #Sets the direction of tent. The other option available for WeldTentDirection is Reversed, Both. weld.UseWorksheet = YesNoType.No #Enables the Worksheet if set to Yes. weld.Suppressed = False weld.AdjustWeldHeight = YesNoType.No #Enables AdjustWeldHeight if set to Yes. weld.CreationCriteria = WeldCreationCriteria.Width #Sets the Creation Criteria as Width. The other option available for WeldCreationCriteria is Angle. weld = DataModel.GetObjectById(object_id) #Gets the object by its id. weld.EdgeMeshSize = Quantity(9.0, "mm")#Provides the EdgeMeshSize. weld.CreateOffsetLayer = YesNoType.Yes #Creates offset layers if set to Yes. weld.OffsetLayerHeight = Quantity(9.0, "mm") #Sets the OffsetLayerHeight. weld.NumberOfLayers = 1 #Sets the number of layers. weld.OffsetLayerGrowthRate = 1.2 #Set the growth rate for offset layer. weld.GenerateEndCaps = YesNoType.Yes #Generates triangular end-caps if set to Yes at the free ends of the welds. weld.GenerateNamedSelection = WeldGeneratedNamedSelection.No # Sets the Generated NamedSelection. The other option available for WeldGeneratedNamedSelection is TentAndExtension, HAZ1, HAZ2. weld.MaterialId = None # Sets the material by its id. Here, 0 denotes None and 10 denotes Structural Steel. weld.ThicknessAssignment = WeldThickness.Automatic #Sets the weld thickness. The other options available for weld.ThicknessAssignment are Automatic, MinParentThicknessFactor, MaxParentThicknessFactor, Both, Defined. weld.SharpAngle = Quantity(30, "deg") #Set the Sharp Angle. Here, the default angle is 30 degrees. You can set the value based on your model. weld.ConnectionTolerance = Quantity(0, "mm")#Sets the Connection Tolerance. The default value is 0. You can set the value based on your model. weld.Smoothing = YesNoType.Yes #Set the Smoothing to Yes by default.