Here, we generate a list of cylindrical features and apply the partition operation with a fixed thickness and reversed direction.
1 c. Partitioning Based on Size Range
To partition features based on size constraints, use the following approach:
# Option 3: Partition based on size constraints inspire.geometry.partition(model, thickness="partitionThickness", minSize=0, maxSize=1, reverseDirection=False)
1 d. Editing Partition Construction Features
Once you've created partitions, you might need to modify their properties. Editing partition construction features allows you to adjust parameters such as thickness or direction even after the initial partitioning.
Here's how to edit an existing partition feature:
# Retrieve the most recent partition construction feature partitionCF = model.construction[-1] # Edit the partition thickness and direction partitionCF.edit(partitionOptions=['3 mm', False]) # If needed, retrieve and further modify a specific partition feature partitionCF = model.construction.getCF('Partition 1') partitionCF.edit(partitionOptions=['partitionThickness', True])
This approach provides flexibility in adjusting partitions to meet evolving design requirements
1 e. Updating Variables
You can dynamically update the variables to adjust your partitions:
# Update the partition thickness variable model.variables.update("partitionThickness", 'Length', "5 cm")
By updating partitionThickness, you can modify the partition thickness across the entire model.
2. Fillet (Edge Fillet)
Definition: Round edges to create fillets with a constant or variable radius.
2 a. Retrieve and Apply Fillet to Features
Next, retrieve the features in your model that you want to apply the fillet to. In this example, we apply the fillet to circular features.
# Get circular features from the model features = model.getFeatures(type=inspire.FeatureCircular) # Apply the fillet operation using the defined radius for feature in features: inspire.geometry.edgeFillet(feature, radius='filletRadius')
#Retrieving edge features features =model.getFeatures(type= 'FeatureLinear') # Applying fillet on four edge feature. inspire.geometry.edgeFillet(features[:4], radius='30 cm') # #Retrieving edge features features = model.getFeatures(type=inspire.FeatureLinear) # Tangent Propagation: Edges that are connected and tangent to each other will be included in the fillet operation. inspire.geometry.edgeFillet(features[9], radius='3 cm',tangentPropagation=True, continuity='CURVATURE') # continuity can be TANGENT or CURVATURE.
2 b. Retrieve the Existing Fillet CF by name
Access the specific fillet construction feature you want to modify. You can retrieve it by its name.
# Retrieve the fillet construction feature filletCF = model.construction.getCF('Fillet 1')
2 c. Modify the Fillet Parameters
Update the radius or other properties of the fillet feature as needed. Use the edit method to apply changes.
# Editing existing CF filletCF=model.construction.getCF('Fillet 1') with filletCF.edit(): filletCF.radius = '4 cm' filletCF.continuity='TANGENT'
3. Chamfer
Create beveled edges.
There are two methods to create chamfer,
- Chamfering by Angle - needs one angle and one distance
- Chamfering by Distance - needs two distance
Retrieve the features in your model that you want to apply the chamfer to. In this example, we apply the chamfer to linear features.
# Creating variables model.variables.add("chamferAngle", 'angle', "45 deg") model.variables.add("chamferDist", 'length', 0.03) #Retrieving edge features features =model.getFeatures(type= 'FeatureLinear') # Applying fillet on four edge feature. inspire.geometry.edgeFillet(features[:4], radius='30 cm') # #Retrieving edge features features = model.getFeatures(type=inspire.FeatureLinear) inspire.geometry.chamferByAngle(features[9], angle= 'chamferAngle', dist='chamferDist') inspire.geometry.chamferByDistance(features[10], dist1= 'chamferDist', dist2='chamferDist') # Editing the Chamfer construction feature to redefine the the angle and distance value. chamferCF = model.construction.getCF('Chamfer 1') with chamferCF.edit(): model.variables.add("angle", type="angle", expression=60) model.variables.add("distance", type="length", expression=0.05) chamferCF.angleAndDistance=["angle", "distance"]
4. Shell
Definition: Remove material and create thin walls to generate a shelled part.
from hwx import inspire model = inspire.getModel() parts=model.parts featPlanar=model.parts[0].getFeatures(type='FeaturePlanar')[5] featPlanar.shell(thickness=.5) print("Shell is created on base part with the thickness of 0.5mm") inspire.orientView(direction="isometric") # Editing the Shellconstruction feature to redefine the thickness value. shellCF= model.construction.getCF('Shell 1') with shellCF.edit(): # creating a variable for scale factor model.variables.add('thickness','length','10 cm') shellCF.thickness= 'thickness'
5. Scale
Definition: Resize parts in your model, which is useful when working with an imported model that is associated with a different default unit system.
from hwx import inspire model=inspire.getModel() part=model.parts[0] part.scale(2.0) print("Part is scaled by factor 2") inspire.fitView() # Editing the scale construction feature to redefine the scale value. scaleCF= model.construction.getCF('Scale 1') with scaleCF.edit(): # creating a variable for scale factor model.variables.add('scaleFactor','unitless',10) scaleCF.value = 'scaleFactor'