Operations¶
- pushPull(feature, depth)¶
Pushes or pulls a face or an edge to a specified distance.
- param feature
Feature to push or pull.
- type feature
FeatureArea
- param depth
The precise distance. A positive value extends, whereas a negative value contracts.
- type depth
float | str
- extract(features, maintainReference=True)¶
Extracts geometry features and transfer them into a new part.
- param features
Feature to be extracted.
- type features
list[Feature]
- param maintainReference
If true, set reference associativity otherwise not.
- type maintainReference
bool
- returns
New part created.
- rtype
Part
- mirror(entity, planeOrigin=None, planeNormal=None, keep=True)¶
Mirrors part across a symmetry plane.
If entity is a Part, the planeOrigin and planeNormal need to be passed
- param entity
Part from which a mirror part needs to be created or a Planar feature which needs to be mirrored across the plane
- type entity
Part | FeaturePlanar
- param planeOrigin
The origin of the symmetry plane.
- type planeOrigin
math.Point
- param planeNormal
The normal of the symmetry plane.
- type planeNormal
math.Vector
- param keep
If True it keeps the original part, if False it removes it.
- type keep
bool
- returns
New mirrored part created.
- rtype
Part
- patch(features)¶
Creates patches to fill in specified missing surfaces.
- param features
Features to be patched.
- type features
list[Feature]
- returns
New parts created.
- rtype
list[Part]
- rotate(part, axis, angle, degrees=True)¶
Rotates a part around the specified axis.
This is a body rotation.
- param part
The part to rotate.
- type part
Part
- param axis
The rotation axis. If axis a string, valid choices are “x”, “y”, “z”.
- type axis
Vector | str
- param angle
The rotation angle.
- type angle
float
- param degrees
If True, angle is considered in degrees, if False in radians.
- type degrees
bool
- translate(part, x=0, y=None, z=None)¶
Translates by the specified distance.
If y is None, x is assumed to be a list of 3 floats.
- param part
The part to translate.
- type part
Part
- param x
The distance to translate the ‘x’ vector.
- type x
float
- param y
The distance to translate the ‘y’ vector.
- type y
float
- param z
The distance to translate the ‘z’ vector.
- type z
float
- move(part, position)¶
Translates and/or rotates a part.
- param part
The part to move.
- type part
Part
- param position
The position to move the part at.
- type position
math.Matrix44
- deleteFaces(features)¶
Deletes the specified faces from the part.
- param features
Features to be removed.
- type features
list[Feature]
- scale(parts, value=1.1)¶
Resizes the part to the specified scale value.
This is useful when working with an imported model that is associated with a different default unit system.
- param parts
Parts that need to be scaled.
- type parts
list[Part]
- param value
The scale factor. If value is a string it can be a Model Variable or a value with units.
- type value
float | str
- booleanCombine(target, tools=None)¶
Combines the specified parts.
- param target
Part to be combined with tools.
- type target
Part
- param tools
Parts to be combined with target. Destroyed after combine.
- type tools
list[Part]
- returns
The combined part.
- rtype
Part
- booleanSubtract(targets, tools, keepTools=False)¶
Carves out one set of solid objects from another set of solid objects.
- param targets
The parts being carved.
- type targets
list[Part]
- param tools
The parts doing the carving.
- type tools
list[Part]
- param keepTools
If True, preserves the tools after the operation.
- type keepTools
bool
- returns
The remaining part.
- rtype
Part
- booleanIntersect(targets, tools, keepTargets=False, keepTools=False)¶
Retains only the intersecting portions of two sets of solid objects.
- param targets
The first set of parts.
- type targets
list[Part]
- param tools
A list of parts for boolean intersect operation.
- type tools
list[Part]
- param keepTargets
If True, preserves the target parts after the operation.
- type keepTargets
bool
- param keepTools
If True, preserves the tools parts after the operation.
- type keepTools
bool
- returns
The intersected part.
- rtype
Part
- slice(targets, cutOrigin=None, cutNormal=None, surfaceFeature=None, extendSurface=True)¶
Slices a set of solid objects with a cutting plane or cutting surface.
You must provide cutOrigin and cutNormal or surfaceFeature.
- param targets
The parts to slice across the cutting plane.
- type targets
list[Part]
- param cutOrigin
The origin of the cutting plane.
- type cutOrigin
math.Point
- param cutNormal
The normal of the cutting plane.
- type cutNormal
math.Vector
- param surfaceFeature
The surface to slice the enity accross.
- type surfaceFeature
FeatureArea
- param extendSurface
Set Automatic extension On/Off for tool Surface.
- type extendSurface
bool
- returns
The new sliced part created.
- rtype
Part
- simplifyImprints(entity)¶
Finds and removes imprints from a part.
An imprint is an edge or a point that appears on a surface that can be removed without changing the underlying integrity of the surface, such as scratches or trimmed points.
- param entity
Part/Assembly from which you want to remove the imprints from or FeatureLinear imprint to be removed.
- type entity
Part | Assembly | FeatureLinear
- simplifyRounds(entity, roundType='ALL', minSize=0, maxSize=1)¶
Finds and removes both round (convex) and fillet (concave) surfaces.
- param entity
Part/Assembly from which you want to remove the fillets, chamfers from or a Feature to be removed.
- type entity
Part | Assembly | Feature
- param roundType
Valid values are: ROUNDS, FILLETS, CHAMFERS and ALL.
- type roundType
str
- param minSize
Minimum size of round.
- type minSize
float
- param maxSize
Maximum size of round.
- type maxSize
float
- simplifyHoles(entity, minSize=0, maxSize=1)¶
Finds and removes holes and pockets, and find raised areas such as lettering.
- param entity
Part/Assembly from which you want to remove the holes from or FeatureCircular which needs to be removed.
- type entity
Part | Assembly | Feature
- param minSize
Minimum size of hole.
- type minSize
float
- param maxSize
Maximum size of hole.
- type maxSize
float
- simplifyPlugs(entity, minSize=0, maxSize=1)¶
Finds holes and pockets, and plug them by filling the area with a new part
- param entity
Part/Assembly from which you want to plug the holes or a Circular feature that needs to be plugged.
- type entity
Part | Assembly | Feature
- param minSize
Minimum size of plug.
- type minSize
float
- param maxSize
Maximum size of plug.
- type maxSize
float
- partition(feature, thickness='1 mm', subtractFromTarget=False)¶
Divides a solid part into design and non-design regions by selecting a hole, pocket, or face to offset.
- param feature
Feature to be partitioned.
- type feature
Feature
- param thickness
The partition thickness consider in mm.
- type thickness
float
- param subtractFromTarget
Determines whether to remove the original feature from the part and then create a partition.
- type subtractFromTarget
bool
- returns
New part created.
- rtype
Part
- midSurface(part, surfaceOptions='Mid')¶
Extracts a midsurface or side faces from thin solids, and determine where surfaces are represented.
Replacing parts with midsurfaces yields better results while increasing speed when running an analysis or optimization.
- param part
The part which needs midsurface extraction.
- type part
Part
- param surfaceOptions
This options allows you to extract the Mid, Left or Right surface of the part.
- type surfaceOptions
str
- chamferByAngle(feature, angle=45, dist=0.003)¶
Creates chamfer on a Linear/Planar feature.
- param feature
Feature that needs to be chamfer.
- type feature
Feature
- param angle
Chamfer angle from the edge.
- type angle
float
- param dist
Chamfer distance from the edge.
- type dist
float
- chamferByDistance(feature, dist1=0.003, dist2=0.003)¶
Creates chamfer on a linear or planar feature.
- param feature
Feature that needs to be chamfer.
- type feature
Feature
- param dist1
Chamfer distance from the edge.
- type dist1
float
- param dist2
Chamfer distance from the edge.
- type dist2
float
- shell(feature, thickness=1)¶
Removes material and create thin walls to generate a shelled part.
- param feature
Feature to create a shelled part from.
- type feature
FeatureArea
- param thickness
Shell thickness.
- type thickness
float
- extrude(features, direction, resultType, parts=None, extrudeAsSolid=True, reference=None, extrudeTo1=1, extrudeTo2=1, angle1=0, angle2=0, extrusionEndCaps=None)¶
Extrude sketch profile.
- param features
The features of the sketch to extrude.
- type features
list[Feature]
- param extrudeAsSolid
If True extrude as Solid, otherwise extrude as Sheet.
- type extrudeAsSolid
bool
- param direction
Valid directions to extrude are: SINGLE, BOTH and SYMMETRY.
- type direction
str
- param resultType
Valid choices are: COMBINE, SUBTRACT, INTERSECT and NEW_PART.
- type resultType
str
- param parts
Parts you would like to merge the extruded shape with. Defaults to None. That means the extruded shape will be merged with all parts that touch it.
- type parts
list[Part]
- param reference
Direction vector of extrusion. Defaults to the feature normal.
- type reference
math.Vector | FeatureLinear | System
- param extrudeTo1
If extrudeTo1 is a float then its the extrusion length in direction 1 in meters. If extrudeTo1 is a FeautrePoint or a FeaturePlanar then its used to determine the extrusion length in direction 1. If value is a string it can be a Model Variable or a value with units.
- type extrudeTo1
float | FeaturePlanar | FeaturePoint | str
- param extrudeTo2
If value is a float then it’s the extrusion length in direction 2 in meters. If value is a FeautrePoint or a FeaturePlanar then it’s used to determine the extrusion length in direction 2. If value is a string it can be a Model Variable or a value with units.
- type extrudeTo2
float | FeaturePlanar | FeaturePoint | str
- param angle1
The draft angle in direction 1 in degree. If value is a string it can be a Model Variable or a value with units.
- type angle1
float | str
- param angle2
The draft angle in direction 2 in degree. If value is a string it can be a Model Variable or a value with units.
- type angle2
float | str
- param extrusionEndCaps
Valid choices are: NONE, BOTH, START and END.
- type extrusionEndCaps
str
- returns
New part created.
- rtype
Part
- offset(input, value, newPart=False)¶
Offset surfaces or parts.
- param input
- type input
list[Part] | list[Feature]
- param value
Desired offset distance. Negative value means inward direction. If value is a string it can be a Model Variable or a value with units.
- type value
float | str
- param newPart
If True, creates a new part.
- type newPart
bool
- returns
New part created if newPart was True.
- rtype
Part|None
- thicken(parts, value, symmetric=True)¶
Thicken surface parts and convert them to solids, or thicken and hollow solid parts.
When used on a solid part, the Thicken tool yields a hollow solid. When used on a surface part, the Thicken tool yields a solid part.
- param parts
- type parts
list[Part]
- param value
Desired offset distance. Negative value means inward direction.
- type value
float
- param symmetric
If True, offsets symmetrically on both sides of the part surface.
- type symmetric
bool
- linearPattern(input, direction1, direction2=(0, 0, 0), bothDirection=False, spacing1=0.0, count1=3, spacing2=0.0, count2=3, instances=False, symmetry1=False, symmetry2=False)¶
Linear Pattern parts or faces along a direction.
- param input
- type input
list[Part]
- param direction1
Direction can be a reference line, edge, or axis to which the pattern will be parallel.
- type direction1
math.Vector | FeatureCurve | System
- param direction2
Direction can be a reference line, edge, or axis to which the pattern will be parallel.
- type direction2
math.Vector | FeatureCurve | System
- param bothDirection
If True, sets in both direction otherwise single direction.
- type bothDirection
bool
- param spacing1
Distance between two copies.
- type spacing1
float
- param count1
Number of copies.
- type count1
int
- param spacing2
Distance between two copies.
- type spacing2
float
- param count2
Number of copies.
- type count2
int
- param instances
If True, any changes to part or face will apply to all instances.
- type instances
bool
- param symmetry1
Symmetry in Direction 1.
- type symmetry1
bool
- param symmetry2
Symmetry in Direction 2.
- type symmetry2
bool
Returns: list[Part]: List of parts created.
- createPipe(path, section='CIRCLE', size=0.01, width=0.01, thickness=0.0, angle=None, ignoredFeatures=None, propagate=False, resultType='COMBINE')¶
Create Pipe for FeatureCurve.
- param path
- type path
list[FeatureCurve]
- param section
The Pipe profile type. Valid choices are: CIRCLE, SQUARE, TRIANGLE and RECTANGLE.
- type section
str
- param size
Length of the pipe. If value is a string it can be a Model Variable or a value with units.
- type size
float | str
- param width
Width of the pipe, only applicable for Rectangular profile.
- type width
float
- param thickness
Pipe thickness. If not set or set to zero, it will be solid pipe. If value is a string it can be a Model Variable or a value with units.
- type thickness
float | str
- param angle
Angle in radians. Only for xy alignment.
- type angle
float
- param ignoredFeatures
Ignored Features. Not mandatory. In propagated cases, if we need to ignore certain curves.
- param propagate
if True enables propagate option, otherwise disabled.
- type propagate
bool
- param resultType
Valid values are: COMBINE, SUBTRACT, INTERSECT and NEW_PART.
- type resultType
str
- returns
New part created.
- rtype
Part
- moveFaces(features, position, duplicate=False)¶
Translate, rotate, copy, or extend features.
- param features
The features to move.
- type features
list[FeatureArea]
- param position
The position to move the features at.
- type position
math.Matrix44
- param duplicate
If True, copy the features at given position.
- type duplicate
bool
- intersect(parts, createSolids=False, keepSourceParts=False)¶
Intersect tool that deletes excess faces, edges and vertices.
- param parts
Parts to intersect.
- type parts
list[Part]
- param createSolids
If True, faces of solid volumes automatically selected.
- type createSolids
bool
- param keepSourceParts
Determines whether to keep source parts or not. When original parts are not kept, they are deleted from the model at the end of a successful operation.
- type keepSourceParts
bool
- returns
New part if created otherwise none.
- rtype
Part/None
- convertToMass(parts, parent=None)¶
Replace Parts to concentrated mass.
- param parts
Parts to be replaced with concentrated mass.
- type parts
list[Part]
- param parent
Parent for the mass created.
- type parent
Part
- replaceFromFile(part, filePath)¶
Replace part with the contents of a file.
- param part
The part to be replaced.
- type part
Part
- param filePath
The path to the file whose contents will replace the part.
- type filePath
str
- replaceFromPart(part, toolPart, keepToolPart=False)¶
Replace part with tool part.
- param part
The part to be replaced.
- type part
Part
- param toolPart
The part to replace with.
- type toolPart
Part
- param keepToolPart
Determines whether to keep the toolPart or not after replace.
- type keepToolPart
bool
- circularPattern(input, axis, angle=60, count=3, equalSpacing=False, instances=False, symmetry=False)¶
Circular Pattern parts or faces around an axis.
- param input
- type input
list[Part] | list[FeatureArea]
- param axis
Axis is a reference line, edge, or axis to which the pattern will be parallel.
- type axis
math.Vector | FeatureCurve | System
- param angle
Angle within which the copies are equally spaced.
- type angle
float
- param count
Number of copies.
- type count
int
- param equalSpacing
If True, equally space the copies within a specified Angle.
- type equalSpacing
bool
- param instances
If True, any changes to part or face will apply to all instances.
- type instances
bool
- param symmetry
Symmetry in Direction 1.
- type symmetry
bool
Returns: list[Part]: List of parts created.
- draft(features, direction, neutralPlane, angle1=3.0, angle2=3.0, flipDrawDirection1=False, flipDrawDirection2=False)¶
Add draft to one or more faces of a part when designing a product that is manufactured using injection molding.
- param features
Faces to Draft.
- type features
list[FeatureArea]
- param direction
The Draft direction. Valid values are: SINGLE, BOTH and SYMMETRY.
- type direction
str
- param neutralPlane
A reference plane or an existing face in the model. neutralPlane can not be same as draft feature.
- type neutralPlane
FeaturePlanar, System
- param angle1
The angle1 of draft.
- type angle1
float
- param angle2
The angle2 of draft. This is applicable for BOTH or SYMMETRY value for direction.
- type angle2
float
- param flipDrawDirection1
If True, flips the draw direction of draft in single direction.
- type flipDrawDirection1
bool
- param flipDrawDirection2
If True, flips the draw direction of draft. Applicable for BOTH direction.
- type flipDrawDirection2
bool
- convertBodiesToParts(parts)¶
Convert disconnected bodies to parts.
- param parts
The parts to be converted.
- type parts
list[Part]
- returns
Newly created parts.
- rtype
list[Part]
- breakInstance(parts)¶
Break the instances of a part.
- param parts
Parts for breaking instances.
- type parts
list[Part]
- projectAndSplit(targets, tools, direction, vectorDirection=None, extendProjection=True, extractProjection=False, surfaceNormal=None)¶
Project tools onto targets in a specified direction and splits the targets.
- param targets
List of Parts or features on which feature projection to be.
- type targets
list[Part] | list[Feature]
- param tools
Feature that needs to be projected on Part.
- type tools
list[Feature]
- param direction
Valid values are: TOOL_NORMAL, X, Y, Z, VECTOR and CLOSEST_POINT, SURFACE_NORMAL.
- type direction
str
- param vectorDirection
Vector direction, only applicable when direction is ‘VECTOR’.
- type vectorDirection
FeatureLinear | System
- param extendProjection
If True, extends the projection.
- type extendProjection
bool
- param extractProjection
If True, extract projection without split.
- type extractProjection
bool
- param surfaceNormal
Planar surface along whose normal you want to project the tools.
- type surfaceNormal
FeaturePlanar
Returns: list[Part]: List of parts created.
- revolve2(profiles, axis, direction='SIGLE', resultType='NEW_PART', mergeTargets=None, flipAxis=False, angle1=0, angle2=0)¶
New Revolve - Revolve a face, sketch, line, or 2D edge about an axis.
- param profiles
A face, line, or 2D edge.
- type profiles
FeatureArea | FeatureCurve
- param axis
An edge, line, cylindrical
- type axis
FeatureLinear | FeatureCircular | System
- param hole or a System. If it is of type System it has to have systemType Axis.
Selecting an edge on another part projects the axis of revolution to the planar face that will be rotated.
- param direction
Valid values are: SINGLE, BOTH and SYMMETRY.
- type direction
str
- param resultType
Valid values are: COMBINE, SUBTRACT, INTERSECT and NEW_PART.
- type resultType
str
- param mergeTargets
Explict merge targets for Result Type.
- type mergeTargets
list[Feature]
- param flipAxis
If True, axis will be flipped.
- type flipAxis
bool
- param angle1
The angle of revolution.
- type angle1
float
- param angle2
The angle of revolution when direction is Both.
- type angle2
float
- returns
New part created if resultType is NEW_PART.
- rtype
Part|None
- edgeFillet(feature, radius='3 mm', continuity='TANGENT')¶
Creates fillet on a Linear feature.
- param feature
feature that needs to fillet.
- type feature
Feature
- param radius
Radius of the fillet.
- type radius
float | str
- param continuity
Valid values are: TANGENT and CURVATURE.
- type continuity
str
- sweep(profiles, path, solidProfile=None, sweepAsSolid=True, profileOrientation=True, propagate=True, pathIgnoredFeatures=None, guideCurves=None, pathDirection='DIRECTION_1', twistType='NO_TWIST', twistAngle=0, twistTurns=0, twistAngleDir2=0, twistTurnsDir2=0, resultType='NEW_PART', mergeWithAllParts=True, mergeTargets=None)¶
Sweep a profile along a path to create a solid or 3D surface.
- param profiles
A face or a closed sketch.
- type profiles
FeatureArea | FeatureCurve
- param path
Path for the sweep.
- type path
list[FeatureCurve]
- param solidProfile
Sweep profile as solid. Only applicable for solid cylinder.
- type solidProfile
Part
- param sweepAsSolid
If true, sweep as solids otherwise sweep as surfaces.
- type sweepAsSolid
bool
- param profileOrientation
If true, sweep orientation will be normal to the path otherwise parallel.
- type profileOrientation
bool
- param propagate
If true, all the tangent edges of the input path is also selected.
- type propagate
bool
- param pathIgnoredFeatures
Edge to be ignored when propagate is True.
- type pathIgnoredFeatures
list[FeatureCurve]
- param guideCurves
Guide curves for the sweep. No guide curves are set by default.
- type guideCurves
list[FeatureCurve]
- param pathDirection
Sweep direction. - DIRECTION_1 - DIRECTION_2 - BOTH
- type pathDirection
str
- param twistType
Twist type. - NO_TWIST - ANGLE_TWIST - NO_OF_TURNS
- type twistType
str
- param twistAngle
Twist angle in DIRECTION_1.
- type twistAngle
float
- param twistTurns
Number of twist turns in DIRECTION_1.
- type twistTurns
float
- param twistAngleDir2
Twist angle in DIRECTION_2. Applicable only when pathDirection is “BOTH”.
- type twistAngleDir2
float
- param twistTurnsDir2
Number of twist turns in DIRECTION_2. Applicable only when pathDirection is “BOTH”.
- type twistTurnsDir2
float
- param resultType
Result type of sweep operation. - COMBINE - SUBTRACT - INTERSECT - NEW_PART
- type resultType
str
- param mergeWithAllParts
If True, merge with All parts otherwise merge with parts supplied in mergeTargets.
- type mergeWithAllParts
bool
- param mergeTargets
Parts to be merged with sweep operation.
- type mergeTargets
Part
- returns
New part created if resultType is NEW_PART.
- rtype
Part|None
- nurbsCurve(controlPoints, nurbsCurveType='CURVE_OPEN', nurbsCurveDegree='DEGREE_3', controlPointWeight=None)¶
Create a NURBS curve, which is a free-form curve.
- param controlPoints
List of control points to draw NURBS curve.
- type controlPoints
list[FeaturePoints]
- param nurbsCurveType
NURBS curve type. - CURVE_OPEN - CURVE_CLOSED - CURVE_PERIODIC - CURVE_NUM_TYPES
- type nurbsCurveType
str
- param nurbsCurveDegree
NURBS curve degree. - DEGREE_2 - DEGREE_3 - DEGREE_4 - DEGREE_5 - DEGREE_6 - DEGREE_7
- type nurbsCurveDegree
str
- param controlPointWeight
Index and weight for control point in NURBS curve.
- type controlPointWeight
int, float
- returns
New NURBS created.
- rtype
Part
- patternAlongPath(input, path, count=3, equalSpacing=False, spacing=0.01, instances=False, method='TRANSFORM', orientation='MAINTAIN_SEED_ORIENTATION')¶
Pattern parts or faces along curve.
Args: input (list[Part] | list[FeatureArea]): Parts or Features to create pattern
along the curve.
path (list[FeatureCurve]): Path for pattern. count (int): Number of copies. equalSpacing (bool): If True, equally space the copies. spacing (float): Distance between two copies. instances (bool): If True, any changes to part or face will apply to all instances. method (str): Pattern method.
TRANSFORM
OFFSET
- orientation (str): Pattern Orientation.
TANGENT_TO_CURVE
MAINTAIN_SEED_ORIENTATION
Returns: list[Part | Feature]: List of parts/features created.