Feature (hwx.inspire)#
- class Feature(*args, **kwargs)#
Bases:
object
Features are what gives shape to a Part.
They can be points, lines, planes, holes, etc.
# Name
Type
property
property
property
property
property
property
property
property
property
property
units
property
# Name
Description
chamferByAngle
(feature, angle=45, dist=0.003)Creates chamfer on a Linear/Planar feature.
chamferByDistance
(feature, dist1=0.003, dist2=0.003)Creates chamfer on a linear or planar feature.
circularPattern
(input, axis, angle=60, count=3, equalSpacing=False, instances=False, symmetry=False, axisReverse=False, result=’NEW_PART’, mergeWithAllParts=True, mergeParts=None, copiesToSkip=None)Circular Pattern parts or faces around an axis.
createTag
(input, name=’’, value=’’)Creates tag for any geometry part or feature.
divideCurve
(curve, divisionPoints, uniformDivision=False)Divide a curve by inserting points along the curve.
edgeFillet
(feature, radius=’3 mm’, continuity=’TANGENT’, tangentPropagation=True)Creates fillet on a Linear feature.
extendCurve
(curve, extensionTypeAndDistance, shape=’LINEAR’, extendEnds=’START’, extendAsNewPart=False)Extend a curve and modify the shape of the extension.
extract
(features, maintainReference=True)Extracts geometry features and transfer them into a new part.
faceCurve
(face, method=’POINT’, uRatio=True, vRatio=True, ignoreHoles=True, uCurvesCount=5, vCurvesCount=5, uParmRatioForPointMode=0, vParmRatioForPointMode=0, vertexFeature=None, vertexPoint=None)Extract curves from a face in the U or V direction. This is useful for
findClosestPoint
(self, referencePoint)Returns the point on feature that nearest to the specified point.
getClass
(self, classname)helixCurve
(profile, type=’TURNS_AND_HEIGHT’, numTurns=2, pitch=0.003, height=0.01, startAngle=0, curveHand=’RIGHT’, heightReverse=False, lockDiameterRatio=True, topDiameter=0)Create a solid loft or a lofted surface from profiles and guide curves.
Determines the object matches the specified settings or not.
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, reverseDir1=False, reverseDir2=False, result=’NEW_PART’, mergeWithAllParts=True, mergeParts=None, copiesToSkip=None, seedOnly=False)Linear Pattern parts or faces along a direction.
loft
(profiles, loftAsSolid=True, guideCurves=None, arcLengthProfiles=False, arcLengthGuides=False, swapSurface=False, closed=False, resultType=’NEW_PART’, mergeWithAllParts=True, mergeParts=None, profileChain=False, guideCurvesTangent=False)Create a solid loft or a lofted surface from profiles and guide curves.
moveFaces
(features, position, duplicate=False)Translate, rotate, copy, or extend features.
multiSweep
(profiles, path, sweepAsSolid=True, arcLengthProfiles=False, arcLengthGuides=False, orientation=’PERPENDICULAR’, normalToSurface=None, resultType=’NEW_PART’, mergeWithAllParts=True, mergeParts=None, profileContinuity=None, profileMagnitude=None)Sweep multiple profiles along a path to create a solid or surface.
offset
(input, value, newPart=False)Offset surfaces or parts.
patternAlongPath
(input, path, count=3, equalSpacing=False, spacing=0.01, instances=False, method=’TRANSFORM’, orientation=’MAINTAIN_SEED_ORIENTATION’, pathReverse=False, result=’NEW_PART’, mergeWithAllParts=True, mergeParts=None, copiesToSkip=None)Pattern parts or faces along curve.
projection
(feature, parts, extendEdges=True)Creates projection of a feature from one part to another part.
pushPull
(feature, depth, newPart=False, resultType=None)Pushes or pulls a face or an edge to a specified distance.
revolve2
(profiles, axis, direction=’SINGLE’, resultType=’NEW_PART’, mergeTargets=None, flipAxis=False, angle1=0, angle2=0)New Revolve - Revolve a face, sketch, line, or 2D edge about an axis.
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, mergeParts=None, twist1Reverse=False, twist2Reverse=False, guideScale=’UNIFORM’)Sweep a profile along a path to create a solid or 3D surface.
Example
from hwx import inspire from hwx.inspire.core import highlight model = inspire.openTutorialFile("Motion/PartFeatures_ForJoints.x_t") # Uncomment to see each type # highlight(model.getFeatures(inspire.FeaturePoint)) # highlight(model.getFeatures(inspire.FeatureLinear)) # highlight(model.getFeatures(inspire.FeaturePlanar)) # highlight(model.getFeatures(inspire.FeatureSpherical)) highlight(model.getFeatures(inspire.FeatureCylindrical))
- property part#
Returns the part this feature belongs to.
- property visible#
Determines whether the part is visible in the modeling window.
- property active#
Determines the part this feature belongs to is active or not.
- property location#
The global location of the feature as a point.
- property cg#
The approximate global center of gravity of the feature as a point.
- property ishole#
Determines whether the feature is a hollow circle/cylinder or not.
- findClosestPoint(referencePoint)#
Returns the point on feature that nearest to the specified point.
- property connectedPoints#
The end points of the Feature with any duplicates removed.
- Type:
list[FeaturePoint]
- property connectedCurves#
list[FeatureCurve]
- property connectedFaces#
list[FeatureArea]
- isa(type=None, filter=None, **kwds)#
Determines the object matches the specified settings or not.
- property name#
The unique name of the feature.
- chamferByAngle(angle=45, dist=0.003)#
Creates chamfer on a Linear/Planar feature.
- Parameters:
feature (Feature) – Feature that needs to be chamfer.
angle (float) – Chamfer angle from the edge.
dist (float) – Chamfer distance from the edge.
- chamferByDistance(dist1=0.003, dist2=0.003)#
Creates chamfer on a linear or planar feature.
- Parameters:
feature (Feature) – Feature that needs to be chamfer.
dist1 (float) – Chamfer distance from the edge.
dist2 (float) – Chamfer distance from the edge.
- circularPattern(axis, angle=60, count=3, equalSpacing=False, instances=False, symmetry=False, axisReverse=False, result='NEW_PART', mergeWithAllParts=True, mergeParts=None, copiesToSkip=None)#
Circular Pattern parts or faces around an axis.
- Parameters:
input (list[Part] | list[FeatureArea]) – Parts or Features to create circular pattern.
axis (math.Vector | FeatureCurve | Axis) – Axis is a reference line, edge, or axis to which the pattern will be parallel.
angle (float) – Angle within which the copies are equally spaced.
count (int) – Number of copies.
equalSpacing (bool) – If True, equally space the copies within a specified Angle.
instances (bool) – If True, any changes to part or face will apply to all instances.
symmetry (bool) – Symmetry in Direction 1.
axisReverse (bool) – Reverse the axis in Direction 1.
result (str) – Result type of circular pattern. - COMBINE - SUBTRACT - INTERSECT - NEW_PART
mergeWithAllParts (bool) – If True, merge with All parts otherwise merge with parts supplied in mergeParts.
mergeParts (list[Part]) – Parts to be merged with circular pattern.
(dict{Part (copiesToSkip) – list[indicesToSkip]}): Set copies to skip. It’s basically a dictionary which contains Part as a key and list of indices to skip as values.
Returns: list[Part]: List of parts created.
- createTag(name='', value='')#
Creates tag for any geometry part or feature.
- divideCurve(divisionPoints, uniformDivision=False)#
Divide a curve by inserting points along the curve.
- Parameters:
curve (FeatureCurve) – Curve to divide.
divisionPoints (list(list[float | str], bool)) – List of divisionPoints (length ratio or length along the curve) and the bool value depicts position ratio. If True, Divide the curve on length ratio otherwise division occurs at length along the curve.
uniformDivision (bool) – If True, Curve is uniformly divided.
- Returns:
New part created.
- Return type:
- edgeFillet(radius='3 mm', continuity='TANGENT', tangentPropagation=True)#
Creates fillet on a Linear feature.
- Parameters:
feature (Feature) – feature that needs to fillet.
radius (float | str) – Radius of the fillet.
continuity (str) – Valid values are: TANGENT and CURVATURE.
tangentPropagation (bool) – If True, selecting an edge will also select all of its tangent edges.
- extendCurve(extensionTypeAndDistance, shape='LINEAR', extendEnds='START', extendAsNewPart=False)#
Extend a curve and modify the shape of the extension.
- Parameters:
curve (FeatureCurve) – Extracted Curve to extend.
extensionTypeAndDistance (list[str, float] | list[str, Feature | Plane]) –
Extension type as string and Distance as float to extend. For UP_TO_FEATURE extension type second argument should be either a Feature or System Plane. Valid extension types are:
EXTENSION_DISTANCE
INCREMENT_FACTOR
TOTAL_LENGTH
UP_TO_FEATURE
shape (str) – Shape of extend curve. - LINEAR - SOFT - REFLECTIVE - NATURAL - ARC
extendEnds (str) – To reverse the curve extension direction. - START - END
extendAsNewPart (bool) – Create a new part if True, otherwise merge in original part.
- Returns:
New part created.
- Return type:
- extract(maintainReference=True)#
Extracts geometry features and transfer them into a new part.
- faceCurve(method='POINT', uRatio=True, vRatio=True, ignoreHoles=True, uCurvesCount=5, vCurvesCount=5, uParmRatioForPointMode=0, vParmRatioForPointMode=0, vertexFeature=None, vertexPoint=None)#
Extract curves from a face in the U or V direction. This is useful for creating trim curves that run along a face.
- Parameters:
face (FeatureArea) – Face on which extract curves.
method (str) – Method for face curve. - POINT - VERTEX - MESH
uRatio (bool) – If True, create U curves.
vRatio (bool) – If True, create V curves.
ignoreHoles (bool) – If True, ignore the holes in face curve.
uCurvesCount (Int) – Set U curves count to create for method type MESH.
vCurvesCount (Int) – Set V curves count to create for method type MESH.
uParmRatioForPointMode (Float) – Set U Param for method type POINT, param should be between 0 and 1.
vParmRatioForPointMode (Float) – Set V Param for method type POINT, param should be between 0 and 1.
vertexFeature (FeaturePoint) – Feature point to extract iso-param curve for method type VERTEX.
vertexPoint (math.Point) – Point to create face curves for method type POINT. Point must lie on the face.
- Returns:
New part created.
- Return type:
- helixCurve(type='TURNS_AND_HEIGHT', numTurns=2, pitch=0.003, height=0.01, startAngle=0, curveHand='RIGHT', heightReverse=False, lockDiameterRatio=True, topDiameter=0)#
Create a solid loft or a lofted surface from profiles and guide curves.
- Parameters:
profile (FeatureCircular) – Circular sketch profile.
type (str) – Helix Curve Type. - TURNS_AND_HEIGHT - TURNS_AND_PITCH - HEIGHT_AND_PITCH
numTurns (float) – Number of turns in helix curve.
pitch (float) – Pitch distance of helix curve.
height (float) – Height of helix curve.
startAngle (float) – Start angle of helix curve.
curveHand (str) – Helix curve sweep direction. - LEFT - RIGHT
heightReverse (bool) – If True, Reverse the height in other direction of helix curve.
lockDiameterRatio (bool) – If True, Set lock diameter ratio of helix curve.
topDiameter (float) – Top Diameter of helix curve.
- Returns:
New part created.
- Return type:
- linearPattern(direction1, direction2=(0, 0, 0), bothDirection=False, spacing1=0.0, count1=3, spacing2=0.0, count2=3, instances=False, symmetry1=False, symmetry2=False, reverseDir1=False, reverseDir2=False, result='NEW_PART', mergeWithAllParts=True, mergeParts=None, copiesToSkip=None, seedOnly=False)#
Linear Pattern parts or faces along a direction.
- Parameters:
input (list[Part] | list[FeatureArea]) – Parts or Features to create linear pattern.
direction1 (math.Vector | FeatureCurve | Axis) – Direction can be a reference line, edge, or axis to which the pattern will be parallel.
direction2 (math.Vector | FeatureCurve | Axis) – Direction can be a reference line, edge, or axis to which the pattern will be parallel.
bothDirection (bool) – If True, sets in both direction otherwise single direction.
spacing1 (float) – Distance between two copies.
count1 (int) – Number of copies.
spacing2 (float) – Distance between two copies.
count2 (int) – Number of copies.
instances (bool) – If True, any changes to part or face will apply to all instances.
symmetry1 (bool) – Symmetry in Direction 1.
symmetry2 (bool) – Symmetry in Direction 2.
reverseDir1 (bool) – Reverse the pattern direction in Direction 1.
reverseDir2 (bool) – Reverse the pattern direction in Direction 2.
result (str) – Result type of linear pattern. - COMBINE - SUBTRACT - INTERSECT - NEW_PART
mergeWithAllParts (bool) – If True, merge with All parts otherwise merge with parts supplied in mergeParts.
mergeParts (list[Part]) – Parts to be merged with linear pattern.
(dict{Part (copiesToSkip) – list[tuple(x,y)]}): Set copies to skip. Here x and y are the indices in 2D space of copy , which needs to be skipped.
seedOnly (bool) – If True, pattern the entities only along the first row and first column.
Returns: list[Part]: List of parts created.
- loft(loftAsSolid=True, guideCurves=None, arcLengthProfiles=False, arcLengthGuides=False, swapSurface=False, closed=False, resultType='NEW_PART', mergeWithAllParts=True, mergeParts=None, profileChain=False, guideCurvesTangent=False)#
Create a solid loft or a lofted surface from profiles and guide curves.
- Parameters:
profiles (list[FeatureArea | FeatureCurve]) – Faces, closed sketches or curves.
loftAsSolid (bool) – If true, sweep as solids otherwise sweep as surfaces.
guideCurves (list[FeatureCurve]) – Guide curves for the loft.
arcLengthProfiles (bool) – If True, Set Arc Length Parametrization on profiles.
arcLengthGuides (bool) – If True, Set Arc Length Parametrization on guides.
swapSurface (bool) – If True, interchange the profiles and rails to get preferred shape.
closed (bool) – If True, close the loft.
resultType (str) – Result type of loft operation. - COMBINE - SUBTRACT - INTERSECT - NEW_PART
mergeWithAllParts (bool) – If True, merge with All parts otherwise merge with parts supplied in mergeTargets.
mergeParts (Part) – Parts to be merged with loft operation.
profileChain (bool) – True, Allows to select profile’s connected edges.
guideCurvesTangent (bool) – True, Allows to select guideCurve’s connected edges.
- Returns:
New part created if resultType is NEW_PART.
- Return type:
Part|None
- property minBoundingBox#
Returns the minimum bounding box.
- moveFaces(position, duplicate=False)#
Translate, rotate, copy, or extend features.
- Parameters:
features (list[FeatureArea]) – The features to move.
position (math.Matrix44) – The position to move the features at.
duplicate (bool) – If True, copy the features at given position.
- multiSweep(path, sweepAsSolid=True, arcLengthProfiles=False, arcLengthGuides=False, orientation='PERPENDICULAR', normalToSurface=None, resultType='NEW_PART', mergeWithAllParts=True, mergeParts=None, profileContinuity=None, profileMagnitude=None)#
Sweep multiple profiles along a path to create a solid or surface.
- Parameters:
profiles (list[FeatureArea | FeatureCurve]) – Faces or closed sketches.
path (list[FeatureCurve]) – Path for the multiSweep.
sweepAsSolid (bool) – If true, sweep as solids otherwise sweep as surfaces.
arcLengthProfiles (bool) – If True, Set Arc Length Parametrization on profiles.
arcLengthGuides (bool) – If True, Set Arc Length Parametrization on path.
orientation (str) – Orientation for multiSweep. - PERPENDICULAR - PARALLEL - NORMAL_TO_SURFACE
normalToSurface (list[FeatureArea]) – Face to which sweep orientation will be normal.
resultType (str) – Result type of multiSweep operation. - COMBINE - SUBTRACT - INTERSECT - NEW_PART
mergeWithAllParts (bool) – If True, merge with All parts otherwise merge with parts supplied in mergeTargets.
mergeParts (Part) – Parts to be merged with sweep operation.
profileContinuity (tuple(Feature, str)) –
Tuple of 2 values. First value will be the feature on which continuity will be applied and the second value is continuity type mentioned below.
NONE
SURFACE
MAGNITUDE
profileMagnitude (tuple(Feature, float | str)) – Tuple of 2 values. First value will be the feature on which continuity will be applied and the second value is magnitude.
- Returns:
New part created if resultType is NEW_PART.
- Return type:
Part|None
- offset(value, newPart=False)#
Offset surfaces or parts.
- Parameters:
- Returns:
New part created if newPart was True.
- Return type:
Part|None
- patternAlongPath(path, count=3, equalSpacing=False, spacing=0.01, instances=False, method='TRANSFORM', orientation='MAINTAIN_SEED_ORIENTATION', pathReverse=False, result='NEW_PART', mergeWithAllParts=True, mergeParts=None, copiesToSkip=None)#
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
pathReverse (bool): Reverse the path of pattern. result (str): Result type of pattern along path.
COMBINE
SUBTRACT
INTERSECT
NEW_PART
- mergeWithAllParts (bool): If True, merge with All parts otherwise merge with
parts supplied in mergeParts.
mergeParts (list[Part]): Parts to be merged with pattern along path. copiesToSkip (dict{Part: list[indicesToSkip]}): Set copies to skip. It’s
basically a dictionary which contains Part as a key and list of indices to skip as values.
Returns: list[Part | Feature]: List of parts/features created.
- projection(parts, extendEdges=True)#
Creates projection of a feature from one part to another part.
- pushPull(depth, newPart=False, resultType=None)#
Pushes or pulls a face or an edge to a specified distance.
- Parameters:
feature (Feature) – Feature to push or pull.
depth (float | str) – The precise distance. A positive value extends, whereas a negative value contracts.
newPart (bool) – If True, creates a new Part as a result of pushPull operation.
resultType (str) – Result type of pushPull operation. This option is valid only for pushPull a sketch on face. - NEW_PART - ADD - REMOVE - REPLACE
- Returns:
If New Part created, otherwise return None.
- Return type:
- revolve2(axis, direction='SINGLE', resultType='NEW_PART', mergeTargets=None, flipAxis=False, angle1=0, angle2=0)#
New Revolve - Revolve a face, sketch, line, or 2D edge about an axis.
- Parameters:
profiles (FeatureArea | FeatureCurve) – A face, line, or 2D edge.
axis (FeatureLinear | FeatureCircular | Axis) – An edge, line, cylindrical
Axis. (hole or an) – Selecting an edge on another part projects the axis of revolution to the planar face that will be rotated.
direction (str) – Valid values are: SINGLE, BOTH and SYMMETRY.
resultType (str) – Valid values are: COMBINE, SUBTRACT, INTERSECT and NEW_PART.
mergeTargets (list[Feature]) – Explict merge targets for Result Type.
flipAxis (bool) – If True, axis will be flipped.
angle1 (float) – The angle of revolution.
angle2 (float) – The angle of revolution when direction is Both.
- Returns:
New part created if resultType is NEW_PART.
- Return type:
Part|None
- sweep(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, mergeParts=None, twist1Reverse=False, twist2Reverse=False, guideScale='UNIFORM')#
Sweep a profile along a path to create a solid or 3D surface.
- Parameters:
profiles (FeatureArea | FeatureCurve) – A face or a closed sketch.
path (list[FeatureCurve]) – Path for the sweep.
solidProfile (Part) – Sweep profile as solid. Only applicable for solid cylinder.
sweepAsSolid (bool) – If true, sweep as solids otherwise sweep as surfaces.
profileOrientation (bool) – If true, sweep orientation will be normal to the path otherwise parallel.
propagate (bool) – If true, all the tangent edges of the input path is also selected.
pathIgnoredFeatures (list[FeatureCurve]) – Edge to be ignored when propagate is True.
guideCurves (list[FeatureCurve]) – Guide curves for the sweep. No guide curves are set by default.
pathDirection (str) – Sweep direction. - DIRECTION_1 - DIRECTION_2 - BOTH
twistType (str) – Twist type. - NO_TWIST - ANGLE_TWIST - NO_OF_TURNS
twistAngle (float) – Twist angle in DIRECTION_1.
twistTurns (float) – Number of twist turns in DIRECTION_1.
twistAngleDir2 (float) – Twist angle in DIRECTION_2. Applicable only when pathDirection is “BOTH”.
twistTurnsDir2 (float) – Number of twist turns in DIRECTION_2. Applicable only when pathDirection is “BOTH”.
resultType (str) – Result type of sweep operation. - COMBINE - SUBTRACT - INTERSECT - NEW_PART
mergeWithAllParts (bool) – If True, merge with All parts otherwise merge with parts supplied in mergeTargets.
mergeParts (Part) – Parts to be merged with sweep operation.
twist1Reverse (bool) – If True, Reverse the twist in DIRECTION_1 or DIRECTION_2.
twist2Reverse (bool) – If True, Reverse the twist in DIRECTION_2. Applicable only when pathDirection is “BOTH”.
guideScale (str) – Guide scale option. Applicable only when guideCurves is provided. - UNIFORM - LATERAL
- Returns:
New part created if resultType is NEW_PART.
- Return type:
Part|None