poctools module¶
Solid Primitives¶
Each primitive is added to the currently active group operation. At the outermost level, the active group operation is union().
-
poctools.
Box
(p1, p2)¶ Create a box primitive
-
poctools.
Cylinder
(p1, p2, radius)¶ Create a cylinder primitive
-
poctools.
Cone
(p1, p2, radius1, radius2)¶ Create a cone primitive
-
poctools.
Sphere
(center, radius)¶ Create a sphere primitive
-
poctools.
Torus
(p1, p2, ringRadius, radius)¶ Create a torus
-
poctools.
Extrude
(obj, p1, p2)¶ Create a solid by extruding edge, wire, or face from p1 to p2
-
poctools.
Loft
(profiles, ruled=True, tolerance=1e-06)¶ Create a solid by lofting through a sequence of wires or closed edges
-
poctools.
Pipe
(face, path)¶
-
poctools.
Revolve
(face, p1, p2, angle)¶ Create a solid by revolving the face around the given axis
Other primitives¶
These classes have classmethods to construct objects of the given type. They may be useful in constructing solid primitives; for example, poctools.Loft needs a sequence of Edge objects.
This syntax is for compatibility with occmodel. A future improvement to poc should change them so that e.g., Loft becomes a group operation, and Edge becomes a solid primitive that implicitly adds itself to the surrounding Loft.
-
class
poctools.
Edge
¶ -
classmethod
createArc3P
(start, end, mid)¶
-
classmethod
createCircle
(center, normal, radius)¶
-
classmethod
createEllipse
(center, normal, rMajor, rMinor)¶
-
classmethod
createHelix
(pitch, height, radius, angle, leftHanded=False)¶
-
classmethod
createLine
(p1, p2)¶
-
classmethod
-
poctools.
Vertex
(x, y, z)¶
-
poctools.
Matrix
(*args)¶ Construct a 4x3 matrix from arguments, which may be
- A list of 12 values
- A list of 9 values (in which case the last column is taken to be zeros)
- A list of 3 4-tuples, each taken as a row
- A list of 3 3-tuples, each taken as a row (the last column taken to be zeros)
Postfix operations¶
A postfix operation modifies the currently active group operation in a way other than adding another primitive to it.
-
poctools.
Chamfer
(distance, edges=None)¶ Chamfer the active object
If edges is None, then all edges are filletted.
If edges is callable, it is treated as a predicate which returns True for each edge that should be filleted.
Otherwise, edges must be a sequence of edges to fillet.
-
poctools.
Fillet
(radius, edges=None)¶ Fillet the active object
If edges is None, then all edges are filletted.
If edges is callable, it is treated as a predicate which returns True for each edge that should be filleted.
Otherwise, edges must be a sequence of edges to fillet.
-
poctools.
Rotate
(angle, axis, center=(0, 0, 0))¶ Rotate the active object
-
poctools.
Transform
(mat)¶ Transform the active object
Note that geotools.Transform is imported as Xform within poc files.
-
poctools.
Translate
(delta)¶ Translate the active object
Group operations¶
A group operation is introduced by the with statement, such as with Intersection():. At the conclusion of the with statement, its whole contents are treated as a primitive in the outer operation.
Remember that you can introduce more than one nested group operation with a single with statement (and thus a single indentation level):
with Fillet(8), Difference():
suite
is equivalent to:
with Fillet(8):
with Difference():
suite
-
poctools.
Intersection
()¶ Perform an intersection operation
-
poctools.
Difference
()¶ Perform a difference operation
-
poctools.
Union
()¶ Perform a union operation
-
poctools.
Op
(fn, *args, **kw)¶ Convert a postfix operation into a group operation
the following are roughly equivalent:
with Union(): Box(p1, p2) Box(p3, p4) Fillet(8)
and:
with Op(Fillet, 8): Box(p1, p2) Box(p3, p4)
-
poctools.
Rotated
(angle, axis, center=(0, 0, 0))¶ Perform a rotate operation
-
poctools.
Transformed
(mat)¶ Perform a transformation.
-
poctools.
Translated
(delta)¶ Perform a translate operation
-
poctools.
Chamfered
(distance, edges=None)¶ Perform a fillet operation
-
poctools.
Filleted
(radius, edges=None)¶ Perform a fillet operation
Inquiries¶
An inquiry returns information about the currently active group operation. These inquiries can be used to make decisions, or may also be useful to pass to postfix operations (e.g., to Fillet‘s edges= parameter)
-
poctools.
Bbox
(o=None)¶ Return the bounding box of given object or the current item a a 6-tuple
(minx, miny, minz, maxx, maxy, maxz)
-
poctools.
CenterOfMass
()¶ Return the center of mass box of the current item
-
poctools.
Edges
()¶ Return the edge iterator of the current item
-
poctools.
Faces
()¶ Return the face iterator of the current item
-
poctools.
Vertices
()¶ Return the vertex iterator of the current item
-
poctools.
Wires
()¶ Return the wire iterator of the current item
Other routines¶
These routines are not normally used in poc programs, but may be useful for wrapper programs or for implementing new operations.
-
poctools.
execpoc
(args, **kw)¶ Execute the named .poc file from disk
Returns the resulting top level object
-
poctools.
occ_to_stl
(obj, filename, prec=0.05)¶ Convert a solid to stl
-
poctools.
do_op
(b)¶ Adds the object ‘b’ to the current operation