Operations¶
Public Methods¶
-
createBrick(x=1, y=1, z=1, position=None, parent=None)¶
Creates a PolyNURBS block in space.
See createSurfaceGrid, createPolygonMesh, fit for more advanced create methods.
| param x: | Length of the block. |
|---|---|
| type x: | float |
| param y: | Width of the block. |
| type y: | float |
| param z: | Depth of the block. |
| type z: | float |
| param position: | Transformation matrix of the block. |
| type position: | Matrix44 |
| param parent: | The parent of the new PolyNURBS part created. |
| type parent: | Assembly |
| returns: | The new PolyNURBS part. |
| rtype: | PolyNURBS |
-
createSurfaceGrid(numberRowsOfFaces=1, numberColumnOfFaces=1, cornerVertices=[[0, 0, 0], [1, 0, 0], [1, 1, 0], [0, 1, 0]], parent=None)¶
Creates a PolyNURBS surface in space.
| param numberRowsOfFaces: | |
|---|---|
| Number of faces to be shown vertically for the surface. | |
| type numberRowsOfFaces: | |
| int | |
| param numberColumnOfFaces: | |
| Number of faces to be shown horizontally for the surface. | |
| type numberColumnOfFaces: | |
| int | |
| param cornerVertices: | |
| The four corner vertex location in global space. | |
| type cornerVertices: | |
| list[list[math.Point]] | |
| param parent: | The parent of the new PolyNURBS part created. |
| type parent: | Assembly |
| returns: | The new PolyNURBS part. |
| rtype: | PolyNURBS |
-
createPolygonMesh(vertices, indices, edgeWeights=None, parent=None)¶
Creates a custom PolyNURBs polygon.
| param vertices: | List of each vertex location in global space. |
|---|---|
| type vertices: | list[math.Point] |
| param indices: | List of vertex indices forming each polygon. |
| type indices: | list[list[int]] |
| param edgeWeights: | |
| A list of list containing vertex 1 index, vertex 2 index and the weight. The weight should be in [0, 10], with 10 being perfect crease with the cage. Edge weights pull the smooth surface closer to the cage’s edge. | |
| type edgeWeights: | |
| list[list[int, int, float]] | |
| param parent: | The parent of the new PolyNURBS part created. |
| type parent: | Assembly |
| returns: | The new PolyNURBS part. |
| rtype: | PolyNURBS |
-
edit(self)
Contextmanager to group multiple updates for performance.
-
movePoints(self, deltaLocations)¶
Translates the points according to translation deltas given.
| param deltaLocations: | |
|---|---|
| A mapping of points to their corresponding (dx, dy, dz) translation. | |
| type deltaLocations: | |
| dict[FeaturePoint, math.Point] | |
-
setPointLocations(self, locations)¶
Moves points to an exact location.
| param locations: | |
|---|---|
| A mapping of points to the corresponding new location. | |
| type locations: | dict[FeaturePoint, math.Point] |
-
splitArea(self, area, point1, point2)¶
Splits a single PolyNURBS cage face.
Divides the area into two, including the original face, with a new edge between the original and new face. The order of points determines which resulting face is the original and which is new.
| param area: | The area to divide. |
|---|---|
| type area: | FeatureArea |
| param point1: | The first point of the edge. |
| type point1: | math.Point |
| param point2: | The second point of the edge. |
| type point2: | math.Point |
-
shell(self, areas, thickness=0)
Removes the cage face and creates thin walls to generate a shelled PolyNURBS part.
| param areas: | The cage face to remove. |
|---|---|
| type areas: | FeatureArea |
| param thickness: | |
| The wall thickness of the shelled PolyNURBS part. If invalid thickness, is passed in, it will be computed. | |
| type thickness: | float |
-
findAndFixBadFaces(self)¶
Finds and fixes any bad faces from the given part.
-
closeHolesInSolid(self)¶
Closes holes in a PolyNURBS cage.
-
fit(parts, numberOfFaces=500, curvature=0.5, autoCrease=False, system=None, symmetry=(0, 0, 0), parent=None)
Creates a new PolyNURBS part, on top of an existing mesh geometry.
| param parts: | The part or parts to be fitted. If you pass more than one part, they will be combined into a single fit part. |
|---|---|
| type parts: | list[Part] |
| param numberOfFaces: | |
| The number of PolyNURBS cage faces to be created for each part. | |
| type numberOfFaces: | |
| int | |
| param curvature: | |
| The amount of curvature detail to be captured. The value should range between 0 and 1. Higher values will capture more features. | |
| type curvature: | float |
| param autoCrease: | |
| When True, the Fit operation will attempt to retain sharp edges from the original model, so you can create fillets at a later time. | |
| type autoCrease: | |
| bool | |
| param system: | Reference system which symmetry should occur about. |
| type system: | System |
| param symmetry: | Specifies the direction of the symmetry along which axis of the system. The value can be (0,1,0) specifying the symmetry along Y axis of the reference system. |
| type symmetry: | math.Point |
| param parent: | The parent of the new PolyNURBS part created. |
| type parent: | Assembly |
| returns: | The new PolyNURBS part. |
| rtype: | PolyNURBS |
-
fitSynthesis(synthesis, curvature=50, numberOfFaces=2500, shrinkWrapSize=0.0019, autoCrease=False, intersect=True)¶
Fits an optimized part with PolyNURBS
| param synthesis: | |
|---|---|
| Synthesis object to get the synthesized part | |
| type synthesis: | Synthesis |
| param curvature: | |
| The amount of curvature detail to be captured. The value should range between 0 and 100. Higher values will capture more features. | |
| type curvature: | float |
| param numberOfFaces: | |
| The number of PolyNURBs cage faces to be created for each optimized part. | |
| type numberOfFaces: | |
| int | |
| param shrinkWrapSize: | |
| The Voxel dimension size for each PolyNURB cage. | |
| type shrinkWrapSize: | |
| float | |
| param autoCrease: | |
| When True, the Fit operation will attempt to retain sharp edges from the original model, so you can create fillets at a later time. | |
| type autoCrease: | |
| bool | |
| param intersect: | |
| When True, intersects the optimized part with the new PolyNURBS part. | |
| type intersect: | bool |
-
ShapeVariable(points, direction, **kwds)¶
Define which directions PolyNURBS cage points can move during PolyNURBS optimization.