cadquery API Reference
Full documentation for cadquery (2.8.0)
cadquery.Assembly
Python Library Documentation: class Assembly in module cadquery.assembly
class Assembly(builtins.object)
| Assembly(obj: Union[cadquery.occ_impl.shapes.Shape, cadquery.cq.Workplane, NoneType] = None, loc: Optional[cadquery.occ_impl.geom.Location] = None, name: Optional[str] = None, color: Optional[cadquery.occ_impl.assembly.Color] = None, material: Optional[cadquery.occ_impl.assembly.Material] = None, metadata: Optional[Dict[str, Any]] = None)
|
| Nested assembly of Workplane and Shape objects defining their relative positions.
|
| Methods defined here:
|
| __contains__(self, name: str) -> bool
|
| __dir__(self)
| Modified __dir__ for autocompletion.
|
| __getattr__(self, name: str) -> Union[ForwardRef('Assembly'), cadquery.occ_impl.shapes.Shape]
| . based access to children.
|
| __getitem__(self, name: str) -> Union[ForwardRef('Assembly'), cadquery.occ_impl.shapes.Shape]
| [] based access to children.
|
| __getstate__(self)
| Explicit getstate needed due to getattr.
|
| __init__(self, obj: Union[cadquery.occ_impl.shapes.Shape, cadquery.cq.Workplane, NoneType] = None, loc: Optional[cadquery.occ_impl.geom.Location] = None, name: Optional[str] = None, color: Optional[cadquery.occ_impl.assembly.Color] = None, material: Optional[cadquery.occ_impl.assembly.Material] = None, metadata: Optional[Dict[str, Any]] = None)
| construct an assembly
|
| :param obj: root object of the assembly (default: None)
| :param loc: location of the root object (default: None, interpreted as identity transformation)
| :param name: unique name of the root object (default: None, resulting in an UUID being generated)
| :param color: color of the added object (default: None)
| :param material: material (for visual and/or physical properties) of the added object (default: None)
| :param metadata: a store for user-defined metadata (default: None)
| :return: An Assembly object.
|
|
| To create an empty assembly use::
|
| assy = Assembly(None)
|
| To create one constraint a root object::
|
| b = Workplane().box(1, 1, 1)
| assy = Assembly(b, Location(Vector(0, 0, 1)), name="root")
|
| __iter__(self, loc: Optional[cadquery.occ_impl.geom.Location] = None, name: Optional[str] = None, color: Optional[cadquery.occ_impl.assembly.Color] = None) -> Iterator[Tuple[cadquery.occ_impl.shapes.Shape, str, cadquery.occ_impl.geom.Location, Optional[cadquery.occ_impl.assembly.Color]]]
| Assembly iterator yielding shapes, names, locations and colors.
|
| __setstate__(self, d)
| Explicit setstate needed due to getattr.
|
| add(self, arg, **kwargs)
| Add a subassembly to the current assembly.
|
| addSubshape(self, s: cadquery.occ_impl.shapes.Shape, name: Optional[str] = None, color: Optional[cadquery.occ_impl.assembly.Color] = None, layer: Optional[str] = None) -> 'Assembly'
| Handles name, color and layer metadata for subshapes.
|
| :param s: The subshape to add metadata to.
| :param name: The name to assign to the subshape.
| :param color: The color to assign to the subshape.
| :param layer: The layer to assign to the subshape.
| :return: The modified assembly.
|
| constrain(self, *args, param=None)
| Define a new constraint.
|
| export(self, path: str, exportType: Optional[Literal['STEP', 'XML', 'XBF', 'GLTF', 'VTKJS', 'VRML', 'STL']] = None, mode: Literal['default', 'fused'] = 'default', tolerance: float = 0.1, angularTolerance: float = 0.1, unit: Literal['MM', 'CM', 'M', 'KM', 'INCH', 'FT', 'MI', 'UM', 'NM'] = 'MM', outputUnit: Optional[Literal['MM', 'CM', 'M', 'KM', 'INCH', 'FT', 'MI', 'UM', 'NM']] = None, **kwargs) -> Self
| Save assembly to a file.
|
| :param path: Path and filename for writing.
| :param exportType: export format (default: None, results in format being inferred form the path)
| :param mode: STEP only - See :meth:`~cadquery.occ_impl.exporters.assembly.exportAssembly`.
| :param tolerance: the deflection tolerance, in model units. Only used for glTF, VRML. Default 0.1.
| :param angularTolerance: the angular tolerance, in radians. Only used for glTF, VRML. Default 0.1.
| :param unit: The internal unit of the model's geometry values. Only used for STEP. Default "MM".
| :type unit: UnitLiterals
| :param outputUnit: The unit to use in the STEP file header. If None, defaults to the value of ``unit``.
| Use this when you want the output file to declare a different unit than the model's internal unit,
| for example to export a MM model as a STEP file declaring meters.
| :type outputUnit: UnitLiterals or None
| :param \**kwargs: Additional keyword arguments. Only used for STEP, glTF and STL.
| See :meth:`~cadquery.occ_impl.exporters.assembly.exportAssembly`.
| :param ascii: STL only - Sets whether or not STL export should be text or binary
| :type ascii: bool
|
| remove(self, name: str) -> 'Assembly'
| Remove a part/subassembly from the current assembly.
|
| :param name: Name of the part/subassembly to be removed
| :return: The modified assembly
|
| *NOTE* This method can cause problems with deeply nested assemblies and does not remove
| constraints associated with the removed part/subassembly.
|
| save(self, path: str, exportType: Optional[Literal['STEP', 'XML', 'XBF', 'GLTF', 'VTKJS', 'VRML', 'STL']] = None, mode: Literal['default', 'fused'] = 'default', tolerance: float = 0.1, angularTolerance: float = 0.1, **kwargs) -> Self
| Save assembly to a file.
|
| :param path: Path and filename for writing.
| :param exportType: export format (default: None, results in format being inferred form the path)
| :param mode: STEP only - See :meth:`~cadquery.occ_impl.exporters.assembly.exportAssembly`.
| :param tolerance: the deflection tolerance, in model units. Only used for glTF, VRML. Default 0.1.
| :param angularTolerance: the angular tolerance, in radians. Only used for glTF, VRML. Default 0.1.
| :param \**kwargs: Additional keyword arguments. Only used for STEP, glTF and STL.
| See :meth:`~cadquery.occ_impl.exporters.assembly.exportAssembly`.
| :param ascii: STL only - Sets whether or not STL export should be text or binary
| :type ascii: bool
|
| solve(self, verbosity: int = 0) -> Self
| Solve the constraints.
|
| toCompound(self) -> cadquery.occ_impl.shapes.Compound
| Returns a Compound made from this Assembly (including all children) with the
| current Locations applied. Usually this method would only be used after solving.
|
| traverse(self) -> Iterator[Tuple[str, ForwardRef('Assembly')]]
| Yield (name, child) pairs in a bottom-up manner
|
| ----------------------------------------------------------------------
| Class methods defined here:
|
| importStep(path: str, unit: Literal['MM', 'CM', 'M', 'KM', 'INCH', 'FT', 'MI', 'UM', 'NM'] = 'MM') -> Self
| Reads an assembly from a STEP file.
|
| :param path: Path and filename for reading.
| :param unit: The unit of measurement for the STEP file. Default "MM".
| :return: An Assembly object.
|
| load(path: str, importType: Optional[Literal['STEP', 'XML', 'XBF']] = None, unit: Literal['MM', 'CM', 'M', 'KM', 'INCH', 'FT', 'MI', 'UM', 'NM'] = 'MM') -> Self
| Load step, xbf or xml. Only STEP supports unit conversion on loading.
|
| ----------------------------------------------------------------------
| Readonly properties defined here:
|
| shapes
| List of Shape objects in the .obj field
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __annotations__ = {'_solve_result': typing.Optional[typing.Dict[str, t...
cadquery.BoundBox
Python Library Documentation: class BoundBox in module cadquery.occ_impl.geom
class BoundBox(builtins.object)
| BoundBox(bb: OCP.OCP.Bnd.Bnd_Box) -> None
|
| A BoundingBox for an object or set of objects. Wraps the OCP one
|
| Methods defined here:
|
| __init__(self, bb: OCP.OCP.Bnd.Bnd_Box) -> None
| Initialize self. See help(type(self)) for accurate signature.
|
| add(self, obj: Union[Tuple[float, float, float], cadquery.occ_impl.geom.Vector, ForwardRef('BoundBox')], tol: Optional[float] = None) -> 'BoundBox'
| Returns a modified (expanded) bounding box
|
| obj can be one of several things:
| 1. a 3-tuple corresponding to x,y, and z amounts to add
| 2. a vector, containing the x,y,z values to add
| 3. another bounding box, where a new box will be created that
| encloses both.
|
| This bounding box is not changed.
|
| enlarge(self, tol: float) -> 'BoundBox'
| Returns a modified (expanded) bounding box, expanded in all
| directions by the tolerance value.
|
| This means that the minimum values of its X, Y and Z intervals
| of the bounding box are reduced by the absolute value of tol, while
| the maximum values are increased by the same amount.
|
| isInside(self, b2: 'BoundBox') -> bool
| Is the provided bounding box inside this one?
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| findOutsideBox2D(bb1: 'BoundBox', bb2: 'BoundBox') -> Optional[ForwardRef('BoundBox')]
| Compares bounding boxes
|
| Compares bounding boxes. Returns none if neither is inside the other.
| Returns the outer one if either is outside the other.
|
| BoundBox.isInside works in 3d, but this is a 2d bounding box, so it
| doesn't work correctly plus, there was all kinds of rounding error in
| the built-in implementation i do not understand.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __annotations__ = {'DiagonalLength': <class 'float'>, 'center': <class...
cadquery.CQ
Python Library Documentation: class Workplane in module cadquery.cq
class Workplane(builtins.object)
| Workplane(inPlane='XY', origin=(0, 0, 0), obj=None)
|
| Defines a coordinate system in space, in which 2D coordinates can be used.
|
| :param plane: the plane in which the workplane will be done
| :type plane: a Plane object, or a string in (XY|YZ|XZ|front|back|top|bottom|left|right)
| :param origin: the desired origin of the new workplane
| :type origin: a 3-tuple in global coordinates, or None to default to the origin
| :param obj: an object to use initially for the stack
| :type obj: a CAD primitive, or None to use the centerpoint of the plane as the initial
| stack value.
| :raises: ValueError if the provided plane is not a plane, a valid named workplane
| :return: A Workplane object, with coordinate system matching the supplied plane.
|
| The most common use is::
|
| s = Workplane("XY")
|
| After creation, the stack contains a single point, the origin of the underlying plane,
| and the *current point* is on the origin.
|
| .. note::
| You can also create workplanes on the surface of existing faces using
| :meth:`workplane`
|
| Methods defined here:
|
| __add__(self: ~T, other: Union[ForwardRef('Workplane'), cadquery.occ_impl.shapes.Solid, cadquery.occ_impl.shapes.Compound]) -> ~T
| Syntactic sugar for union.
|
| Notice that :code:`r = a + b` is equivalent to :code:`r = a.union(b)` and :code:`r = a | b`.
|
| __and__(self: ~T, other: Union[ForwardRef('Workplane'), cadquery.occ_impl.shapes.Solid, cadquery.occ_impl.shapes.Compound]) -> ~T
| Syntactic sugar for intersect.
|
| Notice that :code:`r = a & b` is equivalent to :code:`r = a.intersect(b)`.
|
| Example::
|
| Box = Workplane("XY").box(1, 1, 1, centered=(False, False, False))
| Sphere = Workplane("XY").sphere(1)
| result = Box & Sphere
|
| __getitem__(self: ~T, item: Union[int, Sequence[int], slice]) -> ~T
|
| __init__(self, inPlane='XY', origin=(0, 0, 0), obj=None)
| make a workplane from a particular plane
|
| :param inPlane: the plane in which the workplane will be done
| :type inPlane: a Plane object, or a string in (XY|YZ|XZ|front|back|top|bottom|left|right)
| :param origin: the desired origin of the new workplane
| :type origin: a 3-tuple in global coordinates, or None to default to the origin
| :param obj: an object to use initially for the stack
| :type obj: a CAD primitive, or None to use the centerpoint of the plane as the initial
| stack value.
| :raises: ValueError if the provided plane is not a plane, or one of XY|YZ|XZ
| :return: A Workplane object, with coordinate system matching the supplied plane.
|
| The most common use is::
|
| s = Workplane("XY")
|
| After creation, the stack contains a single point, the origin of the underlying plane, and
| the *current point* is on the origin.
|
| __iter__(self: ~T) -> Iterator[cadquery.occ_impl.shapes.Shape]
| Special method for iterating over Shapes in objects
|
| __mul__(self: ~T, other: Union[ForwardRef('Workplane'), cadquery.occ_impl.shapes.Solid, cadquery.occ_impl.shapes.Compound]) -> ~T
| Syntactic sugar for intersect.
|
| Notice that :code:`r = a * b` is equivalent to :code:`r = a.intersect(b)`.
|
| Example::
|
| Box = Workplane("XY").box(1, 1, 1, centered=(False, False, False))
| Sphere = Workplane("XY").sphere(1)
| result = Box * Sphere
|
| __or__(self: ~T, other: Union[ForwardRef('Workplane'), cadquery.occ_impl.shapes.Solid, cadquery.occ_impl.shapes.Compound]) -> ~T
| Syntactic sugar for union.
|
| Notice that :code:`r = a | b` is equivalent to :code:`r = a.union(b)` and :code:`r = a + b`.
|
| Example::
|
| Box = Workplane("XY").box(1, 1, 1, centered=(False, False, False))
| Sphere = Workplane("XY").sphere(1)
| result = Box | Sphere
|
| __sub__(self: ~T, other: Union[ForwardRef('Workplane'), cadquery.occ_impl.shapes.Solid, cadquery.occ_impl.shapes.Compound]) -> ~T
| Syntactic sugar for cut.
|
| Notice that :code:`r = a - b` is equivalent to :code:`r = a.cut(b)`.
|
| Example::
|
| Box = Workplane("XY").box(1, 1, 1, centered=(False, False, False))
| Sphere = Workplane("XY").sphere(1)
| result = Box - Sphere
|
| __truediv__(self: ~T, other: Union[ForwardRef('Workplane'), cadquery.occ_impl.shapes.Solid, cadquery.occ_impl.shapes.Compound]) -> ~T
| Syntactic sugar for split.
|
| Notice that :code:`r = a / b` is equivalent to :code:`r = a.split(b)`.
|
| Example::
|
| Box = Workplane("XY").box(1, 1, 1, centered=(False, False, False))
| Sphere = Workplane("XY").sphere(1)
| result = Box / Sphere
|
| add(self, obj)
| Adds an object or a list of objects to the stack
|
| :param obj: an object to add
| :type obj: a Workplane, CAD primitive, or list of CAD primitives
| :return: a Workplane with the requested operation performed
|
| If a Workplane object, the values of that object's stack are added. If
| a list of cad primitives, they are all added. If a single CAD primitive
| then it is added.
|
| Used in rare cases when you need to combine the results of several CQ
| results into a single Workplane object.
|
| all(self: ~T) -> List[~T]
| Return a list of all CQ objects on the stack.
|
| useful when you need to operate on the elements
| individually.
|
| Contrast with vals, which returns the underlying
| objects for all of the items on the stack
|
| ancestors(self: ~T, kind: Literal['Vertex', 'Edge', 'Wire', 'Face', 'Shell', 'Solid', 'CompSolid', 'Compound'], tag: Optional[str] = None) -> ~T
| Select topological ancestors.
|
| :param kind: kind of ancestor, e.g. "Face" or "Edge"
| :param tag: if set, search the tagged object instead of self
| :return: a Workplane object whose stack contains selected ancestors.
|
| apply(self: ~T, f: Callable[[Iterable[Union[cadquery.occ_impl.geom.Vector, cadquery.occ_impl.geom.Location, cadquery.occ_impl.shapes.Shape, cadquery.sketch.Sketch]]], Iterable[Union[cadquery.occ_impl.geom.Vector, cadquery.occ_impl.geom.Location, cadquery.occ_impl.shapes.Shape, cadquery.sketch.Sketch]]]) -> ~T
| Apply a callable to all items at once.
|
| :param f: Callable to be applied.
| :return: Workplane object with f applied to all items.
|
| bezier(self: ~T, listOfXYTuple: Iterable[Union[Tuple[float, float], Tuple[float, float, float], cadquery.occ_impl.geom.Vector]], forConstruction: bool = False, includeCurrent: bool = False, makeWire: bool = False) -> ~T
| Make a cubic Bézier curve by the provided points (2D or 3D).
|
| :param listOfXYTuple: Bezier control points and end point.
| All points except the last point are Bezier control points,
| and the last point is the end point
| :param includeCurrent: Use the current point as a starting point of the curve
| :param makeWire: convert the resulting bezier edge to a wire
| :return: a Workplane object with the current point at the end of the bezier
|
| The Bézier Will begin at either current point or the first point
| of listOfXYTuple, and end with the last point of listOfXYTuple
|
| box(self: ~T, length: float, width: float, height: float, centered: Union[bool, Tuple[bool, bool, bool]] = True, combine: Union[bool, Literal['cut', 'a', 's']] = True, clean: bool = True) -> ~T
| Return a 3d box with specified dimensions for each object on the stack.
|
| :param length: box size in X direction
| :param width: box size in Y direction
| :param height: box size in Z direction
| :param centered: If True, the box will be centered around the reference point.
| If False, the corner of the box will be on the reference point and it will
| extend in the positive x, y and z directions. Can also use a 3-tuple to
| specify centering along each axis.
| :param combine: should the results be combined with other solids on the stack
| (and each other)?
| :param clean: call :meth:`clean` afterwards to have a clean shape
|
| One box is created for each item on the current stack. If no items are on the stack, one box
| using the current workplane center is created.
|
| If combine is true, the result will be a single object on the stack. If a solid was found
| in the chain, the result is that solid with all boxes produced fused onto it otherwise, the
| result is the combination of all the produced boxes.
|
| If combine is false, the result will be a list of the boxes produced.
|
| Most often boxes form the basis for a part::
|
| # make a single box with lower left corner at origin
| s = Workplane().box(1, 2, 3, centered=False)
|
| But sometimes it is useful to create an array of them::
|
| # create 4 small square bumps on a larger base plate:
| s = (
| Workplane()
| .box(4, 4, 0.5)
| .faces(">Z")
| .workplane()
| .rect(3, 3, forConstruction=True)
| .vertices()
| .box(0.25, 0.25, 0.25, combine=True)
| )
|
| cboreHole(self: ~T, diameter: float, cboreDiameter: float, cboreDepth: float, depth: Optional[float] = None, clean: bool = True) -> ~T
| Makes a counterbored hole for each item on the stack.
|
| :param diameter: the diameter of the hole
| :param cboreDiameter: the diameter of the cbore, must be greater than hole diameter
| :param cboreDepth: depth of the counterbore
| :type cboreDepth: float > 0
| :param depth: the depth of the hole
| :type depth: float > 0 or None to drill thru the entire part
| :param clean: call :meth:`clean` afterwards to have a clean shape
|
| The surface of the hole is at the current workplane plane.
|
| One hole is created for each item on the stack. A very common use case is to use a
| construction rectangle to define the centers of a set of holes, like so::
|
| s = (
| Workplane()
| .box(2, 4, 0.5)
| .faces(">Z")
| .workplane()
| .rect(1.5, 3.5, forConstruction=True)
| .vertices()
| .cboreHole(0.125, 0.25, 0.125, depth=None)
| )
|
| This sample creates a plate with a set of holes at the corners.
|
| **Plugin Note**: this is one example of the power of plugins. Counterbored holes are quite
| time consuming to create, but are quite easily defined by users.
|
| see :meth:`cskHole` to make countersinks instead of counterbores
|
| center(self: ~T, x: float, y: float) -> ~T
| Shift local coordinates to the specified location.
|
| The location is specified in terms of local coordinates.
|
| :param x: the new x location
| :param y: the new y location
| :returns: the Workplane object, with the center adjusted.
|
| The current point is set to the new center.
| This method is useful to adjust the center point after it has been created automatically on
| a face, but not where you'd like it to be.
|
| In this example, we adjust the workplane center to be at the corner of a cube, instead of
| the center of a face, which is the default::
|
| # this workplane is centered at x=0.5,y=0.5, the center of the upper face
| s = Workplane().box(1, 1, 1).faces(">Z").workplane()
|
| s = s.center(-0.5, -0.5) # move the center to the corner
| t = s.circle(0.25).extrude(0.2)
| assert t.faces().size() == 9 # a cube with a cylindrical nub at the top right corner
|
| The result is a cube with a round boss on the corner
|
| chamfer(self: ~T, length: float, length2: Optional[float] = None) -> ~T
| Chamfers a solid on the selected edges.
|
| The edges on the stack are chamfered. The solid to which the
| edges belong must be in the parent chain of the selected
| edges.
|
| Optional parameter `length2` can be supplied with a different
| value than `length` for a chamfer that is shorter on one side
| longer on the other side.
|
| :param length: the length of the chamfer, must be greater than zero
| :param length2: optional parameter for asymmetrical chamfer
| :raises ValueError: if at least one edge is not selected
| :raises ValueError: if the solid containing the edge is not in the chain
| :returns: CQ object with the resulting solid selected.
|
| This example will create a unit cube, with the top edges chamfered::
|
| s = Workplane("XY").box(1, 1, 1).faces("+Z").chamfer(0.1)
|
| This example will create chamfers longer on the sides::
|
| s = Workplane("XY").box(1, 1, 1).faces("+Z").chamfer(0.2, 0.1)
|
| circle(self: ~T, radius: float, forConstruction: bool = False) -> ~T
| Make a circle for each item on the stack.
|
| :param radius: radius of the circle
| :param forConstruction: should the new wires be reference geometry only?
| :type forConstruction: true if the wires are for reference, false if they are creating
| part geometry
| :return: a new CQ object with the created wires on the stack
|
| A common use case is to use a for-construction rectangle to define the centers of a
| hole pattern::
|
| s = Workplane().rect(4.0, 4.0, forConstruction=True).vertices().circle(0.25)
|
| Creates 4 circles at the corners of a square centered on the origin. Another common case is
| to use successive circle() calls to create concentric circles. This works because the
| center of a circle is its reference point::
|
| s = Workplane().circle(2.0).circle(1.0)
|
| Creates two concentric circles, which when extruded will form a ring.
|
| Future Enhancements:
| better way to handle forConstruction
| project points not in the workplane plane onto the workplane plane
|
| clean(self: ~T) -> ~T
| Cleans the current solid by removing unwanted edges from the
| faces.
|
| Normally you don't have to call this function. It is
| automatically called after each related operation. You can
| disable this behavior with `clean=False` parameter if method
| has any. In some cases this can improve performance
| drastically but is generally dis-advised since it may break
| some operations such as fillet.
|
| Note that in some cases where lots of solid operations are
| chained, `clean()` may actually improve performance since
| the shape is 'simplified' at each step and thus next operation
| is easier.
|
| Also note that, due to limitation of the underlying engine,
| `clean` may fail to produce a clean output in some cases such as
| spherical faces.
|
| close(self: ~T) -> ~T
| End construction, and attempt to build a closed wire.
|
| :return: a CQ object with a completed wire on the stack, if possible.
|
| After 2D (or 3D) drafting with methods such as lineTo, threePointArc,
| tangentArcPoint and polyline, it is necessary to convert the edges
| produced by these into one or more wires.
|
| When a set of edges is closed, CadQuery assumes it is safe to build
| the group of edges into a wire. This example builds a simple triangular
| prism::
|
| s = Workplane().lineTo(1, 0).lineTo(1, 1).close().extrude(0.2)
|
| combine(self: ~T, clean: bool = True, glue: bool = False, tol: Optional[float] = None) -> ~T
| Attempts to combine all of the items on the stack into a single item.
|
| WARNING: all of the items must be of the same type!
|
| :param clean: call :meth:`clean` afterwards to have a clean shape
| :param glue: use a faster gluing mode for non-overlapping shapes (default False)
| :param tol: tolerance value for fuzzy bool operation mode (default None)
| :raises: ValueError if there are no items on the stack, or if they cannot be combined
| :return: a CQ object with the resulting object selected
|
| compounds(self: ~T, selector: Union[str, cadquery.selectors.Selector, NoneType] = None, tag: Optional[str] = None) -> ~T
| Select compounds on the stack, optionally filtering the selection. If there are multiple
| objects on the stack, they are collected and a list of all the distinct compounds
| is returned.
|
| :param selector: optional Selector object, or string selector expression
| (see :class:`StringSyntaxSelector`)
| :param tag: if set, search the tagged object instead of self
| :return: a CQ object whose stack contains all of the *distinct* compounds of *all* objects on
| the current stack, filtered by the provided selector.
|
| A compound contains multiple CAD primitives that resulted from a single operation, such as
| a union, cut, split, or fillet. Compounds can contain multiple edges, wires, or solids.
|
| consolidateWires(self: ~T) -> ~T
| Attempt to consolidate wires on the stack into a single.
| If possible, a new object with the results are returned.
| if not possible, the wires remain separated
|
| copyWorkplane(self, obj: ~T) -> ~T
| Copies the workplane from obj.
|
| :param obj: an object to copy the workplane from
| :type obj: a CQ object
| :returns: a CQ object with obj's workplane
|
| cskHole(self: ~T, diameter: float, cskDiameter: float, cskAngle: float, depth: Optional[float] = None, clean: bool = True) -> ~T
| Makes a countersunk hole for each item on the stack.
|
| :param diameter: the diameter of the hole
| :type diameter: float > 0
| :param cskDiameter: the diameter of the countersink, must be greater than hole diameter
| :param cskAngle: angle of the countersink, in degrees ( 82 is common )
| :type cskAngle: float > 0
| :param depth: the depth of the hole
| :type depth: float > 0 or None to drill thru the entire part.
| :param clean: call :meth:`clean` afterwards to have a clean shape
|
| The surface of the hole is at the current workplane.
|
| One hole is created for each item on the stack. A very common use case is to use a
| construction rectangle to define the centers of a set of holes, like so::
|
| s = (
| Workplane()
| .box(2, 4, 0.5)
| .faces(">Z")
| .workplane()
| .rect(1.5, 3.5, forConstruction=True)
| .vertices()
| .cskHole(0.125, 0.25, 82, depth=None)
| )
|
| This sample creates a plate with a set of holes at the corners.
|
| **Plugin Note**: this is one example of the power of plugins. CounterSunk holes are quite
| time consuming to create, but are quite easily defined by users.
|
| see :meth:`cboreHole` to make counterbores instead of countersinks
|
| cut(self: ~T, toCut: Union[ForwardRef('Workplane'), cadquery.occ_impl.shapes.Solid, cadquery.occ_impl.shapes.Compound], clean: bool = True, tol: Optional[float] = None) -> ~T
| Cuts the provided solid from the current solid, IE, perform a solid subtraction.
|
| :param toCut: a solid object, or a Workplane object having a solid
| :param clean: call :meth:`clean` afterwards to have a clean shape
| :param tol: tolerance value for fuzzy bool operation mode (default None)
| :raises ValueError: if there is no solid to subtract from in the chain
| :return: a Workplane object with the resulting object selected
|
| cutBlind(self: ~T, until: Union[float, Literal['next', 'last'], cadquery.occ_impl.shapes.Face], clean: bool = True, both: bool = False, taper: Optional[float] = None) -> ~T
| Use all un-extruded wires in the parent chain to create a prismatic cut from existing solid.
|
| Specify either a distance value, or one of "next", "last" to indicate a face to cut to.
|
| Similar to extrude, except that a solid in the parent chain is required to remove material
| from. cutBlind always removes material from a part.
|
| :param until: The distance to cut to, normal to the workplane plane. When a negative float
| is passed the cut extends this far in the opposite direction to the normal of the plane
| (i.e in the solid). The string "next" cuts until the next face orthogonal to the wire
| normal. "last" cuts to the last face. If an object of type Face is passed, then the cut
| will extend until this face.
| :param clean: call :meth:`clean` afterwards to have a clean shape
| :param both: cut in both directions symmetrically
| :param taper: angle for optional tapered extrusion
| :raises ValueError: if there is no solid to subtract from in the chain
| :return: a CQ object with the resulting object selected
|
| see :meth:`cutThruAll` to cut material from the entire part
|
| cutEach(self: ~T, fcn: Callable[[cadquery.occ_impl.geom.Location], cadquery.occ_impl.shapes.Shape], useLocalCoords: bool = False, clean: bool = True) -> ~T
| Evaluates the provided function at each point on the stack (ie, eachpoint)
| and then cuts the result from the context solid.
|
| :param fcn: a function suitable for use in the eachpoint method: ie, that accepts a vector
| :param useLocalCoords: same as for :meth:`eachpoint`
| :param clean: call :meth:`clean` afterwards to have a clean shape
| :raises ValueError: if no solids or compounds are found in the stack or parent chain
| :return: a CQ object that contains the resulting solid
|
| cutThruAll(self: ~T, clean: bool = True, taper: float = 0) -> ~T
| Use all un-extruded wires in the parent chain to create a prismatic cut from existing solid.
| Cuts through all material in both normal directions of workplane.
|
| Similar to extrude, except that a solid in the parent chain is required to remove material
| from. cutThruAll always removes material from a part.
|
| :param clean: call :meth:`clean` afterwards to have a clean shape
| :raises ValueError: if there is no solid to subtract from in the chain
| :raises ValueError: if there are no pending wires to cut with
| :return: a CQ object with the resulting object selected
|
| see :meth:`cutBlind` to cut material to a limited depth
|
| cylinder(self: ~T, height: float, radius: float, direct: Union[Tuple[float, float, float], cadquery.occ_impl.geom.Vector] = Vector: (0.0, 0.0, 1.0), angle: float = 360, centered: Union[bool, Tuple[bool, bool, bool]] = True, combine: Union[bool, Literal['cut', 'a', 's']] = True, clean: bool = True) -> ~T
| Returns a cylinder with the specified radius and height for each point on the stack
|
| :param height: The height of the cylinder
| :param radius: The radius of the cylinder
| :param direct: The direction axis for the creation of the cylinder
| :type direct: A three-tuple
| :param angle: The angle to sweep the cylinder arc through
| :type angle: float > 0
| :param centered: If True, the cylinder will be centered around the reference point. If False,
| the corner of a bounding box around the cylinder will be on the reference point and it
| will extend in the positive x, y and z directions. Can also use a 3-tuple to specify
| centering along each axis.
| :param combine: Whether the results should be combined with other solids on the stack
| (and each other)
| :type combine: true to combine shapes, false otherwise
| :param clean: call :meth:`clean` afterwards to have a clean shape
| :return: A cylinder object for each point on the stack
|
| One cylinder is created for each item on the current stack. If no items are on the stack, one
| cylinder is created using the current workplane center.
|
| If combine is true, the result will be a single object on the stack. If a solid was found
| in the chain, the result is that solid with all cylinders produced fused onto it otherwise,
| the result is the combination of all the produced cylinders.
|
| If combine is false, the result will be a list of the cylinders produced.
|
| each(self: ~T, callback: Callable[[Union[cadquery.occ_impl.geom.Vector, cadquery.occ_impl.geom.Location, cadquery.occ_impl.shapes.Shape, cadquery.sketch.Sketch]], cadquery.occ_impl.shapes.Shape], useLocalCoordinates: bool = False, combine: Union[bool, Literal['cut', 'a', 's']] = True, clean: bool = True) -> ~T
| Runs the provided function on each value in the stack, and collects the return values into
| a new CQ object.
|
| Special note: a newly created workplane always has its center point as its only stack item
|
| :param callBackFunction: the function to call for each item on the current stack.
| :param useLocalCoordinates: should values be converted from local coordinates first?
| :param combine: True or "a" to combine the resulting solid with parent solids if found,
| "cut" or "s" to remove the resulting solid from the parent solids if found.
| False to keep the resulting solid separated from the parent solids.
| :param clean: call :meth:`clean` afterwards to have a clean shape
|
|
| The callback function must accept one argument, which is the item on the stack, and return
| one object, which is collected. If the function returns None, nothing is added to the stack.
| The object passed into the callBackFunction is potentially transformed to local coordinates,
| if useLocalCoordinates is true
|
| useLocalCoordinates is very useful for plugin developers.
|
| If false, the callback function is assumed to be working in global coordinates. Objects
| created are added as-is, and objects passed into the function are sent in using global
| coordinates
|
| If true, the calling function is assumed to be working in local coordinates. Objects are
| transformed to local coordinates before they are passed into the callback method, and result
| objects are transformed to global coordinates after they are returned.
|
| This allows plugin developers to create objects in local coordinates, without worrying
| about the fact that the working plane is different than the global coordinate system.
|
|
| TODO: wrapper object for Wire will clean up forConstruction flag everywhere
|
| eachpoint(self: ~T, arg: Union[cadquery.occ_impl.shapes.Shape, ForwardRef('Workplane'), Callable[[cadquery.occ_impl.geom.Location], cadquery.occ_impl.shapes.Shape]], useLocalCoordinates: bool = False, combine: Union[bool, Literal['cut', 'a', 's']] = False, clean: bool = True) -> ~T
| Same as each(), except arg is translated by the positions on the stack. If arg is a callback function, then the function is called for each point on the stack, and the resulting shape is used.
| :return: CadQuery object which contains a list of vectors (points ) on its stack.
|
| :param useLocalCoordinates: should points be in local or global coordinates
| :param combine: True or "a" to combine the resulting solid with parent solids if found,
| "cut" or "s" to remove the resulting solid from the parent solids if found.
| False to keep the resulting solid separated from the parent solids.
| :param clean: call :meth:`clean` afterwards to have a clean shape
|
|
| The resulting object has a point on the stack for each object on the original stack.
| Vertices and points remain a point. Faces, Wires, Solids, Edges, and Shells are converted
| to a point by using their center of mass.
|
| If the stack has zero length, a single point is returned, which is the center of the current
| workplane/coordinate system
|
| edges(self: ~T, selector: Union[str, cadquery.selectors.Selector, NoneType] = None, tag: Optional[str] = None) -> ~T
| Select the edges of objects on the stack, optionally filtering the selection. If there are
| multiple objects on the stack, the edges of all objects are collected and a list of all the
| distinct edges is returned.
|
| :param selector: optional Selector object, or string selector expression
| (see :class:`StringSyntaxSelector`)
| :param tag: if set, search the tagged object instead of self
| :return: a CQ object whose stack contains all of the *distinct* edges of *all* objects on
| the current stack, filtered by the provided selector.
|
| If there are no edges for any objects on the current stack, an empty CQ object is returned
|
| The typical use is to select the edges of a single object on the stack. For example::
|
| Workplane().box(1, 1, 1).faces("+Z").edges().size()
|
| returns 4, because the topmost face of a cube will contain four edges. Similarly::
|
| Workplane().box(1, 1, 1).edges().size()
|
| returns 12, because a cube has a total of 12 edges, And::
|
| Workplane().box(1, 1, 1).edges("|Z").size()
|
| returns 4, because a cube has 4 edges parallel to the z direction
|
| ellipse(self: ~T, x_radius: float, y_radius: float, rotation_angle: float = 0.0, forConstruction: bool = False) -> ~T
| Make an ellipse for each item on the stack.
|
| :param x_radius: x radius of the ellipse (x-axis of plane the ellipse should lie in)
| :param y_radius: y radius of the ellipse (y-axis of plane the ellipse should lie in)
| :param rotation_angle: angle to rotate the ellipse
| :param forConstruction: should the new wires be reference geometry only?
| :type forConstruction: true if the wires are for reference, false if they are creating
| part geometry
| :return: a new CQ object with the created wires on the stack
|
| *NOTE* Due to a bug in opencascade (https://tracker.dev.opencascade.org/view.php?id=31290)
| the center of mass (equals center for next shape) is shifted. To create concentric ellipses
| use::
|
| Workplane("XY").center(10, 20).ellipse(100, 10).center(0, 0).ellipse(50, 5)
|
| ellipseArc(self: ~T, x_radius: float, y_radius: float, angle1: float = 360, angle2: float = 360, rotation_angle: float = 0.0, sense: Literal[-1, 1] = 1, forConstruction: bool = False, startAtCurrent: bool = True, makeWire: bool = False) -> ~T
| Draw an elliptical arc with x and y radiuses either with start point at current point or
| or current point being the center of the arc
|
| :param x_radius: x radius of the ellipse (along the x-axis of plane the ellipse should lie in)
| :param y_radius: y radius of the ellipse (along the y-axis of plane the ellipse should lie in)
| :param angle1: start angle of arc
| :param angle2: end angle of arc (angle2 == angle1 return closed ellipse = default)
| :param rotation_angle: angle to rotate the created ellipse / arc
| :param sense: clockwise (-1) or counter clockwise (1)
| :param startAtCurrent: True: start point of arc is moved to current point; False: center of
| arc is on current point
| :param makeWire: convert the resulting arc edge to a wire
|
| end(self, n: int = 1) -> 'Workplane'
| Return the nth parent of this CQ element
|
| :param n: number of ancestor to return (default: 1)
| :rtype: a CQ object
| :raises: ValueError if there are no more parents in the chain.
|
| For example::
|
| CQ(obj).faces("+Z").vertices().end()
|
| will return the same as::
|
| CQ(obj).faces("+Z")
|
| export(self: ~T, fname: str, tolerance: float = 0.1, angularTolerance: float = 0.1, unit: Literal['MM', 'CM', 'M', 'KM', 'INCH', 'FT', 'MI', 'UM', 'NM'] = 'MM', outputUnit: Optional[Literal['MM', 'CM', 'M', 'KM', 'INCH', 'FT', 'MI', 'UM', 'NM']] = None, opt: Optional[Dict[str, Any]] = None) -> ~T
| Export Workplane to file.
|
| :param path: Filename.
| :param tolerance: the deflection tolerance, in model units. Default 0.1.
| :param angularTolerance: the angular tolerance, in radians. Default 0.1.
| :param unit: The internal unit of the model's geometry values. Only used for STEP. Default "MM".
| :type unit: UnitLiterals
| :param outputUnit: The unit to use in the STEP file header. If None, defaults to the value of ``unit``.
| Use this when you want the output file to declare a different unit than the model's internal unit,
| for example to export a MM model as a STEP file declaring meters.
| :type outputUnit: UnitLiterals or None
| :param opt: additional options passed to the specific exporter. Default None.
| :return: Self.
|
| exportSvg(self, fileName: str) -> None
| Exports the first item on the stack as an SVG file
|
| For testing purposes mainly.
|
| :param fileName: the filename to export, absolute path to the file
|
| extrude(self: ~T, until: Union[float, Literal['next', 'last'], cadquery.occ_impl.shapes.Face], combine: Union[bool, Literal['cut', 'a', 's']] = True, clean: bool = True, both: bool = False, taper: Optional[float] = None) -> ~T
| Use all un-extruded wires in the parent chain to create a prismatic solid.
|
| :param until: The distance to extrude, normal to the workplane plane. When a float is
| passed, the extrusion extends this far and a negative value is in the opposite direction
| to the normal of the plane. The string "next" extrudes until the next face orthogonal to
| the wire normal. "last" extrudes to the last face. If a object of type Face is passed then
| the extrusion will extend until this face. **Note that the Workplane must contain a Solid for extruding to a given face.**
| :param combine: True or "a" to combine the resulting solid with parent solids if found,
| "cut" or "s" to remove the resulting solid from the parent solids if found.
| False to keep the resulting solid separated from the parent solids.
| :param clean: call :meth:`clean` afterwards to have a clean shape
| :param both: extrude in both directions symmetrically
| :param taper: angle for optional tapered extrusion
| :return: a CQ object with the resulting solid selected.
|
| The returned object is always a CQ object, and depends on whether combine is True, and
| whether a context solid is already defined:
|
| * if combine is False, the new value is pushed onto the stack. Note that when extruding
| until a specified face, combine can not be False
| * if combine is true, the value is combined with the context solid if it exists,
| and the resulting solid becomes the new context solid.
|
| faces(self: ~T, selector: Union[str, cadquery.selectors.Selector, NoneType] = None, tag: Optional[str] = None) -> ~T
| Select the faces of objects on the stack, optionally filtering the selection. If there are
| multiple objects on the stack, the faces of all objects are collected and a list of all the
| distinct faces is returned.
|
| :param selector: optional Selector object, or string selector expression
| (see :class:`StringSyntaxSelector`)
| :param tag: if set, search the tagged object instead of self
| :return: a CQ object whose stack contains all of the *distinct* faces of *all* objects on
| the current stack, filtered by the provided selector.
|
| If there are no faces for any objects on the current stack, an empty CQ object
| is returned.
|
| The typical use is to select the faces of a single object on the stack. For example::
|
| Workplane().box(1, 1, 1).faces("+Z").size()
|
| returns 1, because a cube has one face with a normal in the +Z direction. Similarly::
|
| Workplane().box(1, 1, 1).faces().size()
|
| returns 6, because a cube has a total of 6 faces, And::
|
| Workplane().box(1, 1, 1).faces("|Z").size()
|
| returns 2, because a cube has 2 faces having normals parallel to the z direction
|
| fillet(self: ~T, radius: float) -> ~T
| Fillets a solid on the selected edges.
|
| The edges on the stack are filleted. The solid to which the edges belong must be in the
| parent chain of the selected edges.
|
| :param radius: the radius of the fillet, must be > zero
| :raises ValueError: if at least one edge is not selected
| :raises ValueError: if the solid containing the edge is not in the chain
| :returns: CQ object with the resulting solid selected.
|
| This example will create a unit cube, with the top edges filleted::
|
| s = Workplane().box(1, 1, 1).faces("+Z").edges().fillet(0.1)
|
| filter(self: ~T, f: Callable[[Union[cadquery.occ_impl.geom.Vector, cadquery.occ_impl.geom.Location, cadquery.occ_impl.shapes.Shape, cadquery.sketch.Sketch]], bool]) -> ~T
| Filter items using a boolean predicate.
|
| :param f: Callable to be used for filtering.
| :return: Workplane object with filtered items.
|
| findSolid(self, searchStack: bool = True, searchParents: bool = True) -> Union[cadquery.occ_impl.shapes.Solid, cadquery.occ_impl.shapes.Compound]
| Finds the first solid object in the chain, searching from the current node
| backwards through parents until one is found.
|
| :param searchStack: should objects on the stack be searched first?
| :param searchParents: should parents be searched?
| :raises ValueError: if no solid is found
|
| This function is very important for chains that are modifying a single parent object,
| most often a solid.
|
| Most of the time, a chain defines or selects a solid, and then modifies it using workplanes
| or other operations.
|
| Plugin Developers should make use of this method to find the solid that should be modified,
| if the plugin implements a unary operation, or if the operation will automatically merge its
| results with an object already on the stack.
|
| first(self: ~T) -> ~T
| Return the first item on the stack
|
| :returns: the first item on the stack.
| :rtype: a CQ object
|
| hLine(self: ~T, distance: float, forConstruction: bool = False) -> ~T
| Make a horizontal line from the current point the provided distance
|
| :param distance: (x) distance from current point
| :return: the Workplane object with the current point at the end of the new line
|
| hLineTo(self: ~T, xCoord: float, forConstruction: bool = False) -> ~T
| Make a horizontal line from the current point to the provided x coordinate.
|
| Useful if it is more convenient to specify the end location rather than distance,
| as in :meth:`hLine`
|
| :param xCoord: x coordinate for the end of the line
| :return: the Workplane object with the current point at the end of the new line
|
| hole(self: ~T, diameter: float, depth: Optional[float] = None, clean: bool = True) -> ~T
| Makes a hole for each item on the stack.
|
| :param diameter: the diameter of the hole
| :param depth: the depth of the hole
| :type depth: float > 0 or None to drill thru the entire part.
| :param clean: call :meth:`clean` afterwards to have a clean shape
|
| The surface of the hole is at the current workplane.
|
| One hole is created for each item on the stack. A very common use case is to use a
| construction rectangle to define the centers of a set of holes, like so::
|
| s = (
| Workplane()
| .box(2, 4, 0.5)
| .faces(">Z")
| .workplane()
| .rect(1.5, 3.5, forConstruction=True)
| .vertices()
| .hole(0.125, 82)
| )
|
| This sample creates a plate with a set of holes at the corners.
|
| **Plugin Note**: this is one example of the power of plugins. CounterSunk holes are quite
| time consuming to create, but are quite easily defined by users.
|
| see :meth:`cboreHole` and :meth:`cskHole` to make counterbores or countersinks
|
| interpPlate(self: ~T, surf_edges: Union[Sequence[Union[Tuple[float, float], Tuple[float, float, float], cadquery.occ_impl.geom.Vector]], Sequence[Union[cadquery.occ_impl.shapes.Edge, cadquery.occ_impl.shapes.Wire]], ForwardRef('Workplane')], surf_pts: Sequence[Union[Tuple[float, float], Tuple[float, float, float], cadquery.occ_impl.geom.Vector]] = [], thickness: float = 0, combine: Union[bool, Literal['cut', 'a', 's']] = False, clean: bool = True, degree: int = 3, nbPtsOnCur: int = 15, nbIter: int = 2, anisotropy: bool = False, tol2d: float = 1e-05, tol3d: float = 0.0001, tolAng: float = 0.01, tolCurv: float = 0.1, maxDeg: int = 8, maxSegments: int = 9) -> ~T
| Returns a plate surface that is 'thickness' thick, enclosed by 'surf_edge_pts' points, and going
| through 'surf_pts' points. Using pushPoints directly with interpPlate and combine=True, can be
| very resource intensive depending on the complexity of the shape. In this case set combine=False.
|
| :param surf_edges: list of [x,y,z] ordered coordinates or list of ordered or unordered edges, wires
| :param surf_pts: list of points (uses only edges if [])
| :param thickness: value may be negative or positive depending on thickening direction (2D surface if 0)
| :param combine: should the results be combined with other solids on the stack (and each other)?
| :param clean: call :meth:`clean` afterwards to have a clean shape
| :param degree: >= 2
| :param nbPtsOnCur: number of points on curve >= 15
| :param nbIter: number of iterations >= 2
| :param anisotropy: = bool Anisotropy
| :param tol2d: 2D tolerance
| :param tol3d: 3D tolerance
| :param tolAng: angular tolerance
| :param tolCurv: tolerance for curvature
| :param maxDeg: highest polynomial degree >= 2
| :param maxSegments: greatest number of segments >= 2
|
| intersect(self: ~T, toIntersect: Union[ForwardRef('Workplane'), cadquery.occ_impl.shapes.Solid, cadquery.occ_impl.shapes.Compound], clean: bool = True, tol: Optional[float] = None) -> ~T
| Intersects the provided solid from the current solid.
|
| :param toIntersect: a solid object, or a Workplane object having a solid
| :param clean: call :meth:`clean` afterwards to have a clean shape
| :param tol: tolerance value for fuzzy bool operation mode (default None)
| :raises ValueError: if there is no solid to intersect with in the chain
| :return: a Workplane object with the resulting object selected
|
| invoke(self: ~T, f: Union[Callable[[~T], ~T], Callable[[~T], NoneType], Callable[[], NoneType]]) -> ~T
| Invoke a callable mapping Workplane to Workplane or None. Supports also
| callables that take no arguments such as breakpoint. Returns self if callable
| returns None.
|
| :param f: Callable to be invoked.
| :return: Workplane object.
|
| item(self: ~T, i: int) -> ~T
| Return the ith item on the stack.
|
| :rtype: a CQ object
|
| largestDimension(self) -> float
| Finds the largest dimension in the stack.
|
| Used internally to create thru features, this is how you can compute
| how long or wide a feature must be to make sure to cut through all of the material
|
| :raises ValueError: if no solids or compounds are found
| :return: A value representing the largest dimension of the first solid on the stack
|
| last(self: ~T) -> ~T
| Return the last item on the stack.
|
| :rtype: a CQ object
|
| line(self: ~T, xDist: float, yDist: float, forConstruction: bool = False) -> ~T
| Make a line from the current point to the provided point, using
| dimensions relative to the current point
|
| :param xDist: x distance from current point
| :param yDist: y distance from current point
| :return: the workplane object with the current point at the end of the new line
|
| see :meth:`lineTo` if you want to use absolute coordinates to make a line instead.
|
| lineTo(self: ~T, x: float, y: float, forConstruction: bool = False) -> ~T
| Make a line from the current point to the provided point
|
| :param x: the x point, in workplane plane coordinates
| :param y: the y point, in workplane plane coordinates
| :return: the Workplane object with the current point at the end of the new line
|
| See :meth:`line` if you want to use relative dimensions to make a line instead.
|
| loft(self: ~T, ruled: bool = False, combine: Union[bool, Literal['cut', 'a', 's']] = True, clean: bool = True) -> ~T
| Make a lofted solid, through the set of wires.
|
| :param ruled: When set to `True` connects each section linearly and without continuity
| :param combine: True or "a" to combine the resulting solid with parent solids if found,
| "cut" or "s" to remove the resulting solid from the parent solids if found.
| False to keep the resulting solid separated from the parent solids.
| :param clean: call :meth:`clean` afterwards to have a clean shape
|
| :return: a Workplane object containing the created loft
|
| map(self: ~T, f: Callable[[Union[cadquery.occ_impl.geom.Vector, cadquery.occ_impl.geom.Location, cadquery.occ_impl.shapes.Shape, cadquery.sketch.Sketch]], Union[cadquery.occ_impl.geom.Vector, cadquery.occ_impl.geom.Location, cadquery.occ_impl.shapes.Shape, cadquery.sketch.Sketch]]) -> ~T
| Apply a callable to every item separately.
|
| :param f: Callable to be applied to every item separately.
| :return: Workplane object with f applied to all items.
|
| mirror(self: ~T, mirrorPlane: Union[Literal['XY', 'YX', 'XZ', 'ZX', 'YZ', 'ZY'], Tuple[float, float], Tuple[float, float, float], cadquery.occ_impl.geom.Vector, cadquery.occ_impl.shapes.Face, ForwardRef('Workplane')] = 'XY', basePointVector: Union[Tuple[float, float], Tuple[float, float, float], cadquery.occ_impl.geom.Vector, NoneType] = None, union: bool = False) -> ~T
| Mirror a single CQ object.
|
| :param mirrorPlane: the plane to mirror about
| :type mirrorPlane: string, one of "XY", "YX", "XZ", "ZX", "YZ", "ZY" the planes
| or the normal vector of the plane eg (1,0,0) or a Face object
| :param basePointVector: the base point to mirror about (this is overwritten if a Face is passed)
| :param union: If true will perform a union operation on the mirrored object
|
| mirrorX(self: ~T) -> ~T
| Mirror entities around the x axis of the workplane plane.
|
| :return: a new object with any free edges consolidated into as few wires as possible.
|
| All free edges are collected into a wire, and then the wire is mirrored,
| and finally joined into a new wire
|
| Typically used to make creating wires with symmetry easier.
|
| mirrorY(self: ~T) -> ~T
| Mirror entities around the y axis of the workplane plane.
|
| :return: a new object with any free edges consolidated into as few wires as possible.
|
| All free edges are collected into a wire, and then the wire is mirrored,
| and finally joined into a new wire
|
| Typically used to make creating wires with symmetry easier. This line of code::
|
| s = Workplane().lineTo(2, 2).threePointArc((3, 1), (2, 0)).mirrorX().extrude(0.25)
|
| Produces a flat, heart shaped object
|
| move(self: ~T, xDist: float = 0, yDist: float = 0) -> ~T
| Move the specified distance from the current point, without drawing.
|
| :param xDist: desired x distance, in local coordinates
| :type xDist: float, or none for zero
| :param yDist: desired y distance, in local coordinates
| :type yDist: float, or none for zero.
|
| Not to be confused with :meth:`center`, which moves the center of the entire
| workplane, this method only moves the current point ( and therefore does not affect objects
| already drawn ).
|
| See :meth:`moveTo` to do the same thing but using absolute coordinates
|
| moveTo(self: ~T, x: float = 0, y: float = 0) -> ~T
| Move to the specified point, without drawing.
|
| :param x: desired x location, in local coordinates
| :type x: float, or none for zero
| :param y: desired y location, in local coordinates
| :type y: float, or none for zero.
|
| Not to be confused with :meth:`center`, which moves the center of the entire
| workplane, this method only moves the current point ( and therefore does not affect objects
| already drawn ).
|
| See :meth:`move` to do the same thing but using relative dimensions
|
| newObject(self: ~T, objlist: Iterable[Union[cadquery.occ_impl.geom.Vector, cadquery.occ_impl.geom.Location, cadquery.occ_impl.shapes.Shape, cadquery.sketch.Sketch]]) -> ~T
| Create a new workplane object from this one.
|
| Overrides CQ.newObject, and should be used by extensions, plugins, and
| subclasses to create new objects.
|
| :param objlist: new objects to put on the stack
| :type objlist: a list of CAD primitives
| :return: a new Workplane object with the current workplane as a parent.
|
| offset2D(self: ~T, d: float, kind: Literal['arc', 'intersection', 'tangent'] = 'arc', forConstruction: bool = False) -> ~T
| Creates a 2D offset wire.
|
| :param d: thickness. Negative thickness denotes offset to inside.
| :param kind: offset kind. Use "arc" for rounded and "intersection" for sharp edges (default: "arc")
| :param forConstruction: Should the result be added to pending wires?
|
| :return: CQ object with resulting wire(s).
|
| parametricCurve(self: ~T, func: Callable[[float], Union[Tuple[float, float], Tuple[float, float, float], cadquery.occ_impl.geom.Vector]], N: int = 400, start: float = 0, stop: float = 1, tol: float = 1e-06, minDeg: int = 1, maxDeg: int = 6, smoothing: Optional[Tuple[float, float, float]] = (1, 1, 1), makeWire: bool = True) -> ~T
| Create a spline curve approximating the provided function.
|
| :param func: function f(t) that will generate (x,y,z) pairs
| :type func: float --> (float,float,float)
| :param N: number of points for discretization
| :param start: starting value of the parameter t
| :param stop: final value of the parameter t
| :param tol: tolerance of the algorithm (default: 1e-6)
| :param minDeg: minimum spline degree (default: 1)
| :param maxDeg: maximum spline degree (default: 6)
| :param smoothing: optional parameters for the variational smoothing algorithm (default: (1,1,1))
| :param makeWire: convert the resulting spline edge to a wire
| :return: a Workplane object with the current point unchanged
|
| parametricSurface(self: ~T, func: Callable[[float, float], Union[Tuple[float, float], Tuple[float, float, float], cadquery.occ_impl.geom.Vector]], N: int = 20, start: float = 0, stop: float = 1, tol: float = 0.01, minDeg: int = 1, maxDeg: int = 6, smoothing: Optional[Tuple[float, float, float]] = (1, 1, 1)) -> ~T
| Create a spline surface approximating the provided function.
|
| :param func: function f(u,v) that will generate (x,y,z) pairs
| :type func: (float,float) --> (float,float,float)
| :param N: number of points for discretization in one direction
| :param start: starting value of the parameters u,v
| :param stop: final value of the parameters u,v
| :param tol: tolerance used by the approximation algorithm (default: 1e-3)
| :param minDeg: minimum spline degree (default: 1)
| :param maxDeg: maximum spline degree (default: 3)
| :param smoothing: optional parameters for the variational smoothing algorithm (default: (1,1,1))
| :return: a Workplane object with the current point unchanged
|
| This method might be unstable and may require tuning of the tol parameter.
|
| placeSketch(self: ~T, *sketches: cadquery.sketch.Sketch) -> ~T
| Place the provided sketch(es) based on the current items on the stack.
|
| :return: Workplane object with the sketch added.
|
| polarArray(self: ~T, radius: float, startAngle: float, angle: float, count: int, fill: bool = True, rotate: bool = True) -> ~T
| Creates a polar array of points and pushes them onto the stack.
| The zero degree reference angle is located along the local X-axis.
|
| :param radius: Radius of the array.
| :param startAngle: Starting angle (degrees) of array. Zero degrees is
| situated along the local X-axis.
| :param angle: The angle (degrees) to fill with elements. A positive
| value will fill in the counter-clockwise direction. If fill is
| False, angle is the angle between elements.
| :param count: Number of elements in array. (count >= 1)
| :param fill: Interpret the angle as total if True (default: True).
| :param rotate: Rotate every item (default: True).
|
| polarLine(self: ~T, distance: float, angle: float, forConstruction: bool = False) -> ~T
| Make a line of the given length, at the given angle from the current point
|
| :param distance: distance of the end of the line from the current point
| :param angle: angle of the vector to the end of the line with the x-axis
| :return: the Workplane object with the current point at the end of the new line
|
| polarLineTo(self: ~T, distance: float, angle: float, forConstruction: bool = False) -> ~T
| Make a line from the current point to the given polar coordinates
|
| Useful if it is more convenient to specify the end location rather than
| the distance and angle from the current point
|
| :param distance: distance of the end of the line from the origin
| :param angle: angle of the vector to the end of the line with the x-axis
| :return: the Workplane object with the current point at the end of the new line
|
| polygon(self: ~T, nSides: int, diameter: float, forConstruction: bool = False, circumscribed: bool = False) -> ~T
| Make a polygon for each item on the stack.
|
| By default, each polygon is created by inscribing it in a circle of the
| specified diameter, such that the first vertex is oriented in the x direction.
| Alternatively, each polygon can be created by circumscribing it around
| a circle of the specified diameter, such that the midpoint of the first edge
| is oriented in the x direction. Circumscribed polygons are thus rotated by
| pi/nSides radians relative to the inscribed polygon. This ensures the extent
| of the polygon along the positive x-axis is always known.
| This has the advantage of not requiring additional formulae for purposes such as
| tiling on the x-axis (at least for even sided polygons).
|
| :param nSides: number of sides, must be >= 3
| :param diameter: the diameter of the circle for constructing the polygon
| :param circumscribed: circumscribe the polygon about a circle
| :type circumscribed: true to create the polygon by circumscribing it about a circle,
| false to create the polygon by inscribing it in a circle
| :return: a polygon wire
|
| polyline(self: ~T, listOfXYTuple: Sequence[Union[Tuple[float, float], Tuple[float, float, float], cadquery.occ_impl.geom.Vector]], forConstruction: bool = False, includeCurrent: bool = False) -> ~T
| Create a polyline from a list of points
|
| :param listOfXYTuple: a list of points in Workplane coordinates (2D or 3D)
| :param forConstruction: whether or not the edges are used for reference
| :type forConstruction: true if the edges are for reference, false if they are for creating geometry
| part geometry
| :param includeCurrent: use current point as a starting point of the polyline
| :return: a new CQ object with a list of edges on the stack
|
| *NOTE* most commonly, the resulting wire should be closed.
|
| pushPoints(self: ~T, pntList: Iterable[Union[Tuple[float, float], Tuple[float, float, float], cadquery.occ_impl.geom.Vector, cadquery.occ_impl.geom.Location]]) -> ~T
| Pushes a list of points onto the stack as vertices.
| The points are in the 2D coordinate space of the workplane face
|
| :param pntList: a list of points to push onto the stack
| :type pntList: list of 2-tuples, in *local* coordinates
| :return: a new workplane with the desired points on the stack.
|
| A common use is to provide a list of points for a subsequent operation, such as creating
| circles or holes. This example creates a cube, and then drills three holes through it,
| based on three points::
|
| s = (
| Workplane()
| .box(1, 1, 1)
| .faces(">Z")
| .workplane()
| .pushPoints([(-0.3, 0.3), (0.3, 0.3), (0, 0)])
| )
| body = s.circle(0.05).cutThruAll()
|
| Here the circle function operates on all three points, and is then extruded to create three
| holes. See :meth:`circle` for how it works.
|
| radiusArc(self: ~T, endPoint: Union[Tuple[float, float], Tuple[float, float, float], cadquery.occ_impl.geom.Vector], radius: float, forConstruction: bool = False) -> ~T
| Draw an arc from the current point to endPoint with an arc defined by the radius.
|
| :param endPoint: end point for the arc
| :type endPoint: 2-tuple, in workplane coordinates
| :param radius: the radius of the arc
| :type radius: float, the radius of the arc between start point and end point.
| :return: a workplane with the current point at the end of the arc
|
| Given that a closed contour is drawn clockwise;
| A positive radius means convex arc and negative radius means concave arc.
|
| rarray(self: ~T, xSpacing: float, ySpacing: float, xCount: int, yCount: int, center: Union[bool, Tuple[bool, bool]] = True) -> ~T
| Creates an array of points and pushes them onto the stack.
| If you want to position the array at another point, create another workplane
| that is shifted to the position you would like to use as a reference
|
| :param xSpacing: spacing between points in the x direction ( must be >= 0)
| :param ySpacing: spacing between points in the y direction ( must be >= 0)
| :param xCount: number of points ( > 0 )
| :param yCount: number of points ( > 0 )
| :param center: If True, the array will be centered around the workplane center.
| If False, the lower corner will be on the reference point and the array will
| extend in the positive x and y directions. Can also use a 2-tuple to specify
| centering along each axis.
|
| rect(self: ~T, xLen: float, yLen: float, centered: Union[bool, Tuple[bool, bool]] = True, forConstruction: bool = False) -> ~T
| Make a rectangle for each item on the stack.
|
| :param xLen: length in the x direction (in workplane coordinates)
| :param yLen: length in the y direction (in workplane coordinates)
| :param centered: If True, the rectangle will be centered around the reference
| point. If False, the corner of the rectangle will be on the reference point and
| it will extend in the positive x and y directions. Can also use a 2-tuple to
| specify centering along each axis.
| :param forConstruction: should the new wires be reference geometry only?
| :type forConstruction: true if the wires are for reference, false if they are creating part
| geometry
| :return: a new CQ object with the created wires on the stack
|
| A common use case is to use a for-construction rectangle to define the centers of a hole
| pattern::
|
| s = Workplane().rect(4.0, 4.0, forConstruction=True).vertices().circle(0.25)
|
| Creates 4 circles at the corners of a square centered on the origin.
|
| Negative values for xLen and yLen are permitted, although they only have an effect when
| centered is False.
|
| Future Enhancements:
| * project points not in the workplane plane onto the workplane plane
|
| revolve(self: ~T, angleDegrees: float = 360.0, axisStart: Union[Tuple[float, float], Tuple[float, float, float], cadquery.occ_impl.geom.Vector, NoneType] = None, axisEnd: Union[Tuple[float, float], Tuple[float, float, float], cadquery.occ_impl.geom.Vector, NoneType] = None, combine: Union[bool, Literal['cut', 'a', 's']] = True, clean: bool = True) -> ~T
| Use all un-revolved wires in the parent chain to create a solid.
|
| :param angleDegrees: the angle to revolve through.
| :type angleDegrees: float, anything less than 360 degrees will leave the shape open
| :param axisStart: the start point of the axis of rotation
| :param axisEnd: the end point of the axis of rotation
| :param combine: True or "a" to combine the resulting solid with parent solids if found,
| "cut" or "s" to remove the resulting solid from the parent solids if found.
| False to keep the resulting solid separated from the parent solids.
| :param clean: call :meth:`clean` afterwards to have a clean shape
| :return: a CQ object with the resulting solid selected.
|
| The returned object is always a CQ object, and depends on whether combine is True, and
| whether a context solid is already defined:
|
| * if combine is False, the new value is pushed onto the stack.
| * if combine is true, the value is combined with the context solid if it exists,
| and the resulting solid becomes the new context solid.
|
| .. note::
| Keep in mind that `axisStart` and `axisEnd` are defined relative to the current Workplane center position.
| So if for example you want to revolve a circle centered at (10,0,0) around the Y axis, be sure to either :meth:`move` (or :meth:`moveTo`)
| the current Workplane position or specify `axisStart` and `axisEnd` with the correct vector position.
| In this example (0,0,0), (0,1,0) as axis coords would fail.
|
| rotate(self: ~T, axisStartPoint: Union[Tuple[float, float], Tuple[float, float, float], cadquery.occ_impl.geom.Vector], axisEndPoint: Union[Tuple[float, float], Tuple[float, float, float], cadquery.occ_impl.geom.Vector], angleDegrees: float) -> ~T
| Returns a copy of all of the items on the stack rotated through and angle around the axis
| of rotation.
|
| :param axisStartPoint: The first point of the axis of rotation
| :type axisStartPoint: a 3-tuple of floats
| :param axisEndPoint: The second point of the axis of rotation
| :type axisEndPoint: a 3-tuple of floats
| :param angleDegrees: the rotation angle, in degrees
| :returns: a CQ object
|
| rotateAboutCenter(self: ~T, axisEndPoint: Union[Tuple[float, float], Tuple[float, float, float], cadquery.occ_impl.geom.Vector], angleDegrees: float) -> ~T
| Rotates all items on the stack by the specified angle, about the specified axis
|
| The center of rotation is a vector starting at the center of the object on the stack,
| and ended at the specified point.
|
| :param axisEndPoint: the second point of axis of rotation
| :type axisEndPoint: a three-tuple in global coordinates
| :param angleDegrees: the rotation angle, in degrees
| :returns: a CQ object, with all items rotated.
|
| WARNING: This version returns the same CQ object instead of a new one-- the
| old object is not accessible.
|
| Future Enhancements:
| * A version of this method that returns a transformed copy, rather than modifying
| the originals
| * This method doesn't expose a very good interface, because the axis of rotation
| could be inconsistent between multiple objects. This is because the beginning
| of the axis is variable, while the end is fixed. This is fine when operating on
| one object, but is not cool for multiple.
|
| sagittaArc(self: ~T, endPoint: Union[Tuple[float, float], Tuple[float, float, float], cadquery.occ_impl.geom.Vector], sag: float, forConstruction: bool = False) -> ~T
| Draw an arc from the current point to endPoint with an arc defined by the sag (sagitta).
|
| :param endPoint: end point for the arc
| :type endPoint: 2-tuple, in workplane coordinates
| :param sag: the sagitta of the arc
| :type sag: float, perpendicular distance from arc center to arc baseline.
| :return: a workplane with the current point at the end of the arc
|
| The sagitta is the distance from the center of the arc to the arc base.
| Given that a closed contour is drawn clockwise;
| A positive sagitta means convex arc and negative sagitta means concave arc.
| See `<https://en.wikipedia.org/wiki/Sagitta_(geometry)>`_ for more information.
|
| section(self: ~T, height: float = 0.0) -> ~T
| Slices current solid at the given height.
|
| :param height: height to slice at (default: 0)
| :raises ValueError: if no solids or compounds are found
| :return: a CQ object with the resulting face(s).
|
| shell(self: ~T, thickness: float, kind: Literal['arc', 'intersection'] = 'arc') -> ~T
| Remove the selected faces to create a shell of the specified thickness.
|
| To shell, first create a solid, and *in the same chain* select the faces you wish to remove.
|
| :param thickness: thickness of the desired shell.
| Negative values shell inwards, positive values shell outwards.
| :param kind: kind of join, arc or intersection (default: arc).
| :raises ValueError: if the current stack contains objects that are not faces of a solid
| further up in the chain.
| :returns: a CQ object with the resulting shelled solid selected.
|
| This example will create a hollowed out unit cube, where the top most face is open,
| and all other walls are 0.2 units thick::
|
| Workplane().box(1, 1, 1).faces("+Z").shell(0.2)
|
| You can also select multiple faces at once. Here is an example that creates a three-walled
| corner, by removing three faces of a cube::
|
| Workplane().box(10, 10, 10).faces(">Z or >X or <Y").shell(1)
|
| **Note**: When sharp edges are shelled inwards, they remain sharp corners, but **outward**
| shells are automatically filleted (unless kind="intersection"), because an outward offset
| from a corner generates a radius.
|
| shells(self: ~T, selector: Union[str, cadquery.selectors.Selector, NoneType] = None, tag: Optional[str] = None) -> ~T
| Select the shells of objects on the stack, optionally filtering the selection. If there are
| multiple objects on the stack, the shells of all objects are collected and a list of all the
| distinct shells is returned.
|
| :param selector: optional Selector object, or string selector expression
| (see :class:`StringSyntaxSelector`)
| :param tag: if set, search the tagged object instead of self
| :return: a CQ object whose stack contains all of the *distinct* shells of *all* objects on
| the current stack, filtered by the provided selector.
|
| If there are no shells for any objects on the current stack, an empty CQ object is returned
|
| Most solids will have a single shell, which represents the outer surface. A shell will
| typically be composed of multiple faces.
|
| siblings(self: ~T, kind: Literal['Vertex', 'Edge', 'Wire', 'Face', 'Shell', 'Solid', 'CompSolid', 'Compound'], level: int = 1, tag: Optional[str] = None) -> ~T
| Select topological siblings.
|
| :param kind: kind of linking element, e.g. "Vertex" or "Edge"
| :param level: level of relation - how many elements of kind are in the link
| :param tag: if set, search the tagged object instead of self
| :return: a Workplane object whose stack contains selected siblings.
|
| size(self) -> int
| Return the number of objects currently on the stack
|
| sketch(self: ~T) -> cadquery.sketch.Sketch
| Initialize and return a sketch
|
| :return: Sketch object with the current workplane as a parent.
|
| slot2D(self: ~T, length: float, diameter: float, angle: float = 0) -> ~T
| Creates a rounded slot for each point on the stack.
|
| :param diameter: desired diameter, or width, of slot
| :param length: desired end to end length of slot
| :param angle: angle of slot in degrees, with 0 being along x-axis
| :return: a new CQ object with the created wires on the stack
|
| Can be used to create arrays of slots, such as in cooling applications::
|
| Workplane().box(10, 25, 1).rarray(1, 2, 1, 10).slot2D(8, 1, 0).cutThruAll()
|
| solids(self: ~T, selector: Union[str, cadquery.selectors.Selector, NoneType] = None, tag: Optional[str] = None) -> ~T
| Select the solids of objects on the stack, optionally filtering the selection. If there are
| multiple objects on the stack, the solids of all objects are collected and a list of all the
| distinct solids is returned.
|
| :param selector: optional Selector object, or string selector expression
| (see :class:`StringSyntaxSelector`)
| :param tag: if set, search the tagged object instead of self
| :return: a CQ object whose stack contains all of the *distinct* solids of *all* objects on
| the current stack, filtered by the provided selector.
|
| If there are no solids for any objects on the current stack, an empty CQ object is returned
|
| The typical use is to select a single object on the stack. For example::
|
| Workplane().box(1, 1, 1).solids().size()
|
| returns 1, because a cube consists of one solid.
|
| It is possible for a single CQ object ( or even a single CAD primitive ) to contain
| multiple solids.
|
| sort(self: ~T, key: Callable[[Union[cadquery.occ_impl.geom.Vector, cadquery.occ_impl.geom.Location, cadquery.occ_impl.shapes.Shape, cadquery.sketch.Sketch]], Any]) -> ~T
| Sort items using a callable.
|
| :param key: Callable to be used for sorting.
| :return: Workplane object with items sorted.
|
| sphere(self: ~T, radius: float, direct: Union[Tuple[float, float], Tuple[float, float, float], cadquery.occ_impl.geom.Vector] = (0, 0, 1), angle1: float = -90, angle2: float = 90, angle3: float = 360, centered: Union[bool, Tuple[bool, bool, bool]] = True, combine: Union[bool, Literal['cut', 'a', 's']] = True, clean: bool = True) -> ~T
| Returns a 3D sphere with the specified radius for each point on the stack.
|
| :param radius: The radius of the sphere
| :param direct: The direction axis for the creation of the sphere
| :type direct: A three-tuple
| :param angle1: The first angle to sweep the sphere arc through
| :type angle1: float > 0
| :param angle2: The second angle to sweep the sphere arc through
| :type angle2: float > 0
| :param angle3: The third angle to sweep the sphere arc through
| :type angle3: float > 0
| :param centered: If True, the sphere will be centered around the reference point. If False,
| the corner of a bounding box around the sphere will be on the reference point and it
| will extend in the positive x, y and z directions. Can also use a 3-tuple to specify
| centering along each axis.
| :param combine: Whether the results should be combined with other solids on the stack
| (and each other)
| :type combine: true to combine shapes, false otherwise
| :param clean: call :meth:`clean` afterwards to have a clean shape
| :return: A sphere object for each point on the stack
|
| One sphere is created for each item on the current stack. If no items are on the stack, one
| box using the current workplane center is created.
|
| If combine is true, the result will be a single object on the stack. If a solid was found
| in the chain, the result is that solid with all spheres produced fused onto it otherwise,
| the result is the combination of all the produced spheres.
|
| If combine is false, the result will be a list of the spheres produced.
|
| spline(self: ~T, listOfXYTuple: Iterable[Union[Tuple[float, float], Tuple[float, float, float], cadquery.occ_impl.geom.Vector]], tangents: Optional[Sequence[Union[Tuple[float, float], Tuple[float, float, float], cadquery.occ_impl.geom.Vector]]] = None, periodic: bool = False, parameters: Optional[Sequence[float]] = None, scale: bool = True, tol: Optional[float] = None, forConstruction: bool = False, includeCurrent: bool = False, makeWire: bool = False) -> ~T
| Create a spline interpolated through the provided points (2D or 3D).
|
| :param listOfXYTuple: points to interpolate through
| :param tangents: vectors specifying the direction of the tangent to the
| curve at each of the specified interpolation points.
|
| If only 2 tangents are given, they will be used as the initial and
| final tangent.
|
| If some tangents are not specified (i.e., are None), no tangent
| constraint will be applied to the corresponding interpolation point.
|
| The spline will be C2 continuous at the interpolation points where
| no tangent constraint is specified, and C1 continuous at the points
| where a tangent constraint is specified.
| :param periodic: creation of periodic curves
| :param parameters: the value of the parameter at each interpolation point.
| (The interpolated curve is represented as a vector-valued function of a
| scalar parameter.)
|
| If periodic == True, then len(parameters) must be
| len(interpolation points) + 1, otherwise len(parameters) must be equal to
| len(interpolation points).
| :param scale: whether to scale the specified tangent vectors before
| interpolating.
|
| Each tangent is scaled, so it's length is equal to the derivative of
| the Lagrange interpolated curve.
|
| I.e., set this to True, if you want to use only the direction of
| the tangent vectors specified by ``tangents``, but not their magnitude.
| :param tol: tolerance of the algorithm (consult OCC documentation)
|
| Used to check that the specified points are not too close to each
| other, and that tangent vectors are not too short. (In either case
| interpolation may fail.)
|
| Set to None to use the default tolerance.
| :param includeCurrent: use current point as a starting point of the curve
| :param makeWire: convert the resulting spline edge to a wire
| :return: a Workplane object with the current point at the end of the spline
|
| The spline will begin at the current point, and end with the last point in the
| XY tuple list.
|
| This example creates a block with a spline for one side::
|
| s = Workplane(Plane.XY())
| sPnts = [
| (2.75, 1.5),
| (2.5, 1.75),
| (2.0, 1.5),
| (1.5, 1.0),
| (1.0, 1.25),
| (0.5, 1.0),
| (0, 1.0),
| ]
| r = s.lineTo(3.0, 0).lineTo(3.0, 1.0).spline(sPnts).close()
| r = r.extrude(0.5)
|
| *WARNING* It is fairly easy to create a list of points
| that cannot be correctly interpreted as a spline.
|
| splineApprox(self: ~T, points: Iterable[Union[Tuple[float, float], Tuple[float, float, float], cadquery.occ_impl.geom.Vector]], tol: Optional[float] = 1e-06, minDeg: int = 1, maxDeg: int = 6, smoothing: Optional[Tuple[float, float, float]] = (1, 1, 1), forConstruction: bool = False, includeCurrent: bool = False, makeWire: bool = False) -> ~T
| Create a spline interpolated through the provided points (2D or 3D).
|
| :param points: points to interpolate through
| :param tol: tolerance of the algorithm (default: 1e-6)
| :param minDeg: minimum spline degree (default: 1)
| :param maxDeg: maximum spline degree (default: 6)
| :param smoothing: optional parameters for the variational smoothing algorithm (default: (1,1,1))
| :param includeCurrent: use current point as a starting point of the curve
| :param makeWire: convert the resulting spline edge to a wire
| :return: a Workplane object with the current point at the end of the spline
|
| *WARNING* for advanced users.
|
| split(self: ~T, *args, **kwargs) -> ~T
| Splits a solid on the stack into two parts, optionally keeping the separate parts.
|
| :param bool keepTop: True to keep the top, False or None to discard it
| :param bool keepBottom: True to keep the bottom, False or None to discard it
| :raises ValueError: if keepTop and keepBottom are both false.
| :raises ValueError: if there is no solid in the current stack or parent chain
| :returns: CQ object with the desired objects on the stack.
|
| The most common operation splits a solid and keeps one half. This sample creates
| a split bushing::
|
| # drill a hole in the side
| c = Workplane().box(1, 1, 1).faces(">Z").workplane().circle(0.25).cutThruAll()
|
| # now cut it in half sideways
| c = c.faces(">Y").workplane(-0.5).split(keepTop=True)
|
| sweep(self: ~T, path: Union[ForwardRef('Workplane'), cadquery.occ_impl.shapes.Wire, cadquery.occ_impl.shapes.Edge], multisection: bool = False, sweepAlongWires: Optional[bool] = None, makeSolid: bool = True, isFrenet: bool = False, combine: Union[bool, Literal['cut', 'a', 's']] = True, clean: bool = True, transition: Literal['right', 'round', 'transformed'] = 'right', normal: Union[Tuple[float, float], Tuple[float, float, float], cadquery.occ_impl.geom.Vector, NoneType] = None, auxSpine: Optional[ForwardRef('Workplane')] = None) -> ~T
| Use all un-extruded wires in the parent chain to create a swept solid.
|
| :param path: A wire along which the pending wires will be swept
| :param multiSection: False to create multiple swept from wires on the chain along path.
| True to create only one solid swept along path with shape following the list of wires on the chain
| :param combine: True or "a" to combine the resulting solid with parent solids if found,
| "cut" or "s" to remove the resulting solid from the parent solids if found.
| False to keep the resulting solid separated from the parent solids.
| :param clean: call :meth:`clean` afterwards to have a clean shape
| :param transition: handling of profile orientation at C1 path discontinuities. Possible values are {'transformed','round', 'right'} (default: 'right').
| :param normal: optional fixed normal for extrusion
| :param auxSpine: a wire defining the binormal along the extrusion path
| :return: a CQ object with the resulting solid selected.
|
| tag(self: ~T, name: str) -> ~T
| Tags the current CQ object for later reference.
|
| :param name: the name to tag this object with
| :returns: self, a CQ object with tag applied
|
| tangentArcPoint(self: ~T, endpoint: Union[Tuple[float, float], Tuple[float, float, float], cadquery.occ_impl.geom.Vector], forConstruction: bool = False, relative: bool = True) -> ~T
| Draw an arc as a tangent from the end of the current edge to endpoint.
|
| :param endpoint: point for the arc to end at
| :type endpoint: 2-tuple, 3-tuple or Vector
| :param relative: True if endpoint is specified relative to the current point, False if endpoint is in workplane coordinates
| :return: a Workplane object with an arc on the stack
|
| Requires the the current first object on the stack is an Edge, as would
| be the case after a lineTo operation or similar.
|
| text(self: ~T, txt: str, fontsize: float, distance: float, combine: Union[bool, Literal['cut', 'a', 's']] = 'cut', clean: bool = True, font: str = 'Arial', fontPath: Optional[str] = None, kind: Literal['regular', 'bold', 'italic'] = 'regular', halign: Literal['center', 'left', 'right'] = 'center', valign: Literal['center', 'top', 'bottom'] = 'center') -> ~T
| Returns a 3D text.
|
| :param txt: text to be rendered
| :param fontsize: size of the font in model units
| :param distance: the distance to extrude or cut, normal to the workplane plane
| :type distance: float, negative means opposite the normal direction
| :param combine: True or "a" to combine the resulting solid with parent solids if found,
| "cut" or "s" to remove the resulting solid from the parent solids if found.
| False to keep the resulting solid separated from the parent solids.
| :param clean: call :meth:`clean` afterwards to have a clean shape
| :param font: font name
| :param fontPath: path to font file
| :param kind: font type
| :param halign: horizontal alignment
| :param valign: vertical alignment
| :return: a CQ object with the resulting solid selected
|
| The returned object is always a Workplane object, and depends on whether combine is True, and
| whether a context solid is already defined:
|
| * if combine is False, the new value is pushed onto the stack.
| * if combine is True, "a", "cut" or "s", the value is combined with the context solid if it exists,
| and the resulting solid becomes the new context solid.
|
| Examples::
|
| Create text::
|
| cq.Workplane().text("CadQuery", 5, 1)
|
| Specify the font (name), and kind to use an installed system font::
|
| cq.Workplane().text("CadQuery", 5, 1, font="Liberation Sans Narrow", kind="italic")
|
| Specify fontPath to use a font from a given file::
|
| cq.Workplane().text("CadQuery", 5, 1, fontPath="/opt/fonts/texgyrecursor-bold.otf")
|
| Cut text from a solid (default behavior when context solid exists and combine is not overridden)::
|
| cq.Workplane().box(8, 8, 8).faces(">Z").workplane().text("Z", 5, -1.0)
|
| Add text to a solid::
|
| cq.Workplane().box(8, 8, 8).faces(">Z").workplane().text("Z", 5, 1.0, combine="a")
|
| threePointArc(self: ~T, point1: Union[Tuple[float, float], Tuple[float, float, float], cadquery.occ_impl.geom.Vector], point2: Union[Tuple[float, float], Tuple[float, float, float], cadquery.occ_impl.geom.Vector], forConstruction: bool = False) -> ~T
| Draw an arc from the current point, through point1, and ending at point2
|
| :param point1: point to draw through
| :type point1: 2-tuple, in workplane coordinates
| :param point2: end point for the arc
| :type point2: 2-tuple, in workplane coordinates
| :return: a workplane with the current point at the end of the arc
|
| Future Enhancements:
| provide a version that allows an arc using relative measures
| provide a centerpoint arc
| provide tangent arcs
|
| toOCC(self) -> Any
| Directly returns the wrapped OCCT object.
|
| :return: The wrapped OCCT object
| :rtype: TopoDS_Shape or a subclass
|
| toPending(self: ~T) -> ~T
| Adds wires/edges to pendingWires/pendingEdges.
|
| :return: same CQ object with updated context.
|
| toSvg(self, opts: Any = None) -> str
| Returns svg text that represents the first item on the stack.
|
| for testing purposes.
|
| :param opts: svg formatting options
| :type opts: dictionary, width and height
| :return: a string that contains SVG that represents this item.
|
| transformed(self: ~T, rotate: Union[Tuple[float, float], Tuple[float, float, float], cadquery.occ_impl.geom.Vector] = (0, 0, 0), offset: Union[Tuple[float, float], Tuple[float, float, float], cadquery.occ_impl.geom.Vector] = (0, 0, 0)) -> ~T
| Create a new workplane based on the current one.
| The origin of the new plane is located at the existing origin+offset vector, where offset is
| given in coordinates local to the current plane
| The new plane is rotated through the angles specified by the components of the rotation
| vector.
|
| :param rotate: 3-tuple of angles to rotate, in degrees relative to work plane coordinates
| :param offset: 3-tuple to offset the new plane, in local work plane coordinates
| :return: a new work plane, transformed as requested
|
| translate(self: ~T, vec: Union[Tuple[float, float], Tuple[float, float, float], cadquery.occ_impl.geom.Vector]) -> ~T
| Returns a copy of all of the items on the stack moved by the specified translation vector.
|
| :param tupleDistance: distance to move, in global coordinates
| :type tupleDistance: a 3-tuple of float
| :returns: a CQ object
|
| twistExtrude(self: ~T, distance: float, angleDegrees: float, combine: Union[bool, Literal['cut', 'a', 's']] = True, clean: bool = True) -> ~T
| Extrudes a wire in the direction normal to the plane, but also twists by the specified
| angle over the length of the extrusion.
|
| The center point of the rotation will be the center of the workplane.
|
| See extrude for more details, since this method is the same except for the the addition
| of the angle. In fact, if angle=0, the result is the same as a linear extrude.
|
| **NOTE** This method can create complex calculations, so be careful using it with
| complex geometries
|
| :param distance: the distance to extrude normal to the workplane
| :param angle: angle (in degrees) to rotate through the extrusion
| :param combine: True or "a" to combine the resulting solid with parent solids if found,
| "cut" or "s" to remove the resulting solid from the parent solids if found.
| False to keep the resulting solid separated from the parent solids.
| :param clean: call :meth:`clean` afterwards to have a clean shape
| :return: a CQ object with the resulting solid selected.
|
| union(self: ~T, toUnion: Union[ForwardRef('Workplane'), cadquery.occ_impl.shapes.Solid, cadquery.occ_impl.shapes.Compound, NoneType] = None, clean: bool = True, glue: bool = False, tol: Optional[float] = None) -> ~T
| Unions all of the items on the stack of toUnion with the current solid.
| If there is no current solid, the items in toUnion are unioned together.
|
| :param toUnion: a solid object, or a Workplane object having a solid
| :param clean: call :meth:`clean` afterwards to have a clean shape (default True)
| :param glue: use a faster gluing mode for non-overlapping shapes (default False)
| :param tol: tolerance value for fuzzy bool operation mode (default None)
| :raises: ValueError if there is no solid to add to in the chain
| :return: a Workplane object with the resulting object selected
|
| vLine(self: ~T, distance: float, forConstruction: bool = False) -> ~T
| Make a vertical line from the current point the provided distance
|
| :param distance: (y) distance from current point
| :return: the Workplane object with the current point at the end of the new line
|
| vLineTo(self: ~T, yCoord: float, forConstruction: bool = False) -> ~T
| Make a vertical line from the current point to the provided y coordinate.
|
| Useful if it is more convenient to specify the end location rather than distance,
| as in :meth:`vLine`
|
| :param yCoord: y coordinate for the end of the line
| :return: the Workplane object with the current point at the end of the new line
|
| val(self) -> Union[cadquery.occ_impl.geom.Vector, cadquery.occ_impl.geom.Location, cadquery.occ_impl.shapes.Shape, cadquery.sketch.Sketch]
| Return the first value on the stack. If no value is present, current plane origin is returned.
|
| :return: the first value on the stack.
| :rtype: A CAD primitive
|
| vals(self) -> List[Union[cadquery.occ_impl.geom.Vector, cadquery.occ_impl.geom.Location, cadquery.occ_impl.shapes.Shape, cadquery.sketch.Sketch]]
| get the values in the current list
|
| :rtype: list of occ_impl objects
| :returns: the values of the objects on the stack.
|
| Contrast with :meth:`all`, which returns CQ objects for all of the items on the stack
|
| vertices(self: ~T, selector: Union[str, cadquery.selectors.Selector, NoneType] = None, tag: Optional[str] = None) -> ~T
| Select the vertices of objects on the stack, optionally filtering the selection. If there
| are multiple objects on the stack, the vertices of all objects are collected and a list of
| all the distinct vertices is returned.
|
| :param selector: optional Selector object, or string selector expression
| (see :class:`StringSyntaxSelector`)
| :param tag: if set, search the tagged object instead of self
| :return: a CQ object whose stack contains the *distinct* vertices of *all* objects on the
| current stack, after being filtered by the selector, if provided
|
| If there are no vertices for any objects on the current stack, an empty CQ object
| is returned
|
| The typical use is to select the vertices of a single object on the stack. For example::
|
| Workplane().box(1, 1, 1).faces("+Z").vertices().size()
|
| returns 4, because the topmost face of a cube will contain four vertices. While this::
|
| Workplane().box(1, 1, 1).faces().vertices().size()
|
| returns 8, because a cube has a total of 8 vertices
|
| **Note** Circles are peculiar, they have a single vertex at the center!
|
| wedge(self: ~T, dx: float, dy: float, dz: float, xmin: float, zmin: float, xmax: float, zmax: float, pnt: Union[Tuple[float, float], Tuple[float, float, float], cadquery.occ_impl.geom.Vector] = Vector: (0.0, 0.0, 0.0), dir: Union[Tuple[float, float], Tuple[float, float, float], cadquery.occ_impl.geom.Vector] = Vector: (0.0, 0.0, 1.0), centered: Union[bool, Tuple[bool, bool, bool]] = True, combine: Union[bool, Literal['cut', 'a', 's']] = True, clean: bool = True) -> ~T
| Returns a 3D wedge with the specified dimensions for each point on the stack.
|
| :param dx: Distance along the X axis
| :param dy: Distance along the Y axis
| :param dz: Distance along the Z axis
| :param xmin: The minimum X location
| :param zmin: The minimum Z location
| :param xmax: The maximum X location
| :param zmax: The maximum Z location
| :param pnt: A vector (or tuple) for the origin of the direction for the wedge
| :param dir: The direction vector (or tuple) for the major axis of the wedge
| :param centered: If True, the wedge will be centered around the reference point.
| If False, the corner of the wedge will be on the reference point and it will
| extend in the positive x, y and z directions. Can also use a 3-tuple to
| specify centering along each axis.
| :param combine: Whether the results should be combined with other solids on the stack
| (and each other)
| :param clean: True to attempt to have the kernel clean up the geometry, False otherwise
| :return: A wedge object for each point on the stack
|
| One wedge is created for each item on the current stack. If no items are on the stack, one
| wedge using the current workplane center is created.
|
| If combine is True, the result will be a single object on the stack. If a solid was found
| in the chain, the result is that solid with all wedges produced fused onto it otherwise,
| the result is the combination of all the produced wedges.
|
| If combine is False, the result will be a list of the wedges produced.
|
| wire(self: ~T, forConstruction: bool = False) -> ~T
| Returns a CQ object with all pending edges connected into a wire.
|
| All edges on the stack that can be combined will be combined into a single wire object,
| and other objects will remain on the stack unmodified. If there are no pending edges,
| this method will just return self.
|
| :param forConstruction: whether the wire should be used to make a solid, or if it is just
| for reference
|
| This method is primarily of use to plugin developers making utilities for 2D construction.
| This method should be called when a user operation implies that 2D construction is
| finished, and we are ready to begin working in 3d.
|
| SEE '2D construction concepts' for a more detailed explanation of how CadQuery handles
| edges, wires, etc.
|
| Any non edges will still remain.
|
| wires(self: ~T, selector: Union[str, cadquery.selectors.Selector, NoneType] = None, tag: Optional[str] = None) -> ~T
| Select the wires of objects on the stack, optionally filtering the selection. If there are
| multiple objects on the stack, the wires of all objects are collected and a list of all the
| distinct wires is returned.
|
| :param selector: optional Selector object, or string selector expression
| (see :class:`StringSyntaxSelector`)
| :param tag: if set, search the tagged object instead of self
| :return: a CQ object whose stack contains all of the *distinct* wires of *all* objects on
| the current stack, filtered by the provided selector.
|
| If there are no wires for any objects on the current stack, an empty CQ object is returned
|
| The typical use is to select the wires of a single object on the stack. For example::
|
| Workplane().box(1, 1, 1).faces("+Z").wires().size()
|
| returns 1, because a face typically only has one outer wire
|
| workplane(self: ~T, offset: float = 0.0, invert: bool = False, centerOption: Literal['CenterOfMass', 'ProjectedOrigin', 'CenterOfBoundBox'] = 'ProjectedOrigin', origin: Union[Tuple[float, float], Tuple[float, float, float], cadquery.occ_impl.geom.Vector, NoneType] = None) -> ~T
| Creates a new 2D workplane, located relative to the first face on the stack.
|
| :param offset: offset for the workplane in its normal direction . Default
| :param invert: invert the normal direction from that of the face.
| :param centerOption: how local origin of workplane is determined.
| :param origin: origin for plane center, requires 'ProjectedOrigin' centerOption.
| :type centerOption: string or None='ProjectedOrigin'
| :rtype: Workplane object
|
| The first element on the stack must be a face, a set of
| co-planar faces or a vertex. If a vertex, then the parent
| item on the chain immediately before the vertex must be a
| face.
|
| The result will be a 2D working plane
| with a new coordinate system set up as follows:
|
| * The centerOption parameter sets how the center is defined.
| Options are 'CenterOfMass', 'CenterOfBoundBox', or 'ProjectedOrigin'.
| 'CenterOfMass' and 'CenterOfBoundBox' are in relation to the selected
| face(s) or vertex (vertices). 'ProjectedOrigin' uses by default the current origin
| or the optional origin parameter (if specified) and projects it onto the plane
| defined by the selected face(s).
| * The Z direction will be the normal of the face, computed
| at the center point.
| * The X direction will be parallel to the x-y plane. If the workplane is parallel to
| the global x-y plane, the x direction of the workplane will co-incide with the
| global x direction.
|
| Most commonly, the selected face will be planar, and the workplane lies in the same plane
| of the face ( IE, offset=0). Occasionally, it is useful to define a face offset from
| an existing surface, and even more rarely to define a workplane based on a face that is
| not planar.
|
| workplaneFromTagged(self, name: str) -> 'Workplane'
| Copies the workplane from a tagged parent.
|
| :param name: tag to search for
| :returns: a CQ object with name's workplane
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __annotations__ = {'_tag': typing.Optional[str], 'ctx': <class 'cadque...
cadquery.Color
Python Library Documentation: class Color in module cadquery.occ_impl.assembly
class Color(builtins.object)
| Color(*args, **kwargs)
|
| Wrapper for the OCCT color object Quantity_ColorRGBA.
|
| Methods defined here:
|
| __eq__(self, other)
| Return self==value.
|
| __getstate__(self) -> Tuple[float, float, float, float]
| Helper for pickle.
|
| __hash__(self)
| Return hash(self).
|
| __init__(self, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| __setstate__(self, data: Tuple[float, float, float, float])
|
| toTuple(self) -> Tuple[float, float, float, float]
| Convert Color to RGB tuple.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __annotations__ = {'wrapped': <class 'OCP.OCP.Quantity.Quantity_ColorR...
cadquery.Compound
Python Library Documentation: class Compound in module cadquery.occ_impl.shapes
class Compound(Shape, Mixin3D)
| Compound(obj: 'TopoDS_Shape') -> 'None'
|
| a collection of disconnected solids
|
| Method resolution order:
| Compound
| Shape
| Mixin3D
| builtins.object
|
| Methods defined here:
|
| __bool__(self) -> 'bool'
| Check if empty.
|
| ancestors(self, ctx: 'Shape', kind: 'Shapes') -> 'Compound'
| Iterate over ancestors, i.e. shapes of same kind within ctx shape that contain elements of self.
|
| cut(self, *toCut: 'Shape', tol: 'float | None' = None) -> 'Compound'
| Remove the positional arguments from this Shape.
|
| :param tol: Fuzzy mode tolerance
|
| fuse(self, *toFuse: 'Shape', glue: 'bool' = False, tol: 'float | None' = None) -> 'Compound'
| Fuse shapes together
|
| intersect(self, *toIntersect: 'Shape', tol: 'float | None' = None) -> 'Compound'
| Intersection of the positional arguments and this Shape.
|
| :param tol: Fuzzy mode tolerance
|
| remove(self, *shape: 'Shape') -> 'Self'
| Remove the specified shapes.
|
| siblings(self, ctx: 'Shape', kind: 'Shapes', level: 'int | Iterable[int]' = 1) -> 'Compound'
| Iterate over siblings, i.e. shapes within shape that share subshapes of kind with the elements of self.
|
| ----------------------------------------------------------------------
| Class methods defined here:
|
| makeCompound(listOfShapes: 'Iterable[Shape]') -> 'Compound'
| Create a compound out of a list of shapes
|
| makeText(text: 'str', size: 'float', height: 'float', font: 'str' = 'Arial', fontPath: 'str | None' = None, kind: "Literal['regular', 'bold', 'italic']" = 'regular', halign: "Literal['center', 'left', 'right']" = 'center', valign: "Literal['center', 'top', 'bottom']" = 'center', position: 'Plane' = Plane(origin=(0.0, 0.0, 0.0), xDir=(1.0, 0.0, 0.0), normal=(0.0, 0.0, 1.0))) -> 'Shape'
| Create a 3D text
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __annotations__ = {'wrapped': 'TopoDS_Compound'}
|
| ----------------------------------------------------------------------
| Methods inherited from Shape:
|
| Area(self) -> 'float'
| :returns: The surface area of all faces in this Shape
|
| BoundingBox(self, tolerance: 'float | None' = None) -> 'BoundBox'
| Create a bounding box for this Shape.
|
| :param tolerance: Tolerance value passed to :class:`BoundBox`
| :returns: A :class:`BoundBox` object for this Shape
|
| Center(self) -> 'Vector'
| :returns: The point of the center of mass of this Shape
|
| CenterOfBoundBox(self, tolerance: 'float | None' = None) -> 'Vector'
| :param tolerance: Tolerance passed to the :py:meth:`BoundingBox` method
| :returns: Center of the bounding box of this shape
|
| Closed(self) -> 'bool'
| :returns: The closedness flag
|
| CompSolids(self) -> 'list[CompSolid]'
| :returns: All the compsolids in this Shape
|
| Compounds(self) -> 'list[Compound]'
| :returns: All the compounds in this Shape
|
| Edges(self) -> 'list[Edge]'
| :returns: All the edges in this Shape
|
| Faces(self) -> 'list[Face]'
| :returns: All the faces in this Shape
|
| ShapeType(self) -> 'Shapes'
|
| Shells(self) -> 'list[Shell]'
| :returns: All the shells in this Shape
|
| Solids(self) -> 'list[Solid]'
| :returns: All the solids in this Shape
|
| Vertices(self) -> 'list[Vertex]'
| :returns: All the vertices in this Shape
|
| Volume(self, tol: 'float | None' = None) -> 'float'
| :returns: The volume of this Shape
|
| Wires(self) -> 'list[Wire]'
| :returns: All the wires in this Shape
|
| __add__(self, other: 'Shape') -> 'Shape'
| Fuse self and other.
|
| __and__(self, other: 'Shape') -> 'Compound'
| Set intersection for combining selection results.
|
| __eq__(self, other: 'Any') -> 'bool'
| Return self==value.
|
| __getitem__(self, item: 'int | slice') -> 'Shape'
|
| __getstate__(self) -> 'tuple[BytesIO, bool]'
| Helper for pickle.
|
| __hash__(self) -> 'int'
| Return hash(self).
|
| __init__(self, obj: 'TopoDS_Shape') -> 'None'
| Initialize self. See help(type(self)) for accurate signature.
|
| __iter__(self) -> 'Iterator[Shape]'
| Iterate over subshapes.
|
| __mod__(self, other: 'Shape') -> 'Compound'
| Set difference for combining selection results.
|
| __mul__(self, other: 'Shape') -> 'Shape'
| Intersect self and other.
|
| __or__(self, other: 'Shape') -> 'Compound'
| Set sum for combining selection results.
|
| __setstate__(self, data: 'tuple[BytesIO, bool]') -> 'None'
|
| __sub__(self, other: 'Shape') -> 'Shape'
| Subtract other from self.
|
| __truediv__(self, other: 'Shape') -> 'Shape'
| Split self with other.
|
| clean(self: 'T') -> 'T'
| Experimental clean using ShapeUpgrade
|
| copy(self: 'T', mesh: 'bool' = False) -> 'T'
| Creates a new object that is a copy of this object.
|
| :param mesh: should I copy the triangulation too (default: False)
| :returns: a copy of the object
|
| distance(self, other: 'Shape') -> 'float'
| Minimal distance between two shapes
|
| distances(self, *others: 'Shape') -> 'Iterator[float]'
| Minimal distances to between self and other shapes
|
| edge(self, selector: 'Selector | str | None' = None) -> 'Edge'
| Select a single edge.
|
| edges(self, selector: 'Selector | str | None' = None) -> 'Shape'
| Select edges.
|
| export(self: 'T', fname: 'str', tolerance: 'float' = 0.1, angularTolerance: 'float' = 0.1, unit: 'UnitLiterals' = 'MM', outputUnit: 'UnitLiterals | None' = None, opt: 'dict[str, Any] | None' = None) -> 'None'
| Export Shape to file.
|
| exportBin(self, f: 'str | BytesIO') -> 'bool'
| Export this shape to a binary BREP file.
|
| exportBrep(self, f: 'str | BytesIO') -> 'bool'
| Export this shape to a BREP file
|
| exportStep(self, fileName: 'str', unit: 'UnitLiterals' = 'MM', outputUnit: 'UnitLiterals | None' = None, **kwargs: 'Any') -> 'IFSelect_ReturnStatus'
| Export this shape to a STEP file.
| kwargs is used to provide additional optional keyword arguments to configure the exporter.
|
| :param fileName: Path and filename for writing.
| :type fileName: str
| :param unit: The internal unit of the model's geometry values. Default "MM".
| :type unit: UnitLiterals
| :param outputUnit: The unit to use in the STEP file header. If None, defaults to the value of ``unit``.
| Use this when you want the output file to declare a different unit than the model's internal unit,
| for example to export a MM model as a STEP file declaring meters.
| :type outputUnit: UnitLiterals or None
| :param write_pcurves: Enable or disable writing parametric curves to the STEP file. Default True.
| If False, writes STEP file without pcurves. This decreases the size of the resulting STEP file.
| :type write_pcurves: bool
| :param precision_mode: Controls the uncertainty value for STEP entities. Specify -1, 0, or 1. Default 0.
| See OCCT documentation.
| :type precision_mode: int
|
| exportStl(self, fileName: 'str', tolerance: 'float' = 0.001, angularTolerance: 'float' = 0.1, ascii: 'bool' = False, relative: 'bool' = True, parallel: 'bool' = True) -> 'bool'
| Exports a shape to a specified STL file.
|
| :param fileName: The path and file name to write the STL output to.
| :param tolerance: A linear deflection setting which limits the distance between a curve and its tessellation.
| Setting this value too low will result in large meshes that can consume computing resources.
| Setting the value too high can result in meshes with a level of detail that is too low.
| Default is 1e-3, which is a good starting point for a range of cases.
| :param angularTolerance: Angular deflection setting which limits the angle between subsequent segments in a polyline. Default is 0.1.
| :param ascii: Export the file as ASCII (True) or binary (False) STL format. Default is binary.
| :param relative: If True, tolerance will be scaled by the size of the edge being meshed. Default is True.
| Setting this value to True may cause large features to become faceted, or small features dense.
| :param parallel: If True, OCCT will use parallel processing to mesh the shape. Default is True.
|
| face(self, selector: 'Selector | str | None' = None) -> 'Face'
| Select a single face.
|
| faces(self, selector: 'Selector | str | None' = None) -> 'Shape'
| Select faces.
|
| facesIntersectedByLine(self, point: 'VectorLike', axis: 'VectorLike', tol: 'float' = 0.0001, direction: "Literal['AlongAxis', 'Opposite'] | None" = None) -> 'list[Face]'
| Computes the intersections between the provided line and the faces of this Shape
|
| :param point: Base point for defining a line
| :param axis: Axis on which the line rests
| :param tol: Intersection tolerance
| :param direction: Valid values: "AlongAxis", "Opposite";
| If specified, will ignore all faces that are not in the specified direction
| including the face where the point lies if it is the case
| :returns: A list of intersected faces sorted by distance from point
|
| filter(self, f: 'Callable[[Shape], bool]') -> 'Compound'
|
| fix(self: 'T') -> 'T'
| Try to fix shape if not valid
|
| geomType(self) -> 'Geoms'
| Gets the underlying geometry type.
|
| Implementations can return any values desired, but the values the user
| uses in type filters should correspond to these.
|
| As an example, if a user does::
|
| CQ(object).faces("%mytype")
|
| The expectation is that the geomType attribute will return 'mytype'
|
| The return values depend on the type of the shape:
|
| | Vertex: always 'Vertex'
| | Edge: LINE, CIRCLE, ELLIPSE, HYPERBOLA, PARABOLA, BEZIER,
| | BSPLINE, OFFSET, OTHER
| | Face: PLANE, CYLINDER, CONE, SPHERE, TORUS, BEZIER, BSPLINE,
| | REVOLUTION, EXTRUSION, OFFSET, OTHER
| | Solid: 'Solid'
| | Shell: 'Shell'
| | Compound: 'Compound'
| | Wire: 'Wire'
|
| :returns: A string according to the geometry type
|
| hashCode(self) -> 'int'
| Returns a hashed value denoting this shape. It is computed from the
| TShape and the Location. The Orientation is not used.
|
| isEqual(self, other: 'Shape') -> 'bool'
| Returns True if two shapes are equal, i.e. if they share the same
| TShape with the same Locations and Orientations. Also see
| :py:meth:`isSame`.
|
| isNull(self) -> 'bool'
| Returns true if this shape is null. In other words, it references no
| underlying shape with the potential to be given a location and an
| orientation.
|
| isSame(self, other: 'Shape') -> 'bool'
| Returns True if other and this shape are same, i.e. if they share the
| same TShape with the same Locations. Orientations may differ. Also see
| :py:meth:`isEqual`
|
| isValid(self) -> 'bool'
| Returns True if no defect is detected on the shape S or any of its
| subshapes. See the OCCT docs on BRepCheck_Analyzer::IsValid for a full
| description of what is checked.
|
| locate(self: 'T', loc: 'Location') -> 'T'
| Apply a location in absolute sense to self.
|
| located(self: 'T', loc: 'Location') -> 'T'
| Apply a location in absolute sense to a copy of self.
|
| location(self) -> 'Location'
| Return the current location
|
| mesh(self, tolerance: 'float', angularTolerance: 'float' = 0.1) -> 'None'
| Generate triangulation if none exists.
|
| mirror(self, mirrorPlane: "Literal['XY', 'YX', 'XZ', 'ZX', 'YZ', 'ZY'] | VectorLike" = 'XY', basePointVector: 'VectorLike' = (0, 0, 0)) -> 'Shape'
| Applies a mirror transform to this Shape. Does not duplicate objects
| about the plane.
|
| :param mirrorPlane: The direction of the plane to mirror about - one of
| 'XY', 'XZ' or 'YZ'
| :param basePointVector: The origin of the plane to mirror about
| :returns: The mirrored shape
|
| move(self: 'T', loc: 'Location') -> 'T'
| move(self: 'T', loc: 'Location') -> 'T'
|
| Apply a location in relative sense (i.e. update current location) to self.
|
|
| move(self: 'T', x: 'Real' = 0, y: 'Real' = 0, z: 'Real' = 0, rx: 'Real' = 0, ry: 'Real' = 0, rz: 'Real' = 0) -> 'T'
|
| Apply translation and rotation in relative sense (i.e. update current location) to self.
|
|
| move(self: 'T', loc: 'VectorLike') -> 'T'
|
| Apply a VectorLike in relative sense (i.e. update current location) to self.
|
| moved(self: 'T', s: 'Shape') -> 'Shape'
| moved(self: 'T', loc: 'Location') -> 'T'
|
| Apply a location in relative sense (i.e. update current location) to a copy of self.
|
|
| moved(self: 'T', x: 'Real' = 0, y: 'Real' = 0, z: 'Real' = 0, rx: 'Real' = 0, ry: 'Real' = 0, rz: 'Real' = 0) -> 'T'
|
| Apply translation and rotation in relative sense to a copy of self.
|
|
| moved(self: 'T', loc: 'VectorLike') -> 'T'
|
| Apply a VectorLike in relative sense to a copy of self.
|
| replace(self, old: 'Shape', *new: 'Shape') -> 'Self'
| Replace old subshape with new subshapes.
|
| reverse(self) -> 'Shape'
| Return a copy of self with reversed orientation.
|
| rotate(self: 'T', startVector: 'VectorLike', endVector: 'VectorLike', angleDegrees: 'float') -> 'T'
| Rotates a shape around an axis.
|
| :param startVector: start point of rotation axis
| :type startVector: either a 3-tuple or a Vector
| :param endVector: end point of rotation axis
| :type endVector: either a 3-tuple or a Vector
| :param angleDegrees: angle to rotate, in degrees
| :returns: a copy of the shape, rotated
|
| scale(self, factor: 'float') -> 'Shape'
| Scales this shape through a transformation.
|
| shell(self, selector: 'Selector | str | None' = None) -> 'Shell'
| Select a single shell.
|
| shells(self, selector: 'Selector | str | None' = None) -> 'Shape'
| Select shells.
|
| size(self) -> 'int'
| Simple size implementation.
|
| solid(self, selector: 'Selector | str | None' = None) -> 'Solid'
| Select a single solid.
|
| solids(self, selector: 'Selector | str | None' = None) -> 'Shape'
| Select solids.
|
| sort(self, key: 'Callable[[Shape], Any]') -> 'Compound'
|
| split(self, *splitters: 'Shape') -> 'Shape'
| Split this shape with the positional arguments.
|
| tessellate(self, tolerance: 'float', angularTolerance: 'float' = 0.1) -> 'tuple[list[Vector], list[tuple[int, int, int]]]'
|
| toLocs(self) -> 'list[Location]'
| Convert self to a list of locations.
|
| toNURBS(self: 'T') -> 'T'
| Return a NURBS representation of a given shape.
|
| toSplines(self: 'T', degree: 'int' = 3, tolerance: 'float' = 0.001, nurbs: 'bool' = False) -> 'T'
| Approximate shape with b-splines of the specified degree.
|
| :param degree: Maximum degree.
| :param tolerance: Approximation tolerance.
| :param nurbs: Use rational splines.
|
| toVtkPolyData(self, tolerance: 'float | None' = None, angularTolerance: 'float | None' = None, normals: 'bool' = False) -> 'vtkPolyData'
| Convert shape to vtkPolyData
|
| transformGeometry(self, tMatrix: 'Matrix') -> 'Shape'
| Transforms this shape by tMatrix.
|
| WARNING: transformGeometry will sometimes convert lines and circles to
| splines, but it also has the ability to handle skew and stretching
| transformations.
|
| If your transformation is only translation and rotation, it is safer to
| use :py:meth:`transformShape`, which doesn't change the underlying type
| of the geometry, but cannot handle skew transformations.
|
| :param tMatrix: The transformation matrix
| :returns: a copy of the object, but with geometry transformed instead
| of just rotated.
|
| transformShape(self, tMatrix: 'Matrix') -> 'Shape'
| Transforms this Shape by tMatrix. Also see :py:meth:`transformGeometry`.
|
| :param tMatrix: The transformation matrix
| :returns: a copy of the object, transformed by the provided matrix,
| with all objects keeping their type
|
| translate(self: 'T', vector: 'VectorLike') -> 'T'
| Translates this shape through a transformation.
|
| vertex(self, selector: 'Selector | str | None' = None) -> 'Vertex'
| Select a single vertex.
|
| vertices(self, selector: 'Selector | str | None' = None) -> 'Shape'
| Select vertices.
|
| wire(self, selector: 'Selector | str | None' = None) -> 'Wire'
| Select a single wire.
|
| wires(self, selector: 'Selector | str | None' = None) -> 'Shape'
| Select wires.
|
| ----------------------------------------------------------------------
| Class methods inherited from Shape:
|
| cast(obj: 'TopoDS_Shape', forConstruction: 'bool' = False) -> 'Shape'
| Returns the right type of wrapper, given a OCCT object
|
| importBin(f: 'str | BytesIO') -> 'Shape'
| Import shape from a binary BREP file.
|
| importBrep(f: 'str | BytesIO') -> 'Shape'
| Import shape from a BREP file
|
| ----------------------------------------------------------------------
| Static methods inherited from Shape:
|
| CombinedCenter(objects: 'Iterable[Shape]') -> 'Vector'
| Calculates the center of mass of multiple objects.
|
| :param objects: A list of objects with mass
|
| CombinedCenterOfBoundBox(objects: 'list[Shape]') -> 'Vector'
| Calculates the center of a bounding box of multiple objects.
|
| :param objects: A list of objects
|
| centerOfMass(obj: 'Shape') -> 'Vector'
| Calculates the center of 'mass' of an object.
|
| :param obj: Compute the center of mass of this object
|
| computeMass(obj: 'Shape', tol: 'float | None' = None) -> 'float'
| Calculates the 'mass' of an object.
|
| :param obj: Compute the mass of this object
| :param tol: Numerical integration tolerance (optional).
|
| matrixOfInertia(obj: 'Shape') -> 'list[list[float]]'
| Calculates the matrix of inertia of an object.
| Since the part's density is unknown, this result is inertia/density with units of [1/length].
| :param obj: Compute the matrix of inertia of this object
|
| ----------------------------------------------------------------------
| Data descriptors inherited from Shape:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Methods inherited from Mixin3D:
|
| chamfer(self: 'Any', length: 'float', length2: 'float | None', edgeList: 'Iterable[Edge]') -> 'Any'
| Chamfers the specified edges of this solid.
|
| :param length: length > 0, the length (length) of the chamfer
| :param length2: length2 > 0, optional parameter for asymmetrical chamfer. Should be `None` if not required.
| :param edgeList: a list of Edge objects, which must belong to this solid
| :return: Chamfered solid
|
| dprism(self: 'TS', basis: 'Face | None', profiles: 'list[Wire]', depth: 'Real | None' = None, taper: 'Real' = 0, upToFace: 'Face | None' = None, thruAll: 'bool' = True, additive: 'bool' = True) -> 'TS'
| dprism(self: 'TS', basis: 'Face | None', profiles: 'list[Wire]', depth: 'Real | None' = None, taper: 'Real' = 0, upToFace: 'Face | None' = None, thruAll: 'bool' = True, additive: 'bool' = True) -> 'TS'
|
| Make a prismatic feature (additive or subtractive)
|
| :param basis: face to perform the operation on
| :param profiles: list of profiles
| :param depth: depth of the cut or extrusion
| :param upToFace: a face to extrude until
| :param thruAll: cut thruAll
| :return: a Solid object
|
| fillet(self: 'Any', radius: 'float', edgeList: 'Iterable[Edge]') -> 'Any'
| Fillets the specified edges of this solid.
|
| :param radius: float > 0, the radius of the fillet
| :param edgeList: a list of Edge objects, which must belong to this solid
| :return: Filleted solid
|
| hollow(self: 'Any', faceList: 'Iterable[Face] | None', thickness: 'float', tolerance: 'float' = 0.0001, kind: "Literal['arc', 'intersection']" = 'arc') -> 'Any'
| Make a hollow solid of self.
|
| :param faceList: List of faces to be removed, which must be part of the solid. Can
| be an empty list.
| :param thickness: Floating point thickness. Positive shells outwards, negative
| shells inwards.
| :param tolerance: Modelling tolerance of the method, default=0.0001.
| :return: A shelled solid.
|
| isInside(self: 'ShapeProtocol', point: 'VectorLike', tolerance: 'float' = 1e-06) -> 'bool'
| Returns whether or not the point is inside a solid or compound
| object within the specified tolerance.
|
| :param point: tuple or Vector representing 3D point to be tested
| :param tolerance: tolerance for inside determination, default=1.0e-6
| :return: bool indicating whether or not point is within solid
cadquery.Constraint
Python Library Documentation: class ConstraintSpec in module cadquery.occ_impl.solver
class ConstraintSpec(builtins.object)
| ConstraintSpec(objects: Tuple[str, ...], args: Tuple[cadquery.occ_impl.shapes.Shape, ...], sublocs: Tuple[cadquery.occ_impl.geom.Location, ...], kind: Literal['Plane', 'Point', 'Axis', 'PointInPlane', 'Fixed', 'FixedPoint', 'FixedAxis', 'PointOnLine', 'FixedRotation'], param: Any = None)
|
| Geometrical constraint specification between two shapes of an assembly.
|
| Methods defined here:
|
| __init__(self, objects: Tuple[str, ...], args: Tuple[cadquery.occ_impl.shapes.Shape, ...], sublocs: Tuple[cadquery.occ_impl.geom.Location, ...], kind: Literal['Plane', 'Point', 'Axis', 'PointInPlane', 'Fixed', 'FixedPoint', 'FixedAxis', 'PointOnLine', 'FixedRotation'], param: Any = None)
| Construct a constraint.
|
| :param objects: object names referenced in the constraint
| :param args: subshapes (e.g. faces or edges) of the objects
| :param sublocs: locations of the objects (only relevant if the objects are nested in a sub-assembly)
| :param kind: constraint kind
| :param param: optional arbitrary parameter passed to the solver
|
| toPODs(self) -> Tuple[Tuple[Tuple[Union[OCP.OCP.gp.gp_Pln, OCP.OCP.gp.gp_Dir, OCP.OCP.gp.gp_Pnt, OCP.OCP.gp.gp_Lin, NoneType], ...], Literal['Plane', 'Point', 'Axis', 'PointInPlane', 'Fixed', 'FixedPoint', 'FixedAxis', 'PointOnLine', 'FixedRotation'], Optional[Any]], ...]
| Convert the constraint to a representation used by the solver.
|
| NB: Compound constraints are decomposed into simple ones.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __annotations__ = {'args': typing.Tuple[cadquery.occ_impl.shapes.Shape...
cadquery.DirectionMinMaxSelector
Python Library Documentation: class DirectionMinMaxSelector in module cadquery.selectors
class DirectionMinMaxSelector(CenterNthSelector)
| DirectionMinMaxSelector(vector: cadquery.occ_impl.geom.Vector, directionMax: bool = True, tolerance: float = 0.0001)
|
| Selects objects closest or farthest in the specified direction.
|
| Applicability:
| All object types. for a vertex, its point is used. for all other kinds
| of objects, the center of mass of the object is used.
|
| You can use the string shortcuts >(X|Y|Z) or <(X|Y|Z) if you want to select
| based on a cardinal direction.
|
| For example this::
|
| CQ(aCube).faces(DirectionMinMaxSelector((0, 0, 1), True))
|
| Means to select the face having the center of mass farthest in the positive
| z direction, and is the same as::
|
| CQ(aCube).faces(">Z")
|
| Method resolution order:
| DirectionMinMaxSelector
| CenterNthSelector
| _NthSelector
| Selector
| abc.ABC
| builtins.object
|
| Methods defined here:
|
| __init__(self, vector: cadquery.occ_impl.geom.Vector, directionMax: bool = True, tolerance: float = 0.0001)
| Initialize self. See help(type(self)) for accurate signature.
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __abstractmethods__ = frozenset()
|
| ----------------------------------------------------------------------
| Methods inherited from CenterNthSelector:
|
| key(self, obj: ~Shape) -> float
| Return the key for ordering. Can raise a ValueError if obj can not be
| used to create a key, which will result in obj being dropped by the
| clustering method.
|
| ----------------------------------------------------------------------
| Methods inherited from _NthSelector:
|
| cluster(self, objectlist: Sequence[~Shape]) -> List[List[~Shape]]
| Clusters the elements of objectlist if they are within tolerance.
|
| filter(self, objectlist: Sequence[~Shape]) -> List[~Shape]
| Return the nth object in the objectlist sorted by self.key and
| clustered if within self.tolerance.
|
| ----------------------------------------------------------------------
| Methods inherited from Selector:
|
| __add__(self, other)
|
| __and__(self, other)
|
| __neg__(self)
|
| __sub__(self, other)
|
| ----------------------------------------------------------------------
| Data descriptors inherited from Selector:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
cadquery.DirectionSelector
Python Library Documentation: class DirectionSelector in module cadquery.selectors
class DirectionSelector(BaseDirSelector)
| DirectionSelector(vector: cadquery.occ_impl.geom.Vector, tolerance: float = 0.0001)
|
| Selects objects aligned with the provided direction.
|
| Applicability:
| Linear Edges
| Planar Faces
|
| Use the string syntax shortcut +/-(X|Y|Z) if you want to select based on a cardinal direction.
|
| Example::
|
| CQ(aCube).faces(DirectionSelector((0, 0, 1)))
|
| selects faces with the normal in the z direction, and is equivalent to::
|
| CQ(aCube).faces("+Z")
|
| Method resolution order:
| DirectionSelector
| BaseDirSelector
| Selector
| builtins.object
|
| Methods defined here:
|
| test(self, vec: cadquery.occ_impl.geom.Vector) -> bool
| Test a specified vector. Subclasses override to provide other implementations
|
| ----------------------------------------------------------------------
| Methods inherited from BaseDirSelector:
|
| __init__(self, vector: cadquery.occ_impl.geom.Vector, tolerance: float = 0.0001)
| Initialize self. See help(type(self)) for accurate signature.
|
| filter(self, objectList: Sequence[~Shape]) -> List[~Shape]
| There are lots of kinds of filters, but for planes they are always
| based on the normal of the plane, and for edges on the tangent vector
| along the edge
|
| ----------------------------------------------------------------------
| Methods inherited from Selector:
|
| __add__(self, other)
|
| __and__(self, other)
|
| __neg__(self)
|
| __sub__(self, other)
|
| ----------------------------------------------------------------------
| Data descriptors inherited from Selector:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
cadquery.Edge
Python Library Documentation: class Edge in module cadquery.occ_impl.shapes
class Edge(Shape, Mixin1D)
| Edge(obj: 'TopoDS_Shape') -> 'None'
|
| A trimmed curve that represents the border of a face
|
| Method resolution order:
| Edge
| Shape
| Mixin1D
| builtins.object
|
| Methods defined here:
|
| arcCenter(self) -> 'Vector'
| Center of an underlying circle or ellipse geometry.
|
| close(self) -> 'Edge | Wire'
| Close an Edge
|
| hasPCurve(self, f: 'Face') -> 'bool'
| Check if self has a pcurve defined on f.
|
| trim(self, u0: 'Real', u1: 'Real') -> 'Edge'
| Trim the edge in the parametric space to (u0, u1).
|
| NB: this operation is done on the base geometry.
|
| ----------------------------------------------------------------------
| Class methods defined here:
|
| makeBezier(points: 'list[Vector]') -> 'Edge'
| Create a cubic Bézier Curve from the points.
|
| :param points: a list of Vectors that represent the points.
| The edge will pass through the first and the last point,
| and the inner points are Bézier control points.
| :return: An edge
|
| makeCircle(radius: 'float', pnt: 'VectorLike' = Vector: (0.0, 0.0, 0.0), dir: 'VectorLike' = Vector: (0.0, 0.0, 1.0), angle1: 'float' = 360.0, angle2: 'float' = 360, orientation: 'bool' = True) -> 'Edge'
|
| makeEllipse(x_radius: 'float', y_radius: 'float', pnt: 'VectorLike' = Vector: (0.0, 0.0, 0.0), dir: 'VectorLike' = Vector: (0.0, 0.0, 1.0), xdir: 'VectorLike' = Vector: (1.0, 0.0, 0.0), angle1: 'float' = 360.0, angle2: 'float' = 360.0, sense: 'Literal[-1, 1]' = 1) -> 'Edge'
| Makes an Ellipse centered at the provided point, having normal in the provided direction.
|
| :param cls:
| :param x_radius: x radius of the ellipse (along the x-axis of plane the ellipse should lie in)
| :param y_radius: y radius of the ellipse (along the y-axis of plane the ellipse should lie in)
| :param pnt: vector representing the center of the ellipse
| :param dir: vector representing the direction of the plane the ellipse should lie in
| :param angle1: start angle of arc
| :param angle2: end angle of arc (angle2 == angle1 return closed ellipse = default)
| :param sense: clockwise (-1) or counter clockwise (1)
| :return: an Edge
|
| makeLine(v1: 'VectorLike', v2: 'VectorLike') -> 'Edge'
| Create a line between two points
|
| :param v1: Vector that represents the first point
| :param v2: Vector that represents the second point
| :return: A linear edge between the two provided points
|
| makeSpline(listOfVector: 'list[Vector]', tangents: 'Sequence[Vector] | None' = None, periodic: 'bool' = False, parameters: 'Sequence[float] | None' = None, scale: 'bool' = True, tol: 'float' = 1e-06) -> 'Edge'
| Interpolate a spline through the provided points.
|
| :param listOfVector: a list of Vectors that represent the points
| :param tangents: tuple of Vectors specifying start and finish tangent
| :param periodic: creation of periodic curves
| :param parameters: the value of the parameter at each interpolation point. (The interpolated
| curve is represented as a vector-valued function of a scalar parameter.) If periodic ==
| True, then len(parameters) must be len(intepolation points) + 1, otherwise len(parameters)
| must be equal to len(interpolation points).
| :param scale: whether to scale the specified tangent vectors before interpolating. Each
| tangent is scaled, so it's length is equal to the derivative of the Lagrange interpolated
| curve. I.e., set this to True, if you want to use only the direction of the tangent
| vectors specified by ``tangents``, but not their magnitude.
| :param tol: tolerance of the algorithm (consult OCC documentation). Used to check that the
| specified points are not too close to each other, and that tangent vectors are not too
| short. (In either case interpolation may fail.)
| :return: an Edge
|
| makeSplineApprox(listOfVector: 'list[Vector]', tol: 'float' = 0.001, smoothing: 'tuple[float, float, float] | None' = None, minDeg: 'int' = 1, maxDeg: 'int' = 6) -> 'Edge'
| Approximate a spline through the provided points.
|
| :param listOfVector: a list of Vectors that represent the points
| :param tol: tolerance of the algorithm (consult OCC documentation).
| :param smoothing: optional tuple of 3 weights use for variational smoothing (default: None)
| :param minDeg: minimum spline degree. Enforced only when smothing is None (default: 1)
| :param maxDeg: maximum spline degree (default: 6)
| :return: an Edge
|
| makeTangentArc(v1: 'VectorLike', v2: 'VectorLike', v3: 'VectorLike') -> 'Edge'
| Makes a tangent arc from point v1, in the direction of v2 and ends at v3.
|
| :param cls:
| :param v1: start vector
| :param v2: tangent vector
| :param v3: end vector
| :return: an edge
|
| makeThreePointArc(v1: 'VectorLike', v2: 'VectorLike', v3: 'VectorLike') -> 'Edge'
| Makes a three point arc through the provided points
|
| :param cls:
| :param v1: start vector
| :param v2: middle vector
| :param v3: end vector
| :return: an edge object through the three points
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __annotations__ = {'wrapped': 'TopoDS_Edge'}
|
| ----------------------------------------------------------------------
| Methods inherited from Shape:
|
| Area(self) -> 'float'
| :returns: The surface area of all faces in this Shape
|
| BoundingBox(self, tolerance: 'float | None' = None) -> 'BoundBox'
| Create a bounding box for this Shape.
|
| :param tolerance: Tolerance value passed to :class:`BoundBox`
| :returns: A :class:`BoundBox` object for this Shape
|
| Center(self) -> 'Vector'
| :returns: The point of the center of mass of this Shape
|
| CenterOfBoundBox(self, tolerance: 'float | None' = None) -> 'Vector'
| :param tolerance: Tolerance passed to the :py:meth:`BoundingBox` method
| :returns: Center of the bounding box of this shape
|
| Closed(self) -> 'bool'
| :returns: The closedness flag
|
| CompSolids(self) -> 'list[CompSolid]'
| :returns: All the compsolids in this Shape
|
| Compounds(self) -> 'list[Compound]'
| :returns: All the compounds in this Shape
|
| Edges(self) -> 'list[Edge]'
| :returns: All the edges in this Shape
|
| Faces(self) -> 'list[Face]'
| :returns: All the faces in this Shape
|
| ShapeType(self) -> 'Shapes'
|
| Shells(self) -> 'list[Shell]'
| :returns: All the shells in this Shape
|
| Solids(self) -> 'list[Solid]'
| :returns: All the solids in this Shape
|
| Vertices(self) -> 'list[Vertex]'
| :returns: All the vertices in this Shape
|
| Volume(self, tol: 'float | None' = None) -> 'float'
| :returns: The volume of this Shape
|
| Wires(self) -> 'list[Wire]'
| :returns: All the wires in this Shape
|
| __add__(self, other: 'Shape') -> 'Shape'
| Fuse self and other.
|
| __and__(self, other: 'Shape') -> 'Compound'
| Set intersection for combining selection results.
|
| __eq__(self, other: 'Any') -> 'bool'
| Return self==value.
|
| __getitem__(self, item: 'int | slice') -> 'Shape'
|
| __getstate__(self) -> 'tuple[BytesIO, bool]'
| Helper for pickle.
|
| __hash__(self) -> 'int'
| Return hash(self).
|
| __init__(self, obj: 'TopoDS_Shape') -> 'None'
| Initialize self. See help(type(self)) for accurate signature.
|
| __iter__(self) -> 'Iterator[Shape]'
| Iterate over subshapes.
|
| __mod__(self, other: 'Shape') -> 'Compound'
| Set difference for combining selection results.
|
| __mul__(self, other: 'Shape') -> 'Shape'
| Intersect self and other.
|
| __or__(self, other: 'Shape') -> 'Compound'
| Set sum for combining selection results.
|
| __setstate__(self, data: 'tuple[BytesIO, bool]') -> 'None'
|
| __sub__(self, other: 'Shape') -> 'Shape'
| Subtract other from self.
|
| __truediv__(self, other: 'Shape') -> 'Shape'
| Split self with other.
|
| ancestors(self, ctx: 'Shape', kind: 'Shapes') -> 'Compound'
| Iterate over ancestors, i.e. shapes of type kind within ctx shape that contain self.
|
| clean(self: 'T') -> 'T'
| Experimental clean using ShapeUpgrade
|
| copy(self: 'T', mesh: 'bool' = False) -> 'T'
| Creates a new object that is a copy of this object.
|
| :param mesh: should I copy the triangulation too (default: False)
| :returns: a copy of the object
|
| cut(self, *toCut: 'Shape', tol: 'float | None' = None) -> 'Shape'
| Remove the positional arguments from this Shape.
|
| :param tol: Fuzzy mode tolerance
|
| distance(self, other: 'Shape') -> 'float'
| Minimal distance between two shapes
|
| distances(self, *others: 'Shape') -> 'Iterator[float]'
| Minimal distances to between self and other shapes
|
| edge(self, selector: 'Selector | str | None' = None) -> 'Edge'
| Select a single edge.
|
| edges(self, selector: 'Selector | str | None' = None) -> 'Shape'
| Select edges.
|
| export(self: 'T', fname: 'str', tolerance: 'float' = 0.1, angularTolerance: 'float' = 0.1, unit: 'UnitLiterals' = 'MM', outputUnit: 'UnitLiterals | None' = None, opt: 'dict[str, Any] | None' = None) -> 'None'
| Export Shape to file.
|
| exportBin(self, f: 'str | BytesIO') -> 'bool'
| Export this shape to a binary BREP file.
|
| exportBrep(self, f: 'str | BytesIO') -> 'bool'
| Export this shape to a BREP file
|
| exportStep(self, fileName: 'str', unit: 'UnitLiterals' = 'MM', outputUnit: 'UnitLiterals | None' = None, **kwargs: 'Any') -> 'IFSelect_ReturnStatus'
| Export this shape to a STEP file.
| kwargs is used to provide additional optional keyword arguments to configure the exporter.
|
| :param fileName: Path and filename for writing.
| :type fileName: str
| :param unit: The internal unit of the model's geometry values. Default "MM".
| :type unit: UnitLiterals
| :param outputUnit: The unit to use in the STEP file header. If None, defaults to the value of ``unit``.
| Use this when you want the output file to declare a different unit than the model's internal unit,
| for example to export a MM model as a STEP file declaring meters.
| :type outputUnit: UnitLiterals or None
| :param write_pcurves: Enable or disable writing parametric curves to the STEP file. Default True.
| If False, writes STEP file without pcurves. This decreases the size of the resulting STEP file.
| :type write_pcurves: bool
| :param precision_mode: Controls the uncertainty value for STEP entities. Specify -1, 0, or 1. Default 0.
| See OCCT documentation.
| :type precision_mode: int
|
| exportStl(self, fileName: 'str', tolerance: 'float' = 0.001, angularTolerance: 'float' = 0.1, ascii: 'bool' = False, relative: 'bool' = True, parallel: 'bool' = True) -> 'bool'
| Exports a shape to a specified STL file.
|
| :param fileName: The path and file name to write the STL output to.
| :param tolerance: A linear deflection setting which limits the distance between a curve and its tessellation.
| Setting this value too low will result in large meshes that can consume computing resources.
| Setting the value too high can result in meshes with a level of detail that is too low.
| Default is 1e-3, which is a good starting point for a range of cases.
| :param angularTolerance: Angular deflection setting which limits the angle between subsequent segments in a polyline. Default is 0.1.
| :param ascii: Export the file as ASCII (True) or binary (False) STL format. Default is binary.
| :param relative: If True, tolerance will be scaled by the size of the edge being meshed. Default is True.
| Setting this value to True may cause large features to become faceted, or small features dense.
| :param parallel: If True, OCCT will use parallel processing to mesh the shape. Default is True.
|
| face(self, selector: 'Selector | str | None' = None) -> 'Face'
| Select a single face.
|
| faces(self, selector: 'Selector | str | None' = None) -> 'Shape'
| Select faces.
|
| facesIntersectedByLine(self, point: 'VectorLike', axis: 'VectorLike', tol: 'float' = 0.0001, direction: "Literal['AlongAxis', 'Opposite'] | None" = None) -> 'list[Face]'
| Computes the intersections between the provided line and the faces of this Shape
|
| :param point: Base point for defining a line
| :param axis: Axis on which the line rests
| :param tol: Intersection tolerance
| :param direction: Valid values: "AlongAxis", "Opposite";
| If specified, will ignore all faces that are not in the specified direction
| including the face where the point lies if it is the case
| :returns: A list of intersected faces sorted by distance from point
|
| filter(self, f: 'Callable[[Shape], bool]') -> 'Compound'
|
| fix(self: 'T') -> 'T'
| Try to fix shape if not valid
|
| fuse(self, *toFuse: 'Shape', glue: 'bool' = False, tol: 'float | None' = None) -> 'Shape'
| Fuse the positional arguments with this Shape.
|
| :param glue: Sets the glue option for the algorithm, which allows
| increasing performance of the intersection of the input shapes
| :param tol: Fuzzy mode tolerance
|
| geomType(self) -> 'Geoms'
| Gets the underlying geometry type.
|
| Implementations can return any values desired, but the values the user
| uses in type filters should correspond to these.
|
| As an example, if a user does::
|
| CQ(object).faces("%mytype")
|
| The expectation is that the geomType attribute will return 'mytype'
|
| The return values depend on the type of the shape:
|
| | Vertex: always 'Vertex'
| | Edge: LINE, CIRCLE, ELLIPSE, HYPERBOLA, PARABOLA, BEZIER,
| | BSPLINE, OFFSET, OTHER
| | Face: PLANE, CYLINDER, CONE, SPHERE, TORUS, BEZIER, BSPLINE,
| | REVOLUTION, EXTRUSION, OFFSET, OTHER
| | Solid: 'Solid'
| | Shell: 'Shell'
| | Compound: 'Compound'
| | Wire: 'Wire'
|
| :returns: A string according to the geometry type
|
| hashCode(self) -> 'int'
| Returns a hashed value denoting this shape. It is computed from the
| TShape and the Location. The Orientation is not used.
|
| intersect(self, *toIntersect: 'Shape', tol: 'float | None' = None) -> 'Shape'
| Intersection of the positional arguments and this Shape.
|
| :param tol: Fuzzy mode tolerance
|
| isEqual(self, other: 'Shape') -> 'bool'
| Returns True if two shapes are equal, i.e. if they share the same
| TShape with the same Locations and Orientations. Also see
| :py:meth:`isSame`.
|
| isNull(self) -> 'bool'
| Returns true if this shape is null. In other words, it references no
| underlying shape with the potential to be given a location and an
| orientation.
|
| isSame(self, other: 'Shape') -> 'bool'
| Returns True if other and this shape are same, i.e. if they share the
| same TShape with the same Locations. Orientations may differ. Also see
| :py:meth:`isEqual`
|
| isValid(self) -> 'bool'
| Returns True if no defect is detected on the shape S or any of its
| subshapes. See the OCCT docs on BRepCheck_Analyzer::IsValid for a full
| description of what is checked.
|
| locate(self: 'T', loc: 'Location') -> 'T'
| Apply a location in absolute sense to self.
|
| located(self: 'T', loc: 'Location') -> 'T'
| Apply a location in absolute sense to a copy of self.
|
| location(self) -> 'Location'
| Return the current location
|
| mesh(self, tolerance: 'float', angularTolerance: 'float' = 0.1) -> 'None'
| Generate triangulation if none exists.
|
| mirror(self, mirrorPlane: "Literal['XY', 'YX', 'XZ', 'ZX', 'YZ', 'ZY'] | VectorLike" = 'XY', basePointVector: 'VectorLike' = (0, 0, 0)) -> 'Shape'
| Applies a mirror transform to this Shape. Does not duplicate objects
| about the plane.
|
| :param mirrorPlane: The direction of the plane to mirror about - one of
| 'XY', 'XZ' or 'YZ'
| :param basePointVector: The origin of the plane to mirror about
| :returns: The mirrored shape
|
| move(self: 'T', loc: 'Location') -> 'T'
| move(self: 'T', loc: 'Location') -> 'T'
|
| Apply a location in relative sense (i.e. update current location) to self.
|
|
| move(self: 'T', x: 'Real' = 0, y: 'Real' = 0, z: 'Real' = 0, rx: 'Real' = 0, ry: 'Real' = 0, rz: 'Real' = 0) -> 'T'
|
| Apply translation and rotation in relative sense (i.e. update current location) to self.
|
|
| move(self: 'T', loc: 'VectorLike') -> 'T'
|
| Apply a VectorLike in relative sense (i.e. update current location) to self.
|
| moved(self: 'T', s: 'Shape') -> 'Shape'
| moved(self: 'T', loc: 'Location') -> 'T'
|
| Apply a location in relative sense (i.e. update current location) to a copy of self.
|
|
| moved(self: 'T', x: 'Real' = 0, y: 'Real' = 0, z: 'Real' = 0, rx: 'Real' = 0, ry: 'Real' = 0, rz: 'Real' = 0) -> 'T'
|
| Apply translation and rotation in relative sense to a copy of self.
|
|
| moved(self: 'T', loc: 'VectorLike') -> 'T'
|
| Apply a VectorLike in relative sense to a copy of self.
|
| remove(self, *subshape: 'Shape') -> 'Self'
| Remove subshapes.
|
| replace(self, old: 'Shape', *new: 'Shape') -> 'Self'
| Replace old subshape with new subshapes.
|
| reverse(self) -> 'Shape'
| Return a copy of self with reversed orientation.
|
| rotate(self: 'T', startVector: 'VectorLike', endVector: 'VectorLike', angleDegrees: 'float') -> 'T'
| Rotates a shape around an axis.
|
| :param startVector: start point of rotation axis
| :type startVector: either a 3-tuple or a Vector
| :param endVector: end point of rotation axis
| :type endVector: either a 3-tuple or a Vector
| :param angleDegrees: angle to rotate, in degrees
| :returns: a copy of the shape, rotated
|
| scale(self, factor: 'float') -> 'Shape'
| Scales this shape through a transformation.
|
| shell(self, selector: 'Selector | str | None' = None) -> 'Shell'
| Select a single shell.
|
| shells(self, selector: 'Selector | str | None' = None) -> 'Shape'
| Select shells.
|
| siblings(self, ctx: 'Shape', kind: 'Shapes', level: 'int | Iterable[int]' = 1) -> 'Compound'
| Iterate over siblings, i.e. shapes within ctx shape that share subshapes of type kind with self.
|
| size(self) -> 'int'
| Simple size implementation.
|
| solid(self, selector: 'Selector | str | None' = None) -> 'Solid'
| Select a single solid.
|
| solids(self, selector: 'Selector | str | None' = None) -> 'Shape'
| Select solids.
|
| sort(self, key: 'Callable[[Shape], Any]') -> 'Compound'
|
| split(self, *splitters: 'Shape') -> 'Shape'
| Split this shape with the positional arguments.
|
| tessellate(self, tolerance: 'float', angularTolerance: 'float' = 0.1) -> 'tuple[list[Vector], list[tuple[int, int, int]]]'
|
| toLocs(self) -> 'list[Location]'
| Convert self to a list of locations.
|
| toNURBS(self: 'T') -> 'T'
| Return a NURBS representation of a given shape.
|
| toSplines(self: 'T', degree: 'int' = 3, tolerance: 'float' = 0.001, nurbs: 'bool' = False) -> 'T'
| Approximate shape with b-splines of the specified degree.
|
| :param degree: Maximum degree.
| :param tolerance: Approximation tolerance.
| :param nurbs: Use rational splines.
|
| toVtkPolyData(self, tolerance: 'float | None' = None, angularTolerance: 'float | None' = None, normals: 'bool' = False) -> 'vtkPolyData'
| Convert shape to vtkPolyData
|
| transformGeometry(self, tMatrix: 'Matrix') -> 'Shape'
| Transforms this shape by tMatrix.
|
| WARNING: transformGeometry will sometimes convert lines and circles to
| splines, but it also has the ability to handle skew and stretching
| transformations.
|
| If your transformation is only translation and rotation, it is safer to
| use :py:meth:`transformShape`, which doesn't change the underlying type
| of the geometry, but cannot handle skew transformations.
|
| :param tMatrix: The transformation matrix
| :returns: a copy of the object, but with geometry transformed instead
| of just rotated.
|
| transformShape(self, tMatrix: 'Matrix') -> 'Shape'
| Transforms this Shape by tMatrix. Also see :py:meth:`transformGeometry`.
|
| :param tMatrix: The transformation matrix
| :returns: a copy of the object, transformed by the provided matrix,
| with all objects keeping their type
|
| translate(self: 'T', vector: 'VectorLike') -> 'T'
| Translates this shape through a transformation.
|
| vertex(self, selector: 'Selector | str | None' = None) -> 'Vertex'
| Select a single vertex.
|
| vertices(self, selector: 'Selector | str | None' = None) -> 'Shape'
| Select vertices.
|
| wire(self, selector: 'Selector | str | None' = None) -> 'Wire'
| Select a single wire.
|
| wires(self, selector: 'Selector | str | None' = None) -> 'Shape'
| Select wires.
|
| ----------------------------------------------------------------------
| Class methods inherited from Shape:
|
| cast(obj: 'TopoDS_Shape', forConstruction: 'bool' = False) -> 'Shape'
| Returns the right type of wrapper, given a OCCT object
|
| importBin(f: 'str | BytesIO') -> 'Shape'
| Import shape from a binary BREP file.
|
| importBrep(f: 'str | BytesIO') -> 'Shape'
| Import shape from a BREP file
|
| ----------------------------------------------------------------------
| Static methods inherited from Shape:
|
| CombinedCenter(objects: 'Iterable[Shape]') -> 'Vector'
| Calculates the center of mass of multiple objects.
|
| :param objects: A list of objects with mass
|
| CombinedCenterOfBoundBox(objects: 'list[Shape]') -> 'Vector'
| Calculates the center of a bounding box of multiple objects.
|
| :param objects: A list of objects
|
| centerOfMass(obj: 'Shape') -> 'Vector'
| Calculates the center of 'mass' of an object.
|
| :param obj: Compute the center of mass of this object
|
| computeMass(obj: 'Shape', tol: 'float | None' = None) -> 'float'
| Calculates the 'mass' of an object.
|
| :param obj: Compute the mass of this object
| :param tol: Numerical integration tolerance (optional).
|
| matrixOfInertia(obj: 'Shape') -> 'list[list[float]]'
| Calculates the matrix of inertia of an object.
| Since the part's density is unknown, this result is inertia/density with units of [1/length].
| :param obj: Compute the matrix of inertia of this object
|
| ----------------------------------------------------------------------
| Data descriptors inherited from Shape:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Methods inherited from Mixin1D:
|
| IsClosed(self: 'Mixin1DProtocol') -> 'bool'
|
| Length(self: 'Mixin1DProtocol') -> 'float'
|
| bounds(self: 'Mixin1DProtocol') -> 'tuple[float, float]'
| Parametric bounds of the curve.
|
| curvatureAt(self: 'Mixin1DProtocol', d: 'float', mode: 'ParamMode' = 'length', resolution: 'float' = 1e-06) -> 'float'
| Calculate mean curvature along the underlying curve.
|
| :param d: distance or parameter value
| :param mode: position calculation mode (default: length)
| :param resolution: resolution of the calculation (default: 1e-6)
| :return: mean curvature value at the specified d value.
|
| curvatures(self: 'Mixin1DProtocol', ds: 'Iterable[float]', mode: 'ParamMode' = 'length', resolution: 'float' = 1e-06) -> 'list[float]'
| Calculate mean curvatures along the underlying curve.
|
| :param d: distance or parameter values
| :param mode: position calculation mode (default: length)
| :param resolution: resolution of the calculation (default: 1e-6)
| :return: mean curvature value at the specified d value.
|
| endPoint(self: 'Mixin1DProtocol') -> 'Vector'
| :return: a vector representing the end point of this edge.
|
| Note, circles may have the start and end points the same
|
| locationAt(self: 'Mixin1DProtocol', d: 'float', mode: 'ParamMode' = 'length', frame: 'FrameMode' = 'frenet', planar: 'bool' = False) -> 'Location'
| Generate a location along the underlying curve.
|
| :param d: distance or parameter value
| :param mode: position calculation mode (default: length)
| :param frame: moving frame calculation method (default: frenet)
| :param planar: planar mode
| :return: A Location object representing local coordinate system at the specified distance.
|
| locations(self: 'Mixin1DProtocol', ds: 'Iterable[float]', mode: 'ParamMode' = 'length', frame: 'FrameMode' = 'frenet', planar: 'bool' = False) -> 'list[Location]'
| Generate locations along the curve.
|
| :param ds: distance or parameter values
| :param mode: position calculation mode (default: length)
| :param frame: moving frame calculation method (default: frenet)
| :param planar: planar mode
| :return: A list of Location objects representing local coordinate systems at the specified distances.
|
| normal(self: 'Mixin1DProtocol') -> 'Vector'
| Calculate the normal Vector. Only possible for planar curves.
|
| :return: normal vector
|
| paramAt(self: 'Mixin1DProtocol', d: 'Real | Vector') -> 'float'
| Compute parameter value at the specified normalized distance or a point.
|
| :param d: normalized distance [0, 1] or a point
| :return: parameter value
|
| params(self: 'Mixin1DProtocol', pts: 'Iterable[Vector]', tol: 'float' = 1e-06) -> 'list[float]'
| Computes u values closest to given vectors.
|
| :param pts: the points to compute the parameters at.
| :return: list of u values.
|
| paramsLength(self: 'Mixin1DProtocol', locations: 'Iterable[float]') -> 'list[float]'
| Computes u values at given relative lengths.
|
| :param locations: list of distances.
| :returns: list of u values.
| :param pts: the points to compute the parameters at.
|
| positionAt(self: 'Mixin1DProtocol', d: 'float', mode: 'ParamMode' = 'length') -> 'Vector'
| Generate a position along the underlying curve.
|
| :param d: distance or parameter value
| :param mode: position calculation mode (default: length)
| :return: A Vector on the underlying curve located at the specified d value.
|
| positions(self: 'Mixin1DProtocol', ds: 'Iterable[float]', mode: 'ParamMode' = 'length') -> 'list[Vector]'
| Generate positions along the underlying curve.
|
| :param ds: distance or parameter values
| :param mode: position calculation mode (default: length)
| :return: A list of Vector objects.
|
| project(self: 'T1D', face: 'Face', d: 'VectorLike', closest: 'bool' = True) -> 'T1D | list[T1D]'
| Project onto a face along the specified direction.
|
| radius(self: 'Mixin1DProtocol') -> 'float'
| Calculate the radius.
|
| Note that when applied to a Wire, the radius is simply the radius of the first edge.
|
| :return: radius
| :raises ValueError: if kernel can not reduce the shape to a circular edge
|
| sample(self: 'Mixin1DProtocol', n: 'int | float') -> 'tuple[list[Vector], list[float]]'
| Sample a curve based on a number of points or deflection.
|
| :param n: Number of positions or deflection
| :return: A list of Vectors and a list of parameters.
|
| startPoint(self: 'Mixin1DProtocol') -> 'Vector'
| :return: a vector representing the start point of this edge
|
| Note, circles may have the start and end points the same
|
| tangentAt(self: 'Mixin1DProtocol', locationParam: 'float' = 0.5, mode: 'ParamMode' = 'length') -> 'Vector'
| Compute tangent vector at the specified location.
|
| :param locationParam: distance or parameter value (default: 0.5)
| :param mode: position calculation mode (default: length)
| :return: tangent vector
|
| tangents(self: 'Mixin1DProtocol', locations: 'Iterable[float]', mode: 'ParamMode' = 'length') -> 'list[Vector]'
| Compute tangent vectors at the specified locations.
|
| :param locations: list of distances or parameters.
| :param mode: position calculation mode (default: length).
| :return: list of tangent vectors
cadquery.Face
Python Library Documentation: class Face in module cadquery.occ_impl.shapes
class Face(Shape)
| Face(obj: 'TopoDS_Shape') -> 'None'
|
| a bounded surface that represents part of the boundary of a solid
|
| Method resolution order:
| Face
| Shape
| builtins.object
|
| Methods defined here:
|
| Center(self) -> 'Vector'
| :returns: The point of the center of mass of this Shape
|
| addHole(self, *inner: 'Wire | Edge') -> 'Self'
| Add one or more holes.
|
| chamfer2D(self, d: 'float', vertices: 'Iterable[Vertex]') -> 'Face'
| Apply 2D chamfer to a face
|
| extend(self, d: 'float', umin: 'bool' = True, umax: 'bool' = True, vmin: 'bool' = True, vmax: 'bool' = True) -> 'Face'
| Extend a face. Does not work well in periodic directions.
|
| :param d: length of the extension.
| :param umin: extend along the umin isoline.
| :param umax: extend along the umax isoline.
| :param vmin: extend along the vmin isoline.
| :param vmax: extend along the vmax isoline.
|
| fillet2D(self, radius: 'float', vertices: 'Iterable[Vertex]') -> 'Face'
| Apply 2D fillet to a face
|
| innerWires(self) -> 'list[Wire]'
|
| isoline(self, param: 'Real', direction: "Literal['u', 'v']" = 'v') -> 'Edge'
| Construct an isoline.
|
| isolines(self, params: 'Iterable[Real]', direction: "Literal['u', 'v']" = 'v') -> 'list[Edge]'
| Construct multiple isolines.
|
| locationAt(self, u: 'Real', v: 'Real') -> 'Location'
| Computes the location at the desired location in the u,v parameter space.
|
| :returns: a location
| :param u: the u parametric location to compute the normal at.
| :param v: the v parametric location to compute the normal at.
|
| normalAt(self, locationVector: 'VectorLike | None' = None) -> 'Vector'
| normalAt(self, locationVector: 'VectorLike | None' = None) -> 'Vector'
|
| Computes the normal vector at the desired location on the face.
|
| :returns: a vector representing the direction
| :param locationVector: the location to compute the normal at. If none, the center of the face is used.
| :type locationVector: a vector that lies on the surface.
|
|
| normalAt(self, u: 'Real', v: 'Real') -> 'tuple[Vector, Vector]'
|
| Computes the normal vector at the desired location in the u,v parameter space.
|
| :returns: a vector representing the normal direction and the position
| :param u: the u parametric location to compute the normal at.
| :param v: the v parametric location to compute the normal at.
|
| normals(self, us: 'Iterable[Real]', vs: 'Iterable[Real]') -> 'tuple[list[Vector], list[Vector]]'
| Computes the normal vectors at the desired locations in the u,v parameter space.
|
| :returns: a tuple of list of vectors representing the normal directions and the positions
| :param us: the u parametric locations to compute the normal at.
| :param vs: the v parametric locations to compute the normal at.
|
| outerWire(self) -> 'Wire'
|
| paramAt(self, pt: 'VectorLike') -> 'tuple[float, float]'
| Computes the (u,v) pair closest to a given vector.
|
| :returns: (u, v) tuple
| :param pt: the location to compute the normal at.
| :type pt: a vector that lies on or close to the surface.
|
| params(self, pts: 'Iterable[VectorLike]', tol: 'float' = 1e-09) -> 'tuple[list[float], list[float]]'
| Computes (u,v) pairs closest to given vectors.
|
| :returns: list of (u, v) tuples
| :param pts: the points to compute the normals at.
| :type pts: a list of vectors that lie on the surface.
|
| positionAt(self, u: 'Real', v: 'Real') -> 'Vector'
| Computes the position vector at the desired location in the u,v parameter space.
|
| :returns: a vector representing the position
| :param u: the u parametric location to compute the normal at.
| :param v: the v parametric location to compute the normal at.
|
| positions(self, uvs: 'Iterable[tuple[Real, Real]]') -> 'list[Vector]'
| Computes position vectors at the desired locations in the u,v parameter space.
|
| :returns: list of vectors corresponding to the requested u,v positions
| :param uvs: iterable of u,v pairs.
|
| project(self, other: 'Face', d: 'VectorLike') -> 'Face'
|
| tangentAt(self, u: 'Real', v: 'Real') -> 'tuple[Vector, Vector, Vector]'
| Computes tangent vectors at the desired location in the u,v parameter space.
|
| :returns: vectors representing the tangent directions and the position
| :param u: the u parametric location to compute at.
| :param v: the v parametric location to compute at.
|
| thicken(self, thickness: 'float') -> 'Solid'
| Return a thickened face
|
| toArcs(self, tolerance: 'float' = 0.001) -> 'Face'
| Approximate planar face with arcs and straight line segments.
|
| :param tolerance: Approximation tolerance.
|
| toPln(self) -> 'gp_Pln'
| Convert this face to a gp_Pln.
|
| Note the Location of the resulting plane may not equal the center of this face,
| however the resulting plane will still contain the center of this face.
|
| trim(self, u0: 'Real', u1: 'Real', v0: 'Real', v1: 'Real', tol: 'Real' = 1e-06) -> 'Self'
| trim(self, u0: 'Real', u1: 'Real', v0: 'Real', v1: 'Real', tol: 'Real' = 1e-06) -> 'Self'
|
| Trim the face in the (u,v) space to (u0, u1)x(v1, v2).
|
| NB: this operation is done on the base geometry.
|
|
| trim(self, outer: 'Wire', *inner: 'Wire') -> 'Self'
|
| Trim using wires. The provided wires need to have a pcurve on self.
|
| uvBounds(self) -> 'tuple[float, float, float, float]'
| Parametric bounds (u_min, u_max, v_min, v_max).
|
| ----------------------------------------------------------------------
| Class methods defined here:
|
| constructOn(f: 'Face', outer: 'Wire', *inner: 'Wire') -> 'Face'
|
| makeFromWires(outerWire: 'Wire', innerWires: 'list[Wire]' = []) -> 'Face'
| Makes a planar face from one or more wires
|
| makeNSidedSurface(edges: 'Iterable[Edge | Wire]', constraints: 'Iterable[Edge | Wire | VectorLike | gp_Pnt]', continuity: 'GeomAbs_Shape' = <GeomAbs_Shape.GeomAbs_C0: 0>, degree: 'int' = 3, nbPtsOnCur: 'int' = 15, nbIter: 'int' = 2, anisotropy: 'bool' = False, tol2d: 'float' = 1e-05, tol3d: 'float' = 0.0001, tolAng: 'float' = 0.01, tolCurv: 'float' = 0.1, maxDeg: 'int' = 8, maxSegments: 'int' = 9) -> 'Face'
| Returns a surface enclosed by a closed polygon defined by 'edges' and 'constraints'.
|
| :param edges: edges
| :type edges: list of edges or wires
| :param constraints: constraints
| :type constraints: list of points or edges
| :param continuity: OCC.Core.GeomAbs continuity condition
| :param degree: >=2
| :param nbPtsOnCur: number of points on curve >= 15
| :param nbIter: number of iterations >= 2
| :param anisotropy: bool Anisotropy
| :param tol2d: 2D tolerance >0
| :param tol3d: 3D tolerance >0
| :param tolAng: angular tolerance
| :param tolCurv: tolerance for curvature >0
| :param maxDeg: highest polynomial degree >= 2
| :param maxSegments: greatest number of segments >= 2
|
| makePlane(length: 'float | None' = None, width: 'float | None' = None, basePnt: 'VectorLike' = (0, 0, 0), dir: 'VectorLike' = (0, 0, 1)) -> 'Face'
|
| makeRuledSurface(edgeOrWire1: 'Edge | Wire', edgeOrWire2: 'Edge | Wire') -> 'Face'
| makeRuledSurface(Edge|Wire,Edge|Wire) -- Make a ruled surface
| Create a ruled surface out of two edges or wires. If wires are used then
| these must have the same number of edges
|
| makeSplineApprox(points: 'list[list[Vector]]', tol: 'float' = 0.01, smoothing: 'tuple[float, float, float] | None' = None, minDeg: 'int' = 1, maxDeg: 'int' = 3) -> 'Face'
| Approximate a spline surface through the provided points.
|
| :param points: a 2D list of Vectors that represent the points
| :param tol: tolerance of the algorithm (consult OCC documentation).
| :param smoothing: optional tuple of 3 weights use for variational smoothing (default: None)
| :param minDeg: minimum spline degree. Enforced only when smothing is None (default: 1)
| :param maxDeg: maximum spline degree (default: 6)
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __annotations__ = {'wrapped': 'TopoDS_Face'}
|
| ----------------------------------------------------------------------
| Methods inherited from Shape:
|
| Area(self) -> 'float'
| :returns: The surface area of all faces in this Shape
|
| BoundingBox(self, tolerance: 'float | None' = None) -> 'BoundBox'
| Create a bounding box for this Shape.
|
| :param tolerance: Tolerance value passed to :class:`BoundBox`
| :returns: A :class:`BoundBox` object for this Shape
|
| CenterOfBoundBox(self, tolerance: 'float | None' = None) -> 'Vector'
| :param tolerance: Tolerance passed to the :py:meth:`BoundingBox` method
| :returns: Center of the bounding box of this shape
|
| Closed(self) -> 'bool'
| :returns: The closedness flag
|
| CompSolids(self) -> 'list[CompSolid]'
| :returns: All the compsolids in this Shape
|
| Compounds(self) -> 'list[Compound]'
| :returns: All the compounds in this Shape
|
| Edges(self) -> 'list[Edge]'
| :returns: All the edges in this Shape
|
| Faces(self) -> 'list[Face]'
| :returns: All the faces in this Shape
|
| ShapeType(self) -> 'Shapes'
|
| Shells(self) -> 'list[Shell]'
| :returns: All the shells in this Shape
|
| Solids(self) -> 'list[Solid]'
| :returns: All the solids in this Shape
|
| Vertices(self) -> 'list[Vertex]'
| :returns: All the vertices in this Shape
|
| Volume(self, tol: 'float | None' = None) -> 'float'
| :returns: The volume of this Shape
|
| Wires(self) -> 'list[Wire]'
| :returns: All the wires in this Shape
|
| __add__(self, other: 'Shape') -> 'Shape'
| Fuse self and other.
|
| __and__(self, other: 'Shape') -> 'Compound'
| Set intersection for combining selection results.
|
| __eq__(self, other: 'Any') -> 'bool'
| Return self==value.
|
| __getitem__(self, item: 'int | slice') -> 'Shape'
|
| __getstate__(self) -> 'tuple[BytesIO, bool]'
| Helper for pickle.
|
| __hash__(self) -> 'int'
| Return hash(self).
|
| __init__(self, obj: 'TopoDS_Shape') -> 'None'
| Initialize self. See help(type(self)) for accurate signature.
|
| __iter__(self) -> 'Iterator[Shape]'
| Iterate over subshapes.
|
| __mod__(self, other: 'Shape') -> 'Compound'
| Set difference for combining selection results.
|
| __mul__(self, other: 'Shape') -> 'Shape'
| Intersect self and other.
|
| __or__(self, other: 'Shape') -> 'Compound'
| Set sum for combining selection results.
|
| __setstate__(self, data: 'tuple[BytesIO, bool]') -> 'None'
|
| __sub__(self, other: 'Shape') -> 'Shape'
| Subtract other from self.
|
| __truediv__(self, other: 'Shape') -> 'Shape'
| Split self with other.
|
| ancestors(self, ctx: 'Shape', kind: 'Shapes') -> 'Compound'
| Iterate over ancestors, i.e. shapes of type kind within ctx shape that contain self.
|
| clean(self: 'T') -> 'T'
| Experimental clean using ShapeUpgrade
|
| copy(self: 'T', mesh: 'bool' = False) -> 'T'
| Creates a new object that is a copy of this object.
|
| :param mesh: should I copy the triangulation too (default: False)
| :returns: a copy of the object
|
| cut(self, *toCut: 'Shape', tol: 'float | None' = None) -> 'Shape'
| Remove the positional arguments from this Shape.
|
| :param tol: Fuzzy mode tolerance
|
| distance(self, other: 'Shape') -> 'float'
| Minimal distance between two shapes
|
| distances(self, *others: 'Shape') -> 'Iterator[float]'
| Minimal distances to between self and other shapes
|
| edge(self, selector: 'Selector | str | None' = None) -> 'Edge'
| Select a single edge.
|
| edges(self, selector: 'Selector | str | None' = None) -> 'Shape'
| Select edges.
|
| export(self: 'T', fname: 'str', tolerance: 'float' = 0.1, angularTolerance: 'float' = 0.1, unit: 'UnitLiterals' = 'MM', outputUnit: 'UnitLiterals | None' = None, opt: 'dict[str, Any] | None' = None) -> 'None'
| Export Shape to file.
|
| exportBin(self, f: 'str | BytesIO') -> 'bool'
| Export this shape to a binary BREP file.
|
| exportBrep(self, f: 'str | BytesIO') -> 'bool'
| Export this shape to a BREP file
|
| exportStep(self, fileName: 'str', unit: 'UnitLiterals' = 'MM', outputUnit: 'UnitLiterals | None' = None, **kwargs: 'Any') -> 'IFSelect_ReturnStatus'
| Export this shape to a STEP file.
| kwargs is used to provide additional optional keyword arguments to configure the exporter.
|
| :param fileName: Path and filename for writing.
| :type fileName: str
| :param unit: The internal unit of the model's geometry values. Default "MM".
| :type unit: UnitLiterals
| :param outputUnit: The unit to use in the STEP file header. If None, defaults to the value of ``unit``.
| Use this when you want the output file to declare a different unit than the model's internal unit,
| for example to export a MM model as a STEP file declaring meters.
| :type outputUnit: UnitLiterals or None
| :param write_pcurves: Enable or disable writing parametric curves to the STEP file. Default True.
| If False, writes STEP file without pcurves. This decreases the size of the resulting STEP file.
| :type write_pcurves: bool
| :param precision_mode: Controls the uncertainty value for STEP entities. Specify -1, 0, or 1. Default 0.
| See OCCT documentation.
| :type precision_mode: int
|
| exportStl(self, fileName: 'str', tolerance: 'float' = 0.001, angularTolerance: 'float' = 0.1, ascii: 'bool' = False, relative: 'bool' = True, parallel: 'bool' = True) -> 'bool'
| Exports a shape to a specified STL file.
|
| :param fileName: The path and file name to write the STL output to.
| :param tolerance: A linear deflection setting which limits the distance between a curve and its tessellation.
| Setting this value too low will result in large meshes that can consume computing resources.
| Setting the value too high can result in meshes with a level of detail that is too low.
| Default is 1e-3, which is a good starting point for a range of cases.
| :param angularTolerance: Angular deflection setting which limits the angle between subsequent segments in a polyline. Default is 0.1.
| :param ascii: Export the file as ASCII (True) or binary (False) STL format. Default is binary.
| :param relative: If True, tolerance will be scaled by the size of the edge being meshed. Default is True.
| Setting this value to True may cause large features to become faceted, or small features dense.
| :param parallel: If True, OCCT will use parallel processing to mesh the shape. Default is True.
|
| face(self, selector: 'Selector | str | None' = None) -> 'Face'
| Select a single face.
|
| faces(self, selector: 'Selector | str | None' = None) -> 'Shape'
| Select faces.
|
| facesIntersectedByLine(self, point: 'VectorLike', axis: 'VectorLike', tol: 'float' = 0.0001, direction: "Literal['AlongAxis', 'Opposite'] | None" = None) -> 'list[Face]'
| Computes the intersections between the provided line and the faces of this Shape
|
| :param point: Base point for defining a line
| :param axis: Axis on which the line rests
| :param tol: Intersection tolerance
| :param direction: Valid values: "AlongAxis", "Opposite";
| If specified, will ignore all faces that are not in the specified direction
| including the face where the point lies if it is the case
| :returns: A list of intersected faces sorted by distance from point
|
| filter(self, f: 'Callable[[Shape], bool]') -> 'Compound'
|
| fix(self: 'T') -> 'T'
| Try to fix shape if not valid
|
| fuse(self, *toFuse: 'Shape', glue: 'bool' = False, tol: 'float | None' = None) -> 'Shape'
| Fuse the positional arguments with this Shape.
|
| :param glue: Sets the glue option for the algorithm, which allows
| increasing performance of the intersection of the input shapes
| :param tol: Fuzzy mode tolerance
|
| geomType(self) -> 'Geoms'
| Gets the underlying geometry type.
|
| Implementations can return any values desired, but the values the user
| uses in type filters should correspond to these.
|
| As an example, if a user does::
|
| CQ(object).faces("%mytype")
|
| The expectation is that the geomType attribute will return 'mytype'
|
| The return values depend on the type of the shape:
|
| | Vertex: always 'Vertex'
| | Edge: LINE, CIRCLE, ELLIPSE, HYPERBOLA, PARABOLA, BEZIER,
| | BSPLINE, OFFSET, OTHER
| | Face: PLANE, CYLINDER, CONE, SPHERE, TORUS, BEZIER, BSPLINE,
| | REVOLUTION, EXTRUSION, OFFSET, OTHER
| | Solid: 'Solid'
| | Shell: 'Shell'
| | Compound: 'Compound'
| | Wire: 'Wire'
|
| :returns: A string according to the geometry type
|
| hashCode(self) -> 'int'
| Returns a hashed value denoting this shape. It is computed from the
| TShape and the Location. The Orientation is not used.
|
| intersect(self, *toIntersect: 'Shape', tol: 'float | None' = None) -> 'Shape'
| Intersection of the positional arguments and this Shape.
|
| :param tol: Fuzzy mode tolerance
|
| isEqual(self, other: 'Shape') -> 'bool'
| Returns True if two shapes are equal, i.e. if they share the same
| TShape with the same Locations and Orientations. Also see
| :py:meth:`isSame`.
|
| isNull(self) -> 'bool'
| Returns true if this shape is null. In other words, it references no
| underlying shape with the potential to be given a location and an
| orientation.
|
| isSame(self, other: 'Shape') -> 'bool'
| Returns True if other and this shape are same, i.e. if they share the
| same TShape with the same Locations. Orientations may differ. Also see
| :py:meth:`isEqual`
|
| isValid(self) -> 'bool'
| Returns True if no defect is detected on the shape S or any of its
| subshapes. See the OCCT docs on BRepCheck_Analyzer::IsValid for a full
| description of what is checked.
|
| locate(self: 'T', loc: 'Location') -> 'T'
| Apply a location in absolute sense to self.
|
| located(self: 'T', loc: 'Location') -> 'T'
| Apply a location in absolute sense to a copy of self.
|
| location(self) -> 'Location'
| Return the current location
|
| mesh(self, tolerance: 'float', angularTolerance: 'float' = 0.1) -> 'None'
| Generate triangulation if none exists.
|
| mirror(self, mirrorPlane: "Literal['XY', 'YX', 'XZ', 'ZX', 'YZ', 'ZY'] | VectorLike" = 'XY', basePointVector: 'VectorLike' = (0, 0, 0)) -> 'Shape'
| Applies a mirror transform to this Shape. Does not duplicate objects
| about the plane.
|
| :param mirrorPlane: The direction of the plane to mirror about - one of
| 'XY', 'XZ' or 'YZ'
| :param basePointVector: The origin of the plane to mirror about
| :returns: The mirrored shape
|
| move(self: 'T', loc: 'Location') -> 'T'
| move(self: 'T', loc: 'Location') -> 'T'
|
| Apply a location in relative sense (i.e. update current location) to self.
|
|
| move(self: 'T', x: 'Real' = 0, y: 'Real' = 0, z: 'Real' = 0, rx: 'Real' = 0, ry: 'Real' = 0, rz: 'Real' = 0) -> 'T'
|
| Apply translation and rotation in relative sense (i.e. update current location) to self.
|
|
| move(self: 'T', loc: 'VectorLike') -> 'T'
|
| Apply a VectorLike in relative sense (i.e. update current location) to self.
|
| moved(self: 'T', s: 'Shape') -> 'Shape'
| moved(self: 'T', loc: 'Location') -> 'T'
|
| Apply a location in relative sense (i.e. update current location) to a copy of self.
|
|
| moved(self: 'T', x: 'Real' = 0, y: 'Real' = 0, z: 'Real' = 0, rx: 'Real' = 0, ry: 'Real' = 0, rz: 'Real' = 0) -> 'T'
|
| Apply translation and rotation in relative sense to a copy of self.
|
|
| moved(self: 'T', loc: 'VectorLike') -> 'T'
|
| Apply a VectorLike in relative sense to a copy of self.
|
| remove(self, *subshape: 'Shape') -> 'Self'
| Remove subshapes.
|
| replace(self, old: 'Shape', *new: 'Shape') -> 'Self'
| Replace old subshape with new subshapes.
|
| reverse(self) -> 'Shape'
| Return a copy of self with reversed orientation.
|
| rotate(self: 'T', startVector: 'VectorLike', endVector: 'VectorLike', angleDegrees: 'float') -> 'T'
| Rotates a shape around an axis.
|
| :param startVector: start point of rotation axis
| :type startVector: either a 3-tuple or a Vector
| :param endVector: end point of rotation axis
| :type endVector: either a 3-tuple or a Vector
| :param angleDegrees: angle to rotate, in degrees
| :returns: a copy of the shape, rotated
|
| scale(self, factor: 'float') -> 'Shape'
| Scales this shape through a transformation.
|
| shell(self, selector: 'Selector | str | None' = None) -> 'Shell'
| Select a single shell.
|
| shells(self, selector: 'Selector | str | None' = None) -> 'Shape'
| Select shells.
|
| siblings(self, ctx: 'Shape', kind: 'Shapes', level: 'int | Iterable[int]' = 1) -> 'Compound'
| Iterate over siblings, i.e. shapes within ctx shape that share subshapes of type kind with self.
|
| size(self) -> 'int'
| Simple size implementation.
|
| solid(self, selector: 'Selector | str | None' = None) -> 'Solid'
| Select a single solid.
|
| solids(self, selector: 'Selector | str | None' = None) -> 'Shape'
| Select solids.
|
| sort(self, key: 'Callable[[Shape], Any]') -> 'Compound'
|
| split(self, *splitters: 'Shape') -> 'Shape'
| Split this shape with the positional arguments.
|
| tessellate(self, tolerance: 'float', angularTolerance: 'float' = 0.1) -> 'tuple[list[Vector], list[tuple[int, int, int]]]'
|
| toLocs(self) -> 'list[Location]'
| Convert self to a list of locations.
|
| toNURBS(self: 'T') -> 'T'
| Return a NURBS representation of a given shape.
|
| toSplines(self: 'T', degree: 'int' = 3, tolerance: 'float' = 0.001, nurbs: 'bool' = False) -> 'T'
| Approximate shape with b-splines of the specified degree.
|
| :param degree: Maximum degree.
| :param tolerance: Approximation tolerance.
| :param nurbs: Use rational splines.
|
| toVtkPolyData(self, tolerance: 'float | None' = None, angularTolerance: 'float | None' = None, normals: 'bool' = False) -> 'vtkPolyData'
| Convert shape to vtkPolyData
|
| transformGeometry(self, tMatrix: 'Matrix') -> 'Shape'
| Transforms this shape by tMatrix.
|
| WARNING: transformGeometry will sometimes convert lines and circles to
| splines, but it also has the ability to handle skew and stretching
| transformations.
|
| If your transformation is only translation and rotation, it is safer to
| use :py:meth:`transformShape`, which doesn't change the underlying type
| of the geometry, but cannot handle skew transformations.
|
| :param tMatrix: The transformation matrix
| :returns: a copy of the object, but with geometry transformed instead
| of just rotated.
|
| transformShape(self, tMatrix: 'Matrix') -> 'Shape'
| Transforms this Shape by tMatrix. Also see :py:meth:`transformGeometry`.
|
| :param tMatrix: The transformation matrix
| :returns: a copy of the object, transformed by the provided matrix,
| with all objects keeping their type
|
| translate(self: 'T', vector: 'VectorLike') -> 'T'
| Translates this shape through a transformation.
|
| vertex(self, selector: 'Selector | str | None' = None) -> 'Vertex'
| Select a single vertex.
|
| vertices(self, selector: 'Selector | str | None' = None) -> 'Shape'
| Select vertices.
|
| wire(self, selector: 'Selector | str | None' = None) -> 'Wire'
| Select a single wire.
|
| wires(self, selector: 'Selector | str | None' = None) -> 'Shape'
| Select wires.
|
| ----------------------------------------------------------------------
| Class methods inherited from Shape:
|
| cast(obj: 'TopoDS_Shape', forConstruction: 'bool' = False) -> 'Shape'
| Returns the right type of wrapper, given a OCCT object
|
| importBin(f: 'str | BytesIO') -> 'Shape'
| Import shape from a binary BREP file.
|
| importBrep(f: 'str | BytesIO') -> 'Shape'
| Import shape from a BREP file
|
| ----------------------------------------------------------------------
| Static methods inherited from Shape:
|
| CombinedCenter(objects: 'Iterable[Shape]') -> 'Vector'
| Calculates the center of mass of multiple objects.
|
| :param objects: A list of objects with mass
|
| CombinedCenterOfBoundBox(objects: 'list[Shape]') -> 'Vector'
| Calculates the center of a bounding box of multiple objects.
|
| :param objects: A list of objects
|
| centerOfMass(obj: 'Shape') -> 'Vector'
| Calculates the center of 'mass' of an object.
|
| :param obj: Compute the center of mass of this object
|
| computeMass(obj: 'Shape', tol: 'float | None' = None) -> 'float'
| Calculates the 'mass' of an object.
|
| :param obj: Compute the mass of this object
| :param tol: Numerical integration tolerance (optional).
|
| matrixOfInertia(obj: 'Shape') -> 'list[list[float]]'
| Calculates the matrix of inertia of an object.
| Since the part's density is unknown, this result is inertia/density with units of [1/length].
| :param obj: Compute the matrix of inertia of this object
|
| ----------------------------------------------------------------------
| Data descriptors inherited from Shape:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
cadquery.Location
Python Library Documentation: class Location in module cadquery.occ_impl.geom
class Location(builtins.object)
| Location(t: Union[ForwardRef('Vector'), Tuple[Union[int, float], Union[int, float]], Tuple[Union[int, float], Union[int, float], Union[int, float]]]) -> None
|
| Location in 3D space. Depending on usage can be absolute or relative.
|
| This class wraps the TopLoc_Location class from OCCT. It can be used to move Shape
| objects in both relative and absolute manner. It is the preferred type to locate objects
| in CQ.
|
| Methods defined here:
|
| __getstate__(self) -> _io.BytesIO
| Helper for pickle.
|
| __init__(self, t: Union[ForwardRef('Vector'), Tuple[Union[int, float], Union[int, float]], Tuple[Union[int, float], Union[int, float], Union[int, float]]]) -> None
| __init__(self, t: Union[ForwardRef('Vector'), Tuple[Union[int, float], Union[int, float]], Tuple[Union[int, float], Union[int, float], Union[int, float]]]) -> None
| Location with translation t with respect to the original location.
|
| __init__(self, x: Union[int, float] = 0, y: Union[int, float] = 0, z: Union[int, float] = 0, rx: Union[int, float] = 0, ry: Union[int, float] = 0, rz: Union[int, float] = 0) -> None
| Location with translation (x,y,z) and 3 rotation angles.
|
| __init__(self, t: cadquery.occ_impl.geom.Plane) -> None
| Location corresponding to the location of the Plane t.
|
| __init__(self, t: cadquery.occ_impl.geom.Plane, v: Union[ForwardRef('Vector'), Tuple[Union[int, float], Union[int, float]], Tuple[Union[int, float], Union[int, float], Union[int, float]]]) -> None
| Location corresponding to the angular location of the Plane t with translation v.
|
| __init__(self, T: OCP.OCP.TopLoc.TopLoc_Location) -> None
| Location wrapping the low-level TopLoc_Location object t
|
| __init__(self, T: OCP.OCP.gp.gp_Trsf) -> None
| Location wrapping the low-level gp_Trsf object t
|
| __init__(self, t: Union[ForwardRef('Vector'), Tuple[Union[int, float], Union[int, float]], Tuple[Union[int, float], Union[int, float], Union[int, float]]], ax: Union[ForwardRef('Vector'), Tuple[Union[int, float], Union[int, float]], Tuple[Union[int, float], Union[int, float], Union[int, float]]], angle: Union[int, float]) -> None
| Location with translation t and rotation around ax by angle
| with respect to the original location.
|
| __init__(self, t: Union[ForwardRef('Vector'), Tuple[Union[int, float], Union[int, float]], Tuple[Union[int, float], Union[int, float], Union[int, float]]], angles: Tuple[Union[int, float], Union[int, float], Union[int, float]]) -> None
| Location with translation t and 3 rotation angles.
|
| __mul__(self, other: 'Location') -> 'Location'
|
| __pow__(self, exponent: int) -> 'Location'
|
| __setstate__(self, data: _io.BytesIO)
|
| toTuple(self) -> Tuple[Tuple[float, float, float], Tuple[float, float, float]]
| Convert the location to a translation, rotation tuple.
|
| ----------------------------------------------------------------------
| Readonly properties defined here:
|
| inverse
|
| plane
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __annotations__ = {'wrapped': <class 'OCP.OCP.TopLoc.TopLoc_Location'>...
cadquery.Material
Python Library Documentation: class Material in module cadquery.occ_impl.assembly
class Material(builtins.object)
| Material(name: str | None = None, **kwargs)
|
| Wrapper for the OCCT material classes XCAFDoc_Material and XCAFDoc_VisMaterial.
| XCAFDoc_Material is focused on physical material properties and
| XCAFDoc_VisMaterial is for visual properties to be used when rendering.
|
| Methods defined here:
|
| __eq__(self, other)
| Check equality of this material against another via its tuple.
|
| __getstate__(self) -> Tuple[str, str, float, str]
| Allows pickling.
|
| __hash__(self)
| Create a unique hash for this material via its tuple.
|
| __init__(self, name: str | None = None, **kwargs)
| Can be passed an arbitrary string name for the material along with keyword
| arguments defining some other characteristics of the material. If nothing is
| passed, arbitrary defaults are used.
|
| __setstate__(self, data: Tuple[str, str, float, str])
| Allows pickling.
|
| toTuple(self) -> Tuple[str, str, float, str]
| Convert Material to a tuple.
|
| ----------------------------------------------------------------------
| Readonly properties defined here:
|
| density
| Get the density value of the material.
|
| densityUnit
| Get the units that the material density is defined in.
|
| description
| Get the string description of the material.
|
| name
| Get the string name of the material.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __annotations__ = {'wrapped': <class 'OCP.OCP.XCAFDoc.XCAFDoc_Material...
cadquery.Matrix
Python Library Documentation: class Matrix in module cadquery.occ_impl.geom
class Matrix(builtins.object)
| Matrix(matrix=None)
|
| A 3d , 4x4 transformation matrix.
|
| Used to move geometry in space.
|
| The provided "matrix" parameter may be None, a gp_GTrsf, or a nested list of
| values.
|
| If given a nested list, it is expected to be of the form:
|
| [[m11, m12, m13, m14],
| [m21, m22, m23, m24],
| [m31, m32, m33, m34]]
|
| A fourth row may be given, but it is expected to be: [0.0, 0.0, 0.0, 1.0]
| since this is a transform matrix.
|
| Methods defined here:
|
| __getitem__(self, rc: Tuple[int, int]) -> float
| Provide Matrix[r, c] syntax for accessing individual values. The row
| and column parameters start at zero, which is consistent with most
| python libraries, but is counter to gp_GTrsf(), which is 1-indexed.
|
| __getstate__(self) -> list[list[float]]
| Helper for pickle.
|
| __init__(self, matrix=None)
| Initialize self. See help(type(self)) for accurate signature.
|
| __repr__(self) -> str
| Generate a valid python expression representing this Matrix
|
| __setstate__(self, state: list[list[float]])
|
| inverse(self) -> 'Matrix'
|
| multiply(self, other)
|
| rotateX(self, angle: float)
|
| rotateY(self, angle: float)
|
| rotateZ(self, angle: float)
|
| transposed_list(self) -> Sequence[float]
| Needed by the cqparts gltf exporter
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __annotations__ = {'wrapped': <class 'OCP.OCP.gp.gp_GTrsf'>}
cadquery.NearestToPointSelector
Python Library Documentation: class NearestToPointSelector in module cadquery.selectors class NearestToPointSelector(Selector) | NearestToPointSelector(pnt) | | Selects object nearest the provided point. | | If the object is a vertex or point, the distance | is used. For other kinds of shapes, the center of mass | is used to to compute which is closest. | | Applicability: All Types of Shapes | | Example:: | | CQ(aCube).vertices(NearestToPointSelector((0, 1, 0))) | | returns the vertex of the unit cube closest to the point x=0,y=1,z=0 | | Method resolution order: | NearestToPointSelector | Selector | builtins.object | | Methods defined here: | | __init__(self, pnt) | Initialize self. See help(type(self)) for accurate signature. | | filter(self, objectList: Sequence[~Shape]) | Filter the provided list. | | The default implementation returns the original list unfiltered. | | :param objectList: list to filter | :type objectList: list of OCCT primitives | :return: filtered list | | ---------------------------------------------------------------------- | Methods inherited from Selector: | | __add__(self, other) | | __and__(self, other) | | __neg__(self) | | __sub__(self, other) | | ---------------------------------------------------------------------- | Data descriptors inherited from Selector: | | __dict__ | dictionary for instance variables | | __weakref__ | list of weak references to the object
cadquery.PackageNotFoundError
Python Library Documentation: class PackageNotFoundError in module importlib.metadata class PackageNotFoundError(builtins.ModuleNotFoundError) | The package was not found. | | Method resolution order: | PackageNotFoundError | builtins.ModuleNotFoundError | builtins.ImportError | builtins.Exception | builtins.BaseException | builtins.object | | Methods defined here: | | __str__(self) | Return str(self). | | ---------------------------------------------------------------------- | Readonly properties defined here: | | name | module name | | ---------------------------------------------------------------------- | Data descriptors defined here: | | __weakref__ | list of weak references to the object | | ---------------------------------------------------------------------- | Methods inherited from builtins.ModuleNotFoundError: | | __init__(self, /, *args, **kwargs) | Initialize self. See help(type(self)) for accurate signature. | | ---------------------------------------------------------------------- | Methods inherited from builtins.ImportError: | | __reduce__(...) | Helper for pickle. | | ---------------------------------------------------------------------- | Data descriptors inherited from builtins.ImportError: | | msg | exception message | | name_from | name imported from module | | path | module path | | ---------------------------------------------------------------------- | Static methods inherited from builtins.Exception: | | __new__(*args, **kwargs) class method of builtins.Exception | Create and return a new object. See help(type) for accurate signature. | | ---------------------------------------------------------------------- | Methods inherited from builtins.BaseException: | | __getattribute__(self, name, /) | Return getattr(self, name). | | __repr__(self, /) | Return repr(self). | | __setstate__(...) | | add_note(...) | Exception.add_note(note) -- | add a note to the exception | | with_traceback(...) | Exception.with_traceback(tb) -- | set self.__traceback__ to tb and return self. | | ---------------------------------------------------------------------- | Data descriptors inherited from builtins.BaseException: | | __cause__ | exception cause | | __context__ | exception context | | __dict__ | | __suppress_context__ | | __traceback__ | | args
cadquery.ParallelDirSelector
Python Library Documentation: class ParallelDirSelector in module cadquery.selectors
class ParallelDirSelector(BaseDirSelector)
| ParallelDirSelector(vector: cadquery.occ_impl.geom.Vector, tolerance: float = 0.0001)
|
| Selects objects parallel with the provided direction.
|
| Applicability:
| Linear Edges
| Planar Faces
|
| Use the string syntax shortcut \|(X|Y|Z) if you want to select based on a cardinal direction.
|
| Example::
|
| CQ(aCube).faces(ParallelDirSelector((0, 0, 1)))
|
| selects faces with the normal parallel to the z direction, and is equivalent to::
|
| CQ(aCube).faces("|Z")
|
| Method resolution order:
| ParallelDirSelector
| BaseDirSelector
| Selector
| builtins.object
|
| Methods defined here:
|
| test(self, vec: cadquery.occ_impl.geom.Vector) -> bool
| Test a specified vector. Subclasses override to provide other implementations
|
| ----------------------------------------------------------------------
| Methods inherited from BaseDirSelector:
|
| __init__(self, vector: cadquery.occ_impl.geom.Vector, tolerance: float = 0.0001)
| Initialize self. See help(type(self)) for accurate signature.
|
| filter(self, objectList: Sequence[~Shape]) -> List[~Shape]
| There are lots of kinds of filters, but for planes they are always
| based on the normal of the plane, and for edges on the tangent vector
| along the edge
|
| ----------------------------------------------------------------------
| Methods inherited from Selector:
|
| __add__(self, other)
|
| __and__(self, other)
|
| __neg__(self)
|
| __sub__(self, other)
|
| ----------------------------------------------------------------------
| Data descriptors inherited from Selector:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
cadquery.PerpendicularDirSelector
Python Library Documentation: class PerpendicularDirSelector in module cadquery.selectors
class PerpendicularDirSelector(BaseDirSelector)
| PerpendicularDirSelector(vector: cadquery.occ_impl.geom.Vector, tolerance: float = 0.0001)
|
| Selects objects perpendicular with the provided direction.
|
| Applicability:
| Linear Edges
| Planar Faces
|
| Use the string syntax shortcut #(X|Y|Z) if you want to select based on a
| cardinal direction.
|
| Example::
|
| CQ(aCube).faces(PerpendicularDirSelector((0, 0, 1)))
|
| selects faces with the normal perpendicular to the z direction, and is equivalent to::
|
| CQ(aCube).faces("#Z")
|
| Method resolution order:
| PerpendicularDirSelector
| BaseDirSelector
| Selector
| builtins.object
|
| Methods defined here:
|
| test(self, vec: cadquery.occ_impl.geom.Vector) -> bool
| Test a specified vector. Subclasses override to provide other implementations
|
| ----------------------------------------------------------------------
| Methods inherited from BaseDirSelector:
|
| __init__(self, vector: cadquery.occ_impl.geom.Vector, tolerance: float = 0.0001)
| Initialize self. See help(type(self)) for accurate signature.
|
| filter(self, objectList: Sequence[~Shape]) -> List[~Shape]
| There are lots of kinds of filters, but for planes they are always
| based on the normal of the plane, and for edges on the tangent vector
| along the edge
|
| ----------------------------------------------------------------------
| Methods inherited from Selector:
|
| __add__(self, other)
|
| __and__(self, other)
|
| __neg__(self)
|
| __sub__(self, other)
|
| ----------------------------------------------------------------------
| Data descriptors inherited from Selector:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
cadquery.Plane
Python Library Documentation: class Plane in module cadquery.occ_impl.geom
class Plane(builtins.object)
| Plane(origin: Union[Tuple[Union[int, float], Union[int, float], Union[int, float]], cadquery.occ_impl.geom.Vector], xDir: Union[Tuple[Union[int, float], Union[int, float], Union[int, float]], cadquery.occ_impl.geom.Vector, NoneType] = None, normal: Union[Tuple[Union[int, float], Union[int, float], Union[int, float]], cadquery.occ_impl.geom.Vector] = (0, 0, 1))
|
| A 2D coordinate system in space
|
| A 2D coordinate system in space, with the x-y axes on the plane, and a
| particular point as the origin.
|
| A plane allows the use of 2D coordinates, which are later converted to
| global, 3d coordinates when the operations are complete.
|
| Frequently, it is not necessary to create work planes, as they can be
| created automatically from faces.
|
| Methods defined here:
|
| __eq__(self, other)
| Return self==value.
|
| __getstate__(self) -> Tuple[cadquery.occ_impl.geom.Vector, cadquery.occ_impl.geom.Vector, cadquery.occ_impl.geom.Vector, cadquery.occ_impl.geom.Vector]
| Helper for pickle.
|
| __init__(self, origin: Union[Tuple[Union[int, float], Union[int, float], Union[int, float]], cadquery.occ_impl.geom.Vector], xDir: Union[Tuple[Union[int, float], Union[int, float], Union[int, float]], cadquery.occ_impl.geom.Vector, NoneType] = None, normal: Union[Tuple[Union[int, float], Union[int, float], Union[int, float]], cadquery.occ_impl.geom.Vector] = (0, 0, 1))
| __init__(self, origin: Union[Tuple[Union[int, float], Union[int, float], Union[int, float]], cadquery.occ_impl.geom.Vector], xDir: Union[Tuple[Union[int, float], Union[int, float], Union[int, float]], cadquery.occ_impl.geom.Vector, NoneType] = None, normal: Union[Tuple[Union[int, float], Union[int, float], Union[int, float]], cadquery.occ_impl.geom.Vector] = (0, 0, 1))
| Create a Plane from origin in global coordinates, vector xDir, and normal direction for the plane.
|
| __init__(self, loc: 'Location')
| Create a Plane from Location loc.
|
| __ne__(self, other)
| Return self!=value.
|
| __repr__(self)
| Return repr(self).
|
| __setstate__(self, data: Tuple[cadquery.occ_impl.geom.Vector, cadquery.occ_impl.geom.Vector, cadquery.occ_impl.geom.Vector, cadquery.occ_impl.geom.Vector])
|
| mirrorInPlane(self, listOfShapes, axis='X')
|
| rotated(self, rotate=(0, 0, 0))
| Returns a copy of this plane, rotated about the specified axes
|
| Since the z axis is always normal the plane, rotating around Z will
| always produce a plane that is parallel to this one.
|
| The origin of the workplane is unaffected by the rotation.
|
| Rotations are done in order x, y, z. If you need a different order,
| manually chain together multiple rotate() commands.
|
| :param rotate: Vector [xDegrees, yDegrees, zDegrees]
| :return: a copy of this plane rotated as requested.
|
| setOrigin2d(self, x, y)
| Set a new origin in the plane itself
|
| Set a new origin in the plane itself. The plane's orientation and
| xDrection are unaffected.
|
| :param float x: offset in the x direction
| :param float y: offset in the y direction
| :return: void
|
| The new coordinates are specified in terms of the current 2D system.
| As an example:
|
| p = Plane.XY()
| p.setOrigin2d(2, 2)
| p.setOrigin2d(2, 2)
|
| results in a plane with its origin at (x, y) = (4, 4) in global
| coordinates. Both operations were relative to local coordinates of the
| plane.
|
| toLocalCoords(self, obj)
| Project the provided coordinates onto this plane
|
| :param obj: an object or vector to convert
| :type vector: a vector or shape
| :return: an object of the same type, but converted to local coordinates
|
|
| Most of the time, the z-coordinate returned will be zero, because most
| operations based on a plane are all 2D. Occasionally, though, 3D
| points outside of the current plane are transformed. One such example is
| :py:meth:`Workplane.box`, where 3D corners of a box are transformed to
| orient the box in space correctly.
|
| toPln(self) -> OCP.OCP.gp.gp_Pln
|
| toWorldCoords(self, tuplePoint) -> cadquery.occ_impl.geom.Vector
| Convert a point in local coordinates to global coordinates
|
| :param tuplePoint: point in local coordinates to convert.
| :type tuplePoint: a 2 or three tuple of float. The third value is taken to be zero if not supplied.
| :return: a Vector in global coordinates
|
| ----------------------------------------------------------------------
| Class methods defined here:
|
| XY(origin=(0, 0, 0), xDir=Vector: (1.0, 0.0, 0.0))
|
| XZ(origin=(0, 0, 0), xDir=Vector: (1.0, 0.0, 0.0))
|
| YX(origin=(0, 0, 0), xDir=Vector: (0.0, 1.0, 0.0))
|
| YZ(origin=(0, 0, 0), xDir=Vector: (0.0, 1.0, 0.0))
|
| ZX(origin=(0, 0, 0), xDir=Vector: (0.0, 0.0, 1.0))
|
| ZY(origin=(0, 0, 0), xDir=Vector: (0.0, 0.0, 1.0))
|
| back(origin=(0, 0, 0), xDir=Vector: (-1.0, 0.0, 0.0))
|
| bottom(origin=(0, 0, 0), xDir=Vector: (1.0, 0.0, 0.0))
|
| front(origin=(0, 0, 0), xDir=Vector: (1.0, 0.0, 0.0))
|
| left(origin=(0, 0, 0), xDir=Vector: (0.0, 0.0, 1.0))
|
| named(stdName: str, origin=(0, 0, 0)) -> 'Plane'
| Create a predefined Plane based on the conventional names.
|
| :param stdName: one of (XY|YZ|ZX|XZ|YX|ZY|front|back|left|right|top|bottom)
| :type stdName: string
| :param origin: the desired origin, specified in global coordinates
| :type origin: 3-tuple of the origin of the new plane, in global coordinates.
|
| Available named planes are as follows. Direction references refer to
| the global directions.
|
| =========== ======= ======= ======
| Name xDir yDir zDir
| =========== ======= ======= ======
| XY +x +y +z
| YZ +y +z +x
| ZX +z +x +y
| XZ +x +z -y
| YX +y +x -z
| ZY +z +y -x
| front +x +y +z
| back -x +y -z
| left +z +y -x
| right -z +y +x
| top +x -z +y
| bottom +x +z -y
| =========== ======= ======= ======
|
| right(origin=(0, 0, 0), xDir=Vector: (0.0, 0.0, -1.0))
|
| top(origin=(0, 0, 0), xDir=Vector: (1.0, 0.0, 0.0))
|
| ----------------------------------------------------------------------
| Readonly properties defined here:
|
| location
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| origin
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __annotations__ = {'_origin': <class 'cadquery.occ_impl.geom.Vector'>,...
|
| __hash__ = None
cadquery.Selector
Python Library Documentation: class Selector in module cadquery.selectors class Selector(builtins.object) | Filters a list of objects. | | Filters must provide a single method that filters objects. | | Methods defined here: | | __add__(self, other) | | __and__(self, other) | | __neg__(self) | | __sub__(self, other) | | filter(self, objectList: Sequence[~Shape]) -> List[~Shape] | Filter the provided list. | | The default implementation returns the original list unfiltered. | | :param objectList: list to filter | :type objectList: list of OCCT primitives | :return: filtered list | | ---------------------------------------------------------------------- | Data descriptors defined here: | | __dict__ | dictionary for instance variables | | __weakref__ | list of weak references to the object
cadquery.Shape
Python Library Documentation: class Shape in module cadquery.occ_impl.shapes
class Shape(builtins.object)
| Shape(obj: 'TopoDS_Shape') -> 'None'
|
| Represents a shape in the system. Wraps TopoDS_Shape.
|
| Methods defined here:
|
| Area(self) -> 'float'
| :returns: The surface area of all faces in this Shape
|
| BoundingBox(self, tolerance: 'float | None' = None) -> 'BoundBox'
| Create a bounding box for this Shape.
|
| :param tolerance: Tolerance value passed to :class:`BoundBox`
| :returns: A :class:`BoundBox` object for this Shape
|
| Center(self) -> 'Vector'
| :returns: The point of the center of mass of this Shape
|
| CenterOfBoundBox(self, tolerance: 'float | None' = None) -> 'Vector'
| :param tolerance: Tolerance passed to the :py:meth:`BoundingBox` method
| :returns: Center of the bounding box of this shape
|
| Closed(self) -> 'bool'
| :returns: The closedness flag
|
| CompSolids(self) -> 'list[CompSolid]'
| :returns: All the compsolids in this Shape
|
| Compounds(self) -> 'list[Compound]'
| :returns: All the compounds in this Shape
|
| Edges(self) -> 'list[Edge]'
| :returns: All the edges in this Shape
|
| Faces(self) -> 'list[Face]'
| :returns: All the faces in this Shape
|
| ShapeType(self) -> 'Shapes'
|
| Shells(self) -> 'list[Shell]'
| :returns: All the shells in this Shape
|
| Solids(self) -> 'list[Solid]'
| :returns: All the solids in this Shape
|
| Vertices(self) -> 'list[Vertex]'
| :returns: All the vertices in this Shape
|
| Volume(self, tol: 'float | None' = None) -> 'float'
| :returns: The volume of this Shape
|
| Wires(self) -> 'list[Wire]'
| :returns: All the wires in this Shape
|
| __add__(self, other: 'Shape') -> 'Shape'
| Fuse self and other.
|
| __and__(self, other: 'Shape') -> 'Compound'
| Set intersection for combining selection results.
|
| __eq__(self, other: 'Any') -> 'bool'
| Return self==value.
|
| __getitem__(self, item: 'int | slice') -> 'Shape'
|
| __getstate__(self) -> 'tuple[BytesIO, bool]'
| Helper for pickle.
|
| __hash__(self) -> 'int'
| Return hash(self).
|
| __init__(self, obj: 'TopoDS_Shape') -> 'None'
| Initialize self. See help(type(self)) for accurate signature.
|
| __iter__(self) -> 'Iterator[Shape]'
| Iterate over subshapes.
|
| __mod__(self, other: 'Shape') -> 'Compound'
| Set difference for combining selection results.
|
| __mul__(self, other: 'Shape') -> 'Shape'
| Intersect self and other.
|
| __or__(self, other: 'Shape') -> 'Compound'
| Set sum for combining selection results.
|
| __setstate__(self, data: 'tuple[BytesIO, bool]') -> 'None'
|
| __sub__(self, other: 'Shape') -> 'Shape'
| Subtract other from self.
|
| __truediv__(self, other: 'Shape') -> 'Shape'
| Split self with other.
|
| ancestors(self, ctx: 'Shape', kind: 'Shapes') -> 'Compound'
| Iterate over ancestors, i.e. shapes of type kind within ctx shape that contain self.
|
| clean(self: 'T') -> 'T'
| Experimental clean using ShapeUpgrade
|
| copy(self: 'T', mesh: 'bool' = False) -> 'T'
| Creates a new object that is a copy of this object.
|
| :param mesh: should I copy the triangulation too (default: False)
| :returns: a copy of the object
|
| cut(self, *toCut: 'Shape', tol: 'float | None' = None) -> 'Shape'
| Remove the positional arguments from this Shape.
|
| :param tol: Fuzzy mode tolerance
|
| distance(self, other: 'Shape') -> 'float'
| Minimal distance between two shapes
|
| distances(self, *others: 'Shape') -> 'Iterator[float]'
| Minimal distances to between self and other shapes
|
| edge(self, selector: 'Selector | str | None' = None) -> 'Edge'
| Select a single edge.
|
| edges(self, selector: 'Selector | str | None' = None) -> 'Shape'
| Select edges.
|
| export(self: 'T', fname: 'str', tolerance: 'float' = 0.1, angularTolerance: 'float' = 0.1, unit: 'UnitLiterals' = 'MM', outputUnit: 'UnitLiterals | None' = None, opt: 'dict[str, Any] | None' = None) -> 'None'
| Export Shape to file.
|
| exportBin(self, f: 'str | BytesIO') -> 'bool'
| Export this shape to a binary BREP file.
|
| exportBrep(self, f: 'str | BytesIO') -> 'bool'
| Export this shape to a BREP file
|
| exportStep(self, fileName: 'str', unit: 'UnitLiterals' = 'MM', outputUnit: 'UnitLiterals | None' = None, **kwargs: 'Any') -> 'IFSelect_ReturnStatus'
| Export this shape to a STEP file.
| kwargs is used to provide additional optional keyword arguments to configure the exporter.
|
| :param fileName: Path and filename for writing.
| :type fileName: str
| :param unit: The internal unit of the model's geometry values. Default "MM".
| :type unit: UnitLiterals
| :param outputUnit: The unit to use in the STEP file header. If None, defaults to the value of ``unit``.
| Use this when you want the output file to declare a different unit than the model's internal unit,
| for example to export a MM model as a STEP file declaring meters.
| :type outputUnit: UnitLiterals or None
| :param write_pcurves: Enable or disable writing parametric curves to the STEP file. Default True.
| If False, writes STEP file without pcurves. This decreases the size of the resulting STEP file.
| :type write_pcurves: bool
| :param precision_mode: Controls the uncertainty value for STEP entities. Specify -1, 0, or 1. Default 0.
| See OCCT documentation.
| :type precision_mode: int
|
| exportStl(self, fileName: 'str', tolerance: 'float' = 0.001, angularTolerance: 'float' = 0.1, ascii: 'bool' = False, relative: 'bool' = True, parallel: 'bool' = True) -> 'bool'
| Exports a shape to a specified STL file.
|
| :param fileName: The path and file name to write the STL output to.
| :param tolerance: A linear deflection setting which limits the distance between a curve and its tessellation.
| Setting this value too low will result in large meshes that can consume computing resources.
| Setting the value too high can result in meshes with a level of detail that is too low.
| Default is 1e-3, which is a good starting point for a range of cases.
| :param angularTolerance: Angular deflection setting which limits the angle between subsequent segments in a polyline. Default is 0.1.
| :param ascii: Export the file as ASCII (True) or binary (False) STL format. Default is binary.
| :param relative: If True, tolerance will be scaled by the size of the edge being meshed. Default is True.
| Setting this value to True may cause large features to become faceted, or small features dense.
| :param parallel: If True, OCCT will use parallel processing to mesh the shape. Default is True.
|
| face(self, selector: 'Selector | str | None' = None) -> 'Face'
| Select a single face.
|
| faces(self, selector: 'Selector | str | None' = None) -> 'Shape'
| Select faces.
|
| facesIntersectedByLine(self, point: 'VectorLike', axis: 'VectorLike', tol: 'float' = 0.0001, direction: "Literal['AlongAxis', 'Opposite'] | None" = None) -> 'list[Face]'
| Computes the intersections between the provided line and the faces of this Shape
|
| :param point: Base point for defining a line
| :param axis: Axis on which the line rests
| :param tol: Intersection tolerance
| :param direction: Valid values: "AlongAxis", "Opposite";
| If specified, will ignore all faces that are not in the specified direction
| including the face where the point lies if it is the case
| :returns: A list of intersected faces sorted by distance from point
|
| filter(self, f: 'Callable[[Shape], bool]') -> 'Compound'
|
| fix(self: 'T') -> 'T'
| Try to fix shape if not valid
|
| fuse(self, *toFuse: 'Shape', glue: 'bool' = False, tol: 'float | None' = None) -> 'Shape'
| Fuse the positional arguments with this Shape.
|
| :param glue: Sets the glue option for the algorithm, which allows
| increasing performance of the intersection of the input shapes
| :param tol: Fuzzy mode tolerance
|
| geomType(self) -> 'Geoms'
| Gets the underlying geometry type.
|
| Implementations can return any values desired, but the values the user
| uses in type filters should correspond to these.
|
| As an example, if a user does::
|
| CQ(object).faces("%mytype")
|
| The expectation is that the geomType attribute will return 'mytype'
|
| The return values depend on the type of the shape:
|
| | Vertex: always 'Vertex'
| | Edge: LINE, CIRCLE, ELLIPSE, HYPERBOLA, PARABOLA, BEZIER,
| | BSPLINE, OFFSET, OTHER
| | Face: PLANE, CYLINDER, CONE, SPHERE, TORUS, BEZIER, BSPLINE,
| | REVOLUTION, EXTRUSION, OFFSET, OTHER
| | Solid: 'Solid'
| | Shell: 'Shell'
| | Compound: 'Compound'
| | Wire: 'Wire'
|
| :returns: A string according to the geometry type
|
| hashCode(self) -> 'int'
| Returns a hashed value denoting this shape. It is computed from the
| TShape and the Location. The Orientation is not used.
|
| intersect(self, *toIntersect: 'Shape', tol: 'float | None' = None) -> 'Shape'
| Intersection of the positional arguments and this Shape.
|
| :param tol: Fuzzy mode tolerance
|
| isEqual(self, other: 'Shape') -> 'bool'
| Returns True if two shapes are equal, i.e. if they share the same
| TShape with the same Locations and Orientations. Also see
| :py:meth:`isSame`.
|
| isNull(self) -> 'bool'
| Returns true if this shape is null. In other words, it references no
| underlying shape with the potential to be given a location and an
| orientation.
|
| isSame(self, other: 'Shape') -> 'bool'
| Returns True if other and this shape are same, i.e. if they share the
| same TShape with the same Locations. Orientations may differ. Also see
| :py:meth:`isEqual`
|
| isValid(self) -> 'bool'
| Returns True if no defect is detected on the shape S or any of its
| subshapes. See the OCCT docs on BRepCheck_Analyzer::IsValid for a full
| description of what is checked.
|
| locate(self: 'T', loc: 'Location') -> 'T'
| Apply a location in absolute sense to self.
|
| located(self: 'T', loc: 'Location') -> 'T'
| Apply a location in absolute sense to a copy of self.
|
| location(self) -> 'Location'
| Return the current location
|
| mesh(self, tolerance: 'float', angularTolerance: 'float' = 0.1) -> 'None'
| Generate triangulation if none exists.
|
| mirror(self, mirrorPlane: "Literal['XY', 'YX', 'XZ', 'ZX', 'YZ', 'ZY'] | VectorLike" = 'XY', basePointVector: 'VectorLike' = (0, 0, 0)) -> 'Shape'
| Applies a mirror transform to this Shape. Does not duplicate objects
| about the plane.
|
| :param mirrorPlane: The direction of the plane to mirror about - one of
| 'XY', 'XZ' or 'YZ'
| :param basePointVector: The origin of the plane to mirror about
| :returns: The mirrored shape
|
| move(self: 'T', loc: 'Location') -> 'T'
| move(self: 'T', loc: 'Location') -> 'T'
|
| Apply a location in relative sense (i.e. update current location) to self.
|
|
| move(self: 'T', x: 'Real' = 0, y: 'Real' = 0, z: 'Real' = 0, rx: 'Real' = 0, ry: 'Real' = 0, rz: 'Real' = 0) -> 'T'
|
| Apply translation and rotation in relative sense (i.e. update current location) to self.
|
|
| move(self: 'T', loc: 'VectorLike') -> 'T'
|
| Apply a VectorLike in relative sense (i.e. update current location) to self.
|
| moved(self: 'T', s: 'Shape') -> 'Shape'
| moved(self: 'T', loc: 'Location') -> 'T'
|
| Apply a location in relative sense (i.e. update current location) to a copy of self.
|
|
| moved(self: 'T', x: 'Real' = 0, y: 'Real' = 0, z: 'Real' = 0, rx: 'Real' = 0, ry: 'Real' = 0, rz: 'Real' = 0) -> 'T'
|
| Apply translation and rotation in relative sense to a copy of self.
|
|
| moved(self: 'T', loc: 'VectorLike') -> 'T'
|
| Apply a VectorLike in relative sense to a copy of self.
|
| remove(self, *subshape: 'Shape') -> 'Self'
| Remove subshapes.
|
| replace(self, old: 'Shape', *new: 'Shape') -> 'Self'
| Replace old subshape with new subshapes.
|
| reverse(self) -> 'Shape'
| Return a copy of self with reversed orientation.
|
| rotate(self: 'T', startVector: 'VectorLike', endVector: 'VectorLike', angleDegrees: 'float') -> 'T'
| Rotates a shape around an axis.
|
| :param startVector: start point of rotation axis
| :type startVector: either a 3-tuple or a Vector
| :param endVector: end point of rotation axis
| :type endVector: either a 3-tuple or a Vector
| :param angleDegrees: angle to rotate, in degrees
| :returns: a copy of the shape, rotated
|
| scale(self, factor: 'float') -> 'Shape'
| Scales this shape through a transformation.
|
| shell(self, selector: 'Selector | str | None' = None) -> 'Shell'
| Select a single shell.
|
| shells(self, selector: 'Selector | str | None' = None) -> 'Shape'
| Select shells.
|
| siblings(self, ctx: 'Shape', kind: 'Shapes', level: 'int | Iterable[int]' = 1) -> 'Compound'
| Iterate over siblings, i.e. shapes within ctx shape that share subshapes of type kind with self.
|
| size(self) -> 'int'
| Simple size implementation.
|
| solid(self, selector: 'Selector | str | None' = None) -> 'Solid'
| Select a single solid.
|
| solids(self, selector: 'Selector | str | None' = None) -> 'Shape'
| Select solids.
|
| sort(self, key: 'Callable[[Shape], Any]') -> 'Compound'
|
| split(self, *splitters: 'Shape') -> 'Shape'
| Split this shape with the positional arguments.
|
| tessellate(self, tolerance: 'float', angularTolerance: 'float' = 0.1) -> 'tuple[list[Vector], list[tuple[int, int, int]]]'
|
| toLocs(self) -> 'list[Location]'
| Convert self to a list of locations.
|
| toNURBS(self: 'T') -> 'T'
| Return a NURBS representation of a given shape.
|
| toSplines(self: 'T', degree: 'int' = 3, tolerance: 'float' = 0.001, nurbs: 'bool' = False) -> 'T'
| Approximate shape with b-splines of the specified degree.
|
| :param degree: Maximum degree.
| :param tolerance: Approximation tolerance.
| :param nurbs: Use rational splines.
|
| toVtkPolyData(self, tolerance: 'float | None' = None, angularTolerance: 'float | None' = None, normals: 'bool' = False) -> 'vtkPolyData'
| Convert shape to vtkPolyData
|
| transformGeometry(self, tMatrix: 'Matrix') -> 'Shape'
| Transforms this shape by tMatrix.
|
| WARNING: transformGeometry will sometimes convert lines and circles to
| splines, but it also has the ability to handle skew and stretching
| transformations.
|
| If your transformation is only translation and rotation, it is safer to
| use :py:meth:`transformShape`, which doesn't change the underlying type
| of the geometry, but cannot handle skew transformations.
|
| :param tMatrix: The transformation matrix
| :returns: a copy of the object, but with geometry transformed instead
| of just rotated.
|
| transformShape(self, tMatrix: 'Matrix') -> 'Shape'
| Transforms this Shape by tMatrix. Also see :py:meth:`transformGeometry`.
|
| :param tMatrix: The transformation matrix
| :returns: a copy of the object, transformed by the provided matrix,
| with all objects keeping their type
|
| translate(self: 'T', vector: 'VectorLike') -> 'T'
| Translates this shape through a transformation.
|
| vertex(self, selector: 'Selector | str | None' = None) -> 'Vertex'
| Select a single vertex.
|
| vertices(self, selector: 'Selector | str | None' = None) -> 'Shape'
| Select vertices.
|
| wire(self, selector: 'Selector | str | None' = None) -> 'Wire'
| Select a single wire.
|
| wires(self, selector: 'Selector | str | None' = None) -> 'Shape'
| Select wires.
|
| ----------------------------------------------------------------------
| Class methods defined here:
|
| cast(obj: 'TopoDS_Shape', forConstruction: 'bool' = False) -> 'Shape'
| Returns the right type of wrapper, given a OCCT object
|
| importBin(f: 'str | BytesIO') -> 'Shape'
| Import shape from a binary BREP file.
|
| importBrep(f: 'str | BytesIO') -> 'Shape'
| Import shape from a BREP file
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| CombinedCenter(objects: 'Iterable[Shape]') -> 'Vector'
| Calculates the center of mass of multiple objects.
|
| :param objects: A list of objects with mass
|
| CombinedCenterOfBoundBox(objects: 'list[Shape]') -> 'Vector'
| Calculates the center of a bounding box of multiple objects.
|
| :param objects: A list of objects
|
| centerOfMass(obj: 'Shape') -> 'Vector'
| Calculates the center of 'mass' of an object.
|
| :param obj: Compute the center of mass of this object
|
| computeMass(obj: 'Shape', tol: 'float | None' = None) -> 'float'
| Calculates the 'mass' of an object.
|
| :param obj: Compute the mass of this object
| :param tol: Numerical integration tolerance (optional).
|
| matrixOfInertia(obj: 'Shape') -> 'list[list[float]]'
| Calculates the matrix of inertia of an object.
| Since the part's density is unknown, this result is inertia/density with units of [1/length].
| :param obj: Compute the matrix of inertia of this object
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __annotations__ = {'forConstruction': 'bool', 'wrapped': 'TopoDS_Shape...
cadquery.Shell
Python Library Documentation: class Shell in module cadquery.occ_impl.shapes
class Shell(Shape)
| Shell(obj: 'TopoDS_Shape') -> 'None'
|
| the outer boundary of a surface
|
| Method resolution order:
| Shell
| Shape
| builtins.object
|
| Class methods defined here:
|
| makeShell(listOfFaces: 'Iterable[Face]') -> 'Shell'
| Makes a shell from faces.
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __annotations__ = {'wrapped': 'TopoDS_Shell'}
|
| ----------------------------------------------------------------------
| Methods inherited from Shape:
|
| Area(self) -> 'float'
| :returns: The surface area of all faces in this Shape
|
| BoundingBox(self, tolerance: 'float | None' = None) -> 'BoundBox'
| Create a bounding box for this Shape.
|
| :param tolerance: Tolerance value passed to :class:`BoundBox`
| :returns: A :class:`BoundBox` object for this Shape
|
| Center(self) -> 'Vector'
| :returns: The point of the center of mass of this Shape
|
| CenterOfBoundBox(self, tolerance: 'float | None' = None) -> 'Vector'
| :param tolerance: Tolerance passed to the :py:meth:`BoundingBox` method
| :returns: Center of the bounding box of this shape
|
| Closed(self) -> 'bool'
| :returns: The closedness flag
|
| CompSolids(self) -> 'list[CompSolid]'
| :returns: All the compsolids in this Shape
|
| Compounds(self) -> 'list[Compound]'
| :returns: All the compounds in this Shape
|
| Edges(self) -> 'list[Edge]'
| :returns: All the edges in this Shape
|
| Faces(self) -> 'list[Face]'
| :returns: All the faces in this Shape
|
| ShapeType(self) -> 'Shapes'
|
| Shells(self) -> 'list[Shell]'
| :returns: All the shells in this Shape
|
| Solids(self) -> 'list[Solid]'
| :returns: All the solids in this Shape
|
| Vertices(self) -> 'list[Vertex]'
| :returns: All the vertices in this Shape
|
| Volume(self, tol: 'float | None' = None) -> 'float'
| :returns: The volume of this Shape
|
| Wires(self) -> 'list[Wire]'
| :returns: All the wires in this Shape
|
| __add__(self, other: 'Shape') -> 'Shape'
| Fuse self and other.
|
| __and__(self, other: 'Shape') -> 'Compound'
| Set intersection for combining selection results.
|
| __eq__(self, other: 'Any') -> 'bool'
| Return self==value.
|
| __getitem__(self, item: 'int | slice') -> 'Shape'
|
| __getstate__(self) -> 'tuple[BytesIO, bool]'
| Helper for pickle.
|
| __hash__(self) -> 'int'
| Return hash(self).
|
| __init__(self, obj: 'TopoDS_Shape') -> 'None'
| Initialize self. See help(type(self)) for accurate signature.
|
| __iter__(self) -> 'Iterator[Shape]'
| Iterate over subshapes.
|
| __mod__(self, other: 'Shape') -> 'Compound'
| Set difference for combining selection results.
|
| __mul__(self, other: 'Shape') -> 'Shape'
| Intersect self and other.
|
| __or__(self, other: 'Shape') -> 'Compound'
| Set sum for combining selection results.
|
| __setstate__(self, data: 'tuple[BytesIO, bool]') -> 'None'
|
| __sub__(self, other: 'Shape') -> 'Shape'
| Subtract other from self.
|
| __truediv__(self, other: 'Shape') -> 'Shape'
| Split self with other.
|
| ancestors(self, ctx: 'Shape', kind: 'Shapes') -> 'Compound'
| Iterate over ancestors, i.e. shapes of type kind within ctx shape that contain self.
|
| clean(self: 'T') -> 'T'
| Experimental clean using ShapeUpgrade
|
| copy(self: 'T', mesh: 'bool' = False) -> 'T'
| Creates a new object that is a copy of this object.
|
| :param mesh: should I copy the triangulation too (default: False)
| :returns: a copy of the object
|
| cut(self, *toCut: 'Shape', tol: 'float | None' = None) -> 'Shape'
| Remove the positional arguments from this Shape.
|
| :param tol: Fuzzy mode tolerance
|
| distance(self, other: 'Shape') -> 'float'
| Minimal distance between two shapes
|
| distances(self, *others: 'Shape') -> 'Iterator[float]'
| Minimal distances to between self and other shapes
|
| edge(self, selector: 'Selector | str | None' = None) -> 'Edge'
| Select a single edge.
|
| edges(self, selector: 'Selector | str | None' = None) -> 'Shape'
| Select edges.
|
| export(self: 'T', fname: 'str', tolerance: 'float' = 0.1, angularTolerance: 'float' = 0.1, unit: 'UnitLiterals' = 'MM', outputUnit: 'UnitLiterals | None' = None, opt: 'dict[str, Any] | None' = None) -> 'None'
| Export Shape to file.
|
| exportBin(self, f: 'str | BytesIO') -> 'bool'
| Export this shape to a binary BREP file.
|
| exportBrep(self, f: 'str | BytesIO') -> 'bool'
| Export this shape to a BREP file
|
| exportStep(self, fileName: 'str', unit: 'UnitLiterals' = 'MM', outputUnit: 'UnitLiterals | None' = None, **kwargs: 'Any') -> 'IFSelect_ReturnStatus'
| Export this shape to a STEP file.
| kwargs is used to provide additional optional keyword arguments to configure the exporter.
|
| :param fileName: Path and filename for writing.
| :type fileName: str
| :param unit: The internal unit of the model's geometry values. Default "MM".
| :type unit: UnitLiterals
| :param outputUnit: The unit to use in the STEP file header. If None, defaults to the value of ``unit``.
| Use this when you want the output file to declare a different unit than the model's internal unit,
| for example to export a MM model as a STEP file declaring meters.
| :type outputUnit: UnitLiterals or None
| :param write_pcurves: Enable or disable writing parametric curves to the STEP file. Default True.
| If False, writes STEP file without pcurves. This decreases the size of the resulting STEP file.
| :type write_pcurves: bool
| :param precision_mode: Controls the uncertainty value for STEP entities. Specify -1, 0, or 1. Default 0.
| See OCCT documentation.
| :type precision_mode: int
|
| exportStl(self, fileName: 'str', tolerance: 'float' = 0.001, angularTolerance: 'float' = 0.1, ascii: 'bool' = False, relative: 'bool' = True, parallel: 'bool' = True) -> 'bool'
| Exports a shape to a specified STL file.
|
| :param fileName: The path and file name to write the STL output to.
| :param tolerance: A linear deflection setting which limits the distance between a curve and its tessellation.
| Setting this value too low will result in large meshes that can consume computing resources.
| Setting the value too high can result in meshes with a level of detail that is too low.
| Default is 1e-3, which is a good starting point for a range of cases.
| :param angularTolerance: Angular deflection setting which limits the angle between subsequent segments in a polyline. Default is 0.1.
| :param ascii: Export the file as ASCII (True) or binary (False) STL format. Default is binary.
| :param relative: If True, tolerance will be scaled by the size of the edge being meshed. Default is True.
| Setting this value to True may cause large features to become faceted, or small features dense.
| :param parallel: If True, OCCT will use parallel processing to mesh the shape. Default is True.
|
| face(self, selector: 'Selector | str | None' = None) -> 'Face'
| Select a single face.
|
| faces(self, selector: 'Selector | str | None' = None) -> 'Shape'
| Select faces.
|
| facesIntersectedByLine(self, point: 'VectorLike', axis: 'VectorLike', tol: 'float' = 0.0001, direction: "Literal['AlongAxis', 'Opposite'] | None" = None) -> 'list[Face]'
| Computes the intersections between the provided line and the faces of this Shape
|
| :param point: Base point for defining a line
| :param axis: Axis on which the line rests
| :param tol: Intersection tolerance
| :param direction: Valid values: "AlongAxis", "Opposite";
| If specified, will ignore all faces that are not in the specified direction
| including the face where the point lies if it is the case
| :returns: A list of intersected faces sorted by distance from point
|
| filter(self, f: 'Callable[[Shape], bool]') -> 'Compound'
|
| fix(self: 'T') -> 'T'
| Try to fix shape if not valid
|
| fuse(self, *toFuse: 'Shape', glue: 'bool' = False, tol: 'float | None' = None) -> 'Shape'
| Fuse the positional arguments with this Shape.
|
| :param glue: Sets the glue option for the algorithm, which allows
| increasing performance of the intersection of the input shapes
| :param tol: Fuzzy mode tolerance
|
| geomType(self) -> 'Geoms'
| Gets the underlying geometry type.
|
| Implementations can return any values desired, but the values the user
| uses in type filters should correspond to these.
|
| As an example, if a user does::
|
| CQ(object).faces("%mytype")
|
| The expectation is that the geomType attribute will return 'mytype'
|
| The return values depend on the type of the shape:
|
| | Vertex: always 'Vertex'
| | Edge: LINE, CIRCLE, ELLIPSE, HYPERBOLA, PARABOLA, BEZIER,
| | BSPLINE, OFFSET, OTHER
| | Face: PLANE, CYLINDER, CONE, SPHERE, TORUS, BEZIER, BSPLINE,
| | REVOLUTION, EXTRUSION, OFFSET, OTHER
| | Solid: 'Solid'
| | Shell: 'Shell'
| | Compound: 'Compound'
| | Wire: 'Wire'
|
| :returns: A string according to the geometry type
|
| hashCode(self) -> 'int'
| Returns a hashed value denoting this shape. It is computed from the
| TShape and the Location. The Orientation is not used.
|
| intersect(self, *toIntersect: 'Shape', tol: 'float | None' = None) -> 'Shape'
| Intersection of the positional arguments and this Shape.
|
| :param tol: Fuzzy mode tolerance
|
| isEqual(self, other: 'Shape') -> 'bool'
| Returns True if two shapes are equal, i.e. if they share the same
| TShape with the same Locations and Orientations. Also see
| :py:meth:`isSame`.
|
| isNull(self) -> 'bool'
| Returns true if this shape is null. In other words, it references no
| underlying shape with the potential to be given a location and an
| orientation.
|
| isSame(self, other: 'Shape') -> 'bool'
| Returns True if other and this shape are same, i.e. if they share the
| same TShape with the same Locations. Orientations may differ. Also see
| :py:meth:`isEqual`
|
| isValid(self) -> 'bool'
| Returns True if no defect is detected on the shape S or any of its
| subshapes. See the OCCT docs on BRepCheck_Analyzer::IsValid for a full
| description of what is checked.
|
| locate(self: 'T', loc: 'Location') -> 'T'
| Apply a location in absolute sense to self.
|
| located(self: 'T', loc: 'Location') -> 'T'
| Apply a location in absolute sense to a copy of self.
|
| location(self) -> 'Location'
| Return the current location
|
| mesh(self, tolerance: 'float', angularTolerance: 'float' = 0.1) -> 'None'
| Generate triangulation if none exists.
|
| mirror(self, mirrorPlane: "Literal['XY', 'YX', 'XZ', 'ZX', 'YZ', 'ZY'] | VectorLike" = 'XY', basePointVector: 'VectorLike' = (0, 0, 0)) -> 'Shape'
| Applies a mirror transform to this Shape. Does not duplicate objects
| about the plane.
|
| :param mirrorPlane: The direction of the plane to mirror about - one of
| 'XY', 'XZ' or 'YZ'
| :param basePointVector: The origin of the plane to mirror about
| :returns: The mirrored shape
|
| move(self: 'T', loc: 'Location') -> 'T'
| move(self: 'T', loc: 'Location') -> 'T'
|
| Apply a location in relative sense (i.e. update current location) to self.
|
|
| move(self: 'T', x: 'Real' = 0, y: 'Real' = 0, z: 'Real' = 0, rx: 'Real' = 0, ry: 'Real' = 0, rz: 'Real' = 0) -> 'T'
|
| Apply translation and rotation in relative sense (i.e. update current location) to self.
|
|
| move(self: 'T', loc: 'VectorLike') -> 'T'
|
| Apply a VectorLike in relative sense (i.e. update current location) to self.
|
| moved(self: 'T', s: 'Shape') -> 'Shape'
| moved(self: 'T', loc: 'Location') -> 'T'
|
| Apply a location in relative sense (i.e. update current location) to a copy of self.
|
|
| moved(self: 'T', x: 'Real' = 0, y: 'Real' = 0, z: 'Real' = 0, rx: 'Real' = 0, ry: 'Real' = 0, rz: 'Real' = 0) -> 'T'
|
| Apply translation and rotation in relative sense to a copy of self.
|
|
| moved(self: 'T', loc: 'VectorLike') -> 'T'
|
| Apply a VectorLike in relative sense to a copy of self.
|
| remove(self, *subshape: 'Shape') -> 'Self'
| Remove subshapes.
|
| replace(self, old: 'Shape', *new: 'Shape') -> 'Self'
| Replace old subshape with new subshapes.
|
| reverse(self) -> 'Shape'
| Return a copy of self with reversed orientation.
|
| rotate(self: 'T', startVector: 'VectorLike', endVector: 'VectorLike', angleDegrees: 'float') -> 'T'
| Rotates a shape around an axis.
|
| :param startVector: start point of rotation axis
| :type startVector: either a 3-tuple or a Vector
| :param endVector: end point of rotation axis
| :type endVector: either a 3-tuple or a Vector
| :param angleDegrees: angle to rotate, in degrees
| :returns: a copy of the shape, rotated
|
| scale(self, factor: 'float') -> 'Shape'
| Scales this shape through a transformation.
|
| shell(self, selector: 'Selector | str | None' = None) -> 'Shell'
| Select a single shell.
|
| shells(self, selector: 'Selector | str | None' = None) -> 'Shape'
| Select shells.
|
| siblings(self, ctx: 'Shape', kind: 'Shapes', level: 'int | Iterable[int]' = 1) -> 'Compound'
| Iterate over siblings, i.e. shapes within ctx shape that share subshapes of type kind with self.
|
| size(self) -> 'int'
| Simple size implementation.
|
| solid(self, selector: 'Selector | str | None' = None) -> 'Solid'
| Select a single solid.
|
| solids(self, selector: 'Selector | str | None' = None) -> 'Shape'
| Select solids.
|
| sort(self, key: 'Callable[[Shape], Any]') -> 'Compound'
|
| split(self, *splitters: 'Shape') -> 'Shape'
| Split this shape with the positional arguments.
|
| tessellate(self, tolerance: 'float', angularTolerance: 'float' = 0.1) -> 'tuple[list[Vector], list[tuple[int, int, int]]]'
|
| toLocs(self) -> 'list[Location]'
| Convert self to a list of locations.
|
| toNURBS(self: 'T') -> 'T'
| Return a NURBS representation of a given shape.
|
| toSplines(self: 'T', degree: 'int' = 3, tolerance: 'float' = 0.001, nurbs: 'bool' = False) -> 'T'
| Approximate shape with b-splines of the specified degree.
|
| :param degree: Maximum degree.
| :param tolerance: Approximation tolerance.
| :param nurbs: Use rational splines.
|
| toVtkPolyData(self, tolerance: 'float | None' = None, angularTolerance: 'float | None' = None, normals: 'bool' = False) -> 'vtkPolyData'
| Convert shape to vtkPolyData
|
| transformGeometry(self, tMatrix: 'Matrix') -> 'Shape'
| Transforms this shape by tMatrix.
|
| WARNING: transformGeometry will sometimes convert lines and circles to
| splines, but it also has the ability to handle skew and stretching
| transformations.
|
| If your transformation is only translation and rotation, it is safer to
| use :py:meth:`transformShape`, which doesn't change the underlying type
| of the geometry, but cannot handle skew transformations.
|
| :param tMatrix: The transformation matrix
| :returns: a copy of the object, but with geometry transformed instead
| of just rotated.
|
| transformShape(self, tMatrix: 'Matrix') -> 'Shape'
| Transforms this Shape by tMatrix. Also see :py:meth:`transformGeometry`.
|
| :param tMatrix: The transformation matrix
| :returns: a copy of the object, transformed by the provided matrix,
| with all objects keeping their type
|
| translate(self: 'T', vector: 'VectorLike') -> 'T'
| Translates this shape through a transformation.
|
| vertex(self, selector: 'Selector | str | None' = None) -> 'Vertex'
| Select a single vertex.
|
| vertices(self, selector: 'Selector | str | None' = None) -> 'Shape'
| Select vertices.
|
| wire(self, selector: 'Selector | str | None' = None) -> 'Wire'
| Select a single wire.
|
| wires(self, selector: 'Selector | str | None' = None) -> 'Shape'
| Select wires.
|
| ----------------------------------------------------------------------
| Class methods inherited from Shape:
|
| cast(obj: 'TopoDS_Shape', forConstruction: 'bool' = False) -> 'Shape'
| Returns the right type of wrapper, given a OCCT object
|
| importBin(f: 'str | BytesIO') -> 'Shape'
| Import shape from a binary BREP file.
|
| importBrep(f: 'str | BytesIO') -> 'Shape'
| Import shape from a BREP file
|
| ----------------------------------------------------------------------
| Static methods inherited from Shape:
|
| CombinedCenter(objects: 'Iterable[Shape]') -> 'Vector'
| Calculates the center of mass of multiple objects.
|
| :param objects: A list of objects with mass
|
| CombinedCenterOfBoundBox(objects: 'list[Shape]') -> 'Vector'
| Calculates the center of a bounding box of multiple objects.
|
| :param objects: A list of objects
|
| centerOfMass(obj: 'Shape') -> 'Vector'
| Calculates the center of 'mass' of an object.
|
| :param obj: Compute the center of mass of this object
|
| computeMass(obj: 'Shape', tol: 'float | None' = None) -> 'float'
| Calculates the 'mass' of an object.
|
| :param obj: Compute the mass of this object
| :param tol: Numerical integration tolerance (optional).
|
| matrixOfInertia(obj: 'Shape') -> 'list[list[float]]'
| Calculates the matrix of inertia of an object.
| Since the part's density is unknown, this result is inertia/density with units of [1/length].
| :param obj: Compute the matrix of inertia of this object
|
| ----------------------------------------------------------------------
| Data descriptors inherited from Shape:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
cadquery.Sketch
Python Library Documentation: class Sketch in module cadquery.sketch
class Sketch(builtins.object)
| Sketch(parent: Any = None, locs: Iterable[cadquery.occ_impl.geom.Location] = (<cadquery.occ_impl.geom.Location object at 0x000001B8DA2193D0>,), obj: Optional[cadquery.occ_impl.shapes.Compound] = None)
|
| 2D sketch. Supports faces, edges and edges with constraints based construction.
|
| Methods defined here:
|
| __add__(self: ~T, other: 'Sketch') -> ~T
| Fuse self and other.
|
| __getitem__(self: ~T, item: Union[int, Sequence[int], slice]) -> ~T
|
| __init__(self: ~T, parent: Any = None, locs: Iterable[cadquery.occ_impl.geom.Location] = (<cadquery.occ_impl.geom.Location object at 0x000001B8DA2193D0>,), obj: Optional[cadquery.occ_impl.shapes.Compound] = None)
| Construct an empty sketch.
|
| __iter__(self) -> Union[Iterator[cadquery.occ_impl.shapes.Face], Iterator[cadquery.occ_impl.shapes.Edge]]
| Iterate over faces-locations combinations. If not faces are present
| iterate over edges:
|
| __mul__(self: ~T, other: 'Sketch') -> ~T
| Intersect self and other.
|
| __sub__(self: ~T, other: 'Sketch') -> ~T
| Subtract other from self.
|
| __truediv__(self: ~T, other: 'Sketch') -> ~T
| Split self with other.
|
| add(self: ~T) -> ~T
| Add selection to the underlying faces.
|
| apply(self: ~T, f: Callable[[Iterable[Union[cadquery.occ_impl.shapes.Shape, cadquery.occ_impl.geom.Location]]], Iterable[Union[cadquery.occ_impl.shapes.Shape, cadquery.occ_impl.geom.Location]]])
| Apply a callable to all items at once.
|
| :param f: Callable to be applied.
| :return: Sketch object with f applied to all items.
|
| arc(self: ~T, p1: Union[cadquery.occ_impl.geom.Vector, Tuple[Union[int, float], Union[int, float]]], p2: Union[cadquery.occ_impl.geom.Vector, Tuple[Union[int, float], Union[int, float]]], p3: Union[cadquery.occ_impl.geom.Vector, Tuple[Union[int, float], Union[int, float]]], tag: Optional[str] = None, forConstruction: bool = False) -> ~T
| arc(self: ~T, p1: Union[cadquery.occ_impl.geom.Vector, Tuple[Union[int, float], Union[int, float]]], p2: Union[cadquery.occ_impl.geom.Vector, Tuple[Union[int, float], Union[int, float]]], p3: Union[cadquery.occ_impl.geom.Vector, Tuple[Union[int, float], Union[int, float]]], tag: Optional[str] = None, forConstruction: bool = False) -> ~T
|
| Construct an arc.
|
| assemble(self: ~T, mode: Literal['a', 's', 'i', 'c', 'r'] = 'a', tag: Optional[str] = None) -> ~T
| Assemble edges into faces.
|
| bezier(self: ~T, pts: Iterable[Union[cadquery.occ_impl.geom.Vector, Tuple[Union[int, float], Union[int, float]]]], tag: Optional[str] = None, forConstruction: bool = False) -> ~T
| Construct an bezier curve.
|
| The edge will pass through the last points, and the inner points
| are bezier control points.
|
| chamfer(self: ~T, d: Union[int, float]) -> ~T
| Add a chamfer based on current selection.
|
| circle(self: ~T, r: Union[int, float], mode: Literal['a', 's', 'i', 'c', 'r'] = 'a', tag: Optional[str] = None) -> ~T
| Construct a circular face.
|
| clean(self: ~T) -> ~T
| Remove internal wires.
|
| close(self: ~T, tag: Optional[str] = None) -> ~T
| Connect last edge to the first one.
|
| constrain(self: ~T, tag: str, constraint: Literal['Fixed', 'FixedPoint', 'Coincident', 'Angle', 'Length', 'Distance', 'Radius', 'Orientation', 'ArcAngle'], arg: Any) -> ~T
| constrain(self: ~T, tag: str, constraint: Literal['Fixed', 'FixedPoint', 'Coincident', 'Angle', 'Length', 'Distance', 'Radius', 'Orientation', 'ArcAngle'], arg: Any) -> ~T
|
| Add a constraint.
|
| copy(self: ~T) -> ~T
| Create a partial copy of the sketch.
|
| delete(self: ~T) -> ~T
| Delete selected object.
|
| distribute(self: ~T, n: int, start: Union[int, float] = 0, stop: Union[int, float] = 1, rotate: bool = True) -> ~T
| Distribute locations along selected edges or wires.
|
| each(self: ~T, callback: Callable[[cadquery.occ_impl.geom.Location], Union[cadquery.occ_impl.shapes.Face, ForwardRef('Sketch'), cadquery.occ_impl.shapes.Compound]], mode: Literal['a', 's', 'i', 'c', 'r'] = 'a', tag: Optional[str] = None, ignore_selection: bool = False) -> ~T
| Apply a callback on all applicable entities.
|
| edge(self: ~T, val: cadquery.occ_impl.shapes.Edge, tag: Optional[str] = None, forConstruction: bool = False) -> ~T
| Add an edge to the sketch.
|
| edges(self: ~T, s: Union[str, cadquery.selectors.Selector, NoneType] = None, tag: Optional[str] = None) -> ~T
| Select edges.
|
| ellipse(self: ~T, a1: Union[int, float], a2: Union[int, float], angle: Union[int, float] = 0, mode: Literal['a', 's', 'i', 'c', 'r'] = 'a', tag: Optional[str] = None) -> ~T
| Construct an elliptical face.
|
| export(self: ~T, fname: str, tolerance: float = 0.1, angularTolerance: float = 0.1, unit: Literal['MM', 'CM', 'M', 'KM', 'INCH', 'FT', 'MI', 'UM', 'NM'] = 'MM', outputUnit: Optional[Literal['MM', 'CM', 'M', 'KM', 'INCH', 'FT', 'MI', 'UM', 'NM']] = None, opt: Optional[Dict[str, Any]] = None) -> ~T
| Export Sketch to file.
|
| :param path: Filename.
| :param tolerance: the deflection tolerance, in model units. Default 0.1.
| :param angularTolerance: the angular tolerance, in radians. Default 0.1.
| :param unit: The internal unit of the model's geometry values. Only used for STEP. Default "MM".
| :type unit: UnitLiterals
| :param outputUnit: The unit to use in the STEP file header. If None, defaults to the value of ``unit``.
| Use this when you want the output file to declare a different unit than the model's internal unit,
| for example to export a MM model as a STEP file declaring meters.
| :type outputUnit: UnitLiterals or None
| :param opt: additional options passed to the specific exporter. Default None.
| :return: Self.
|
| face(self: ~T, b: Union[cadquery.occ_impl.shapes.Wire, Iterable[cadquery.occ_impl.shapes.Edge], cadquery.occ_impl.shapes.Shape, ~T], angle: Union[int, float] = 0, mode: Literal['a', 's', 'i', 'c', 'r'] = 'a', tag: Optional[str] = None, ignore_selection: bool = False) -> ~T
| Construct a face from a wire or edges.
|
| faces(self: ~T, s: Union[str, cadquery.selectors.Selector, NoneType] = None, tag: Optional[str] = None) -> ~T
| Select faces.
|
| fillet(self: ~T, d: Union[int, float]) -> ~T
| Add a fillet based on current selection.
|
| filter(self: ~T, f: Callable[[Union[cadquery.occ_impl.shapes.Shape, cadquery.occ_impl.geom.Location]], bool]) -> ~T
| Filter items using a boolean predicate.
|
| :param f: Callable to be used for filtering.
| :return: Sketch object with filtered items.
|
| finalize(self) -> Any
| Finish sketch construction and return the parent.
|
| hull(self: ~T, mode: Literal['a', 's', 'i', 'c', 'r'] = 'a', tag: Optional[str] = None) -> ~T
| Generate a convex hull from current selection or all objects.
|
| importDXF(self: ~T, filename: str, tol: float = 1e-06, exclude: List[str] = [], include: List[str] = [], angle: Union[int, float] = 0, mode: Literal['a', 's', 'i', 'c', 'r'] = 'a', tag: Optional[str] = None) -> ~T
| Import a DXF file and construct face(s)
|
| invoke(self: ~T, f: Union[Callable[[~T], ~T], Callable[[~T], NoneType], Callable[[], NoneType]])
| Invoke a callable mapping Sketch to Sketch or None. Supports also
| callables that take no arguments such as breakpoint. Returns self if callable
| returns None.
|
| :param f: Callable to be invoked.
| :return: Sketch object.
|
| located(self: ~T, loc: cadquery.occ_impl.geom.Location) -> ~T
| Create a partial copy of the sketch with a new location.
|
| map(self: ~T, f: Callable[[Union[cadquery.occ_impl.shapes.Shape, cadquery.occ_impl.geom.Location]], Union[cadquery.occ_impl.shapes.Shape, cadquery.occ_impl.geom.Location]])
| Apply a callable to every item separately.
|
| :param f: Callable to be applied to every item separately.
| :return: Sketch object with f applied to all items.
|
| moved(self: ~T, *args, **kwargs) -> ~T
| Create a partial copy of the sketch with moved _faces.
|
| offset(self: ~T, d: Union[int, float], mode: Literal['a', 's', 'i', 'c', 'r'] = 'a', tag: Optional[str] = None) -> ~T
| Offset selected wires or edges.
|
| parray(self: ~T, r: Union[int, float], a1: Union[int, float], da: Union[int, float], n: int, rotate: bool = True) -> ~T
| Generate a polar array of locations.
|
| polygon(self: ~T, pts: Iterable[Union[cadquery.occ_impl.geom.Vector, Tuple[Union[int, float], Union[int, float]]]], angle: Union[int, float] = 0, mode: Literal['a', 's', 'i', 'c', 'r'] = 'a', tag: Optional[str] = None) -> ~T
| Construct a polygonal face.
|
| push(self: ~T, locs: Iterable[Union[cadquery.occ_impl.geom.Location, cadquery.occ_impl.geom.Vector, Tuple[Union[int, float], Union[int, float]]]], tag: Optional[str] = None) -> ~T
| Set current selection to given locations or points.
|
| rarray(self: ~T, xs: Union[int, float], ys: Union[int, float], nx: int, ny: int) -> ~T
| Generate a rectangular array of locations.
|
| rect(self: ~T, w: Union[int, float], h: Union[int, float], angle: Union[int, float] = 0, mode: Literal['a', 's', 'i', 'c', 'r'] = 'a', tag: Optional[str] = None) -> ~T
| Construct a rectangular face.
|
| regularPolygon(self: ~T, r: Union[int, float], n: int, angle: Union[int, float] = 0, mode: Literal['a', 's', 'i', 'c', 'r'] = 'a', tag: Optional[str] = None) -> ~T
| Construct a regular polygonal face.
|
| replace(self: ~T) -> ~T
| Replace the underlying faces with the selection.
|
| reset(self: ~T) -> ~T
| Reset current selection.
|
| segment(self: ~T, p1: Union[cadquery.occ_impl.geom.Vector, Tuple[Union[int, float], Union[int, float]]], p2: Union[cadquery.occ_impl.geom.Vector, Tuple[Union[int, float], Union[int, float]]], tag: Optional[str] = None, forConstruction: bool = False) -> ~T
| segment(self: ~T, p1: Union[cadquery.occ_impl.geom.Vector, Tuple[Union[int, float], Union[int, float]]], p2: Union[cadquery.occ_impl.geom.Vector, Tuple[Union[int, float], Union[int, float]]], tag: Optional[str] = None, forConstruction: bool = False) -> ~T
|
| Construct a segment.
|
| select(self: ~T, *tags: str) -> ~T
| Select based on tags.
|
| slot(self: ~T, w: Union[int, float], h: Union[int, float], angle: Union[int, float] = 0, mode: Literal['a', 's', 'i', 'c', 'r'] = 'a', tag: Optional[str] = None) -> ~T
| Construct a slot-shaped face.
|
| solve(self: ~T) -> ~T
| Solve current constraints and update edge positions.
|
| sort(self: ~T, key: Callable[[Union[cadquery.occ_impl.shapes.Shape, cadquery.occ_impl.geom.Location]], Any]) -> ~T
| Sort items using a callable.
|
| :param key: Callable to be used for sorting.
| :return: Sketch object with items sorted.
|
| spline(self: ~T, pts: Iterable[Union[cadquery.occ_impl.geom.Vector, Tuple[Union[int, float], Union[int, float]]]], tangents: Optional[Iterable[Union[cadquery.occ_impl.geom.Vector, Tuple[Union[int, float], Union[int, float]]]]], periodic: bool, tag: Optional[str] = None, forConstruction: bool = False) -> ~T
| spline(self: ~T, pts: Iterable[Union[cadquery.occ_impl.geom.Vector, Tuple[Union[int, float], Union[int, float]]]], tangents: Optional[Iterable[Union[cadquery.occ_impl.geom.Vector, Tuple[Union[int, float], Union[int, float]]]]], periodic: bool, tag: Optional[str] = None, forConstruction: bool = False) -> ~T
|
| Construct a spline edge.
|
| subtract(self: ~T) -> ~T
| Subtract selection from the underlying faces.
|
| tag(self: ~T, tag: str) -> ~T
| Tag current selection.
|
| trapezoid(self: ~T, w: Union[int, float], h: Union[int, float], a1: Union[int, float], a2: Optional[float] = None, angle: Union[int, float] = 0, mode: Literal['a', 's', 'i', 'c', 'r'] = 'a', tag: Optional[str] = None) -> ~T
| Construct a trapezoidal face.
|
| val(self: ~T) -> Union[cadquery.occ_impl.shapes.Shape, cadquery.occ_impl.geom.Location]
| Return the first selected item, underlying compound or first edge.
|
| vals(self: ~T) -> List[Union[cadquery.occ_impl.shapes.Shape, cadquery.occ_impl.geom.Location]]
| Return all selected items, underlying compound or all edges.
|
| vertices(self: ~T, s: Union[str, cadquery.selectors.Selector, NoneType] = None, tag: Optional[str] = None) -> ~T
| Select vertices.
|
| wires(self: ~T, s: Union[str, cadquery.selectors.Selector, NoneType] = None, tag: Optional[str] = None) -> ~T
| Select wires.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __annotations__ = {'_constraints': typing.List[cadquery.sketch.Constra...
cadquery.Solid
Python Library Documentation: class Solid in module cadquery.occ_impl.shapes
class Solid(Shape, Mixin3D)
| Solid(obj: 'TopoDS_Shape') -> 'None'
|
| a single solid
|
| Method resolution order:
| Solid
| Shape
| Mixin3D
| builtins.object
|
| Methods defined here:
|
| addCavity(self, *shells: 'Shell | Solid') -> 'Self'
| Add one or more cavities.
|
| innerShells(self) -> 'list[Shell]'
| Returns inner shells.
|
| outerShell(self) -> 'Shell'
| Returns outer shell.
|
| ----------------------------------------------------------------------
| Class methods defined here:
|
| extrudeLinear(outerWire: 'Wire', innerWires: 'list[Wire]', vecNormal: 'VectorLike', taper: 'Real' = 0) -> 'Solid'
| Attempt to extrude the list of wires into a prismatic solid in the provided direction
|
| :param outerWire: the outermost wire
| :param innerWires: a list of inner wires
| :param vecNormal: a vector along which to extrude the wires
| :param taper: taper angle, default=0
| :return: a Solid object
|
| The wires must not intersect
|
| Extruding wires is very non-trivial. Nested wires imply very different geometry, and
| there are many geometries that are invalid. In general, the following conditions must be met:
|
| * all wires must be closed
| * there cannot be any intersecting or self-intersecting wires
| * wires must be listed from outside in
| * more than one levels of nesting is not supported reliably
|
| This method will attempt to sort the wires, but there is much work remaining to make this method
| reliable.
|
| extrudeLinearWithRotation(outerWire: 'Wire', innerWires: 'list[Wire]', vecCenter: 'VectorLike', vecNormal: 'VectorLike', angleDegrees: 'Real') -> 'Solid'
| Creates a 'twisted prism' by extruding, while simultaneously rotating around the extrusion vector.
|
| Though the signature may appear to be similar enough to extrudeLinear to merit combining them, the
| construction methods used here are different enough that they should be separate.
|
| At a high level, the steps followed are:
|
| (1) accept a set of wires
| (2) create another set of wires like this one, but which are transformed and rotated
| (3) create a ruledSurface between the sets of wires
| (4) create a shell and compute the resulting object
|
| :param outerWire: the outermost wire
| :param innerWires: a list of inner wires
| :param vecCenter: the center point about which to rotate. the axis of rotation is defined by
| vecNormal, located at vecCenter.
| :param vecNormal: a vector along which to extrude the wires
| :param angleDegrees: the angle to rotate through while extruding
| :return: a Solid object
|
| makeBox(length: 'float', width: 'float', height: 'float', pnt: 'VectorLike' = Vector: (0.0, 0.0, 0.0), dir: 'VectorLike' = Vector: (0.0, 0.0, 1.0)) -> 'Solid'
| makeBox(length,width,height,[pnt,dir]) -- Make a box located in pnt with the dimensions (length,width,height)
| By default pnt=Vector(0,0,0) and dir=Vector(0,0,1)
|
| makeCone(radius1: 'float', radius2: 'float', height: 'float', pnt: 'VectorLike' = Vector: (0.0, 0.0, 0.0), dir: 'VectorLike' = Vector: (0.0, 0.0, 1.0), angleDegrees: 'float' = 360) -> 'Solid'
| Make a cone with given radii and height
| By default pnt=Vector(0,0,0),
| dir=Vector(0,0,1) and angle=360
|
| makeCylinder(radius: 'float', height: 'float', pnt: 'VectorLike' = Vector: (0.0, 0.0, 0.0), dir: 'VectorLike' = Vector: (0.0, 0.0, 1.0), angleDegrees: 'float' = 360) -> 'Solid'
| makeCylinder(radius,height,[pnt,dir,angle]) --
| Make a cylinder with a given radius and height
| By default pnt=Vector(0,0,0),dir=Vector(0,0,1) and angle=360
|
| makeLoft(listOfWire: 'list[Wire]', ruled: 'bool' = False) -> 'Solid'
| makes a loft from a list of wires
| The wires will be converted into faces when possible-- it is presumed that nobody ever actually
| wants to make an infinitely thin shell for a real FreeCADPart.
|
| makeSolid(shell: 'Shell') -> 'Solid'
| Makes a solid from a single shell.
|
| makeSphere(radius: 'float', pnt: 'VectorLike' = Vector: (0.0, 0.0, 0.0), dir: 'VectorLike' = Vector: (0.0, 0.0, 1.0), angleDegrees1: 'float' = 0, angleDegrees2: 'float' = 90, angleDegrees3: 'float' = 360) -> 'Shape'
| Make a sphere with a given radius
| By default pnt=Vector(0,0,0), dir=Vector(0,0,1), angle1=0, angle2=90 and angle3=360
|
| makeTorus(radius1: 'float', radius2: 'float', pnt: 'VectorLike' = Vector: (0.0, 0.0, 0.0), dir: 'VectorLike' = Vector: (0.0, 0.0, 1.0), angleDegrees1: 'float' = 0, angleDegrees2: 'float' = 360) -> 'Solid'
| makeTorus(radius1,radius2,[pnt,dir,angle1,angle2,angle]) --
| Make a torus with a given radii and angles
| By default pnt=Vector(0,0,0),dir=Vector(0,0,1),angle1=0
| ,angle1=360 and angle=360
|
| makeWedge(dx: 'float', dy: 'float', dz: 'float', xmin: 'float', zmin: 'float', xmax: 'float', zmax: 'float', pnt: 'VectorLike' = Vector: (0.0, 0.0, 0.0), dir: 'VectorLike' = Vector: (0.0, 0.0, 1.0)) -> 'Solid'
| Make a wedge located in pnt
| By default pnt=Vector(0,0,0) and dir=Vector(0,0,1)
|
| revolve(outerWire: 'Wire', innerWires: 'list[Wire]', angleDegrees: 'Real', axisStart: 'VectorLike', axisEnd: 'VectorLike') -> 'Solid'
| Attempt to revolve the list of wires into a solid in the provided direction
|
| :param outerWire: the outermost wire
| :param innerWires: a list of inner wires
| :param angleDegrees: the angle to revolve through.
| :type angleDegrees: float, anything less than 360 degrees will leave the shape open
| :param axisStart: the start point of the axis of rotation
| :param axisEnd: the end point of the axis of rotation
| :return: a Solid object
|
| The wires must not intersect
|
| * all wires must be closed
| * there cannot be any intersecting or self-intersecting wires
| * wires must be listed from outside in
| * more than one levels of nesting is not supported reliably
| * the wire(s) that you're revolving cannot be centered
|
| This method will attempt to sort the wires, but there is much work remaining to make this method
| reliable.
|
| sweep(outerWire: 'Wire', innerWires: 'list[Wire]', path: 'Wire | Edge', makeSolid: 'bool' = True, isFrenet: 'bool' = False, mode: 'Vector | Wire | Edge | None' = None, transitionMode: "Literal['transformed', 'round', 'right']" = 'transformed') -> 'Shape'
| sweep(cls, outerWire: 'Wire', innerWires: 'list[Wire]', path: 'Wire | Edge', makeSolid: 'bool' = True, isFrenet: 'bool' = False, mode: 'Vector | Wire | Edge | None' = None, transitionMode: "Literal['transformed', 'round', 'right']" = 'transformed') -> 'Shape'
|
| Attempt to sweep the list of wires into a prismatic solid along the provided path
|
| :param outerWire: the outermost wire
| :param innerWires: a list of inner wires
| :param path: The wire to sweep the face resulting from the wires over
| :param makeSolid: return Solid or Shell (default True)
| :param isFrenet: Frenet mode (default False)
| :param mode: additional sweep mode parameters
| :param transitionMode:
| handling of profile orientation at C1 path discontinuities.
| Possible values are {'transformed','round', 'right'} (default: 'right').
| :return: a Solid object
|
| sweep_multi(profiles: 'Iterable[Wire | Face]', path: 'Wire | Edge', makeSolid: 'bool' = True, isFrenet: 'bool' = False, mode: 'Vector | Wire | Edge | None' = None) -> 'Solid'
| Multi section sweep. Only single outer profile per section is allowed.
|
| :param profiles: list of profiles
| :param path: The wire to sweep the face resulting from the wires over
| :param mode: additional sweep mode parameters.
| :return: a Solid object
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| isSolid(obj: 'Shape') -> 'bool'
| Returns true if the object is a solid, false otherwise
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __annotations__ = {'wrapped': 'TopoDS_Solid'}
|
| ----------------------------------------------------------------------
| Methods inherited from Shape:
|
| Area(self) -> 'float'
| :returns: The surface area of all faces in this Shape
|
| BoundingBox(self, tolerance: 'float | None' = None) -> 'BoundBox'
| Create a bounding box for this Shape.
|
| :param tolerance: Tolerance value passed to :class:`BoundBox`
| :returns: A :class:`BoundBox` object for this Shape
|
| Center(self) -> 'Vector'
| :returns: The point of the center of mass of this Shape
|
| CenterOfBoundBox(self, tolerance: 'float | None' = None) -> 'Vector'
| :param tolerance: Tolerance passed to the :py:meth:`BoundingBox` method
| :returns: Center of the bounding box of this shape
|
| Closed(self) -> 'bool'
| :returns: The closedness flag
|
| CompSolids(self) -> 'list[CompSolid]'
| :returns: All the compsolids in this Shape
|
| Compounds(self) -> 'list[Compound]'
| :returns: All the compounds in this Shape
|
| Edges(self) -> 'list[Edge]'
| :returns: All the edges in this Shape
|
| Faces(self) -> 'list[Face]'
| :returns: All the faces in this Shape
|
| ShapeType(self) -> 'Shapes'
|
| Shells(self) -> 'list[Shell]'
| :returns: All the shells in this Shape
|
| Solids(self) -> 'list[Solid]'
| :returns: All the solids in this Shape
|
| Vertices(self) -> 'list[Vertex]'
| :returns: All the vertices in this Shape
|
| Volume(self, tol: 'float | None' = None) -> 'float'
| :returns: The volume of this Shape
|
| Wires(self) -> 'list[Wire]'
| :returns: All the wires in this Shape
|
| __add__(self, other: 'Shape') -> 'Shape'
| Fuse self and other.
|
| __and__(self, other: 'Shape') -> 'Compound'
| Set intersection for combining selection results.
|
| __eq__(self, other: 'Any') -> 'bool'
| Return self==value.
|
| __getitem__(self, item: 'int | slice') -> 'Shape'
|
| __getstate__(self) -> 'tuple[BytesIO, bool]'
| Helper for pickle.
|
| __hash__(self) -> 'int'
| Return hash(self).
|
| __init__(self, obj: 'TopoDS_Shape') -> 'None'
| Initialize self. See help(type(self)) for accurate signature.
|
| __iter__(self) -> 'Iterator[Shape]'
| Iterate over subshapes.
|
| __mod__(self, other: 'Shape') -> 'Compound'
| Set difference for combining selection results.
|
| __mul__(self, other: 'Shape') -> 'Shape'
| Intersect self and other.
|
| __or__(self, other: 'Shape') -> 'Compound'
| Set sum for combining selection results.
|
| __setstate__(self, data: 'tuple[BytesIO, bool]') -> 'None'
|
| __sub__(self, other: 'Shape') -> 'Shape'
| Subtract other from self.
|
| __truediv__(self, other: 'Shape') -> 'Shape'
| Split self with other.
|
| ancestors(self, ctx: 'Shape', kind: 'Shapes') -> 'Compound'
| Iterate over ancestors, i.e. shapes of type kind within ctx shape that contain self.
|
| clean(self: 'T') -> 'T'
| Experimental clean using ShapeUpgrade
|
| copy(self: 'T', mesh: 'bool' = False) -> 'T'
| Creates a new object that is a copy of this object.
|
| :param mesh: should I copy the triangulation too (default: False)
| :returns: a copy of the object
|
| cut(self, *toCut: 'Shape', tol: 'float | None' = None) -> 'Shape'
| Remove the positional arguments from this Shape.
|
| :param tol: Fuzzy mode tolerance
|
| distance(self, other: 'Shape') -> 'float'
| Minimal distance between two shapes
|
| distances(self, *others: 'Shape') -> 'Iterator[float]'
| Minimal distances to between self and other shapes
|
| edge(self, selector: 'Selector | str | None' = None) -> 'Edge'
| Select a single edge.
|
| edges(self, selector: 'Selector | str | None' = None) -> 'Shape'
| Select edges.
|
| export(self: 'T', fname: 'str', tolerance: 'float' = 0.1, angularTolerance: 'float' = 0.1, unit: 'UnitLiterals' = 'MM', outputUnit: 'UnitLiterals | None' = None, opt: 'dict[str, Any] | None' = None) -> 'None'
| Export Shape to file.
|
| exportBin(self, f: 'str | BytesIO') -> 'bool'
| Export this shape to a binary BREP file.
|
| exportBrep(self, f: 'str | BytesIO') -> 'bool'
| Export this shape to a BREP file
|
| exportStep(self, fileName: 'str', unit: 'UnitLiterals' = 'MM', outputUnit: 'UnitLiterals | None' = None, **kwargs: 'Any') -> 'IFSelect_ReturnStatus'
| Export this shape to a STEP file.
| kwargs is used to provide additional optional keyword arguments to configure the exporter.
|
| :param fileName: Path and filename for writing.
| :type fileName: str
| :param unit: The internal unit of the model's geometry values. Default "MM".
| :type unit: UnitLiterals
| :param outputUnit: The unit to use in the STEP file header. If None, defaults to the value of ``unit``.
| Use this when you want the output file to declare a different unit than the model's internal unit,
| for example to export a MM model as a STEP file declaring meters.
| :type outputUnit: UnitLiterals or None
| :param write_pcurves: Enable or disable writing parametric curves to the STEP file. Default True.
| If False, writes STEP file without pcurves. This decreases the size of the resulting STEP file.
| :type write_pcurves: bool
| :param precision_mode: Controls the uncertainty value for STEP entities. Specify -1, 0, or 1. Default 0.
| See OCCT documentation.
| :type precision_mode: int
|
| exportStl(self, fileName: 'str', tolerance: 'float' = 0.001, angularTolerance: 'float' = 0.1, ascii: 'bool' = False, relative: 'bool' = True, parallel: 'bool' = True) -> 'bool'
| Exports a shape to a specified STL file.
|
| :param fileName: The path and file name to write the STL output to.
| :param tolerance: A linear deflection setting which limits the distance between a curve and its tessellation.
| Setting this value too low will result in large meshes that can consume computing resources.
| Setting the value too high can result in meshes with a level of detail that is too low.
| Default is 1e-3, which is a good starting point for a range of cases.
| :param angularTolerance: Angular deflection setting which limits the angle between subsequent segments in a polyline. Default is 0.1.
| :param ascii: Export the file as ASCII (True) or binary (False) STL format. Default is binary.
| :param relative: If True, tolerance will be scaled by the size of the edge being meshed. Default is True.
| Setting this value to True may cause large features to become faceted, or small features dense.
| :param parallel: If True, OCCT will use parallel processing to mesh the shape. Default is True.
|
| face(self, selector: 'Selector | str | None' = None) -> 'Face'
| Select a single face.
|
| faces(self, selector: 'Selector | str | None' = None) -> 'Shape'
| Select faces.
|
| facesIntersectedByLine(self, point: 'VectorLike', axis: 'VectorLike', tol: 'float' = 0.0001, direction: "Literal['AlongAxis', 'Opposite'] | None" = None) -> 'list[Face]'
| Computes the intersections between the provided line and the faces of this Shape
|
| :param point: Base point for defining a line
| :param axis: Axis on which the line rests
| :param tol: Intersection tolerance
| :param direction: Valid values: "AlongAxis", "Opposite";
| If specified, will ignore all faces that are not in the specified direction
| including the face where the point lies if it is the case
| :returns: A list of intersected faces sorted by distance from point
|
| filter(self, f: 'Callable[[Shape], bool]') -> 'Compound'
|
| fix(self: 'T') -> 'T'
| Try to fix shape if not valid
|
| fuse(self, *toFuse: 'Shape', glue: 'bool' = False, tol: 'float | None' = None) -> 'Shape'
| Fuse the positional arguments with this Shape.
|
| :param glue: Sets the glue option for the algorithm, which allows
| increasing performance of the intersection of the input shapes
| :param tol: Fuzzy mode tolerance
|
| geomType(self) -> 'Geoms'
| Gets the underlying geometry type.
|
| Implementations can return any values desired, but the values the user
| uses in type filters should correspond to these.
|
| As an example, if a user does::
|
| CQ(object).faces("%mytype")
|
| The expectation is that the geomType attribute will return 'mytype'
|
| The return values depend on the type of the shape:
|
| | Vertex: always 'Vertex'
| | Edge: LINE, CIRCLE, ELLIPSE, HYPERBOLA, PARABOLA, BEZIER,
| | BSPLINE, OFFSET, OTHER
| | Face: PLANE, CYLINDER, CONE, SPHERE, TORUS, BEZIER, BSPLINE,
| | REVOLUTION, EXTRUSION, OFFSET, OTHER
| | Solid: 'Solid'
| | Shell: 'Shell'
| | Compound: 'Compound'
| | Wire: 'Wire'
|
| :returns: A string according to the geometry type
|
| hashCode(self) -> 'int'
| Returns a hashed value denoting this shape. It is computed from the
| TShape and the Location. The Orientation is not used.
|
| intersect(self, *toIntersect: 'Shape', tol: 'float | None' = None) -> 'Shape'
| Intersection of the positional arguments and this Shape.
|
| :param tol: Fuzzy mode tolerance
|
| isEqual(self, other: 'Shape') -> 'bool'
| Returns True if two shapes are equal, i.e. if they share the same
| TShape with the same Locations and Orientations. Also see
| :py:meth:`isSame`.
|
| isNull(self) -> 'bool'
| Returns true if this shape is null. In other words, it references no
| underlying shape with the potential to be given a location and an
| orientation.
|
| isSame(self, other: 'Shape') -> 'bool'
| Returns True if other and this shape are same, i.e. if they share the
| same TShape with the same Locations. Orientations may differ. Also see
| :py:meth:`isEqual`
|
| isValid(self) -> 'bool'
| Returns True if no defect is detected on the shape S or any of its
| subshapes. See the OCCT docs on BRepCheck_Analyzer::IsValid for a full
| description of what is checked.
|
| locate(self: 'T', loc: 'Location') -> 'T'
| Apply a location in absolute sense to self.
|
| located(self: 'T', loc: 'Location') -> 'T'
| Apply a location in absolute sense to a copy of self.
|
| location(self) -> 'Location'
| Return the current location
|
| mesh(self, tolerance: 'float', angularTolerance: 'float' = 0.1) -> 'None'
| Generate triangulation if none exists.
|
| mirror(self, mirrorPlane: "Literal['XY', 'YX', 'XZ', 'ZX', 'YZ', 'ZY'] | VectorLike" = 'XY', basePointVector: 'VectorLike' = (0, 0, 0)) -> 'Shape'
| Applies a mirror transform to this Shape. Does not duplicate objects
| about the plane.
|
| :param mirrorPlane: The direction of the plane to mirror about - one of
| 'XY', 'XZ' or 'YZ'
| :param basePointVector: The origin of the plane to mirror about
| :returns: The mirrored shape
|
| move(self: 'T', loc: 'Location') -> 'T'
| move(self: 'T', loc: 'Location') -> 'T'
|
| Apply a location in relative sense (i.e. update current location) to self.
|
|
| move(self: 'T', x: 'Real' = 0, y: 'Real' = 0, z: 'Real' = 0, rx: 'Real' = 0, ry: 'Real' = 0, rz: 'Real' = 0) -> 'T'
|
| Apply translation and rotation in relative sense (i.e. update current location) to self.
|
|
| move(self: 'T', loc: 'VectorLike') -> 'T'
|
| Apply a VectorLike in relative sense (i.e. update current location) to self.
|
| moved(self: 'T', s: 'Shape') -> 'Shape'
| moved(self: 'T', loc: 'Location') -> 'T'
|
| Apply a location in relative sense (i.e. update current location) to a copy of self.
|
|
| moved(self: 'T', x: 'Real' = 0, y: 'Real' = 0, z: 'Real' = 0, rx: 'Real' = 0, ry: 'Real' = 0, rz: 'Real' = 0) -> 'T'
|
| Apply translation and rotation in relative sense to a copy of self.
|
|
| moved(self: 'T', loc: 'VectorLike') -> 'T'
|
| Apply a VectorLike in relative sense to a copy of self.
|
| remove(self, *subshape: 'Shape') -> 'Self'
| Remove subshapes.
|
| replace(self, old: 'Shape', *new: 'Shape') -> 'Self'
| Replace old subshape with new subshapes.
|
| reverse(self) -> 'Shape'
| Return a copy of self with reversed orientation.
|
| rotate(self: 'T', startVector: 'VectorLike', endVector: 'VectorLike', angleDegrees: 'float') -> 'T'
| Rotates a shape around an axis.
|
| :param startVector: start point of rotation axis
| :type startVector: either a 3-tuple or a Vector
| :param endVector: end point of rotation axis
| :type endVector: either a 3-tuple or a Vector
| :param angleDegrees: angle to rotate, in degrees
| :returns: a copy of the shape, rotated
|
| scale(self, factor: 'float') -> 'Shape'
| Scales this shape through a transformation.
|
| shell(self, selector: 'Selector | str | None' = None) -> 'Shell'
| Select a single shell.
|
| shells(self, selector: 'Selector | str | None' = None) -> 'Shape'
| Select shells.
|
| siblings(self, ctx: 'Shape', kind: 'Shapes', level: 'int | Iterable[int]' = 1) -> 'Compound'
| Iterate over siblings, i.e. shapes within ctx shape that share subshapes of type kind with self.
|
| size(self) -> 'int'
| Simple size implementation.
|
| solid(self, selector: 'Selector | str | None' = None) -> 'Solid'
| Select a single solid.
|
| solids(self, selector: 'Selector | str | None' = None) -> 'Shape'
| Select solids.
|
| sort(self, key: 'Callable[[Shape], Any]') -> 'Compound'
|
| split(self, *splitters: 'Shape') -> 'Shape'
| Split this shape with the positional arguments.
|
| tessellate(self, tolerance: 'float', angularTolerance: 'float' = 0.1) -> 'tuple[list[Vector], list[tuple[int, int, int]]]'
|
| toLocs(self) -> 'list[Location]'
| Convert self to a list of locations.
|
| toNURBS(self: 'T') -> 'T'
| Return a NURBS representation of a given shape.
|
| toSplines(self: 'T', degree: 'int' = 3, tolerance: 'float' = 0.001, nurbs: 'bool' = False) -> 'T'
| Approximate shape with b-splines of the specified degree.
|
| :param degree: Maximum degree.
| :param tolerance: Approximation tolerance.
| :param nurbs: Use rational splines.
|
| toVtkPolyData(self, tolerance: 'float | None' = None, angularTolerance: 'float | None' = None, normals: 'bool' = False) -> 'vtkPolyData'
| Convert shape to vtkPolyData
|
| transformGeometry(self, tMatrix: 'Matrix') -> 'Shape'
| Transforms this shape by tMatrix.
|
| WARNING: transformGeometry will sometimes convert lines and circles to
| splines, but it also has the ability to handle skew and stretching
| transformations.
|
| If your transformation is only translation and rotation, it is safer to
| use :py:meth:`transformShape`, which doesn't change the underlying type
| of the geometry, but cannot handle skew transformations.
|
| :param tMatrix: The transformation matrix
| :returns: a copy of the object, but with geometry transformed instead
| of just rotated.
|
| transformShape(self, tMatrix: 'Matrix') -> 'Shape'
| Transforms this Shape by tMatrix. Also see :py:meth:`transformGeometry`.
|
| :param tMatrix: The transformation matrix
| :returns: a copy of the object, transformed by the provided matrix,
| with all objects keeping their type
|
| translate(self: 'T', vector: 'VectorLike') -> 'T'
| Translates this shape through a transformation.
|
| vertex(self, selector: 'Selector | str | None' = None) -> 'Vertex'
| Select a single vertex.
|
| vertices(self, selector: 'Selector | str | None' = None) -> 'Shape'
| Select vertices.
|
| wire(self, selector: 'Selector | str | None' = None) -> 'Wire'
| Select a single wire.
|
| wires(self, selector: 'Selector | str | None' = None) -> 'Shape'
| Select wires.
|
| ----------------------------------------------------------------------
| Class methods inherited from Shape:
|
| cast(obj: 'TopoDS_Shape', forConstruction: 'bool' = False) -> 'Shape'
| Returns the right type of wrapper, given a OCCT object
|
| importBin(f: 'str | BytesIO') -> 'Shape'
| Import shape from a binary BREP file.
|
| importBrep(f: 'str | BytesIO') -> 'Shape'
| Import shape from a BREP file
|
| ----------------------------------------------------------------------
| Static methods inherited from Shape:
|
| CombinedCenter(objects: 'Iterable[Shape]') -> 'Vector'
| Calculates the center of mass of multiple objects.
|
| :param objects: A list of objects with mass
|
| CombinedCenterOfBoundBox(objects: 'list[Shape]') -> 'Vector'
| Calculates the center of a bounding box of multiple objects.
|
| :param objects: A list of objects
|
| centerOfMass(obj: 'Shape') -> 'Vector'
| Calculates the center of 'mass' of an object.
|
| :param obj: Compute the center of mass of this object
|
| computeMass(obj: 'Shape', tol: 'float | None' = None) -> 'float'
| Calculates the 'mass' of an object.
|
| :param obj: Compute the mass of this object
| :param tol: Numerical integration tolerance (optional).
|
| matrixOfInertia(obj: 'Shape') -> 'list[list[float]]'
| Calculates the matrix of inertia of an object.
| Since the part's density is unknown, this result is inertia/density with units of [1/length].
| :param obj: Compute the matrix of inertia of this object
|
| ----------------------------------------------------------------------
| Data descriptors inherited from Shape:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Methods inherited from Mixin3D:
|
| chamfer(self: 'Any', length: 'float', length2: 'float | None', edgeList: 'Iterable[Edge]') -> 'Any'
| Chamfers the specified edges of this solid.
|
| :param length: length > 0, the length (length) of the chamfer
| :param length2: length2 > 0, optional parameter for asymmetrical chamfer. Should be `None` if not required.
| :param edgeList: a list of Edge objects, which must belong to this solid
| :return: Chamfered solid
|
| dprism(self: 'TS', basis: 'Face | None', profiles: 'list[Wire]', depth: 'Real | None' = None, taper: 'Real' = 0, upToFace: 'Face | None' = None, thruAll: 'bool' = True, additive: 'bool' = True) -> 'TS'
| dprism(self: 'TS', basis: 'Face | None', profiles: 'list[Wire]', depth: 'Real | None' = None, taper: 'Real' = 0, upToFace: 'Face | None' = None, thruAll: 'bool' = True, additive: 'bool' = True) -> 'TS'
|
| Make a prismatic feature (additive or subtractive)
|
| :param basis: face to perform the operation on
| :param profiles: list of profiles
| :param depth: depth of the cut or extrusion
| :param upToFace: a face to extrude until
| :param thruAll: cut thruAll
| :return: a Solid object
|
| fillet(self: 'Any', radius: 'float', edgeList: 'Iterable[Edge]') -> 'Any'
| Fillets the specified edges of this solid.
|
| :param radius: float > 0, the radius of the fillet
| :param edgeList: a list of Edge objects, which must belong to this solid
| :return: Filleted solid
|
| hollow(self: 'Any', faceList: 'Iterable[Face] | None', thickness: 'float', tolerance: 'float' = 0.0001, kind: "Literal['arc', 'intersection']" = 'arc') -> 'Any'
| Make a hollow solid of self.
|
| :param faceList: List of faces to be removed, which must be part of the solid. Can
| be an empty list.
| :param thickness: Floating point thickness. Positive shells outwards, negative
| shells inwards.
| :param tolerance: Modelling tolerance of the method, default=0.0001.
| :return: A shelled solid.
|
| isInside(self: 'ShapeProtocol', point: 'VectorLike', tolerance: 'float' = 1e-06) -> 'bool'
| Returns whether or not the point is inside a solid or compound
| object within the specified tolerance.
|
| :param point: tuple or Vector representing 3D point to be tested
| :param tolerance: tolerance for inside determination, default=1.0e-6
| :return: bool indicating whether or not point is within solid
cadquery.StringSyntaxSelector
Python Library Documentation: class StringSyntaxSelector in module cadquery.selectors
class StringSyntaxSelector(Selector)
| StringSyntaxSelector(selectorString)
|
| Filter lists objects using a simple string syntax. All of the filters available in the string syntax
| are also available ( usually with more functionality ) through the creation of full-fledged
| selector objects. see :py:class:`Selector` and its subclasses
|
| Filtering works differently depending on the type of object list being filtered.
|
| :param selectorString: A two-part selector string, [selector][axis]
|
| :return: objects that match the specified selector
|
| ***Modifiers*** are ``('|','+','-','<','>','%')``
|
| :\|:
| parallel to ( same as :py:class:`ParallelDirSelector` ). Can return multiple objects.
| :#:
| perpendicular to (same as :py:class:`PerpendicularDirSelector` )
| :+:
| positive direction (same as :py:class:`DirectionSelector` )
| :-:
| negative direction (same as :py:class:`DirectionSelector` )
| :>:
| maximize (same as :py:class:`DirectionMinMaxSelector` with directionMax=True)
| :<:
| minimize (same as :py:class:`DirectionMinMaxSelector` with directionMax=False )
| :%:
| curve/surface type (same as :py:class:`TypeSelector`)
|
| ***axisStrings*** are: ``X,Y,Z,XY,YZ,XZ`` or ``(x,y,z)`` which defines an arbitrary direction
|
| It is possible to combine simple selectors together using logical operations.
| The following operations are supported
|
| :and:
| Logical AND, e.g. >X and >Y
| :or:
| Logical OR, e.g. \|X or \|Y
| :not:
| Logical NOT, e.g. not #XY
| :exc(ept):
| Set difference (equivalent to AND NOT): \|X exc >Z
|
| Finally, it is also possible to use even more complex expressions with nesting
| and arbitrary number of terms, e.g.
|
| (not >X[0] and #XY) or >XY[0]
|
| Selectors are a complex topic: see :ref:`selector_reference` for more information
|
| Method resolution order:
| StringSyntaxSelector
| Selector
| builtins.object
|
| Methods defined here:
|
| __init__(self, selectorString)
| Feed the input string through the parser and construct an relevant complex selector object
|
| filter(self, objectList: Sequence[~Shape])
| Filter give object list through th already constructed complex selector object
|
| ----------------------------------------------------------------------
| Methods inherited from Selector:
|
| __add__(self, other)
|
| __and__(self, other)
|
| __neg__(self)
|
| __sub__(self, other)
|
| ----------------------------------------------------------------------
| Data descriptors inherited from Selector:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
cadquery.TypeSelector
Python Library Documentation: class TypeSelector in module cadquery.selectors
class TypeSelector(Selector)
| TypeSelector(typeString: str)
|
| Selects objects having the prescribed geometry type.
|
| Applicability:
| Faces: PLANE, CYLINDER, CONE, SPHERE, TORUS, BEZIER, BSPLINE, REVOLUTION, EXTRUSION, OFFSET, OTHER
| Edges: LINE, CIRCLE, ELLIPSE, HYPERBOLA, PARABOLA, BEZIER, BSPLINE, OFFSET, OTHER
|
| You can use the string selector syntax. For example this::
|
| CQ(aCube).faces(TypeSelector("PLANE"))
|
| will select 6 faces, and is equivalent to::
|
| CQ(aCube).faces("%PLANE")
|
| Method resolution order:
| TypeSelector
| Selector
| builtins.object
|
| Methods defined here:
|
| __init__(self, typeString: str)
| Initialize self. See help(type(self)) for accurate signature.
|
| filter(self, objectList: Sequence[~Shape]) -> List[~Shape]
| Filter the provided list.
|
| The default implementation returns the original list unfiltered.
|
| :param objectList: list to filter
| :type objectList: list of OCCT primitives
| :return: filtered list
|
| ----------------------------------------------------------------------
| Methods inherited from Selector:
|
| __add__(self, other)
|
| __and__(self, other)
|
| __neg__(self)
|
| __sub__(self, other)
|
| ----------------------------------------------------------------------
| Data descriptors inherited from Selector:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
cadquery.UnitLiterals
Python Library Documentation: _LiteralGenericAlias in module typing
Literal = typing.Literal
Special typing form to define literal types (a.k.a. value types).
This form can be used to indicate to type checkers that the corresponding
variable or function parameter has a value equivalent to the provided
literal (or one of several literals)::
def validate_simple(data: Any) -> Literal[True]: # always returns True
...
MODE = Literal['r', 'rb', 'w', 'wb']
def open_helper(file: str, mode: MODE) -> str:
...
open_helper('/some/path', 'r') # Passes type check
open_helper('/other/path', 'typo') # Error in type checker
Literal[...] cannot be subclassed. At runtime, an arbitrary value
is allowed as type argument to Literal[...], but type checkers may
impose restrictions.
cadquery.Vector
Python Library Documentation: class Vector in module cadquery.occ_impl.geom
class Vector(builtins.object)
| Vector(*args)
|
| Create a 3-dimensional vector
|
| :param args: a 3D vector, with x-y-z parts.
|
| you can either provide:
| * nothing (in which case the null vector is return)
| * a gp_Vec
| * a vector ( in which case it is copied )
| * a 3-tuple
| * a 2-tuple (z assumed to be 0)
| * three float values: x, y, and z
| * two float values: x,y
|
| Methods defined here:
|
| Center(self) -> 'Vector'
| Return the vector itself
|
| The center of myself is myself.
| Provided so that vectors, vertices, and other shapes all support a
| common interface, when Center() is requested for all objects on the
| stack.
|
| __abs__(self) -> float
|
| __add__(self, v: 'Vector') -> 'Vector'
|
| __eq__(self, other: 'Vector') -> bool
| Return self==value.
|
| __getstate__(self) -> tuple[float, float, float]
| Helper for pickle.
|
| __init__(self, *args)
| Initialize self. See help(type(self)) for accurate signature.
|
| __iter__(self) -> Iterator[float]
|
| __mul__(self, scale: float) -> 'Vector'
|
| __neg__(self) -> 'Vector'
|
| __repr__(self) -> str
| Return repr(self).
|
| __rmul__(self, scale: float) -> 'Vector'
|
| __setstate__(self, state: tuple[float, float, float])
|
| __str__(self) -> str
| Return str(self).
|
| __sub__(self, v: 'Vector') -> 'Vector'
|
| __truediv__(self, denom: float) -> 'Vector'
|
| add(self, v: 'Vector') -> 'Vector'
|
| cross(self, v: 'Vector') -> 'Vector'
|
| distanceToLine(self)
|
| distanceToPlane(self)
|
| dot(self, v: 'Vector') -> float
|
| getAngle(self, v: 'Vector') -> float
|
| getSignedAngle(self, v: 'Vector') -> float
|
| multiply(self, scale: float) -> 'Vector'
| Return a copy multiplied by the provided scalar
|
| normalized(self) -> 'Vector'
| Return a normalized version of this vector
|
| projectToLine(self, line: 'Vector') -> 'Vector'
| Returns a new vector equal to the projection of this Vector onto the line
| represented by Vector <line>
|
| :param args: Vector
|
| Returns the projected vector.
|
| projectToPlane(self, plane: 'Plane') -> 'Vector'
| Vector is projected onto the plane provided as input.
|
| :param args: Plane object
|
| Returns the projected vector.
|
| sub(self, v: 'Vector') -> 'Vector'
|
| toDir(self) -> OCP.OCP.gp.gp_Dir
|
| toPnt(self) -> OCP.OCP.gp.gp_Pnt
|
| toTuple(self) -> Tuple[float, float, float]
|
| transform(self, T: 'Matrix') -> 'Vector'
|
| ----------------------------------------------------------------------
| Readonly properties defined here:
|
| Length
|
| wrapped
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| x
|
| y
|
| z
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __annotations__ = {'_wrapped': <class 'OCP.OCP.gp.gp_Vec'>}
|
| __hash__ = None
cadquery.Vertex
Python Library Documentation: class Vertex in module cadquery.occ_impl.shapes
class Vertex(Shape)
| Vertex(obj: 'TopoDS_Shape', forConstruction: 'bool' = False) -> 'None'
|
| A Single Point in Space
|
| Method resolution order:
| Vertex
| Shape
| builtins.object
|
| Methods defined here:
|
| Center(self) -> 'Vector'
| The center of a vertex is itself!
|
| __init__(self, obj: 'TopoDS_Shape', forConstruction: 'bool' = False) -> 'None'
| Create a vertex
|
| toTuple(self) -> 'tuple[float, float, float]'
|
| ----------------------------------------------------------------------
| Class methods defined here:
|
| makeVertex(x: 'float', y: 'float', z: 'float') -> 'Vertex'
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __annotations__ = {'wrapped': 'TopoDS_Vertex'}
|
| ----------------------------------------------------------------------
| Methods inherited from Shape:
|
| Area(self) -> 'float'
| :returns: The surface area of all faces in this Shape
|
| BoundingBox(self, tolerance: 'float | None' = None) -> 'BoundBox'
| Create a bounding box for this Shape.
|
| :param tolerance: Tolerance value passed to :class:`BoundBox`
| :returns: A :class:`BoundBox` object for this Shape
|
| CenterOfBoundBox(self, tolerance: 'float | None' = None) -> 'Vector'
| :param tolerance: Tolerance passed to the :py:meth:`BoundingBox` method
| :returns: Center of the bounding box of this shape
|
| Closed(self) -> 'bool'
| :returns: The closedness flag
|
| CompSolids(self) -> 'list[CompSolid]'
| :returns: All the compsolids in this Shape
|
| Compounds(self) -> 'list[Compound]'
| :returns: All the compounds in this Shape
|
| Edges(self) -> 'list[Edge]'
| :returns: All the edges in this Shape
|
| Faces(self) -> 'list[Face]'
| :returns: All the faces in this Shape
|
| ShapeType(self) -> 'Shapes'
|
| Shells(self) -> 'list[Shell]'
| :returns: All the shells in this Shape
|
| Solids(self) -> 'list[Solid]'
| :returns: All the solids in this Shape
|
| Vertices(self) -> 'list[Vertex]'
| :returns: All the vertices in this Shape
|
| Volume(self, tol: 'float | None' = None) -> 'float'
| :returns: The volume of this Shape
|
| Wires(self) -> 'list[Wire]'
| :returns: All the wires in this Shape
|
| __add__(self, other: 'Shape') -> 'Shape'
| Fuse self and other.
|
| __and__(self, other: 'Shape') -> 'Compound'
| Set intersection for combining selection results.
|
| __eq__(self, other: 'Any') -> 'bool'
| Return self==value.
|
| __getitem__(self, item: 'int | slice') -> 'Shape'
|
| __getstate__(self) -> 'tuple[BytesIO, bool]'
| Helper for pickle.
|
| __hash__(self) -> 'int'
| Return hash(self).
|
| __iter__(self) -> 'Iterator[Shape]'
| Iterate over subshapes.
|
| __mod__(self, other: 'Shape') -> 'Compound'
| Set difference for combining selection results.
|
| __mul__(self, other: 'Shape') -> 'Shape'
| Intersect self and other.
|
| __or__(self, other: 'Shape') -> 'Compound'
| Set sum for combining selection results.
|
| __setstate__(self, data: 'tuple[BytesIO, bool]') -> 'None'
|
| __sub__(self, other: 'Shape') -> 'Shape'
| Subtract other from self.
|
| __truediv__(self, other: 'Shape') -> 'Shape'
| Split self with other.
|
| ancestors(self, ctx: 'Shape', kind: 'Shapes') -> 'Compound'
| Iterate over ancestors, i.e. shapes of type kind within ctx shape that contain self.
|
| clean(self: 'T') -> 'T'
| Experimental clean using ShapeUpgrade
|
| copy(self: 'T', mesh: 'bool' = False) -> 'T'
| Creates a new object that is a copy of this object.
|
| :param mesh: should I copy the triangulation too (default: False)
| :returns: a copy of the object
|
| cut(self, *toCut: 'Shape', tol: 'float | None' = None) -> 'Shape'
| Remove the positional arguments from this Shape.
|
| :param tol: Fuzzy mode tolerance
|
| distance(self, other: 'Shape') -> 'float'
| Minimal distance between two shapes
|
| distances(self, *others: 'Shape') -> 'Iterator[float]'
| Minimal distances to between self and other shapes
|
| edge(self, selector: 'Selector | str | None' = None) -> 'Edge'
| Select a single edge.
|
| edges(self, selector: 'Selector | str | None' = None) -> 'Shape'
| Select edges.
|
| export(self: 'T', fname: 'str', tolerance: 'float' = 0.1, angularTolerance: 'float' = 0.1, unit: 'UnitLiterals' = 'MM', outputUnit: 'UnitLiterals | None' = None, opt: 'dict[str, Any] | None' = None) -> 'None'
| Export Shape to file.
|
| exportBin(self, f: 'str | BytesIO') -> 'bool'
| Export this shape to a binary BREP file.
|
| exportBrep(self, f: 'str | BytesIO') -> 'bool'
| Export this shape to a BREP file
|
| exportStep(self, fileName: 'str', unit: 'UnitLiterals' = 'MM', outputUnit: 'UnitLiterals | None' = None, **kwargs: 'Any') -> 'IFSelect_ReturnStatus'
| Export this shape to a STEP file.
| kwargs is used to provide additional optional keyword arguments to configure the exporter.
|
| :param fileName: Path and filename for writing.
| :type fileName: str
| :param unit: The internal unit of the model's geometry values. Default "MM".
| :type unit: UnitLiterals
| :param outputUnit: The unit to use in the STEP file header. If None, defaults to the value of ``unit``.
| Use this when you want the output file to declare a different unit than the model's internal unit,
| for example to export a MM model as a STEP file declaring meters.
| :type outputUnit: UnitLiterals or None
| :param write_pcurves: Enable or disable writing parametric curves to the STEP file. Default True.
| If False, writes STEP file without pcurves. This decreases the size of the resulting STEP file.
| :type write_pcurves: bool
| :param precision_mode: Controls the uncertainty value for STEP entities. Specify -1, 0, or 1. Default 0.
| See OCCT documentation.
| :type precision_mode: int
|
| exportStl(self, fileName: 'str', tolerance: 'float' = 0.001, angularTolerance: 'float' = 0.1, ascii: 'bool' = False, relative: 'bool' = True, parallel: 'bool' = True) -> 'bool'
| Exports a shape to a specified STL file.
|
| :param fileName: The path and file name to write the STL output to.
| :param tolerance: A linear deflection setting which limits the distance between a curve and its tessellation.
| Setting this value too low will result in large meshes that can consume computing resources.
| Setting the value too high can result in meshes with a level of detail that is too low.
| Default is 1e-3, which is a good starting point for a range of cases.
| :param angularTolerance: Angular deflection setting which limits the angle between subsequent segments in a polyline. Default is 0.1.
| :param ascii: Export the file as ASCII (True) or binary (False) STL format. Default is binary.
| :param relative: If True, tolerance will be scaled by the size of the edge being meshed. Default is True.
| Setting this value to True may cause large features to become faceted, or small features dense.
| :param parallel: If True, OCCT will use parallel processing to mesh the shape. Default is True.
|
| face(self, selector: 'Selector | str | None' = None) -> 'Face'
| Select a single face.
|
| faces(self, selector: 'Selector | str | None' = None) -> 'Shape'
| Select faces.
|
| facesIntersectedByLine(self, point: 'VectorLike', axis: 'VectorLike', tol: 'float' = 0.0001, direction: "Literal['AlongAxis', 'Opposite'] | None" = None) -> 'list[Face]'
| Computes the intersections between the provided line and the faces of this Shape
|
| :param point: Base point for defining a line
| :param axis: Axis on which the line rests
| :param tol: Intersection tolerance
| :param direction: Valid values: "AlongAxis", "Opposite";
| If specified, will ignore all faces that are not in the specified direction
| including the face where the point lies if it is the case
| :returns: A list of intersected faces sorted by distance from point
|
| filter(self, f: 'Callable[[Shape], bool]') -> 'Compound'
|
| fix(self: 'T') -> 'T'
| Try to fix shape if not valid
|
| fuse(self, *toFuse: 'Shape', glue: 'bool' = False, tol: 'float | None' = None) -> 'Shape'
| Fuse the positional arguments with this Shape.
|
| :param glue: Sets the glue option for the algorithm, which allows
| increasing performance of the intersection of the input shapes
| :param tol: Fuzzy mode tolerance
|
| geomType(self) -> 'Geoms'
| Gets the underlying geometry type.
|
| Implementations can return any values desired, but the values the user
| uses in type filters should correspond to these.
|
| As an example, if a user does::
|
| CQ(object).faces("%mytype")
|
| The expectation is that the geomType attribute will return 'mytype'
|
| The return values depend on the type of the shape:
|
| | Vertex: always 'Vertex'
| | Edge: LINE, CIRCLE, ELLIPSE, HYPERBOLA, PARABOLA, BEZIER,
| | BSPLINE, OFFSET, OTHER
| | Face: PLANE, CYLINDER, CONE, SPHERE, TORUS, BEZIER, BSPLINE,
| | REVOLUTION, EXTRUSION, OFFSET, OTHER
| | Solid: 'Solid'
| | Shell: 'Shell'
| | Compound: 'Compound'
| | Wire: 'Wire'
|
| :returns: A string according to the geometry type
|
| hashCode(self) -> 'int'
| Returns a hashed value denoting this shape. It is computed from the
| TShape and the Location. The Orientation is not used.
|
| intersect(self, *toIntersect: 'Shape', tol: 'float | None' = None) -> 'Shape'
| Intersection of the positional arguments and this Shape.
|
| :param tol: Fuzzy mode tolerance
|
| isEqual(self, other: 'Shape') -> 'bool'
| Returns True if two shapes are equal, i.e. if they share the same
| TShape with the same Locations and Orientations. Also see
| :py:meth:`isSame`.
|
| isNull(self) -> 'bool'
| Returns true if this shape is null. In other words, it references no
| underlying shape with the potential to be given a location and an
| orientation.
|
| isSame(self, other: 'Shape') -> 'bool'
| Returns True if other and this shape are same, i.e. if they share the
| same TShape with the same Locations. Orientations may differ. Also see
| :py:meth:`isEqual`
|
| isValid(self) -> 'bool'
| Returns True if no defect is detected on the shape S or any of its
| subshapes. See the OCCT docs on BRepCheck_Analyzer::IsValid for a full
| description of what is checked.
|
| locate(self: 'T', loc: 'Location') -> 'T'
| Apply a location in absolute sense to self.
|
| located(self: 'T', loc: 'Location') -> 'T'
| Apply a location in absolute sense to a copy of self.
|
| location(self) -> 'Location'
| Return the current location
|
| mesh(self, tolerance: 'float', angularTolerance: 'float' = 0.1) -> 'None'
| Generate triangulation if none exists.
|
| mirror(self, mirrorPlane: "Literal['XY', 'YX', 'XZ', 'ZX', 'YZ', 'ZY'] | VectorLike" = 'XY', basePointVector: 'VectorLike' = (0, 0, 0)) -> 'Shape'
| Applies a mirror transform to this Shape. Does not duplicate objects
| about the plane.
|
| :param mirrorPlane: The direction of the plane to mirror about - one of
| 'XY', 'XZ' or 'YZ'
| :param basePointVector: The origin of the plane to mirror about
| :returns: The mirrored shape
|
| move(self: 'T', loc: 'Location') -> 'T'
| move(self: 'T', loc: 'Location') -> 'T'
|
| Apply a location in relative sense (i.e. update current location) to self.
|
|
| move(self: 'T', x: 'Real' = 0, y: 'Real' = 0, z: 'Real' = 0, rx: 'Real' = 0, ry: 'Real' = 0, rz: 'Real' = 0) -> 'T'
|
| Apply translation and rotation in relative sense (i.e. update current location) to self.
|
|
| move(self: 'T', loc: 'VectorLike') -> 'T'
|
| Apply a VectorLike in relative sense (i.e. update current location) to self.
|
| moved(self: 'T', s: 'Shape') -> 'Shape'
| moved(self: 'T', loc: 'Location') -> 'T'
|
| Apply a location in relative sense (i.e. update current location) to a copy of self.
|
|
| moved(self: 'T', x: 'Real' = 0, y: 'Real' = 0, z: 'Real' = 0, rx: 'Real' = 0, ry: 'Real' = 0, rz: 'Real' = 0) -> 'T'
|
| Apply translation and rotation in relative sense to a copy of self.
|
|
| moved(self: 'T', loc: 'VectorLike') -> 'T'
|
| Apply a VectorLike in relative sense to a copy of self.
|
| remove(self, *subshape: 'Shape') -> 'Self'
| Remove subshapes.
|
| replace(self, old: 'Shape', *new: 'Shape') -> 'Self'
| Replace old subshape with new subshapes.
|
| reverse(self) -> 'Shape'
| Return a copy of self with reversed orientation.
|
| rotate(self: 'T', startVector: 'VectorLike', endVector: 'VectorLike', angleDegrees: 'float') -> 'T'
| Rotates a shape around an axis.
|
| :param startVector: start point of rotation axis
| :type startVector: either a 3-tuple or a Vector
| :param endVector: end point of rotation axis
| :type endVector: either a 3-tuple or a Vector
| :param angleDegrees: angle to rotate, in degrees
| :returns: a copy of the shape, rotated
|
| scale(self, factor: 'float') -> 'Shape'
| Scales this shape through a transformation.
|
| shell(self, selector: 'Selector | str | None' = None) -> 'Shell'
| Select a single shell.
|
| shells(self, selector: 'Selector | str | None' = None) -> 'Shape'
| Select shells.
|
| siblings(self, ctx: 'Shape', kind: 'Shapes', level: 'int | Iterable[int]' = 1) -> 'Compound'
| Iterate over siblings, i.e. shapes within ctx shape that share subshapes of type kind with self.
|
| size(self) -> 'int'
| Simple size implementation.
|
| solid(self, selector: 'Selector | str | None' = None) -> 'Solid'
| Select a single solid.
|
| solids(self, selector: 'Selector | str | None' = None) -> 'Shape'
| Select solids.
|
| sort(self, key: 'Callable[[Shape], Any]') -> 'Compound'
|
| split(self, *splitters: 'Shape') -> 'Shape'
| Split this shape with the positional arguments.
|
| tessellate(self, tolerance: 'float', angularTolerance: 'float' = 0.1) -> 'tuple[list[Vector], list[tuple[int, int, int]]]'
|
| toLocs(self) -> 'list[Location]'
| Convert self to a list of locations.
|
| toNURBS(self: 'T') -> 'T'
| Return a NURBS representation of a given shape.
|
| toSplines(self: 'T', degree: 'int' = 3, tolerance: 'float' = 0.001, nurbs: 'bool' = False) -> 'T'
| Approximate shape with b-splines of the specified degree.
|
| :param degree: Maximum degree.
| :param tolerance: Approximation tolerance.
| :param nurbs: Use rational splines.
|
| toVtkPolyData(self, tolerance: 'float | None' = None, angularTolerance: 'float | None' = None, normals: 'bool' = False) -> 'vtkPolyData'
| Convert shape to vtkPolyData
|
| transformGeometry(self, tMatrix: 'Matrix') -> 'Shape'
| Transforms this shape by tMatrix.
|
| WARNING: transformGeometry will sometimes convert lines and circles to
| splines, but it also has the ability to handle skew and stretching
| transformations.
|
| If your transformation is only translation and rotation, it is safer to
| use :py:meth:`transformShape`, which doesn't change the underlying type
| of the geometry, but cannot handle skew transformations.
|
| :param tMatrix: The transformation matrix
| :returns: a copy of the object, but with geometry transformed instead
| of just rotated.
|
| transformShape(self, tMatrix: 'Matrix') -> 'Shape'
| Transforms this Shape by tMatrix. Also see :py:meth:`transformGeometry`.
|
| :param tMatrix: The transformation matrix
| :returns: a copy of the object, transformed by the provided matrix,
| with all objects keeping their type
|
| translate(self: 'T', vector: 'VectorLike') -> 'T'
| Translates this shape through a transformation.
|
| vertex(self, selector: 'Selector | str | None' = None) -> 'Vertex'
| Select a single vertex.
|
| vertices(self, selector: 'Selector | str | None' = None) -> 'Shape'
| Select vertices.
|
| wire(self, selector: 'Selector | str | None' = None) -> 'Wire'
| Select a single wire.
|
| wires(self, selector: 'Selector | str | None' = None) -> 'Shape'
| Select wires.
|
| ----------------------------------------------------------------------
| Class methods inherited from Shape:
|
| cast(obj: 'TopoDS_Shape', forConstruction: 'bool' = False) -> 'Shape'
| Returns the right type of wrapper, given a OCCT object
|
| importBin(f: 'str | BytesIO') -> 'Shape'
| Import shape from a binary BREP file.
|
| importBrep(f: 'str | BytesIO') -> 'Shape'
| Import shape from a BREP file
|
| ----------------------------------------------------------------------
| Static methods inherited from Shape:
|
| CombinedCenter(objects: 'Iterable[Shape]') -> 'Vector'
| Calculates the center of mass of multiple objects.
|
| :param objects: A list of objects with mass
|
| CombinedCenterOfBoundBox(objects: 'list[Shape]') -> 'Vector'
| Calculates the center of a bounding box of multiple objects.
|
| :param objects: A list of objects
|
| centerOfMass(obj: 'Shape') -> 'Vector'
| Calculates the center of 'mass' of an object.
|
| :param obj: Compute the center of mass of this object
|
| computeMass(obj: 'Shape', tol: 'float | None' = None) -> 'float'
| Calculates the 'mass' of an object.
|
| :param obj: Compute the mass of this object
| :param tol: Numerical integration tolerance (optional).
|
| matrixOfInertia(obj: 'Shape') -> 'list[list[float]]'
| Calculates the matrix of inertia of an object.
| Since the part's density is unknown, this result is inertia/density with units of [1/length].
| :param obj: Compute the matrix of inertia of this object
|
| ----------------------------------------------------------------------
| Data descriptors inherited from Shape:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
cadquery.Wire
Python Library Documentation: class Wire in module cadquery.occ_impl.shapes
class Wire(Shape, Mixin1D)
| Wire(obj: 'TopoDS_Shape') -> 'None'
|
| A series of connected, ordered Edges, that typically bounds a Face
|
| Method resolution order:
| Wire
| Shape
| Mixin1D
| builtins.object
|
| Methods defined here:
|
| Vertices(self) -> 'list[Vertex]'
| Ordered list of vertices of the wire.
|
| __iter__(self) -> 'Iterator[Edge]'
| Iterate over edges in an ordered way.
|
| chamfer2D(self, d: 'float', vertices: 'Iterable[Vertex]') -> 'Wire'
| Apply 2D chamfer to a wire
|
| close(self) -> 'Wire'
| Close a Wire
|
| fillet(self, radius: 'float', vertices: 'Iterable[Vertex] | None' = None) -> 'Wire'
| Apply 2D or 3D fillet to a wire
|
| :param radius: the radius of the fillet, must be > zero
| :param vertices: the vertices to delete (where the fillet will be applied). By default
| all vertices are deleted except ends of open wires.
| :return: A wire with filleted corners
|
| fillet2D(self, radius: 'float', vertices: 'Iterable[Vertex]') -> 'Wire'
| Apply 2D fillet to a wire
|
| offset2D(self, d: 'float', kind: "Literal['arc', 'intersection', 'tangent']" = 'arc') -> 'list[Wire]'
| Offsets a planar wire
|
| stitch(self, other: 'Wire') -> 'Wire'
| Attempt to stitch wires
|
| ----------------------------------------------------------------------
| Class methods defined here:
|
| assembleEdges(listOfEdges: 'Iterable[Edge]') -> 'Wire'
| Attempts to build a wire that consists of the edges in the provided list
|
| :param cls:
| :param listOfEdges: a list of Edge objects. The edges are not to be consecutive.
| :return: a wire with the edges assembled
|
| BRepBuilderAPI_MakeWire::Error() values:
|
| * BRepBuilderAPI_WireDone = 0
| * BRepBuilderAPI_EmptyWire = 1
| * BRepBuilderAPI_DisconnectedWire = 2
| * BRepBuilderAPI_NonManifoldWire = 3
|
| combine(listOfWires: 'Iterable[Wire | Edge]', tol: 'float' = 1e-09) -> 'list[Wire]'
| Attempt to combine a list of wires and edges into a new wire.
|
| :param cls:
| :param listOfWires:
| :param tol: default 1e-9
| :return: list[Wire]
|
| makeCircle(radius: 'float', center: 'VectorLike', normal: 'VectorLike') -> 'Wire'
| Makes a Circle centered at the provided point, having normal in the provided direction
|
| :param radius: floating point radius of the circle, must be > 0
| :param center: vector representing the center of the circle
| :param normal: vector representing the direction of the plane the circle should lie in
|
| makeEllipse(x_radius: 'float', y_radius: 'float', center: 'VectorLike', normal: 'VectorLike', xDir: 'VectorLike', angle1: 'float' = 360.0, angle2: 'float' = 360.0, rotation_angle: 'float' = 0.0, closed: 'bool' = True) -> 'Wire'
| Makes an Ellipse centered at the provided point, having normal in the provided direction
|
| :param x_radius: floating point major radius of the ellipse (x-axis), must be > 0
| :param y_radius: floating point minor radius of the ellipse (y-axis), must be > 0
| :param center: vector representing the center of the circle
| :param normal: vector representing the direction of the plane the circle should lie in
| :param angle1: start angle of arc
| :param angle2: end angle of arc
| :param rotation_angle: angle to rotate the created ellipse / arc
|
| makeHelix(pitch: 'float', height: 'float', radius: 'float', center: 'VectorLike' = Vector: (0.0, 0.0, 0.0), dir: 'VectorLike' = Vector: (0.0, 0.0, 1.0), angle: 'float' = 360.0, lefthand: 'bool' = False) -> 'Wire'
| Make a helix with a given pitch, height and radius
| By default a cylindrical surface is used to create the helix. If
| the fourth parameter is set (the apex given in degree) a conical surface is used instead'
|
| makePolygon(listOfVertices: 'Iterable[VectorLike]', forConstruction: 'bool' = False, close: 'bool' = False) -> 'Wire'
| Construct a polygonal wire from points.
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __annotations__ = {'wrapped': 'TopoDS_Wire'}
|
| ----------------------------------------------------------------------
| Methods inherited from Shape:
|
| Area(self) -> 'float'
| :returns: The surface area of all faces in this Shape
|
| BoundingBox(self, tolerance: 'float | None' = None) -> 'BoundBox'
| Create a bounding box for this Shape.
|
| :param tolerance: Tolerance value passed to :class:`BoundBox`
| :returns: A :class:`BoundBox` object for this Shape
|
| Center(self) -> 'Vector'
| :returns: The point of the center of mass of this Shape
|
| CenterOfBoundBox(self, tolerance: 'float | None' = None) -> 'Vector'
| :param tolerance: Tolerance passed to the :py:meth:`BoundingBox` method
| :returns: Center of the bounding box of this shape
|
| Closed(self) -> 'bool'
| :returns: The closedness flag
|
| CompSolids(self) -> 'list[CompSolid]'
| :returns: All the compsolids in this Shape
|
| Compounds(self) -> 'list[Compound]'
| :returns: All the compounds in this Shape
|
| Edges(self) -> 'list[Edge]'
| :returns: All the edges in this Shape
|
| Faces(self) -> 'list[Face]'
| :returns: All the faces in this Shape
|
| ShapeType(self) -> 'Shapes'
|
| Shells(self) -> 'list[Shell]'
| :returns: All the shells in this Shape
|
| Solids(self) -> 'list[Solid]'
| :returns: All the solids in this Shape
|
| Volume(self, tol: 'float | None' = None) -> 'float'
| :returns: The volume of this Shape
|
| Wires(self) -> 'list[Wire]'
| :returns: All the wires in this Shape
|
| __add__(self, other: 'Shape') -> 'Shape'
| Fuse self and other.
|
| __and__(self, other: 'Shape') -> 'Compound'
| Set intersection for combining selection results.
|
| __eq__(self, other: 'Any') -> 'bool'
| Return self==value.
|
| __getitem__(self, item: 'int | slice') -> 'Shape'
|
| __getstate__(self) -> 'tuple[BytesIO, bool]'
| Helper for pickle.
|
| __hash__(self) -> 'int'
| Return hash(self).
|
| __init__(self, obj: 'TopoDS_Shape') -> 'None'
| Initialize self. See help(type(self)) for accurate signature.
|
| __mod__(self, other: 'Shape') -> 'Compound'
| Set difference for combining selection results.
|
| __mul__(self, other: 'Shape') -> 'Shape'
| Intersect self and other.
|
| __or__(self, other: 'Shape') -> 'Compound'
| Set sum for combining selection results.
|
| __setstate__(self, data: 'tuple[BytesIO, bool]') -> 'None'
|
| __sub__(self, other: 'Shape') -> 'Shape'
| Subtract other from self.
|
| __truediv__(self, other: 'Shape') -> 'Shape'
| Split self with other.
|
| ancestors(self, ctx: 'Shape', kind: 'Shapes') -> 'Compound'
| Iterate over ancestors, i.e. shapes of type kind within ctx shape that contain self.
|
| clean(self: 'T') -> 'T'
| Experimental clean using ShapeUpgrade
|
| copy(self: 'T', mesh: 'bool' = False) -> 'T'
| Creates a new object that is a copy of this object.
|
| :param mesh: should I copy the triangulation too (default: False)
| :returns: a copy of the object
|
| cut(self, *toCut: 'Shape', tol: 'float | None' = None) -> 'Shape'
| Remove the positional arguments from this Shape.
|
| :param tol: Fuzzy mode tolerance
|
| distance(self, other: 'Shape') -> 'float'
| Minimal distance between two shapes
|
| distances(self, *others: 'Shape') -> 'Iterator[float]'
| Minimal distances to between self and other shapes
|
| edge(self, selector: 'Selector | str | None' = None) -> 'Edge'
| Select a single edge.
|
| edges(self, selector: 'Selector | str | None' = None) -> 'Shape'
| Select edges.
|
| export(self: 'T', fname: 'str', tolerance: 'float' = 0.1, angularTolerance: 'float' = 0.1, unit: 'UnitLiterals' = 'MM', outputUnit: 'UnitLiterals | None' = None, opt: 'dict[str, Any] | None' = None) -> 'None'
| Export Shape to file.
|
| exportBin(self, f: 'str | BytesIO') -> 'bool'
| Export this shape to a binary BREP file.
|
| exportBrep(self, f: 'str | BytesIO') -> 'bool'
| Export this shape to a BREP file
|
| exportStep(self, fileName: 'str', unit: 'UnitLiterals' = 'MM', outputUnit: 'UnitLiterals | None' = None, **kwargs: 'Any') -> 'IFSelect_ReturnStatus'
| Export this shape to a STEP file.
| kwargs is used to provide additional optional keyword arguments to configure the exporter.
|
| :param fileName: Path and filename for writing.
| :type fileName: str
| :param unit: The internal unit of the model's geometry values. Default "MM".
| :type unit: UnitLiterals
| :param outputUnit: The unit to use in the STEP file header. If None, defaults to the value of ``unit``.
| Use this when you want the output file to declare a different unit than the model's internal unit,
| for example to export a MM model as a STEP file declaring meters.
| :type outputUnit: UnitLiterals or None
| :param write_pcurves: Enable or disable writing parametric curves to the STEP file. Default True.
| If False, writes STEP file without pcurves. This decreases the size of the resulting STEP file.
| :type write_pcurves: bool
| :param precision_mode: Controls the uncertainty value for STEP entities. Specify -1, 0, or 1. Default 0.
| See OCCT documentation.
| :type precision_mode: int
|
| exportStl(self, fileName: 'str', tolerance: 'float' = 0.001, angularTolerance: 'float' = 0.1, ascii: 'bool' = False, relative: 'bool' = True, parallel: 'bool' = True) -> 'bool'
| Exports a shape to a specified STL file.
|
| :param fileName: The path and file name to write the STL output to.
| :param tolerance: A linear deflection setting which limits the distance between a curve and its tessellation.
| Setting this value too low will result in large meshes that can consume computing resources.
| Setting the value too high can result in meshes with a level of detail that is too low.
| Default is 1e-3, which is a good starting point for a range of cases.
| :param angularTolerance: Angular deflection setting which limits the angle between subsequent segments in a polyline. Default is 0.1.
| :param ascii: Export the file as ASCII (True) or binary (False) STL format. Default is binary.
| :param relative: If True, tolerance will be scaled by the size of the edge being meshed. Default is True.
| Setting this value to True may cause large features to become faceted, or small features dense.
| :param parallel: If True, OCCT will use parallel processing to mesh the shape. Default is True.
|
| face(self, selector: 'Selector | str | None' = None) -> 'Face'
| Select a single face.
|
| faces(self, selector: 'Selector | str | None' = None) -> 'Shape'
| Select faces.
|
| facesIntersectedByLine(self, point: 'VectorLike', axis: 'VectorLike', tol: 'float' = 0.0001, direction: "Literal['AlongAxis', 'Opposite'] | None" = None) -> 'list[Face]'
| Computes the intersections between the provided line and the faces of this Shape
|
| :param point: Base point for defining a line
| :param axis: Axis on which the line rests
| :param tol: Intersection tolerance
| :param direction: Valid values: "AlongAxis", "Opposite";
| If specified, will ignore all faces that are not in the specified direction
| including the face where the point lies if it is the case
| :returns: A list of intersected faces sorted by distance from point
|
| filter(self, f: 'Callable[[Shape], bool]') -> 'Compound'
|
| fix(self: 'T') -> 'T'
| Try to fix shape if not valid
|
| fuse(self, *toFuse: 'Shape', glue: 'bool' = False, tol: 'float | None' = None) -> 'Shape'
| Fuse the positional arguments with this Shape.
|
| :param glue: Sets the glue option for the algorithm, which allows
| increasing performance of the intersection of the input shapes
| :param tol: Fuzzy mode tolerance
|
| geomType(self) -> 'Geoms'
| Gets the underlying geometry type.
|
| Implementations can return any values desired, but the values the user
| uses in type filters should correspond to these.
|
| As an example, if a user does::
|
| CQ(object).faces("%mytype")
|
| The expectation is that the geomType attribute will return 'mytype'
|
| The return values depend on the type of the shape:
|
| | Vertex: always 'Vertex'
| | Edge: LINE, CIRCLE, ELLIPSE, HYPERBOLA, PARABOLA, BEZIER,
| | BSPLINE, OFFSET, OTHER
| | Face: PLANE, CYLINDER, CONE, SPHERE, TORUS, BEZIER, BSPLINE,
| | REVOLUTION, EXTRUSION, OFFSET, OTHER
| | Solid: 'Solid'
| | Shell: 'Shell'
| | Compound: 'Compound'
| | Wire: 'Wire'
|
| :returns: A string according to the geometry type
|
| hashCode(self) -> 'int'
| Returns a hashed value denoting this shape. It is computed from the
| TShape and the Location. The Orientation is not used.
|
| intersect(self, *toIntersect: 'Shape', tol: 'float | None' = None) -> 'Shape'
| Intersection of the positional arguments and this Shape.
|
| :param tol: Fuzzy mode tolerance
|
| isEqual(self, other: 'Shape') -> 'bool'
| Returns True if two shapes are equal, i.e. if they share the same
| TShape with the same Locations and Orientations. Also see
| :py:meth:`isSame`.
|
| isNull(self) -> 'bool'
| Returns true if this shape is null. In other words, it references no
| underlying shape with the potential to be given a location and an
| orientation.
|
| isSame(self, other: 'Shape') -> 'bool'
| Returns True if other and this shape are same, i.e. if they share the
| same TShape with the same Locations. Orientations may differ. Also see
| :py:meth:`isEqual`
|
| isValid(self) -> 'bool'
| Returns True if no defect is detected on the shape S or any of its
| subshapes. See the OCCT docs on BRepCheck_Analyzer::IsValid for a full
| description of what is checked.
|
| locate(self: 'T', loc: 'Location') -> 'T'
| Apply a location in absolute sense to self.
|
| located(self: 'T', loc: 'Location') -> 'T'
| Apply a location in absolute sense to a copy of self.
|
| location(self) -> 'Location'
| Return the current location
|
| mesh(self, tolerance: 'float', angularTolerance: 'float' = 0.1) -> 'None'
| Generate triangulation if none exists.
|
| mirror(self, mirrorPlane: "Literal['XY', 'YX', 'XZ', 'ZX', 'YZ', 'ZY'] | VectorLike" = 'XY', basePointVector: 'VectorLike' = (0, 0, 0)) -> 'Shape'
| Applies a mirror transform to this Shape. Does not duplicate objects
| about the plane.
|
| :param mirrorPlane: The direction of the plane to mirror about - one of
| 'XY', 'XZ' or 'YZ'
| :param basePointVector: The origin of the plane to mirror about
| :returns: The mirrored shape
|
| move(self: 'T', loc: 'Location') -> 'T'
| move(self: 'T', loc: 'Location') -> 'T'
|
| Apply a location in relative sense (i.e. update current location) to self.
|
|
| move(self: 'T', x: 'Real' = 0, y: 'Real' = 0, z: 'Real' = 0, rx: 'Real' = 0, ry: 'Real' = 0, rz: 'Real' = 0) -> 'T'
|
| Apply translation and rotation in relative sense (i.e. update current location) to self.
|
|
| move(self: 'T', loc: 'VectorLike') -> 'T'
|
| Apply a VectorLike in relative sense (i.e. update current location) to self.
|
| moved(self: 'T', s: 'Shape') -> 'Shape'
| moved(self: 'T', loc: 'Location') -> 'T'
|
| Apply a location in relative sense (i.e. update current location) to a copy of self.
|
|
| moved(self: 'T', x: 'Real' = 0, y: 'Real' = 0, z: 'Real' = 0, rx: 'Real' = 0, ry: 'Real' = 0, rz: 'Real' = 0) -> 'T'
|
| Apply translation and rotation in relative sense to a copy of self.
|
|
| moved(self: 'T', loc: 'VectorLike') -> 'T'
|
| Apply a VectorLike in relative sense to a copy of self.
|
| remove(self, *subshape: 'Shape') -> 'Self'
| Remove subshapes.
|
| replace(self, old: 'Shape', *new: 'Shape') -> 'Self'
| Replace old subshape with new subshapes.
|
| reverse(self) -> 'Shape'
| Return a copy of self with reversed orientation.
|
| rotate(self: 'T', startVector: 'VectorLike', endVector: 'VectorLike', angleDegrees: 'float') -> 'T'
| Rotates a shape around an axis.
|
| :param startVector: start point of rotation axis
| :type startVector: either a 3-tuple or a Vector
| :param endVector: end point of rotation axis
| :type endVector: either a 3-tuple or a Vector
| :param angleDegrees: angle to rotate, in degrees
| :returns: a copy of the shape, rotated
|
| scale(self, factor: 'float') -> 'Shape'
| Scales this shape through a transformation.
|
| shell(self, selector: 'Selector | str | None' = None) -> 'Shell'
| Select a single shell.
|
| shells(self, selector: 'Selector | str | None' = None) -> 'Shape'
| Select shells.
|
| siblings(self, ctx: 'Shape', kind: 'Shapes', level: 'int | Iterable[int]' = 1) -> 'Compound'
| Iterate over siblings, i.e. shapes within ctx shape that share subshapes of type kind with self.
|
| size(self) -> 'int'
| Simple size implementation.
|
| solid(self, selector: 'Selector | str | None' = None) -> 'Solid'
| Select a single solid.
|
| solids(self, selector: 'Selector | str | None' = None) -> 'Shape'
| Select solids.
|
| sort(self, key: 'Callable[[Shape], Any]') -> 'Compound'
|
| split(self, *splitters: 'Shape') -> 'Shape'
| Split this shape with the positional arguments.
|
| tessellate(self, tolerance: 'float', angularTolerance: 'float' = 0.1) -> 'tuple[list[Vector], list[tuple[int, int, int]]]'
|
| toLocs(self) -> 'list[Location]'
| Convert self to a list of locations.
|
| toNURBS(self: 'T') -> 'T'
| Return a NURBS representation of a given shape.
|
| toSplines(self: 'T', degree: 'int' = 3, tolerance: 'float' = 0.001, nurbs: 'bool' = False) -> 'T'
| Approximate shape with b-splines of the specified degree.
|
| :param degree: Maximum degree.
| :param tolerance: Approximation tolerance.
| :param nurbs: Use rational splines.
|
| toVtkPolyData(self, tolerance: 'float | None' = None, angularTolerance: 'float | None' = None, normals: 'bool' = False) -> 'vtkPolyData'
| Convert shape to vtkPolyData
|
| transformGeometry(self, tMatrix: 'Matrix') -> 'Shape'
| Transforms this shape by tMatrix.
|
| WARNING: transformGeometry will sometimes convert lines and circles to
| splines, but it also has the ability to handle skew and stretching
| transformations.
|
| If your transformation is only translation and rotation, it is safer to
| use :py:meth:`transformShape`, which doesn't change the underlying type
| of the geometry, but cannot handle skew transformations.
|
| :param tMatrix: The transformation matrix
| :returns: a copy of the object, but with geometry transformed instead
| of just rotated.
|
| transformShape(self, tMatrix: 'Matrix') -> 'Shape'
| Transforms this Shape by tMatrix. Also see :py:meth:`transformGeometry`.
|
| :param tMatrix: The transformation matrix
| :returns: a copy of the object, transformed by the provided matrix,
| with all objects keeping their type
|
| translate(self: 'T', vector: 'VectorLike') -> 'T'
| Translates this shape through a transformation.
|
| vertex(self, selector: 'Selector | str | None' = None) -> 'Vertex'
| Select a single vertex.
|
| vertices(self, selector: 'Selector | str | None' = None) -> 'Shape'
| Select vertices.
|
| wire(self, selector: 'Selector | str | None' = None) -> 'Wire'
| Select a single wire.
|
| wires(self, selector: 'Selector | str | None' = None) -> 'Shape'
| Select wires.
|
| ----------------------------------------------------------------------
| Class methods inherited from Shape:
|
| cast(obj: 'TopoDS_Shape', forConstruction: 'bool' = False) -> 'Shape'
| Returns the right type of wrapper, given a OCCT object
|
| importBin(f: 'str | BytesIO') -> 'Shape'
| Import shape from a binary BREP file.
|
| importBrep(f: 'str | BytesIO') -> 'Shape'
| Import shape from a BREP file
|
| ----------------------------------------------------------------------
| Static methods inherited from Shape:
|
| CombinedCenter(objects: 'Iterable[Shape]') -> 'Vector'
| Calculates the center of mass of multiple objects.
|
| :param objects: A list of objects with mass
|
| CombinedCenterOfBoundBox(objects: 'list[Shape]') -> 'Vector'
| Calculates the center of a bounding box of multiple objects.
|
| :param objects: A list of objects
|
| centerOfMass(obj: 'Shape') -> 'Vector'
| Calculates the center of 'mass' of an object.
|
| :param obj: Compute the center of mass of this object
|
| computeMass(obj: 'Shape', tol: 'float | None' = None) -> 'float'
| Calculates the 'mass' of an object.
|
| :param obj: Compute the mass of this object
| :param tol: Numerical integration tolerance (optional).
|
| matrixOfInertia(obj: 'Shape') -> 'list[list[float]]'
| Calculates the matrix of inertia of an object.
| Since the part's density is unknown, this result is inertia/density with units of [1/length].
| :param obj: Compute the matrix of inertia of this object
|
| ----------------------------------------------------------------------
| Data descriptors inherited from Shape:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Methods inherited from Mixin1D:
|
| IsClosed(self: 'Mixin1DProtocol') -> 'bool'
|
| Length(self: 'Mixin1DProtocol') -> 'float'
|
| bounds(self: 'Mixin1DProtocol') -> 'tuple[float, float]'
| Parametric bounds of the curve.
|
| curvatureAt(self: 'Mixin1DProtocol', d: 'float', mode: 'ParamMode' = 'length', resolution: 'float' = 1e-06) -> 'float'
| Calculate mean curvature along the underlying curve.
|
| :param d: distance or parameter value
| :param mode: position calculation mode (default: length)
| :param resolution: resolution of the calculation (default: 1e-6)
| :return: mean curvature value at the specified d value.
|
| curvatures(self: 'Mixin1DProtocol', ds: 'Iterable[float]', mode: 'ParamMode' = 'length', resolution: 'float' = 1e-06) -> 'list[float]'
| Calculate mean curvatures along the underlying curve.
|
| :param d: distance or parameter values
| :param mode: position calculation mode (default: length)
| :param resolution: resolution of the calculation (default: 1e-6)
| :return: mean curvature value at the specified d value.
|
| endPoint(self: 'Mixin1DProtocol') -> 'Vector'
| :return: a vector representing the end point of this edge.
|
| Note, circles may have the start and end points the same
|
| locationAt(self: 'Mixin1DProtocol', d: 'float', mode: 'ParamMode' = 'length', frame: 'FrameMode' = 'frenet', planar: 'bool' = False) -> 'Location'
| Generate a location along the underlying curve.
|
| :param d: distance or parameter value
| :param mode: position calculation mode (default: length)
| :param frame: moving frame calculation method (default: frenet)
| :param planar: planar mode
| :return: A Location object representing local coordinate system at the specified distance.
|
| locations(self: 'Mixin1DProtocol', ds: 'Iterable[float]', mode: 'ParamMode' = 'length', frame: 'FrameMode' = 'frenet', planar: 'bool' = False) -> 'list[Location]'
| Generate locations along the curve.
|
| :param ds: distance or parameter values
| :param mode: position calculation mode (default: length)
| :param frame: moving frame calculation method (default: frenet)
| :param planar: planar mode
| :return: A list of Location objects representing local coordinate systems at the specified distances.
|
| normal(self: 'Mixin1DProtocol') -> 'Vector'
| Calculate the normal Vector. Only possible for planar curves.
|
| :return: normal vector
|
| paramAt(self: 'Mixin1DProtocol', d: 'Real | Vector') -> 'float'
| Compute parameter value at the specified normalized distance or a point.
|
| :param d: normalized distance [0, 1] or a point
| :return: parameter value
|
| params(self: 'Mixin1DProtocol', pts: 'Iterable[Vector]', tol: 'float' = 1e-06) -> 'list[float]'
| Computes u values closest to given vectors.
|
| :param pts: the points to compute the parameters at.
| :return: list of u values.
|
| paramsLength(self: 'Mixin1DProtocol', locations: 'Iterable[float]') -> 'list[float]'
| Computes u values at given relative lengths.
|
| :param locations: list of distances.
| :returns: list of u values.
| :param pts: the points to compute the parameters at.
|
| positionAt(self: 'Mixin1DProtocol', d: 'float', mode: 'ParamMode' = 'length') -> 'Vector'
| Generate a position along the underlying curve.
|
| :param d: distance or parameter value
| :param mode: position calculation mode (default: length)
| :return: A Vector on the underlying curve located at the specified d value.
|
| positions(self: 'Mixin1DProtocol', ds: 'Iterable[float]', mode: 'ParamMode' = 'length') -> 'list[Vector]'
| Generate positions along the underlying curve.
|
| :param ds: distance or parameter values
| :param mode: position calculation mode (default: length)
| :return: A list of Vector objects.
|
| project(self: 'T1D', face: 'Face', d: 'VectorLike', closest: 'bool' = True) -> 'T1D | list[T1D]'
| Project onto a face along the specified direction.
|
| radius(self: 'Mixin1DProtocol') -> 'float'
| Calculate the radius.
|
| Note that when applied to a Wire, the radius is simply the radius of the first edge.
|
| :return: radius
| :raises ValueError: if kernel can not reduce the shape to a circular edge
|
| sample(self: 'Mixin1DProtocol', n: 'int | float') -> 'tuple[list[Vector], list[float]]'
| Sample a curve based on a number of points or deflection.
|
| :param n: Number of positions or deflection
| :return: A list of Vectors and a list of parameters.
|
| startPoint(self: 'Mixin1DProtocol') -> 'Vector'
| :return: a vector representing the start point of this edge
|
| Note, circles may have the start and end points the same
|
| tangentAt(self: 'Mixin1DProtocol', locationParam: 'float' = 0.5, mode: 'ParamMode' = 'length') -> 'Vector'
| Compute tangent vector at the specified location.
|
| :param locationParam: distance or parameter value (default: 0.5)
| :param mode: position calculation mode (default: length)
| :return: tangent vector
|
| tangents(self: 'Mixin1DProtocol', locations: 'Iterable[float]', mode: 'ParamMode' = 'length') -> 'list[Vector]'
| Compute tangent vectors at the specified locations.
|
| :param locations: list of distances or parameters.
| :param mode: position calculation mode (default: length).
| :return: list of tangent vectors
cadquery.Workplane
Python Library Documentation: class Workplane in module cadquery.cq
class Workplane(builtins.object)
| Workplane(inPlane='XY', origin=(0, 0, 0), obj=None)
|
| Defines a coordinate system in space, in which 2D coordinates can be used.
|
| :param plane: the plane in which the workplane will be done
| :type plane: a Plane object, or a string in (XY|YZ|XZ|front|back|top|bottom|left|right)
| :param origin: the desired origin of the new workplane
| :type origin: a 3-tuple in global coordinates, or None to default to the origin
| :param obj: an object to use initially for the stack
| :type obj: a CAD primitive, or None to use the centerpoint of the plane as the initial
| stack value.
| :raises: ValueError if the provided plane is not a plane, a valid named workplane
| :return: A Workplane object, with coordinate system matching the supplied plane.
|
| The most common use is::
|
| s = Workplane("XY")
|
| After creation, the stack contains a single point, the origin of the underlying plane,
| and the *current point* is on the origin.
|
| .. note::
| You can also create workplanes on the surface of existing faces using
| :meth:`workplane`
|
| Methods defined here:
|
| __add__(self: ~T, other: Union[ForwardRef('Workplane'), cadquery.occ_impl.shapes.Solid, cadquery.occ_impl.shapes.Compound]) -> ~T
| Syntactic sugar for union.
|
| Notice that :code:`r = a + b` is equivalent to :code:`r = a.union(b)` and :code:`r = a | b`.
|
| __and__(self: ~T, other: Union[ForwardRef('Workplane'), cadquery.occ_impl.shapes.Solid, cadquery.occ_impl.shapes.Compound]) -> ~T
| Syntactic sugar for intersect.
|
| Notice that :code:`r = a & b` is equivalent to :code:`r = a.intersect(b)`.
|
| Example::
|
| Box = Workplane("XY").box(1, 1, 1, centered=(False, False, False))
| Sphere = Workplane("XY").sphere(1)
| result = Box & Sphere
|
| __getitem__(self: ~T, item: Union[int, Sequence[int], slice]) -> ~T
|
| __init__(self, inPlane='XY', origin=(0, 0, 0), obj=None)
| make a workplane from a particular plane
|
| :param inPlane: the plane in which the workplane will be done
| :type inPlane: a Plane object, or a string in (XY|YZ|XZ|front|back|top|bottom|left|right)
| :param origin: the desired origin of the new workplane
| :type origin: a 3-tuple in global coordinates, or None to default to the origin
| :param obj: an object to use initially for the stack
| :type obj: a CAD primitive, or None to use the centerpoint of the plane as the initial
| stack value.
| :raises: ValueError if the provided plane is not a plane, or one of XY|YZ|XZ
| :return: A Workplane object, with coordinate system matching the supplied plane.
|
| The most common use is::
|
| s = Workplane("XY")
|
| After creation, the stack contains a single point, the origin of the underlying plane, and
| the *current point* is on the origin.
|
| __iter__(self: ~T) -> Iterator[cadquery.occ_impl.shapes.Shape]
| Special method for iterating over Shapes in objects
|
| __mul__(self: ~T, other: Union[ForwardRef('Workplane'), cadquery.occ_impl.shapes.Solid, cadquery.occ_impl.shapes.Compound]) -> ~T
| Syntactic sugar for intersect.
|
| Notice that :code:`r = a * b` is equivalent to :code:`r = a.intersect(b)`.
|
| Example::
|
| Box = Workplane("XY").box(1, 1, 1, centered=(False, False, False))
| Sphere = Workplane("XY").sphere(1)
| result = Box * Sphere
|
| __or__(self: ~T, other: Union[ForwardRef('Workplane'), cadquery.occ_impl.shapes.Solid, cadquery.occ_impl.shapes.Compound]) -> ~T
| Syntactic sugar for union.
|
| Notice that :code:`r = a | b` is equivalent to :code:`r = a.union(b)` and :code:`r = a + b`.
|
| Example::
|
| Box = Workplane("XY").box(1, 1, 1, centered=(False, False, False))
| Sphere = Workplane("XY").sphere(1)
| result = Box | Sphere
|
| __sub__(self: ~T, other: Union[ForwardRef('Workplane'), cadquery.occ_impl.shapes.Solid, cadquery.occ_impl.shapes.Compound]) -> ~T
| Syntactic sugar for cut.
|
| Notice that :code:`r = a - b` is equivalent to :code:`r = a.cut(b)`.
|
| Example::
|
| Box = Workplane("XY").box(1, 1, 1, centered=(False, False, False))
| Sphere = Workplane("XY").sphere(1)
| result = Box - Sphere
|
| __truediv__(self: ~T, other: Union[ForwardRef('Workplane'), cadquery.occ_impl.shapes.Solid, cadquery.occ_impl.shapes.Compound]) -> ~T
| Syntactic sugar for split.
|
| Notice that :code:`r = a / b` is equivalent to :code:`r = a.split(b)`.
|
| Example::
|
| Box = Workplane("XY").box(1, 1, 1, centered=(False, False, False))
| Sphere = Workplane("XY").sphere(1)
| result = Box / Sphere
|
| add(self, obj)
| Adds an object or a list of objects to the stack
|
| :param obj: an object to add
| :type obj: a Workplane, CAD primitive, or list of CAD primitives
| :return: a Workplane with the requested operation performed
|
| If a Workplane object, the values of that object's stack are added. If
| a list of cad primitives, they are all added. If a single CAD primitive
| then it is added.
|
| Used in rare cases when you need to combine the results of several CQ
| results into a single Workplane object.
|
| all(self: ~T) -> List[~T]
| Return a list of all CQ objects on the stack.
|
| useful when you need to operate on the elements
| individually.
|
| Contrast with vals, which returns the underlying
| objects for all of the items on the stack
|
| ancestors(self: ~T, kind: Literal['Vertex', 'Edge', 'Wire', 'Face', 'Shell', 'Solid', 'CompSolid', 'Compound'], tag: Optional[str] = None) -> ~T
| Select topological ancestors.
|
| :param kind: kind of ancestor, e.g. "Face" or "Edge"
| :param tag: if set, search the tagged object instead of self
| :return: a Workplane object whose stack contains selected ancestors.
|
| apply(self: ~T, f: Callable[[Iterable[Union[cadquery.occ_impl.geom.Vector, cadquery.occ_impl.geom.Location, cadquery.occ_impl.shapes.Shape, cadquery.sketch.Sketch]]], Iterable[Union[cadquery.occ_impl.geom.Vector, cadquery.occ_impl.geom.Location, cadquery.occ_impl.shapes.Shape, cadquery.sketch.Sketch]]]) -> ~T
| Apply a callable to all items at once.
|
| :param f: Callable to be applied.
| :return: Workplane object with f applied to all items.
|
| bezier(self: ~T, listOfXYTuple: Iterable[Union[Tuple[float, float], Tuple[float, float, float], cadquery.occ_impl.geom.Vector]], forConstruction: bool = False, includeCurrent: bool = False, makeWire: bool = False) -> ~T
| Make a cubic Bézier curve by the provided points (2D or 3D).
|
| :param listOfXYTuple: Bezier control points and end point.
| All points except the last point are Bezier control points,
| and the last point is the end point
| :param includeCurrent: Use the current point as a starting point of the curve
| :param makeWire: convert the resulting bezier edge to a wire
| :return: a Workplane object with the current point at the end of the bezier
|
| The Bézier Will begin at either current point or the first point
| of listOfXYTuple, and end with the last point of listOfXYTuple
|
| box(self: ~T, length: float, width: float, height: float, centered: Union[bool, Tuple[bool, bool, bool]] = True, combine: Union[bool, Literal['cut', 'a', 's']] = True, clean: bool = True) -> ~T
| Return a 3d box with specified dimensions for each object on the stack.
|
| :param length: box size in X direction
| :param width: box size in Y direction
| :param height: box size in Z direction
| :param centered: If True, the box will be centered around the reference point.
| If False, the corner of the box will be on the reference point and it will
| extend in the positive x, y and z directions. Can also use a 3-tuple to
| specify centering along each axis.
| :param combine: should the results be combined with other solids on the stack
| (and each other)?
| :param clean: call :meth:`clean` afterwards to have a clean shape
|
| One box is created for each item on the current stack. If no items are on the stack, one box
| using the current workplane center is created.
|
| If combine is true, the result will be a single object on the stack. If a solid was found
| in the chain, the result is that solid with all boxes produced fused onto it otherwise, the
| result is the combination of all the produced boxes.
|
| If combine is false, the result will be a list of the boxes produced.
|
| Most often boxes form the basis for a part::
|
| # make a single box with lower left corner at origin
| s = Workplane().box(1, 2, 3, centered=False)
|
| But sometimes it is useful to create an array of them::
|
| # create 4 small square bumps on a larger base plate:
| s = (
| Workplane()
| .box(4, 4, 0.5)
| .faces(">Z")
| .workplane()
| .rect(3, 3, forConstruction=True)
| .vertices()
| .box(0.25, 0.25, 0.25, combine=True)
| )
|
| cboreHole(self: ~T, diameter: float, cboreDiameter: float, cboreDepth: float, depth: Optional[float] = None, clean: bool = True) -> ~T
| Makes a counterbored hole for each item on the stack.
|
| :param diameter: the diameter of the hole
| :param cboreDiameter: the diameter of the cbore, must be greater than hole diameter
| :param cboreDepth: depth of the counterbore
| :type cboreDepth: float > 0
| :param depth: the depth of the hole
| :type depth: float > 0 or None to drill thru the entire part
| :param clean: call :meth:`clean` afterwards to have a clean shape
|
| The surface of the hole is at the current workplane plane.
|
| One hole is created for each item on the stack. A very common use case is to use a
| construction rectangle to define the centers of a set of holes, like so::
|
| s = (
| Workplane()
| .box(2, 4, 0.5)
| .faces(">Z")
| .workplane()
| .rect(1.5, 3.5, forConstruction=True)
| .vertices()
| .cboreHole(0.125, 0.25, 0.125, depth=None)
| )
|
| This sample creates a plate with a set of holes at the corners.
|
| **Plugin Note**: this is one example of the power of plugins. Counterbored holes are quite
| time consuming to create, but are quite easily defined by users.
|
| see :meth:`cskHole` to make countersinks instead of counterbores
|
| center(self: ~T, x: float, y: float) -> ~T
| Shift local coordinates to the specified location.
|
| The location is specified in terms of local coordinates.
|
| :param x: the new x location
| :param y: the new y location
| :returns: the Workplane object, with the center adjusted.
|
| The current point is set to the new center.
| This method is useful to adjust the center point after it has been created automatically on
| a face, but not where you'd like it to be.
|
| In this example, we adjust the workplane center to be at the corner of a cube, instead of
| the center of a face, which is the default::
|
| # this workplane is centered at x=0.5,y=0.5, the center of the upper face
| s = Workplane().box(1, 1, 1).faces(">Z").workplane()
|
| s = s.center(-0.5, -0.5) # move the center to the corner
| t = s.circle(0.25).extrude(0.2)
| assert t.faces().size() == 9 # a cube with a cylindrical nub at the top right corner
|
| The result is a cube with a round boss on the corner
|
| chamfer(self: ~T, length: float, length2: Optional[float] = None) -> ~T
| Chamfers a solid on the selected edges.
|
| The edges on the stack are chamfered. The solid to which the
| edges belong must be in the parent chain of the selected
| edges.
|
| Optional parameter `length2` can be supplied with a different
| value than `length` for a chamfer that is shorter on one side
| longer on the other side.
|
| :param length: the length of the chamfer, must be greater than zero
| :param length2: optional parameter for asymmetrical chamfer
| :raises ValueError: if at least one edge is not selected
| :raises ValueError: if the solid containing the edge is not in the chain
| :returns: CQ object with the resulting solid selected.
|
| This example will create a unit cube, with the top edges chamfered::
|
| s = Workplane("XY").box(1, 1, 1).faces("+Z").chamfer(0.1)
|
| This example will create chamfers longer on the sides::
|
| s = Workplane("XY").box(1, 1, 1).faces("+Z").chamfer(0.2, 0.1)
|
| circle(self: ~T, radius: float, forConstruction: bool = False) -> ~T
| Make a circle for each item on the stack.
|
| :param radius: radius of the circle
| :param forConstruction: should the new wires be reference geometry only?
| :type forConstruction: true if the wires are for reference, false if they are creating
| part geometry
| :return: a new CQ object with the created wires on the stack
|
| A common use case is to use a for-construction rectangle to define the centers of a
| hole pattern::
|
| s = Workplane().rect(4.0, 4.0, forConstruction=True).vertices().circle(0.25)
|
| Creates 4 circles at the corners of a square centered on the origin. Another common case is
| to use successive circle() calls to create concentric circles. This works because the
| center of a circle is its reference point::
|
| s = Workplane().circle(2.0).circle(1.0)
|
| Creates two concentric circles, which when extruded will form a ring.
|
| Future Enhancements:
| better way to handle forConstruction
| project points not in the workplane plane onto the workplane plane
|
| clean(self: ~T) -> ~T
| Cleans the current solid by removing unwanted edges from the
| faces.
|
| Normally you don't have to call this function. It is
| automatically called after each related operation. You can
| disable this behavior with `clean=False` parameter if method
| has any. In some cases this can improve performance
| drastically but is generally dis-advised since it may break
| some operations such as fillet.
|
| Note that in some cases where lots of solid operations are
| chained, `clean()` may actually improve performance since
| the shape is 'simplified' at each step and thus next operation
| is easier.
|
| Also note that, due to limitation of the underlying engine,
| `clean` may fail to produce a clean output in some cases such as
| spherical faces.
|
| close(self: ~T) -> ~T
| End construction, and attempt to build a closed wire.
|
| :return: a CQ object with a completed wire on the stack, if possible.
|
| After 2D (or 3D) drafting with methods such as lineTo, threePointArc,
| tangentArcPoint and polyline, it is necessary to convert the edges
| produced by these into one or more wires.
|
| When a set of edges is closed, CadQuery assumes it is safe to build
| the group of edges into a wire. This example builds a simple triangular
| prism::
|
| s = Workplane().lineTo(1, 0).lineTo(1, 1).close().extrude(0.2)
|
| combine(self: ~T, clean: bool = True, glue: bool = False, tol: Optional[float] = None) -> ~T
| Attempts to combine all of the items on the stack into a single item.
|
| WARNING: all of the items must be of the same type!
|
| :param clean: call :meth:`clean` afterwards to have a clean shape
| :param glue: use a faster gluing mode for non-overlapping shapes (default False)
| :param tol: tolerance value for fuzzy bool operation mode (default None)
| :raises: ValueError if there are no items on the stack, or if they cannot be combined
| :return: a CQ object with the resulting object selected
|
| compounds(self: ~T, selector: Union[str, cadquery.selectors.Selector, NoneType] = None, tag: Optional[str] = None) -> ~T
| Select compounds on the stack, optionally filtering the selection. If there are multiple
| objects on the stack, they are collected and a list of all the distinct compounds
| is returned.
|
| :param selector: optional Selector object, or string selector expression
| (see :class:`StringSyntaxSelector`)
| :param tag: if set, search the tagged object instead of self
| :return: a CQ object whose stack contains all of the *distinct* compounds of *all* objects on
| the current stack, filtered by the provided selector.
|
| A compound contains multiple CAD primitives that resulted from a single operation, such as
| a union, cut, split, or fillet. Compounds can contain multiple edges, wires, or solids.
|
| consolidateWires(self: ~T) -> ~T
| Attempt to consolidate wires on the stack into a single.
| If possible, a new object with the results are returned.
| if not possible, the wires remain separated
|
| copyWorkplane(self, obj: ~T) -> ~T
| Copies the workplane from obj.
|
| :param obj: an object to copy the workplane from
| :type obj: a CQ object
| :returns: a CQ object with obj's workplane
|
| cskHole(self: ~T, diameter: float, cskDiameter: float, cskAngle: float, depth: Optional[float] = None, clean: bool = True) -> ~T
| Makes a countersunk hole for each item on the stack.
|
| :param diameter: the diameter of the hole
| :type diameter: float > 0
| :param cskDiameter: the diameter of the countersink, must be greater than hole diameter
| :param cskAngle: angle of the countersink, in degrees ( 82 is common )
| :type cskAngle: float > 0
| :param depth: the depth of the hole
| :type depth: float > 0 or None to drill thru the entire part.
| :param clean: call :meth:`clean` afterwards to have a clean shape
|
| The surface of the hole is at the current workplane.
|
| One hole is created for each item on the stack. A very common use case is to use a
| construction rectangle to define the centers of a set of holes, like so::
|
| s = (
| Workplane()
| .box(2, 4, 0.5)
| .faces(">Z")
| .workplane()
| .rect(1.5, 3.5, forConstruction=True)
| .vertices()
| .cskHole(0.125, 0.25, 82, depth=None)
| )
|
| This sample creates a plate with a set of holes at the corners.
|
| **Plugin Note**: this is one example of the power of plugins. CounterSunk holes are quite
| time consuming to create, but are quite easily defined by users.
|
| see :meth:`cboreHole` to make counterbores instead of countersinks
|
| cut(self: ~T, toCut: Union[ForwardRef('Workplane'), cadquery.occ_impl.shapes.Solid, cadquery.occ_impl.shapes.Compound], clean: bool = True, tol: Optional[float] = None) -> ~T
| Cuts the provided solid from the current solid, IE, perform a solid subtraction.
|
| :param toCut: a solid object, or a Workplane object having a solid
| :param clean: call :meth:`clean` afterwards to have a clean shape
| :param tol: tolerance value for fuzzy bool operation mode (default None)
| :raises ValueError: if there is no solid to subtract from in the chain
| :return: a Workplane object with the resulting object selected
|
| cutBlind(self: ~T, until: Union[float, Literal['next', 'last'], cadquery.occ_impl.shapes.Face], clean: bool = True, both: bool = False, taper: Optional[float] = None) -> ~T
| Use all un-extruded wires in the parent chain to create a prismatic cut from existing solid.
|
| Specify either a distance value, or one of "next", "last" to indicate a face to cut to.
|
| Similar to extrude, except that a solid in the parent chain is required to remove material
| from. cutBlind always removes material from a part.
|
| :param until: The distance to cut to, normal to the workplane plane. When a negative float
| is passed the cut extends this far in the opposite direction to the normal of the plane
| (i.e in the solid). The string "next" cuts until the next face orthogonal to the wire
| normal. "last" cuts to the last face. If an object of type Face is passed, then the cut
| will extend until this face.
| :param clean: call :meth:`clean` afterwards to have a clean shape
| :param both: cut in both directions symmetrically
| :param taper: angle for optional tapered extrusion
| :raises ValueError: if there is no solid to subtract from in the chain
| :return: a CQ object with the resulting object selected
|
| see :meth:`cutThruAll` to cut material from the entire part
|
| cutEach(self: ~T, fcn: Callable[[cadquery.occ_impl.geom.Location], cadquery.occ_impl.shapes.Shape], useLocalCoords: bool = False, clean: bool = True) -> ~T
| Evaluates the provided function at each point on the stack (ie, eachpoint)
| and then cuts the result from the context solid.
|
| :param fcn: a function suitable for use in the eachpoint method: ie, that accepts a vector
| :param useLocalCoords: same as for :meth:`eachpoint`
| :param clean: call :meth:`clean` afterwards to have a clean shape
| :raises ValueError: if no solids or compounds are found in the stack or parent chain
| :return: a CQ object that contains the resulting solid
|
| cutThruAll(self: ~T, clean: bool = True, taper: float = 0) -> ~T
| Use all un-extruded wires in the parent chain to create a prismatic cut from existing solid.
| Cuts through all material in both normal directions of workplane.
|
| Similar to extrude, except that a solid in the parent chain is required to remove material
| from. cutThruAll always removes material from a part.
|
| :param clean: call :meth:`clean` afterwards to have a clean shape
| :raises ValueError: if there is no solid to subtract from in the chain
| :raises ValueError: if there are no pending wires to cut with
| :return: a CQ object with the resulting object selected
|
| see :meth:`cutBlind` to cut material to a limited depth
|
| cylinder(self: ~T, height: float, radius: float, direct: Union[Tuple[float, float, float], cadquery.occ_impl.geom.Vector] = Vector: (0.0, 0.0, 1.0), angle: float = 360, centered: Union[bool, Tuple[bool, bool, bool]] = True, combine: Union[bool, Literal['cut', 'a', 's']] = True, clean: bool = True) -> ~T
| Returns a cylinder with the specified radius and height for each point on the stack
|
| :param height: The height of the cylinder
| :param radius: The radius of the cylinder
| :param direct: The direction axis for the creation of the cylinder
| :type direct: A three-tuple
| :param angle: The angle to sweep the cylinder arc through
| :type angle: float > 0
| :param centered: If True, the cylinder will be centered around the reference point. If False,
| the corner of a bounding box around the cylinder will be on the reference point and it
| will extend in the positive x, y and z directions. Can also use a 3-tuple to specify
| centering along each axis.
| :param combine: Whether the results should be combined with other solids on the stack
| (and each other)
| :type combine: true to combine shapes, false otherwise
| :param clean: call :meth:`clean` afterwards to have a clean shape
| :return: A cylinder object for each point on the stack
|
| One cylinder is created for each item on the current stack. If no items are on the stack, one
| cylinder is created using the current workplane center.
|
| If combine is true, the result will be a single object on the stack. If a solid was found
| in the chain, the result is that solid with all cylinders produced fused onto it otherwise,
| the result is the combination of all the produced cylinders.
|
| If combine is false, the result will be a list of the cylinders produced.
|
| each(self: ~T, callback: Callable[[Union[cadquery.occ_impl.geom.Vector, cadquery.occ_impl.geom.Location, cadquery.occ_impl.shapes.Shape, cadquery.sketch.Sketch]], cadquery.occ_impl.shapes.Shape], useLocalCoordinates: bool = False, combine: Union[bool, Literal['cut', 'a', 's']] = True, clean: bool = True) -> ~T
| Runs the provided function on each value in the stack, and collects the return values into
| a new CQ object.
|
| Special note: a newly created workplane always has its center point as its only stack item
|
| :param callBackFunction: the function to call for each item on the current stack.
| :param useLocalCoordinates: should values be converted from local coordinates first?
| :param combine: True or "a" to combine the resulting solid with parent solids if found,
| "cut" or "s" to remove the resulting solid from the parent solids if found.
| False to keep the resulting solid separated from the parent solids.
| :param clean: call :meth:`clean` afterwards to have a clean shape
|
|
| The callback function must accept one argument, which is the item on the stack, and return
| one object, which is collected. If the function returns None, nothing is added to the stack.
| The object passed into the callBackFunction is potentially transformed to local coordinates,
| if useLocalCoordinates is true
|
| useLocalCoordinates is very useful for plugin developers.
|
| If false, the callback function is assumed to be working in global coordinates. Objects
| created are added as-is, and objects passed into the function are sent in using global
| coordinates
|
| If true, the calling function is assumed to be working in local coordinates. Objects are
| transformed to local coordinates before they are passed into the callback method, and result
| objects are transformed to global coordinates after they are returned.
|
| This allows plugin developers to create objects in local coordinates, without worrying
| about the fact that the working plane is different than the global coordinate system.
|
|
| TODO: wrapper object for Wire will clean up forConstruction flag everywhere
|
| eachpoint(self: ~T, arg: Union[cadquery.occ_impl.shapes.Shape, ForwardRef('Workplane'), Callable[[cadquery.occ_impl.geom.Location], cadquery.occ_impl.shapes.Shape]], useLocalCoordinates: bool = False, combine: Union[bool, Literal['cut', 'a', 's']] = False, clean: bool = True) -> ~T
| Same as each(), except arg is translated by the positions on the stack. If arg is a callback function, then the function is called for each point on the stack, and the resulting shape is used.
| :return: CadQuery object which contains a list of vectors (points ) on its stack.
|
| :param useLocalCoordinates: should points be in local or global coordinates
| :param combine: True or "a" to combine the resulting solid with parent solids if found,
| "cut" or "s" to remove the resulting solid from the parent solids if found.
| False to keep the resulting solid separated from the parent solids.
| :param clean: call :meth:`clean` afterwards to have a clean shape
|
|
| The resulting object has a point on the stack for each object on the original stack.
| Vertices and points remain a point. Faces, Wires, Solids, Edges, and Shells are converted
| to a point by using their center of mass.
|
| If the stack has zero length, a single point is returned, which is the center of the current
| workplane/coordinate system
|
| edges(self: ~T, selector: Union[str, cadquery.selectors.Selector, NoneType] = None, tag: Optional[str] = None) -> ~T
| Select the edges of objects on the stack, optionally filtering the selection. If there are
| multiple objects on the stack, the edges of all objects are collected and a list of all the
| distinct edges is returned.
|
| :param selector: optional Selector object, or string selector expression
| (see :class:`StringSyntaxSelector`)
| :param tag: if set, search the tagged object instead of self
| :return: a CQ object whose stack contains all of the *distinct* edges of *all* objects on
| the current stack, filtered by the provided selector.
|
| If there are no edges for any objects on the current stack, an empty CQ object is returned
|
| The typical use is to select the edges of a single object on the stack. For example::
|
| Workplane().box(1, 1, 1).faces("+Z").edges().size()
|
| returns 4, because the topmost face of a cube will contain four edges. Similarly::
|
| Workplane().box(1, 1, 1).edges().size()
|
| returns 12, because a cube has a total of 12 edges, And::
|
| Workplane().box(1, 1, 1).edges("|Z").size()
|
| returns 4, because a cube has 4 edges parallel to the z direction
|
| ellipse(self: ~T, x_radius: float, y_radius: float, rotation_angle: float = 0.0, forConstruction: bool = False) -> ~T
| Make an ellipse for each item on the stack.
|
| :param x_radius: x radius of the ellipse (x-axis of plane the ellipse should lie in)
| :param y_radius: y radius of the ellipse (y-axis of plane the ellipse should lie in)
| :param rotation_angle: angle to rotate the ellipse
| :param forConstruction: should the new wires be reference geometry only?
| :type forConstruction: true if the wires are for reference, false if they are creating
| part geometry
| :return: a new CQ object with the created wires on the stack
|
| *NOTE* Due to a bug in opencascade (https://tracker.dev.opencascade.org/view.php?id=31290)
| the center of mass (equals center for next shape) is shifted. To create concentric ellipses
| use::
|
| Workplane("XY").center(10, 20).ellipse(100, 10).center(0, 0).ellipse(50, 5)
|
| ellipseArc(self: ~T, x_radius: float, y_radius: float, angle1: float = 360, angle2: float = 360, rotation_angle: float = 0.0, sense: Literal[-1, 1] = 1, forConstruction: bool = False, startAtCurrent: bool = True, makeWire: bool = False) -> ~T
| Draw an elliptical arc with x and y radiuses either with start point at current point or
| or current point being the center of the arc
|
| :param x_radius: x radius of the ellipse (along the x-axis of plane the ellipse should lie in)
| :param y_radius: y radius of the ellipse (along the y-axis of plane the ellipse should lie in)
| :param angle1: start angle of arc
| :param angle2: end angle of arc (angle2 == angle1 return closed ellipse = default)
| :param rotation_angle: angle to rotate the created ellipse / arc
| :param sense: clockwise (-1) or counter clockwise (1)
| :param startAtCurrent: True: start point of arc is moved to current point; False: center of
| arc is on current point
| :param makeWire: convert the resulting arc edge to a wire
|
| end(self, n: int = 1) -> 'Workplane'
| Return the nth parent of this CQ element
|
| :param n: number of ancestor to return (default: 1)
| :rtype: a CQ object
| :raises: ValueError if there are no more parents in the chain.
|
| For example::
|
| CQ(obj).faces("+Z").vertices().end()
|
| will return the same as::
|
| CQ(obj).faces("+Z")
|
| export(self: ~T, fname: str, tolerance: float = 0.1, angularTolerance: float = 0.1, unit: Literal['MM', 'CM', 'M', 'KM', 'INCH', 'FT', 'MI', 'UM', 'NM'] = 'MM', outputUnit: Optional[Literal['MM', 'CM', 'M', 'KM', 'INCH', 'FT', 'MI', 'UM', 'NM']] = None, opt: Optional[Dict[str, Any]] = None) -> ~T
| Export Workplane to file.
|
| :param path: Filename.
| :param tolerance: the deflection tolerance, in model units. Default 0.1.
| :param angularTolerance: the angular tolerance, in radians. Default 0.1.
| :param unit: The internal unit of the model's geometry values. Only used for STEP. Default "MM".
| :type unit: UnitLiterals
| :param outputUnit: The unit to use in the STEP file header. If None, defaults to the value of ``unit``.
| Use this when you want the output file to declare a different unit than the model's internal unit,
| for example to export a MM model as a STEP file declaring meters.
| :type outputUnit: UnitLiterals or None
| :param opt: additional options passed to the specific exporter. Default None.
| :return: Self.
|
| exportSvg(self, fileName: str) -> None
| Exports the first item on the stack as an SVG file
|
| For testing purposes mainly.
|
| :param fileName: the filename to export, absolute path to the file
|
| extrude(self: ~T, until: Union[float, Literal['next', 'last'], cadquery.occ_impl.shapes.Face], combine: Union[bool, Literal['cut', 'a', 's']] = True, clean: bool = True, both: bool = False, taper: Optional[float] = None) -> ~T
| Use all un-extruded wires in the parent chain to create a prismatic solid.
|
| :param until: The distance to extrude, normal to the workplane plane. When a float is
| passed, the extrusion extends this far and a negative value is in the opposite direction
| to the normal of the plane. The string "next" extrudes until the next face orthogonal to
| the wire normal. "last" extrudes to the last face. If a object of type Face is passed then
| the extrusion will extend until this face. **Note that the Workplane must contain a Solid for extruding to a given face.**
| :param combine: True or "a" to combine the resulting solid with parent solids if found,
| "cut" or "s" to remove the resulting solid from the parent solids if found.
| False to keep the resulting solid separated from the parent solids.
| :param clean: call :meth:`clean` afterwards to have a clean shape
| :param both: extrude in both directions symmetrically
| :param taper: angle for optional tapered extrusion
| :return: a CQ object with the resulting solid selected.
|
| The returned object is always a CQ object, and depends on whether combine is True, and
| whether a context solid is already defined:
|
| * if combine is False, the new value is pushed onto the stack. Note that when extruding
| until a specified face, combine can not be False
| * if combine is true, the value is combined with the context solid if it exists,
| and the resulting solid becomes the new context solid.
|
| faces(self: ~T, selector: Union[str, cadquery.selectors.Selector, NoneType] = None, tag: Optional[str] = None) -> ~T
| Select the faces of objects on the stack, optionally filtering the selection. If there are
| multiple objects on the stack, the faces of all objects are collected and a list of all the
| distinct faces is returned.
|
| :param selector: optional Selector object, or string selector expression
| (see :class:`StringSyntaxSelector`)
| :param tag: if set, search the tagged object instead of self
| :return: a CQ object whose stack contains all of the *distinct* faces of *all* objects on
| the current stack, filtered by the provided selector.
|
| If there are no faces for any objects on the current stack, an empty CQ object
| is returned.
|
| The typical use is to select the faces of a single object on the stack. For example::
|
| Workplane().box(1, 1, 1).faces("+Z").size()
|
| returns 1, because a cube has one face with a normal in the +Z direction. Similarly::
|
| Workplane().box(1, 1, 1).faces().size()
|
| returns 6, because a cube has a total of 6 faces, And::
|
| Workplane().box(1, 1, 1).faces("|Z").size()
|
| returns 2, because a cube has 2 faces having normals parallel to the z direction
|
| fillet(self: ~T, radius: float) -> ~T
| Fillets a solid on the selected edges.
|
| The edges on the stack are filleted. The solid to which the edges belong must be in the
| parent chain of the selected edges.
|
| :param radius: the radius of the fillet, must be > zero
| :raises ValueError: if at least one edge is not selected
| :raises ValueError: if the solid containing the edge is not in the chain
| :returns: CQ object with the resulting solid selected.
|
| This example will create a unit cube, with the top edges filleted::
|
| s = Workplane().box(1, 1, 1).faces("+Z").edges().fillet(0.1)
|
| filter(self: ~T, f: Callable[[Union[cadquery.occ_impl.geom.Vector, cadquery.occ_impl.geom.Location, cadquery.occ_impl.shapes.Shape, cadquery.sketch.Sketch]], bool]) -> ~T
| Filter items using a boolean predicate.
|
| :param f: Callable to be used for filtering.
| :return: Workplane object with filtered items.
|
| findSolid(self, searchStack: bool = True, searchParents: bool = True) -> Union[cadquery.occ_impl.shapes.Solid, cadquery.occ_impl.shapes.Compound]
| Finds the first solid object in the chain, searching from the current node
| backwards through parents until one is found.
|
| :param searchStack: should objects on the stack be searched first?
| :param searchParents: should parents be searched?
| :raises ValueError: if no solid is found
|
| This function is very important for chains that are modifying a single parent object,
| most often a solid.
|
| Most of the time, a chain defines or selects a solid, and then modifies it using workplanes
| or other operations.
|
| Plugin Developers should make use of this method to find the solid that should be modified,
| if the plugin implements a unary operation, or if the operation will automatically merge its
| results with an object already on the stack.
|
| first(self: ~T) -> ~T
| Return the first item on the stack
|
| :returns: the first item on the stack.
| :rtype: a CQ object
|
| hLine(self: ~T, distance: float, forConstruction: bool = False) -> ~T
| Make a horizontal line from the current point the provided distance
|
| :param distance: (x) distance from current point
| :return: the Workplane object with the current point at the end of the new line
|
| hLineTo(self: ~T, xCoord: float, forConstruction: bool = False) -> ~T
| Make a horizontal line from the current point to the provided x coordinate.
|
| Useful if it is more convenient to specify the end location rather than distance,
| as in :meth:`hLine`
|
| :param xCoord: x coordinate for the end of the line
| :return: the Workplane object with the current point at the end of the new line
|
| hole(self: ~T, diameter: float, depth: Optional[float] = None, clean: bool = True) -> ~T
| Makes a hole for each item on the stack.
|
| :param diameter: the diameter of the hole
| :param depth: the depth of the hole
| :type depth: float > 0 or None to drill thru the entire part.
| :param clean: call :meth:`clean` afterwards to have a clean shape
|
| The surface of the hole is at the current workplane.
|
| One hole is created for each item on the stack. A very common use case is to use a
| construction rectangle to define the centers of a set of holes, like so::
|
| s = (
| Workplane()
| .box(2, 4, 0.5)
| .faces(">Z")
| .workplane()
| .rect(1.5, 3.5, forConstruction=True)
| .vertices()
| .hole(0.125, 82)
| )
|
| This sample creates a plate with a set of holes at the corners.
|
| **Plugin Note**: this is one example of the power of plugins. CounterSunk holes are quite
| time consuming to create, but are quite easily defined by users.
|
| see :meth:`cboreHole` and :meth:`cskHole` to make counterbores or countersinks
|
| interpPlate(self: ~T, surf_edges: Union[Sequence[Union[Tuple[float, float], Tuple[float, float, float], cadquery.occ_impl.geom.Vector]], Sequence[Union[cadquery.occ_impl.shapes.Edge, cadquery.occ_impl.shapes.Wire]], ForwardRef('Workplane')], surf_pts: Sequence[Union[Tuple[float, float], Tuple[float, float, float], cadquery.occ_impl.geom.Vector]] = [], thickness: float = 0, combine: Union[bool, Literal['cut', 'a', 's']] = False, clean: bool = True, degree: int = 3, nbPtsOnCur: int = 15, nbIter: int = 2, anisotropy: bool = False, tol2d: float = 1e-05, tol3d: float = 0.0001, tolAng: float = 0.01, tolCurv: float = 0.1, maxDeg: int = 8, maxSegments: int = 9) -> ~T
| Returns a plate surface that is 'thickness' thick, enclosed by 'surf_edge_pts' points, and going
| through 'surf_pts' points. Using pushPoints directly with interpPlate and combine=True, can be
| very resource intensive depending on the complexity of the shape. In this case set combine=False.
|
| :param surf_edges: list of [x,y,z] ordered coordinates or list of ordered or unordered edges, wires
| :param surf_pts: list of points (uses only edges if [])
| :param thickness: value may be negative or positive depending on thickening direction (2D surface if 0)
| :param combine: should the results be combined with other solids on the stack (and each other)?
| :param clean: call :meth:`clean` afterwards to have a clean shape
| :param degree: >= 2
| :param nbPtsOnCur: number of points on curve >= 15
| :param nbIter: number of iterations >= 2
| :param anisotropy: = bool Anisotropy
| :param tol2d: 2D tolerance
| :param tol3d: 3D tolerance
| :param tolAng: angular tolerance
| :param tolCurv: tolerance for curvature
| :param maxDeg: highest polynomial degree >= 2
| :param maxSegments: greatest number of segments >= 2
|
| intersect(self: ~T, toIntersect: Union[ForwardRef('Workplane'), cadquery.occ_impl.shapes.Solid, cadquery.occ_impl.shapes.Compound], clean: bool = True, tol: Optional[float] = None) -> ~T
| Intersects the provided solid from the current solid.
|
| :param toIntersect: a solid object, or a Workplane object having a solid
| :param clean: call :meth:`clean` afterwards to have a clean shape
| :param tol: tolerance value for fuzzy bool operation mode (default None)
| :raises ValueError: if there is no solid to intersect with in the chain
| :return: a Workplane object with the resulting object selected
|
| invoke(self: ~T, f: Union[Callable[[~T], ~T], Callable[[~T], NoneType], Callable[[], NoneType]]) -> ~T
| Invoke a callable mapping Workplane to Workplane or None. Supports also
| callables that take no arguments such as breakpoint. Returns self if callable
| returns None.
|
| :param f: Callable to be invoked.
| :return: Workplane object.
|
| item(self: ~T, i: int) -> ~T
| Return the ith item on the stack.
|
| :rtype: a CQ object
|
| largestDimension(self) -> float
| Finds the largest dimension in the stack.
|
| Used internally to create thru features, this is how you can compute
| how long or wide a feature must be to make sure to cut through all of the material
|
| :raises ValueError: if no solids or compounds are found
| :return: A value representing the largest dimension of the first solid on the stack
|
| last(self: ~T) -> ~T
| Return the last item on the stack.
|
| :rtype: a CQ object
|
| line(self: ~T, xDist: float, yDist: float, forConstruction: bool = False) -> ~T
| Make a line from the current point to the provided point, using
| dimensions relative to the current point
|
| :param xDist: x distance from current point
| :param yDist: y distance from current point
| :return: the workplane object with the current point at the end of the new line
|
| see :meth:`lineTo` if you want to use absolute coordinates to make a line instead.
|
| lineTo(self: ~T, x: float, y: float, forConstruction: bool = False) -> ~T
| Make a line from the current point to the provided point
|
| :param x: the x point, in workplane plane coordinates
| :param y: the y point, in workplane plane coordinates
| :return: the Workplane object with the current point at the end of the new line
|
| See :meth:`line` if you want to use relative dimensions to make a line instead.
|
| loft(self: ~T, ruled: bool = False, combine: Union[bool, Literal['cut', 'a', 's']] = True, clean: bool = True) -> ~T
| Make a lofted solid, through the set of wires.
|
| :param ruled: When set to `True` connects each section linearly and without continuity
| :param combine: True or "a" to combine the resulting solid with parent solids if found,
| "cut" or "s" to remove the resulting solid from the parent solids if found.
| False to keep the resulting solid separated from the parent solids.
| :param clean: call :meth:`clean` afterwards to have a clean shape
|
| :return: a Workplane object containing the created loft
|
| map(self: ~T, f: Callable[[Union[cadquery.occ_impl.geom.Vector, cadquery.occ_impl.geom.Location, cadquery.occ_impl.shapes.Shape, cadquery.sketch.Sketch]], Union[cadquery.occ_impl.geom.Vector, cadquery.occ_impl.geom.Location, cadquery.occ_impl.shapes.Shape, cadquery.sketch.Sketch]]) -> ~T
| Apply a callable to every item separately.
|
| :param f: Callable to be applied to every item separately.
| :return: Workplane object with f applied to all items.
|
| mirror(self: ~T, mirrorPlane: Union[Literal['XY', 'YX', 'XZ', 'ZX', 'YZ', 'ZY'], Tuple[float, float], Tuple[float, float, float], cadquery.occ_impl.geom.Vector, cadquery.occ_impl.shapes.Face, ForwardRef('Workplane')] = 'XY', basePointVector: Union[Tuple[float, float], Tuple[float, float, float], cadquery.occ_impl.geom.Vector, NoneType] = None, union: bool = False) -> ~T
| Mirror a single CQ object.
|
| :param mirrorPlane: the plane to mirror about
| :type mirrorPlane: string, one of "XY", "YX", "XZ", "ZX", "YZ", "ZY" the planes
| or the normal vector of the plane eg (1,0,0) or a Face object
| :param basePointVector: the base point to mirror about (this is overwritten if a Face is passed)
| :param union: If true will perform a union operation on the mirrored object
|
| mirrorX(self: ~T) -> ~T
| Mirror entities around the x axis of the workplane plane.
|
| :return: a new object with any free edges consolidated into as few wires as possible.
|
| All free edges are collected into a wire, and then the wire is mirrored,
| and finally joined into a new wire
|
| Typically used to make creating wires with symmetry easier.
|
| mirrorY(self: ~T) -> ~T
| Mirror entities around the y axis of the workplane plane.
|
| :return: a new object with any free edges consolidated into as few wires as possible.
|
| All free edges are collected into a wire, and then the wire is mirrored,
| and finally joined into a new wire
|
| Typically used to make creating wires with symmetry easier. This line of code::
|
| s = Workplane().lineTo(2, 2).threePointArc((3, 1), (2, 0)).mirrorX().extrude(0.25)
|
| Produces a flat, heart shaped object
|
| move(self: ~T, xDist: float = 0, yDist: float = 0) -> ~T
| Move the specified distance from the current point, without drawing.
|
| :param xDist: desired x distance, in local coordinates
| :type xDist: float, or none for zero
| :param yDist: desired y distance, in local coordinates
| :type yDist: float, or none for zero.
|
| Not to be confused with :meth:`center`, which moves the center of the entire
| workplane, this method only moves the current point ( and therefore does not affect objects
| already drawn ).
|
| See :meth:`moveTo` to do the same thing but using absolute coordinates
|
| moveTo(self: ~T, x: float = 0, y: float = 0) -> ~T
| Move to the specified point, without drawing.
|
| :param x: desired x location, in local coordinates
| :type x: float, or none for zero
| :param y: desired y location, in local coordinates
| :type y: float, or none for zero.
|
| Not to be confused with :meth:`center`, which moves the center of the entire
| workplane, this method only moves the current point ( and therefore does not affect objects
| already drawn ).
|
| See :meth:`move` to do the same thing but using relative dimensions
|
| newObject(self: ~T, objlist: Iterable[Union[cadquery.occ_impl.geom.Vector, cadquery.occ_impl.geom.Location, cadquery.occ_impl.shapes.Shape, cadquery.sketch.Sketch]]) -> ~T
| Create a new workplane object from this one.
|
| Overrides CQ.newObject, and should be used by extensions, plugins, and
| subclasses to create new objects.
|
| :param objlist: new objects to put on the stack
| :type objlist: a list of CAD primitives
| :return: a new Workplane object with the current workplane as a parent.
|
| offset2D(self: ~T, d: float, kind: Literal['arc', 'intersection', 'tangent'] = 'arc', forConstruction: bool = False) -> ~T
| Creates a 2D offset wire.
|
| :param d: thickness. Negative thickness denotes offset to inside.
| :param kind: offset kind. Use "arc" for rounded and "intersection" for sharp edges (default: "arc")
| :param forConstruction: Should the result be added to pending wires?
|
| :return: CQ object with resulting wire(s).
|
| parametricCurve(self: ~T, func: Callable[[float], Union[Tuple[float, float], Tuple[float, float, float], cadquery.occ_impl.geom.Vector]], N: int = 400, start: float = 0, stop: float = 1, tol: float = 1e-06, minDeg: int = 1, maxDeg: int = 6, smoothing: Optional[Tuple[float, float, float]] = (1, 1, 1), makeWire: bool = True) -> ~T
| Create a spline curve approximating the provided function.
|
| :param func: function f(t) that will generate (x,y,z) pairs
| :type func: float --> (float,float,float)
| :param N: number of points for discretization
| :param start: starting value of the parameter t
| :param stop: final value of the parameter t
| :param tol: tolerance of the algorithm (default: 1e-6)
| :param minDeg: minimum spline degree (default: 1)
| :param maxDeg: maximum spline degree (default: 6)
| :param smoothing: optional parameters for the variational smoothing algorithm (default: (1,1,1))
| :param makeWire: convert the resulting spline edge to a wire
| :return: a Workplane object with the current point unchanged
|
| parametricSurface(self: ~T, func: Callable[[float, float], Union[Tuple[float, float], Tuple[float, float, float], cadquery.occ_impl.geom.Vector]], N: int = 20, start: float = 0, stop: float = 1, tol: float = 0.01, minDeg: int = 1, maxDeg: int = 6, smoothing: Optional[Tuple[float, float, float]] = (1, 1, 1)) -> ~T
| Create a spline surface approximating the provided function.
|
| :param func: function f(u,v) that will generate (x,y,z) pairs
| :type func: (float,float) --> (float,float,float)
| :param N: number of points for discretization in one direction
| :param start: starting value of the parameters u,v
| :param stop: final value of the parameters u,v
| :param tol: tolerance used by the approximation algorithm (default: 1e-3)
| :param minDeg: minimum spline degree (default: 1)
| :param maxDeg: maximum spline degree (default: 3)
| :param smoothing: optional parameters for the variational smoothing algorithm (default: (1,1,1))
| :return: a Workplane object with the current point unchanged
|
| This method might be unstable and may require tuning of the tol parameter.
|
| placeSketch(self: ~T, *sketches: cadquery.sketch.Sketch) -> ~T
| Place the provided sketch(es) based on the current items on the stack.
|
| :return: Workplane object with the sketch added.
|
| polarArray(self: ~T, radius: float, startAngle: float, angle: float, count: int, fill: bool = True, rotate: bool = True) -> ~T
| Creates a polar array of points and pushes them onto the stack.
| The zero degree reference angle is located along the local X-axis.
|
| :param radius: Radius of the array.
| :param startAngle: Starting angle (degrees) of array. Zero degrees is
| situated along the local X-axis.
| :param angle: The angle (degrees) to fill with elements. A positive
| value will fill in the counter-clockwise direction. If fill is
| False, angle is the angle between elements.
| :param count: Number of elements in array. (count >= 1)
| :param fill: Interpret the angle as total if True (default: True).
| :param rotate: Rotate every item (default: True).
|
| polarLine(self: ~T, distance: float, angle: float, forConstruction: bool = False) -> ~T
| Make a line of the given length, at the given angle from the current point
|
| :param distance: distance of the end of the line from the current point
| :param angle: angle of the vector to the end of the line with the x-axis
| :return: the Workplane object with the current point at the end of the new line
|
| polarLineTo(self: ~T, distance: float, angle: float, forConstruction: bool = False) -> ~T
| Make a line from the current point to the given polar coordinates
|
| Useful if it is more convenient to specify the end location rather than
| the distance and angle from the current point
|
| :param distance: distance of the end of the line from the origin
| :param angle: angle of the vector to the end of the line with the x-axis
| :return: the Workplane object with the current point at the end of the new line
|
| polygon(self: ~T, nSides: int, diameter: float, forConstruction: bool = False, circumscribed: bool = False) -> ~T
| Make a polygon for each item on the stack.
|
| By default, each polygon is created by inscribing it in a circle of the
| specified diameter, such that the first vertex is oriented in the x direction.
| Alternatively, each polygon can be created by circumscribing it around
| a circle of the specified diameter, such that the midpoint of the first edge
| is oriented in the x direction. Circumscribed polygons are thus rotated by
| pi/nSides radians relative to the inscribed polygon. This ensures the extent
| of the polygon along the positive x-axis is always known.
| This has the advantage of not requiring additional formulae for purposes such as
| tiling on the x-axis (at least for even sided polygons).
|
| :param nSides: number of sides, must be >= 3
| :param diameter: the diameter of the circle for constructing the polygon
| :param circumscribed: circumscribe the polygon about a circle
| :type circumscribed: true to create the polygon by circumscribing it about a circle,
| false to create the polygon by inscribing it in a circle
| :return: a polygon wire
|
| polyline(self: ~T, listOfXYTuple: Sequence[Union[Tuple[float, float], Tuple[float, float, float], cadquery.occ_impl.geom.Vector]], forConstruction: bool = False, includeCurrent: bool = False) -> ~T
| Create a polyline from a list of points
|
| :param listOfXYTuple: a list of points in Workplane coordinates (2D or 3D)
| :param forConstruction: whether or not the edges are used for reference
| :type forConstruction: true if the edges are for reference, false if they are for creating geometry
| part geometry
| :param includeCurrent: use current point as a starting point of the polyline
| :return: a new CQ object with a list of edges on the stack
|
| *NOTE* most commonly, the resulting wire should be closed.
|
| pushPoints(self: ~T, pntList: Iterable[Union[Tuple[float, float], Tuple[float, float, float], cadquery.occ_impl.geom.Vector, cadquery.occ_impl.geom.Location]]) -> ~T
| Pushes a list of points onto the stack as vertices.
| The points are in the 2D coordinate space of the workplane face
|
| :param pntList: a list of points to push onto the stack
| :type pntList: list of 2-tuples, in *local* coordinates
| :return: a new workplane with the desired points on the stack.
|
| A common use is to provide a list of points for a subsequent operation, such as creating
| circles or holes. This example creates a cube, and then drills three holes through it,
| based on three points::
|
| s = (
| Workplane()
| .box(1, 1, 1)
| .faces(">Z")
| .workplane()
| .pushPoints([(-0.3, 0.3), (0.3, 0.3), (0, 0)])
| )
| body = s.circle(0.05).cutThruAll()
|
| Here the circle function operates on all three points, and is then extruded to create three
| holes. See :meth:`circle` for how it works.
|
| radiusArc(self: ~T, endPoint: Union[Tuple[float, float], Tuple[float, float, float], cadquery.occ_impl.geom.Vector], radius: float, forConstruction: bool = False) -> ~T
| Draw an arc from the current point to endPoint with an arc defined by the radius.
|
| :param endPoint: end point for the arc
| :type endPoint: 2-tuple, in workplane coordinates
| :param radius: the radius of the arc
| :type radius: float, the radius of the arc between start point and end point.
| :return: a workplane with the current point at the end of the arc
|
| Given that a closed contour is drawn clockwise;
| A positive radius means convex arc and negative radius means concave arc.
|
| rarray(self: ~T, xSpacing: float, ySpacing: float, xCount: int, yCount: int, center: Union[bool, Tuple[bool, bool]] = True) -> ~T
| Creates an array of points and pushes them onto the stack.
| If you want to position the array at another point, create another workplane
| that is shifted to the position you would like to use as a reference
|
| :param xSpacing: spacing between points in the x direction ( must be >= 0)
| :param ySpacing: spacing between points in the y direction ( must be >= 0)
| :param xCount: number of points ( > 0 )
| :param yCount: number of points ( > 0 )
| :param center: If True, the array will be centered around the workplane center.
| If False, the lower corner will be on the reference point and the array will
| extend in the positive x and y directions. Can also use a 2-tuple to specify
| centering along each axis.
|
| rect(self: ~T, xLen: float, yLen: float, centered: Union[bool, Tuple[bool, bool]] = True, forConstruction: bool = False) -> ~T
| Make a rectangle for each item on the stack.
|
| :param xLen: length in the x direction (in workplane coordinates)
| :param yLen: length in the y direction (in workplane coordinates)
| :param centered: If True, the rectangle will be centered around the reference
| point. If False, the corner of the rectangle will be on the reference point and
| it will extend in the positive x and y directions. Can also use a 2-tuple to
| specify centering along each axis.
| :param forConstruction: should the new wires be reference geometry only?
| :type forConstruction: true if the wires are for reference, false if they are creating part
| geometry
| :return: a new CQ object with the created wires on the stack
|
| A common use case is to use a for-construction rectangle to define the centers of a hole
| pattern::
|
| s = Workplane().rect(4.0, 4.0, forConstruction=True).vertices().circle(0.25)
|
| Creates 4 circles at the corners of a square centered on the origin.
|
| Negative values for xLen and yLen are permitted, although they only have an effect when
| centered is False.
|
| Future Enhancements:
| * project points not in the workplane plane onto the workplane plane
|
| revolve(self: ~T, angleDegrees: float = 360.0, axisStart: Union[Tuple[float, float], Tuple[float, float, float], cadquery.occ_impl.geom.Vector, NoneType] = None, axisEnd: Union[Tuple[float, float], Tuple[float, float, float], cadquery.occ_impl.geom.Vector, NoneType] = None, combine: Union[bool, Literal['cut', 'a', 's']] = True, clean: bool = True) -> ~T
| Use all un-revolved wires in the parent chain to create a solid.
|
| :param angleDegrees: the angle to revolve through.
| :type angleDegrees: float, anything less than 360 degrees will leave the shape open
| :param axisStart: the start point of the axis of rotation
| :param axisEnd: the end point of the axis of rotation
| :param combine: True or "a" to combine the resulting solid with parent solids if found,
| "cut" or "s" to remove the resulting solid from the parent solids if found.
| False to keep the resulting solid separated from the parent solids.
| :param clean: call :meth:`clean` afterwards to have a clean shape
| :return: a CQ object with the resulting solid selected.
|
| The returned object is always a CQ object, and depends on whether combine is True, and
| whether a context solid is already defined:
|
| * if combine is False, the new value is pushed onto the stack.
| * if combine is true, the value is combined with the context solid if it exists,
| and the resulting solid becomes the new context solid.
|
| .. note::
| Keep in mind that `axisStart` and `axisEnd` are defined relative to the current Workplane center position.
| So if for example you want to revolve a circle centered at (10,0,0) around the Y axis, be sure to either :meth:`move` (or :meth:`moveTo`)
| the current Workplane position or specify `axisStart` and `axisEnd` with the correct vector position.
| In this example (0,0,0), (0,1,0) as axis coords would fail.
|
| rotate(self: ~T, axisStartPoint: Union[Tuple[float, float], Tuple[float, float, float], cadquery.occ_impl.geom.Vector], axisEndPoint: Union[Tuple[float, float], Tuple[float, float, float], cadquery.occ_impl.geom.Vector], angleDegrees: float) -> ~T
| Returns a copy of all of the items on the stack rotated through and angle around the axis
| of rotation.
|
| :param axisStartPoint: The first point of the axis of rotation
| :type axisStartPoint: a 3-tuple of floats
| :param axisEndPoint: The second point of the axis of rotation
| :type axisEndPoint: a 3-tuple of floats
| :param angleDegrees: the rotation angle, in degrees
| :returns: a CQ object
|
| rotateAboutCenter(self: ~T, axisEndPoint: Union[Tuple[float, float], Tuple[float, float, float], cadquery.occ_impl.geom.Vector], angleDegrees: float) -> ~T
| Rotates all items on the stack by the specified angle, about the specified axis
|
| The center of rotation is a vector starting at the center of the object on the stack,
| and ended at the specified point.
|
| :param axisEndPoint: the second point of axis of rotation
| :type axisEndPoint: a three-tuple in global coordinates
| :param angleDegrees: the rotation angle, in degrees
| :returns: a CQ object, with all items rotated.
|
| WARNING: This version returns the same CQ object instead of a new one-- the
| old object is not accessible.
|
| Future Enhancements:
| * A version of this method that returns a transformed copy, rather than modifying
| the originals
| * This method doesn't expose a very good interface, because the axis of rotation
| could be inconsistent between multiple objects. This is because the beginning
| of the axis is variable, while the end is fixed. This is fine when operating on
| one object, but is not cool for multiple.
|
| sagittaArc(self: ~T, endPoint: Union[Tuple[float, float], Tuple[float, float, float], cadquery.occ_impl.geom.Vector], sag: float, forConstruction: bool = False) -> ~T
| Draw an arc from the current point to endPoint with an arc defined by the sag (sagitta).
|
| :param endPoint: end point for the arc
| :type endPoint: 2-tuple, in workplane coordinates
| :param sag: the sagitta of the arc
| :type sag: float, perpendicular distance from arc center to arc baseline.
| :return: a workplane with the current point at the end of the arc
|
| The sagitta is the distance from the center of the arc to the arc base.
| Given that a closed contour is drawn clockwise;
| A positive sagitta means convex arc and negative sagitta means concave arc.
| See `<https://en.wikipedia.org/wiki/Sagitta_(geometry)>`_ for more information.
|
| section(self: ~T, height: float = 0.0) -> ~T
| Slices current solid at the given height.
|
| :param height: height to slice at (default: 0)
| :raises ValueError: if no solids or compounds are found
| :return: a CQ object with the resulting face(s).
|
| shell(self: ~T, thickness: float, kind: Literal['arc', 'intersection'] = 'arc') -> ~T
| Remove the selected faces to create a shell of the specified thickness.
|
| To shell, first create a solid, and *in the same chain* select the faces you wish to remove.
|
| :param thickness: thickness of the desired shell.
| Negative values shell inwards, positive values shell outwards.
| :param kind: kind of join, arc or intersection (default: arc).
| :raises ValueError: if the current stack contains objects that are not faces of a solid
| further up in the chain.
| :returns: a CQ object with the resulting shelled solid selected.
|
| This example will create a hollowed out unit cube, where the top most face is open,
| and all other walls are 0.2 units thick::
|
| Workplane().box(1, 1, 1).faces("+Z").shell(0.2)
|
| You can also select multiple faces at once. Here is an example that creates a three-walled
| corner, by removing three faces of a cube::
|
| Workplane().box(10, 10, 10).faces(">Z or >X or <Y").shell(1)
|
| **Note**: When sharp edges are shelled inwards, they remain sharp corners, but **outward**
| shells are automatically filleted (unless kind="intersection"), because an outward offset
| from a corner generates a radius.
|
| shells(self: ~T, selector: Union[str, cadquery.selectors.Selector, NoneType] = None, tag: Optional[str] = None) -> ~T
| Select the shells of objects on the stack, optionally filtering the selection. If there are
| multiple objects on the stack, the shells of all objects are collected and a list of all the
| distinct shells is returned.
|
| :param selector: optional Selector object, or string selector expression
| (see :class:`StringSyntaxSelector`)
| :param tag: if set, search the tagged object instead of self
| :return: a CQ object whose stack contains all of the *distinct* shells of *all* objects on
| the current stack, filtered by the provided selector.
|
| If there are no shells for any objects on the current stack, an empty CQ object is returned
|
| Most solids will have a single shell, which represents the outer surface. A shell will
| typically be composed of multiple faces.
|
| siblings(self: ~T, kind: Literal['Vertex', 'Edge', 'Wire', 'Face', 'Shell', 'Solid', 'CompSolid', 'Compound'], level: int = 1, tag: Optional[str] = None) -> ~T
| Select topological siblings.
|
| :param kind: kind of linking element, e.g. "Vertex" or "Edge"
| :param level: level of relation - how many elements of kind are in the link
| :param tag: if set, search the tagged object instead of self
| :return: a Workplane object whose stack contains selected siblings.
|
| size(self) -> int
| Return the number of objects currently on the stack
|
| sketch(self: ~T) -> cadquery.sketch.Sketch
| Initialize and return a sketch
|
| :return: Sketch object with the current workplane as a parent.
|
| slot2D(self: ~T, length: float, diameter: float, angle: float = 0) -> ~T
| Creates a rounded slot for each point on the stack.
|
| :param diameter: desired diameter, or width, of slot
| :param length: desired end to end length of slot
| :param angle: angle of slot in degrees, with 0 being along x-axis
| :return: a new CQ object with the created wires on the stack
|
| Can be used to create arrays of slots, such as in cooling applications::
|
| Workplane().box(10, 25, 1).rarray(1, 2, 1, 10).slot2D(8, 1, 0).cutThruAll()
|
| solids(self: ~T, selector: Union[str, cadquery.selectors.Selector, NoneType] = None, tag: Optional[str] = None) -> ~T
| Select the solids of objects on the stack, optionally filtering the selection. If there are
| multiple objects on the stack, the solids of all objects are collected and a list of all the
| distinct solids is returned.
|
| :param selector: optional Selector object, or string selector expression
| (see :class:`StringSyntaxSelector`)
| :param tag: if set, search the tagged object instead of self
| :return: a CQ object whose stack contains all of the *distinct* solids of *all* objects on
| the current stack, filtered by the provided selector.
|
| If there are no solids for any objects on the current stack, an empty CQ object is returned
|
| The typical use is to select a single object on the stack. For example::
|
| Workplane().box(1, 1, 1).solids().size()
|
| returns 1, because a cube consists of one solid.
|
| It is possible for a single CQ object ( or even a single CAD primitive ) to contain
| multiple solids.
|
| sort(self: ~T, key: Callable[[Union[cadquery.occ_impl.geom.Vector, cadquery.occ_impl.geom.Location, cadquery.occ_impl.shapes.Shape, cadquery.sketch.Sketch]], Any]) -> ~T
| Sort items using a callable.
|
| :param key: Callable to be used for sorting.
| :return: Workplane object with items sorted.
|
| sphere(self: ~T, radius: float, direct: Union[Tuple[float, float], Tuple[float, float, float], cadquery.occ_impl.geom.Vector] = (0, 0, 1), angle1: float = -90, angle2: float = 90, angle3: float = 360, centered: Union[bool, Tuple[bool, bool, bool]] = True, combine: Union[bool, Literal['cut', 'a', 's']] = True, clean: bool = True) -> ~T
| Returns a 3D sphere with the specified radius for each point on the stack.
|
| :param radius: The radius of the sphere
| :param direct: The direction axis for the creation of the sphere
| :type direct: A three-tuple
| :param angle1: The first angle to sweep the sphere arc through
| :type angle1: float > 0
| :param angle2: The second angle to sweep the sphere arc through
| :type angle2: float > 0
| :param angle3: The third angle to sweep the sphere arc through
| :type angle3: float > 0
| :param centered: If True, the sphere will be centered around the reference point. If False,
| the corner of a bounding box around the sphere will be on the reference point and it
| will extend in the positive x, y and z directions. Can also use a 3-tuple to specify
| centering along each axis.
| :param combine: Whether the results should be combined with other solids on the stack
| (and each other)
| :type combine: true to combine shapes, false otherwise
| :param clean: call :meth:`clean` afterwards to have a clean shape
| :return: A sphere object for each point on the stack
|
| One sphere is created for each item on the current stack. If no items are on the stack, one
| box using the current workplane center is created.
|
| If combine is true, the result will be a single object on the stack. If a solid was found
| in the chain, the result is that solid with all spheres produced fused onto it otherwise,
| the result is the combination of all the produced spheres.
|
| If combine is false, the result will be a list of the spheres produced.
|
| spline(self: ~T, listOfXYTuple: Iterable[Union[Tuple[float, float], Tuple[float, float, float], cadquery.occ_impl.geom.Vector]], tangents: Optional[Sequence[Union[Tuple[float, float], Tuple[float, float, float], cadquery.occ_impl.geom.Vector]]] = None, periodic: bool = False, parameters: Optional[Sequence[float]] = None, scale: bool = True, tol: Optional[float] = None, forConstruction: bool = False, includeCurrent: bool = False, makeWire: bool = False) -> ~T
| Create a spline interpolated through the provided points (2D or 3D).
|
| :param listOfXYTuple: points to interpolate through
| :param tangents: vectors specifying the direction of the tangent to the
| curve at each of the specified interpolation points.
|
| If only 2 tangents are given, they will be used as the initial and
| final tangent.
|
| If some tangents are not specified (i.e., are None), no tangent
| constraint will be applied to the corresponding interpolation point.
|
| The spline will be C2 continuous at the interpolation points where
| no tangent constraint is specified, and C1 continuous at the points
| where a tangent constraint is specified.
| :param periodic: creation of periodic curves
| :param parameters: the value of the parameter at each interpolation point.
| (The interpolated curve is represented as a vector-valued function of a
| scalar parameter.)
|
| If periodic == True, then len(parameters) must be
| len(interpolation points) + 1, otherwise len(parameters) must be equal to
| len(interpolation points).
| :param scale: whether to scale the specified tangent vectors before
| interpolating.
|
| Each tangent is scaled, so it's length is equal to the derivative of
| the Lagrange interpolated curve.
|
| I.e., set this to True, if you want to use only the direction of
| the tangent vectors specified by ``tangents``, but not their magnitude.
| :param tol: tolerance of the algorithm (consult OCC documentation)
|
| Used to check that the specified points are not too close to each
| other, and that tangent vectors are not too short. (In either case
| interpolation may fail.)
|
| Set to None to use the default tolerance.
| :param includeCurrent: use current point as a starting point of the curve
| :param makeWire: convert the resulting spline edge to a wire
| :return: a Workplane object with the current point at the end of the spline
|
| The spline will begin at the current point, and end with the last point in the
| XY tuple list.
|
| This example creates a block with a spline for one side::
|
| s = Workplane(Plane.XY())
| sPnts = [
| (2.75, 1.5),
| (2.5, 1.75),
| (2.0, 1.5),
| (1.5, 1.0),
| (1.0, 1.25),
| (0.5, 1.0),
| (0, 1.0),
| ]
| r = s.lineTo(3.0, 0).lineTo(3.0, 1.0).spline(sPnts).close()
| r = r.extrude(0.5)
|
| *WARNING* It is fairly easy to create a list of points
| that cannot be correctly interpreted as a spline.
|
| splineApprox(self: ~T, points: Iterable[Union[Tuple[float, float], Tuple[float, float, float], cadquery.occ_impl.geom.Vector]], tol: Optional[float] = 1e-06, minDeg: int = 1, maxDeg: int = 6, smoothing: Optional[Tuple[float, float, float]] = (1, 1, 1), forConstruction: bool = False, includeCurrent: bool = False, makeWire: bool = False) -> ~T
| Create a spline interpolated through the provided points (2D or 3D).
|
| :param points: points to interpolate through
| :param tol: tolerance of the algorithm (default: 1e-6)
| :param minDeg: minimum spline degree (default: 1)
| :param maxDeg: maximum spline degree (default: 6)
| :param smoothing: optional parameters for the variational smoothing algorithm (default: (1,1,1))
| :param includeCurrent: use current point as a starting point of the curve
| :param makeWire: convert the resulting spline edge to a wire
| :return: a Workplane object with the current point at the end of the spline
|
| *WARNING* for advanced users.
|
| split(self: ~T, *args, **kwargs) -> ~T
| Splits a solid on the stack into two parts, optionally keeping the separate parts.
|
| :param bool keepTop: True to keep the top, False or None to discard it
| :param bool keepBottom: True to keep the bottom, False or None to discard it
| :raises ValueError: if keepTop and keepBottom are both false.
| :raises ValueError: if there is no solid in the current stack or parent chain
| :returns: CQ object with the desired objects on the stack.
|
| The most common operation splits a solid and keeps one half. This sample creates
| a split bushing::
|
| # drill a hole in the side
| c = Workplane().box(1, 1, 1).faces(">Z").workplane().circle(0.25).cutThruAll()
|
| # now cut it in half sideways
| c = c.faces(">Y").workplane(-0.5).split(keepTop=True)
|
| sweep(self: ~T, path: Union[ForwardRef('Workplane'), cadquery.occ_impl.shapes.Wire, cadquery.occ_impl.shapes.Edge], multisection: bool = False, sweepAlongWires: Optional[bool] = None, makeSolid: bool = True, isFrenet: bool = False, combine: Union[bool, Literal['cut', 'a', 's']] = True, clean: bool = True, transition: Literal['right', 'round', 'transformed'] = 'right', normal: Union[Tuple[float, float], Tuple[float, float, float], cadquery.occ_impl.geom.Vector, NoneType] = None, auxSpine: Optional[ForwardRef('Workplane')] = None) -> ~T
| Use all un-extruded wires in the parent chain to create a swept solid.
|
| :param path: A wire along which the pending wires will be swept
| :param multiSection: False to create multiple swept from wires on the chain along path.
| True to create only one solid swept along path with shape following the list of wires on the chain
| :param combine: True or "a" to combine the resulting solid with parent solids if found,
| "cut" or "s" to remove the resulting solid from the parent solids if found.
| False to keep the resulting solid separated from the parent solids.
| :param clean: call :meth:`clean` afterwards to have a clean shape
| :param transition: handling of profile orientation at C1 path discontinuities. Possible values are {'transformed','round', 'right'} (default: 'right').
| :param normal: optional fixed normal for extrusion
| :param auxSpine: a wire defining the binormal along the extrusion path
| :return: a CQ object with the resulting solid selected.
|
| tag(self: ~T, name: str) -> ~T
| Tags the current CQ object for later reference.
|
| :param name: the name to tag this object with
| :returns: self, a CQ object with tag applied
|
| tangentArcPoint(self: ~T, endpoint: Union[Tuple[float, float], Tuple[float, float, float], cadquery.occ_impl.geom.Vector], forConstruction: bool = False, relative: bool = True) -> ~T
| Draw an arc as a tangent from the end of the current edge to endpoint.
|
| :param endpoint: point for the arc to end at
| :type endpoint: 2-tuple, 3-tuple or Vector
| :param relative: True if endpoint is specified relative to the current point, False if endpoint is in workplane coordinates
| :return: a Workplane object with an arc on the stack
|
| Requires the the current first object on the stack is an Edge, as would
| be the case after a lineTo operation or similar.
|
| text(self: ~T, txt: str, fontsize: float, distance: float, combine: Union[bool, Literal['cut', 'a', 's']] = 'cut', clean: bool = True, font: str = 'Arial', fontPath: Optional[str] = None, kind: Literal['regular', 'bold', 'italic'] = 'regular', halign: Literal['center', 'left', 'right'] = 'center', valign: Literal['center', 'top', 'bottom'] = 'center') -> ~T
| Returns a 3D text.
|
| :param txt: text to be rendered
| :param fontsize: size of the font in model units
| :param distance: the distance to extrude or cut, normal to the workplane plane
| :type distance: float, negative means opposite the normal direction
| :param combine: True or "a" to combine the resulting solid with parent solids if found,
| "cut" or "s" to remove the resulting solid from the parent solids if found.
| False to keep the resulting solid separated from the parent solids.
| :param clean: call :meth:`clean` afterwards to have a clean shape
| :param font: font name
| :param fontPath: path to font file
| :param kind: font type
| :param halign: horizontal alignment
| :param valign: vertical alignment
| :return: a CQ object with the resulting solid selected
|
| The returned object is always a Workplane object, and depends on whether combine is True, and
| whether a context solid is already defined:
|
| * if combine is False, the new value is pushed onto the stack.
| * if combine is True, "a", "cut" or "s", the value is combined with the context solid if it exists,
| and the resulting solid becomes the new context solid.
|
| Examples::
|
| Create text::
|
| cq.Workplane().text("CadQuery", 5, 1)
|
| Specify the font (name), and kind to use an installed system font::
|
| cq.Workplane().text("CadQuery", 5, 1, font="Liberation Sans Narrow", kind="italic")
|
| Specify fontPath to use a font from a given file::
|
| cq.Workplane().text("CadQuery", 5, 1, fontPath="/opt/fonts/texgyrecursor-bold.otf")
|
| Cut text from a solid (default behavior when context solid exists and combine is not overridden)::
|
| cq.Workplane().box(8, 8, 8).faces(">Z").workplane().text("Z", 5, -1.0)
|
| Add text to a solid::
|
| cq.Workplane().box(8, 8, 8).faces(">Z").workplane().text("Z", 5, 1.0, combine="a")
|
| threePointArc(self: ~T, point1: Union[Tuple[float, float], Tuple[float, float, float], cadquery.occ_impl.geom.Vector], point2: Union[Tuple[float, float], Tuple[float, float, float], cadquery.occ_impl.geom.Vector], forConstruction: bool = False) -> ~T
| Draw an arc from the current point, through point1, and ending at point2
|
| :param point1: point to draw through
| :type point1: 2-tuple, in workplane coordinates
| :param point2: end point for the arc
| :type point2: 2-tuple, in workplane coordinates
| :return: a workplane with the current point at the end of the arc
|
| Future Enhancements:
| provide a version that allows an arc using relative measures
| provide a centerpoint arc
| provide tangent arcs
|
| toOCC(self) -> Any
| Directly returns the wrapped OCCT object.
|
| :return: The wrapped OCCT object
| :rtype: TopoDS_Shape or a subclass
|
| toPending(self: ~T) -> ~T
| Adds wires/edges to pendingWires/pendingEdges.
|
| :return: same CQ object with updated context.
|
| toSvg(self, opts: Any = None) -> str
| Returns svg text that represents the first item on the stack.
|
| for testing purposes.
|
| :param opts: svg formatting options
| :type opts: dictionary, width and height
| :return: a string that contains SVG that represents this item.
|
| transformed(self: ~T, rotate: Union[Tuple[float, float], Tuple[float, float, float], cadquery.occ_impl.geom.Vector] = (0, 0, 0), offset: Union[Tuple[float, float], Tuple[float, float, float], cadquery.occ_impl.geom.Vector] = (0, 0, 0)) -> ~T
| Create a new workplane based on the current one.
| The origin of the new plane is located at the existing origin+offset vector, where offset is
| given in coordinates local to the current plane
| The new plane is rotated through the angles specified by the components of the rotation
| vector.
|
| :param rotate: 3-tuple of angles to rotate, in degrees relative to work plane coordinates
| :param offset: 3-tuple to offset the new plane, in local work plane coordinates
| :return: a new work plane, transformed as requested
|
| translate(self: ~T, vec: Union[Tuple[float, float], Tuple[float, float, float], cadquery.occ_impl.geom.Vector]) -> ~T
| Returns a copy of all of the items on the stack moved by the specified translation vector.
|
| :param tupleDistance: distance to move, in global coordinates
| :type tupleDistance: a 3-tuple of float
| :returns: a CQ object
|
| twistExtrude(self: ~T, distance: float, angleDegrees: float, combine: Union[bool, Literal['cut', 'a', 's']] = True, clean: bool = True) -> ~T
| Extrudes a wire in the direction normal to the plane, but also twists by the specified
| angle over the length of the extrusion.
|
| The center point of the rotation will be the center of the workplane.
|
| See extrude for more details, since this method is the same except for the the addition
| of the angle. In fact, if angle=0, the result is the same as a linear extrude.
|
| **NOTE** This method can create complex calculations, so be careful using it with
| complex geometries
|
| :param distance: the distance to extrude normal to the workplane
| :param angle: angle (in degrees) to rotate through the extrusion
| :param combine: True or "a" to combine the resulting solid with parent solids if found,
| "cut" or "s" to remove the resulting solid from the parent solids if found.
| False to keep the resulting solid separated from the parent solids.
| :param clean: call :meth:`clean` afterwards to have a clean shape
| :return: a CQ object with the resulting solid selected.
|
| union(self: ~T, toUnion: Union[ForwardRef('Workplane'), cadquery.occ_impl.shapes.Solid, cadquery.occ_impl.shapes.Compound, NoneType] = None, clean: bool = True, glue: bool = False, tol: Optional[float] = None) -> ~T
| Unions all of the items on the stack of toUnion with the current solid.
| If there is no current solid, the items in toUnion are unioned together.
|
| :param toUnion: a solid object, or a Workplane object having a solid
| :param clean: call :meth:`clean` afterwards to have a clean shape (default True)
| :param glue: use a faster gluing mode for non-overlapping shapes (default False)
| :param tol: tolerance value for fuzzy bool operation mode (default None)
| :raises: ValueError if there is no solid to add to in the chain
| :return: a Workplane object with the resulting object selected
|
| vLine(self: ~T, distance: float, forConstruction: bool = False) -> ~T
| Make a vertical line from the current point the provided distance
|
| :param distance: (y) distance from current point
| :return: the Workplane object with the current point at the end of the new line
|
| vLineTo(self: ~T, yCoord: float, forConstruction: bool = False) -> ~T
| Make a vertical line from the current point to the provided y coordinate.
|
| Useful if it is more convenient to specify the end location rather than distance,
| as in :meth:`vLine`
|
| :param yCoord: y coordinate for the end of the line
| :return: the Workplane object with the current point at the end of the new line
|
| val(self) -> Union[cadquery.occ_impl.geom.Vector, cadquery.occ_impl.geom.Location, cadquery.occ_impl.shapes.Shape, cadquery.sketch.Sketch]
| Return the first value on the stack. If no value is present, current plane origin is returned.
|
| :return: the first value on the stack.
| :rtype: A CAD primitive
|
| vals(self) -> List[Union[cadquery.occ_impl.geom.Vector, cadquery.occ_impl.geom.Location, cadquery.occ_impl.shapes.Shape, cadquery.sketch.Sketch]]
| get the values in the current list
|
| :rtype: list of occ_impl objects
| :returns: the values of the objects on the stack.
|
| Contrast with :meth:`all`, which returns CQ objects for all of the items on the stack
|
| vertices(self: ~T, selector: Union[str, cadquery.selectors.Selector, NoneType] = None, tag: Optional[str] = None) -> ~T
| Select the vertices of objects on the stack, optionally filtering the selection. If there
| are multiple objects on the stack, the vertices of all objects are collected and a list of
| all the distinct vertices is returned.
|
| :param selector: optional Selector object, or string selector expression
| (see :class:`StringSyntaxSelector`)
| :param tag: if set, search the tagged object instead of self
| :return: a CQ object whose stack contains the *distinct* vertices of *all* objects on the
| current stack, after being filtered by the selector, if provided
|
| If there are no vertices for any objects on the current stack, an empty CQ object
| is returned
|
| The typical use is to select the vertices of a single object on the stack. For example::
|
| Workplane().box(1, 1, 1).faces("+Z").vertices().size()
|
| returns 4, because the topmost face of a cube will contain four vertices. While this::
|
| Workplane().box(1, 1, 1).faces().vertices().size()
|
| returns 8, because a cube has a total of 8 vertices
|
| **Note** Circles are peculiar, they have a single vertex at the center!
|
| wedge(self: ~T, dx: float, dy: float, dz: float, xmin: float, zmin: float, xmax: float, zmax: float, pnt: Union[Tuple[float, float], Tuple[float, float, float], cadquery.occ_impl.geom.Vector] = Vector: (0.0, 0.0, 0.0), dir: Union[Tuple[float, float], Tuple[float, float, float], cadquery.occ_impl.geom.Vector] = Vector: (0.0, 0.0, 1.0), centered: Union[bool, Tuple[bool, bool, bool]] = True, combine: Union[bool, Literal['cut', 'a', 's']] = True, clean: bool = True) -> ~T
| Returns a 3D wedge with the specified dimensions for each point on the stack.
|
| :param dx: Distance along the X axis
| :param dy: Distance along the Y axis
| :param dz: Distance along the Z axis
| :param xmin: The minimum X location
| :param zmin: The minimum Z location
| :param xmax: The maximum X location
| :param zmax: The maximum Z location
| :param pnt: A vector (or tuple) for the origin of the direction for the wedge
| :param dir: The direction vector (or tuple) for the major axis of the wedge
| :param centered: If True, the wedge will be centered around the reference point.
| If False, the corner of the wedge will be on the reference point and it will
| extend in the positive x, y and z directions. Can also use a 3-tuple to
| specify centering along each axis.
| :param combine: Whether the results should be combined with other solids on the stack
| (and each other)
| :param clean: True to attempt to have the kernel clean up the geometry, False otherwise
| :return: A wedge object for each point on the stack
|
| One wedge is created for each item on the current stack. If no items are on the stack, one
| wedge using the current workplane center is created.
|
| If combine is True, the result will be a single object on the stack. If a solid was found
| in the chain, the result is that solid with all wedges produced fused onto it otherwise,
| the result is the combination of all the produced wedges.
|
| If combine is False, the result will be a list of the wedges produced.
|
| wire(self: ~T, forConstruction: bool = False) -> ~T
| Returns a CQ object with all pending edges connected into a wire.
|
| All edges on the stack that can be combined will be combined into a single wire object,
| and other objects will remain on the stack unmodified. If there are no pending edges,
| this method will just return self.
|
| :param forConstruction: whether the wire should be used to make a solid, or if it is just
| for reference
|
| This method is primarily of use to plugin developers making utilities for 2D construction.
| This method should be called when a user operation implies that 2D construction is
| finished, and we are ready to begin working in 3d.
|
| SEE '2D construction concepts' for a more detailed explanation of how CadQuery handles
| edges, wires, etc.
|
| Any non edges will still remain.
|
| wires(self: ~T, selector: Union[str, cadquery.selectors.Selector, NoneType] = None, tag: Optional[str] = None) -> ~T
| Select the wires of objects on the stack, optionally filtering the selection. If there are
| multiple objects on the stack, the wires of all objects are collected and a list of all the
| distinct wires is returned.
|
| :param selector: optional Selector object, or string selector expression
| (see :class:`StringSyntaxSelector`)
| :param tag: if set, search the tagged object instead of self
| :return: a CQ object whose stack contains all of the *distinct* wires of *all* objects on
| the current stack, filtered by the provided selector.
|
| If there are no wires for any objects on the current stack, an empty CQ object is returned
|
| The typical use is to select the wires of a single object on the stack. For example::
|
| Workplane().box(1, 1, 1).faces("+Z").wires().size()
|
| returns 1, because a face typically only has one outer wire
|
| workplane(self: ~T, offset: float = 0.0, invert: bool = False, centerOption: Literal['CenterOfMass', 'ProjectedOrigin', 'CenterOfBoundBox'] = 'ProjectedOrigin', origin: Union[Tuple[float, float], Tuple[float, float, float], cadquery.occ_impl.geom.Vector, NoneType] = None) -> ~T
| Creates a new 2D workplane, located relative to the first face on the stack.
|
| :param offset: offset for the workplane in its normal direction . Default
| :param invert: invert the normal direction from that of the face.
| :param centerOption: how local origin of workplane is determined.
| :param origin: origin for plane center, requires 'ProjectedOrigin' centerOption.
| :type centerOption: string or None='ProjectedOrigin'
| :rtype: Workplane object
|
| The first element on the stack must be a face, a set of
| co-planar faces or a vertex. If a vertex, then the parent
| item on the chain immediately before the vertex must be a
| face.
|
| The result will be a 2D working plane
| with a new coordinate system set up as follows:
|
| * The centerOption parameter sets how the center is defined.
| Options are 'CenterOfMass', 'CenterOfBoundBox', or 'ProjectedOrigin'.
| 'CenterOfMass' and 'CenterOfBoundBox' are in relation to the selected
| face(s) or vertex (vertices). 'ProjectedOrigin' uses by default the current origin
| or the optional origin parameter (if specified) and projects it onto the plane
| defined by the selected face(s).
| * The Z direction will be the normal of the face, computed
| at the center point.
| * The X direction will be parallel to the x-y plane. If the workplane is parallel to
| the global x-y plane, the x direction of the workplane will co-incide with the
| global x direction.
|
| Most commonly, the selected face will be planar, and the workplane lies in the same plane
| of the face ( IE, offset=0). Occasionally, it is useful to define a face offset from
| an existing surface, and even more rarely to define a workplane based on a face that is
| not planar.
|
| workplaneFromTagged(self, name: str) -> 'Workplane'
| Copies the workplane from a tagged parent.
|
| :param name: tag to search for
| :returns: a CQ object with name's workplane
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __annotations__ = {'_tag': typing.Optional[str], 'ctx': <class 'cadque...
cadquery.assembly
Python Library Documentation: module cadquery.assembly in cadquery
NAME
cadquery.assembly
CLASSES
builtins.object
Assembly
class Assembly(builtins.object)
| Assembly(obj: Union[cadquery.occ_impl.shapes.Shape, cadquery.cq.Workplane, NoneType] = None, loc: Optional[cadquery.occ_impl.geom.Location] = None, name: Optional[str] = None, color: Optional[cadquery.occ_impl.assembly.Color] = None, material: Optional[cadquery.occ_impl.assembly.Material] = None, metadata: Optional[Dict[str, Any]] = None)
|
| Nested assembly of Workplane and Shape objects defining their relative positions.
|
| Methods defined here:
|
| __contains__(self, name: str) -> bool
|
| __dir__(self)
| Modified __dir__ for autocompletion.
|
| __getattr__(self, name: str) -> Union[ForwardRef('Assembly'), cadquery.occ_impl.shapes.Shape]
| . based access to children.
|
| __getitem__(self, name: str) -> Union[ForwardRef('Assembly'), cadquery.occ_impl.shapes.Shape]
| [] based access to children.
|
| __getstate__(self)
| Explicit getstate needed due to getattr.
|
| __init__(self, obj: Union[cadquery.occ_impl.shapes.Shape, cadquery.cq.Workplane, NoneType] = None, loc: Optional[cadquery.occ_impl.geom.Location] = None, name: Optional[str] = None, color: Optional[cadquery.occ_impl.assembly.Color] = None, material: Optional[cadquery.occ_impl.assembly.Material] = None, metadata: Optional[Dict[str, Any]] = None)
| construct an assembly
|
| :param obj: root object of the assembly (default: None)
| :param loc: location of the root object (default: None, interpreted as identity transformation)
| :param name: unique name of the root object (default: None, resulting in an UUID being generated)
| :param color: color of the added object (default: None)
| :param material: material (for visual and/or physical properties) of the added object (default: None)
| :param metadata: a store for user-defined metadata (default: None)
| :return: An Assembly object.
|
|
| To create an empty assembly use::
|
| assy = Assembly(None)
|
| To create one constraint a root object::
|
| b = Workplane().box(1, 1, 1)
| assy = Assembly(b, Location(Vector(0, 0, 1)), name="root")
|
| __iter__(self, loc: Optional[cadquery.occ_impl.geom.Location] = None, name: Optional[str] = None, color: Optional[cadquery.occ_impl.assembly.Color] = None) -> Iterator[Tuple[cadquery.occ_impl.shapes.Shape, str, cadquery.occ_impl.geom.Location, Optional[cadquery.occ_impl.assembly.Color]]]
| Assembly iterator yielding shapes, names, locations and colors.
|
| __setstate__(self, d)
| Explicit setstate needed due to getattr.
|
| add(self, arg, **kwargs)
| Add a subassembly to the current assembly.
|
| addSubshape(self, s: cadquery.occ_impl.shapes.Shape, name: Optional[str] = None, color: Optional[cadquery.occ_impl.assembly.Color] = None, layer: Optional[str] = None) -> 'Assembly'
| Handles name, color and layer metadata for subshapes.
|
| :param s: The subshape to add metadata to.
| :param name: The name to assign to the subshape.
| :param color: The color to assign to the subshape.
| :param layer: The layer to assign to the subshape.
| :return: The modified assembly.
|
| constrain(self, *args, param=None)
| Define a new constraint.
|
| export(self, path: str, exportType: Optional[Literal['STEP', 'XML', 'XBF', 'GLTF', 'VTKJS', 'VRML', 'STL']] = None, mode: Literal['default', 'fused'] = 'default', tolerance: float = 0.1, angularTolerance: float = 0.1, unit: Literal['MM', 'CM', 'M', 'KM', 'INCH', 'FT', 'MI', 'UM', 'NM'] = 'MM', outputUnit: Optional[Literal['MM', 'CM', 'M', 'KM', 'INCH', 'FT', 'MI', 'UM', 'NM']] = None, **kwargs) -> Self
| Save assembly to a file.
|
| :param path: Path and filename for writing.
| :param exportType: export format (default: None, results in format being inferred form the path)
| :param mode: STEP only - See :meth:`~cadquery.occ_impl.exporters.assembly.exportAssembly`.
| :param tolerance: the deflection tolerance, in model units. Only used for glTF, VRML. Default 0.1.
| :param angularTolerance: the angular tolerance, in radians. Only used for glTF, VRML. Default 0.1.
| :param unit: The internal unit of the model's geometry values. Only used for STEP. Default "MM".
| :type unit: UnitLiterals
| :param outputUnit: The unit to use in the STEP file header. If None, defaults to the value of ``unit``.
| Use this when you want the output file to declare a different unit than the model's internal unit,
| for example to export a MM model as a STEP file declaring meters.
| :type outputUnit: UnitLiterals or None
| :param \**kwargs: Additional keyword arguments. Only used for STEP, glTF and STL.
| See :meth:`~cadquery.occ_impl.exporters.assembly.exportAssembly`.
| :param ascii: STL only - Sets whether or not STL export should be text or binary
| :type ascii: bool
|
| remove(self, name: str) -> 'Assembly'
| Remove a part/subassembly from the current assembly.
|
| :param name: Name of the part/subassembly to be removed
| :return: The modified assembly
|
| *NOTE* This method can cause problems with deeply nested assemblies and does not remove
| constraints associated with the removed part/subassembly.
|
| save(self, path: str, exportType: Optional[Literal['STEP', 'XML', 'XBF', 'GLTF', 'VTKJS', 'VRML', 'STL']] = None, mode: Literal['default', 'fused'] = 'default', tolerance: float = 0.1, angularTolerance: float = 0.1, **kwargs) -> Self
| Save assembly to a file.
|
| :param path: Path and filename for writing.
| :param exportType: export format (default: None, results in format being inferred form the path)
| :param mode: STEP only - See :meth:`~cadquery.occ_impl.exporters.assembly.exportAssembly`.
| :param tolerance: the deflection tolerance, in model units. Only used for glTF, VRML. Default 0.1.
| :param angularTolerance: the angular tolerance, in radians. Only used for glTF, VRML. Default 0.1.
| :param \**kwargs: Additional keyword arguments. Only used for STEP, glTF and STL.
| See :meth:`~cadquery.occ_impl.exporters.assembly.exportAssembly`.
| :param ascii: STL only - Sets whether or not STL export should be text or binary
| :type ascii: bool
|
| solve(self, verbosity: int = 0) -> Self
| Solve the constraints.
|
| toCompound(self) -> cadquery.occ_impl.shapes.Compound
| Returns a Compound made from this Assembly (including all children) with the
| current Locations applied. Usually this method would only be used after solving.
|
| traverse(self) -> Iterator[Tuple[str, ForwardRef('Assembly')]]
| Yield (name, child) pairs in a bottom-up manner
|
| ----------------------------------------------------------------------
| Class methods defined here:
|
| importStep(path: str, unit: Literal['MM', 'CM', 'M', 'KM', 'INCH', 'FT', 'MI', 'UM', 'NM'] = 'MM') -> Self
| Reads an assembly from a STEP file.
|
| :param path: Path and filename for reading.
| :param unit: The unit of measurement for the STEP file. Default "MM".
| :return: An Assembly object.
|
| load(path: str, importType: Optional[Literal['STEP', 'XML', 'XBF']] = None, unit: Literal['MM', 'CM', 'M', 'KM', 'INCH', 'FT', 'MI', 'UM', 'NM'] = 'MM') -> Self
| Load step, xbf or xml. Only STEP supports unit conversion on loading.
|
| ----------------------------------------------------------------------
| Readonly properties defined here:
|
| shapes
| List of Shape objects in the .obj field
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __annotations__ = {'_solve_result': typing.Optional[typing.Dict[str, t...
FUNCTIONS
reduce(...)
reduce(function, iterable[, initial]) -> value
Apply a function of two arguments cumulatively to the items of a sequence
or iterable, from left to right, so as to reduce the iterable to a single
value. For example, reduce(lambda x, y: x+y, [1, 2, 3, 4, 5]) calculates
((((1+2)+3)+4)+5). If initial is present, it is placed before the items
of the iterable in the calculation, and serves as a default when the
iterable is empty.
warn(...)
Issue a warning, or maybe ignore it or raise an exception.
message
Text of the warning message.
category
The Warning category subclass. Defaults to UserWarning.
stacklevel
How far up the call stack to make this warning appear. A value of 2 for
example attributes the warning to the caller of the code calling warn().
source
If supplied, the destroyed object which emitted a ResourceWarning
skip_file_prefixes
An optional tuple of module filename prefixes indicating frames to skip
during stacklevel computations for stack frame attribution.
DATA
AssemblyObjects = typing.Union[cadquery.occ_impl.shapes.Shape, cadquer...
BinaryConstraintKind = typing.Literal['Plane', 'Point', 'Axis', 'Point...
ConstraintKind = typing.Literal['Plane', 'Point', 'Axis', 'PointI...nt...
Dict = typing.Dict
A generic version of dict.
ExportLiterals = typing.Literal['STEP', 'XML', 'XBF', 'GLTF', 'VTKJS',...
ImportLiterals = typing.Literal['STEP', 'XML', 'XBF']
Iterator = typing.Iterator
A generic version of collections.abc.Iterator.
List = typing.List
A generic version of list.
Literal = typing.Literal
Special typing form to define literal types (a.k.a. value types).
This form can be used to indicate to type checkers that the corresponding
variable or function parameter has a value equivalent to the provided
literal (or one of several literals)::
def validate_simple(data: Any) -> Literal[True]: # always returns True
...
MODE = Literal['r', 'rb', 'w', 'wb']
def open_helper(file: str, mode: MODE) -> str:
...
open_helper('/some/path', 'r') # Passes type check
open_helper('/other/path', 'typo') # Error in type checker
Literal[...] cannot be subclassed. At runtime, an arbitrary value
is allowed as type argument to Literal[...], but type checkers may
impose restrictions.
Optional = typing.Optional
Optional[X] is equivalent to Union[X, None].
PATH_DELIM = '/'
STEPExportModeLiterals = typing.Literal['default', 'fused']
Self = typing.Self
Used to spell the type of "self" in classes.
Example::
from typing import Self
class Foo:
def return_self(self) -> Self:
...
return self
This is especially useful for:
- classmethods that are used as alternative constructors
- annotating an `__enter__` method which returns self
Tuple = typing.Tuple
Deprecated alias to builtins.tuple.
Tuple[X, Y] is the cross-product type of X and Y.
Example: Tuple[T1, T2] is a tuple of two elements corresponding
to type variables T1 and T2. Tuple[int, float, str] is a tuple
of an int, a float and a string.
To specify a variable-length tuple of homogeneous type, use Tuple[T, ...].
UnaryConstraintKind = typing.Literal['Fixed', 'FixedPoint', 'FixedAxis...
Union = typing.Union
Union type; Union[X, Y] means either X or Y.
On Python 3.10 and higher, the | operator
can also be used to denote unions;
X | Y means the same thing to the type checker as Union[X, Y].
To define a union, use e.g. Union[int, str]. Details:
- The arguments must be types and there must be at least one.
- None as an argument is a special case and is replaced by
type(None).
- Unions of unions are flattened, e.g.::
assert Union[Union[int, str], float] == Union[int, str, float]
- Unions of a single argument vanish, e.g.::
assert Union[int] == int # The constructor actually returns int
- Redundant arguments are skipped, e.g.::
assert Union[int, str, int] == Union[int, str]
- When comparing unions, the argument order is ignored, e.g.::
assert Union[int, str] == Union[str, int]
- You cannot subclass or instantiate a union.
- You can use Optional[X] as a shorthand for Union[X, None].
UnitLiterals = typing.Literal['MM', 'CM', 'M', 'KM', 'INCH', 'FT', 'MI...
FILE
c:\users\youse\appdata\local\programs\python\python312\lib\site-packages\cadquery\assembly.py
cadquery.cq
Python Library Documentation: module cadquery.cq in cadquery
NAME
cadquery.cq
DESCRIPTION
# Copyright (c) CadQuery Development Team.
# Distributed under the terms of the Apache 2 License.
CLASSES
builtins.object
CQContext
Workplane
CQ = class Workplane(builtins.object)
| CQ(inPlane='XY', origin=(0, 0, 0), obj=None)
|
| Defines a coordinate system in space, in which 2D coordinates can be used.
|
| :param plane: the plane in which the workplane will be done
| :type plane: a Plane object, or a string in (XY|YZ|XZ|front|back|top|bottom|left|right)
| :param origin: the desired origin of the new workplane
| :type origin: a 3-tuple in global coordinates, or None to default to the origin
| :param obj: an object to use initially for the stack
| :type obj: a CAD primitive, or None to use the centerpoint of the plane as the initial
| stack value.
| :raises: ValueError if the provided plane is not a plane, a valid named workplane
| :return: A Workplane object, with coordinate system matching the supplied plane.
|
| The most common use is::
|
| s = Workplane("XY")
|
| After creation, the stack contains a single point, the origin of the underlying plane,
| and the *current point* is on the origin.
|
| .. note::
| You can also create workplanes on the surface of existing faces using
| :meth:`workplane`
|
| Methods defined here:
|
| __add__(self: ~T, other: Union[ForwardRef('Workplane'), cadquery.occ_impl.shapes.Solid, cadquery.occ_impl.shapes.Compound]) -> ~T
| Syntactic sugar for union.
|
| Notice that :code:`r = a + b` is equivalent to :code:`r = a.union(b)` and :code:`r = a | b`.
|
| __and__(self: ~T, other: Union[ForwardRef('Workplane'), cadquery.occ_impl.shapes.Solid, cadquery.occ_impl.shapes.Compound]) -> ~T
| Syntactic sugar for intersect.
|
| Notice that :code:`r = a & b` is equivalent to :code:`r = a.intersect(b)`.
|
| Example::
|
| Box = Workplane("XY").box(1, 1, 1, centered=(False, False, False))
| Sphere = Workplane("XY").sphere(1)
| result = Box & Sphere
|
| __getitem__(self: ~T, item: Union[int, Sequence[int], slice]) -> ~T
|
| __init__(self, inPlane='XY', origin=(0, 0, 0), obj=None)
| make a workplane from a particular plane
|
| :param inPlane: the plane in which the workplane will be done
| :type inPlane: a Plane object, or a string in (XY|YZ|XZ|front|back|top|bottom|left|right)
| :param origin: the desired origin of the new workplane
| :type origin: a 3-tuple in global coordinates, or None to default to the origin
| :param obj: an object to use initially for the stack
| :type obj: a CAD primitive, or None to use the centerpoint of the plane as the initial
| stack value.
| :raises: ValueError if the provided plane is not a plane, or one of XY|YZ|XZ
| :return: A Workplane object, with coordinate system matching the supplied plane.
|
| The most common use is::
|
| s = Workplane("XY")
|
| After creation, the stack contains a single point, the origin of the underlying plane, and
| the *current point* is on the origin.
|
| __iter__(self: ~T) -> Iterator[cadquery.occ_impl.shapes.Shape]
| Special method for iterating over Shapes in objects
|
| __mul__(self: ~T, other: Union[ForwardRef('Workplane'), cadquery.occ_impl.shapes.Solid, cadquery.occ_impl.shapes.Compound]) -> ~T
| Syntactic sugar for intersect.
|
| Notice that :code:`r = a * b` is equivalent to :code:`r = a.intersect(b)`.
|
| Example::
|
| Box = Workplane("XY").box(1, 1, 1, centered=(False, False, False))
| Sphere = Workplane("XY").sphere(1)
| result = Box * Sphere
|
| __or__(self: ~T, other: Union[ForwardRef('Workplane'), cadquery.occ_impl.shapes.Solid, cadquery.occ_impl.shapes.Compound]) -> ~T
| Syntactic sugar for union.
|
| Notice that :code:`r = a | b` is equivalent to :code:`r = a.union(b)` and :code:`r = a + b`.
|
| Example::
|
| Box = Workplane("XY").box(1, 1, 1, centered=(False, False, False))
| Sphere = Workplane("XY").sphere(1)
| result = Box | Sphere
|
| __sub__(self: ~T, other: Union[ForwardRef('Workplane'), cadquery.occ_impl.shapes.Solid, cadquery.occ_impl.shapes.Compound]) -> ~T
| Syntactic sugar for cut.
|
| Notice that :code:`r = a - b` is equivalent to :code:`r = a.cut(b)`.
|
| Example::
|
| Box = Workplane("XY").box(1, 1, 1, centered=(False, False, False))
| Sphere = Workplane("XY").sphere(1)
| result = Box - Sphere
|
| __truediv__(self: ~T, other: Union[ForwardRef('Workplane'), cadquery.occ_impl.shapes.Solid, cadquery.occ_impl.shapes.Compound]) -> ~T
| Syntactic sugar for split.
|
| Notice that :code:`r = a / b` is equivalent to :code:`r = a.split(b)`.
|
| Example::
|
| Box = Workplane("XY").box(1, 1, 1, centered=(False, False, False))
| Sphere = Workplane("XY").sphere(1)
| result = Box / Sphere
|
| add(self, obj)
| Adds an object or a list of objects to the stack
|
| :param obj: an object to add
| :type obj: a Workplane, CAD primitive, or list of CAD primitives
| :return: a Workplane with the requested operation performed
|
| If a Workplane object, the values of that object's stack are added. If
| a list of cad primitives, they are all added. If a single CAD primitive
| then it is added.
|
| Used in rare cases when you need to combine the results of several CQ
| results into a single Workplane object.
|
| all(self: ~T) -> List[~T]
| Return a list of all CQ objects on the stack.
|
| useful when you need to operate on the elements
| individually.
|
| Contrast with vals, which returns the underlying
| objects for all of the items on the stack
|
| ancestors(self: ~T, kind: Literal['Vertex', 'Edge', 'Wire', 'Face', 'Shell', 'Solid', 'CompSolid', 'Compound'], tag: Optional[str] = None) -> ~T
| Select topological ancestors.
|
| :param kind: kind of ancestor, e.g. "Face" or "Edge"
| :param tag: if set, search the tagged object instead of self
| :return: a Workplane object whose stack contains selected ancestors.
|
| apply(self: ~T, f: Callable[[Iterable[Union[cadquery.occ_impl.geom.Vector, cadquery.occ_impl.geom.Location, cadquery.occ_impl.shapes.Shape, cadquery.sketch.Sketch]]], Iterable[Union[cadquery.occ_impl.geom.Vector, cadquery.occ_impl.geom.Location, cadquery.occ_impl.shapes.Shape, cadquery.sketch.Sketch]]]) -> ~T
| Apply a callable to all items at once.
|
| :param f: Callable to be applied.
| :return: Workplane object with f applied to all items.
|
| bezier(self: ~T, listOfXYTuple: Iterable[Union[Tuple[float, float], Tuple[float, float, float], cadquery.occ_impl.geom.Vector]], forConstruction: bool = False, includeCurrent: bool = False, makeWire: bool = False) -> ~T
| Make a cubic Bézier curve by the provided points (2D or 3D).
|
| :param listOfXYTuple: Bezier control points and end point.
| All points except the last point are Bezier control points,
| and the last point is the end point
| :param includeCurrent: Use the current point as a starting point of the curve
| :param makeWire: convert the resulting bezier edge to a wire
| :return: a Workplane object with the current point at the end of the bezier
|
| The Bézier Will begin at either current point or the first point
| of listOfXYTuple, and end with the last point of listOfXYTuple
|
| box(self: ~T, length: float, width: float, height: float, centered: Union[bool, Tuple[bool, bool, bool]] = True, combine: Union[bool, Literal['cut', 'a', 's']] = True, clean: bool = True) -> ~T
| Return a 3d box with specified dimensions for each object on the stack.
|
| :param length: box size in X direction
| :param width: box size in Y direction
| :param height: box size in Z direction
| :param centered: If True, the box will be centered around the reference point.
| If False, the corner of the box will be on the reference point and it will
| extend in the positive x, y and z directions. Can also use a 3-tuple to
| specify centering along each axis.
| :param combine: should the results be combined with other solids on the stack
| (and each other)?
| :param clean: call :meth:`clean` afterwards to have a clean shape
|
| One box is created for each item on the current stack. If no items are on the stack, one box
| using the current workplane center is created.
|
| If combine is true, the result will be a single object on the stack. If a solid was found
| in the chain, the result is that solid with all boxes produced fused onto it otherwise, the
| result is the combination of all the produced boxes.
|
| If combine is false, the result will be a list of the boxes produced.
|
| Most often boxes form the basis for a part::
|
| # make a single box with lower left corner at origin
| s = Workplane().box(1, 2, 3, centered=False)
|
| But sometimes it is useful to create an array of them::
|
| # create 4 small square bumps on a larger base plate:
| s = (
| Workplane()
| .box(4, 4, 0.5)
| .faces(">Z")
| .workplane()
| .rect(3, 3, forConstruction=True)
| .vertices()
| .box(0.25, 0.25, 0.25, combine=True)
| )
|
| cboreHole(self: ~T, diameter: float, cboreDiameter: float, cboreDepth: float, depth: Optional[float] = None, clean: bool = True) -> ~T
| Makes a counterbored hole for each item on the stack.
|
| :param diameter: the diameter of the hole
| :param cboreDiameter: the diameter of the cbore, must be greater than hole diameter
| :param cboreDepth: depth of the counterbore
| :type cboreDepth: float > 0
| :param depth: the depth of the hole
| :type depth: float > 0 or None to drill thru the entire part
| :param clean: call :meth:`clean` afterwards to have a clean shape
|
| The surface of the hole is at the current workplane plane.
|
| One hole is created for each item on the stack. A very common use case is to use a
| construction rectangle to define the centers of a set of holes, like so::
|
| s = (
| Workplane()
| .box(2, 4, 0.5)
| .faces(">Z")
| .workplane()
| .rect(1.5, 3.5, forConstruction=True)
| .vertices()
| .cboreHole(0.125, 0.25, 0.125, depth=None)
| )
|
| This sample creates a plate with a set of holes at the corners.
|
| **Plugin Note**: this is one example of the power of plugins. Counterbored holes are quite
| time consuming to create, but are quite easily defined by users.
|
| see :meth:`cskHole` to make countersinks instead of counterbores
|
| center(self: ~T, x: float, y: float) -> ~T
| Shift local coordinates to the specified location.
|
| The location is specified in terms of local coordinates.
|
| :param x: the new x location
| :param y: the new y location
| :returns: the Workplane object, with the center adjusted.
|
| The current point is set to the new center.
| This method is useful to adjust the center point after it has been created automatically on
| a face, but not where you'd like it to be.
|
| In this example, we adjust the workplane center to be at the corner of a cube, instead of
| the center of a face, which is the default::
|
| # this workplane is centered at x=0.5,y=0.5, the center of the upper face
| s = Workplane().box(1, 1, 1).faces(">Z").workplane()
|
| s = s.center(-0.5, -0.5) # move the center to the corner
| t = s.circle(0.25).extrude(0.2)
| assert t.faces().size() == 9 # a cube with a cylindrical nub at the top right corner
|
| The result is a cube with a round boss on the corner
|
| chamfer(self: ~T, length: float, length2: Optional[float] = None) -> ~T
| Chamfers a solid on the selected edges.
|
| The edges on the stack are chamfered. The solid to which the
| edges belong must be in the parent chain of the selected
| edges.
|
| Optional parameter `length2` can be supplied with a different
| value than `length` for a chamfer that is shorter on one side
| longer on the other side.
|
| :param length: the length of the chamfer, must be greater than zero
| :param length2: optional parameter for asymmetrical chamfer
| :raises ValueError: if at least one edge is not selected
| :raises ValueError: if the solid containing the edge is not in the chain
| :returns: CQ object with the resulting solid selected.
|
| This example will create a unit cube, with the top edges chamfered::
|
| s = Workplane("XY").box(1, 1, 1).faces("+Z").chamfer(0.1)
|
| This example will create chamfers longer on the sides::
|
| s = Workplane("XY").box(1, 1, 1).faces("+Z").chamfer(0.2, 0.1)
|
| circle(self: ~T, radius: float, forConstruction: bool = False) -> ~T
| Make a circle for each item on the stack.
|
| :param radius: radius of the circle
| :param forConstruction: should the new wires be reference geometry only?
| :type forConstruction: true if the wires are for reference, false if they are creating
| part geometry
| :return: a new CQ object with the created wires on the stack
|
| A common use case is to use a for-construction rectangle to define the centers of a
| hole pattern::
|
| s = Workplane().rect(4.0, 4.0, forConstruction=True).vertices().circle(0.25)
|
| Creates 4 circles at the corners of a square centered on the origin. Another common case is
| to use successive circle() calls to create concentric circles. This works because the
| center of a circle is its reference point::
|
| s = Workplane().circle(2.0).circle(1.0)
|
| Creates two concentric circles, which when extruded will form a ring.
|
| Future Enhancements:
| better way to handle forConstruction
| project points not in the workplane plane onto the workplane plane
|
| clean(self: ~T) -> ~T
| Cleans the current solid by removing unwanted edges from the
| faces.
|
| Normally you don't have to call this function. It is
| automatically called after each related operation. You can
| disable this behavior with `clean=False` parameter if method
| has any. In some cases this can improve performance
| drastically but is generally dis-advised since it may break
| some operations such as fillet.
|
| Note that in some cases where lots of solid operations are
| chained, `clean()` may actually improve performance since
| the shape is 'simplified' at each step and thus next operation
| is easier.
|
| Also note that, due to limitation of the underlying engine,
| `clean` may fail to produce a clean output in some cases such as
| spherical faces.
|
| close(self: ~T) -> ~T
| End construction, and attempt to build a closed wire.
|
| :return: a CQ object with a completed wire on the stack, if possible.
|
| After 2D (or 3D) drafting with methods such as lineTo, threePointArc,
| tangentArcPoint and polyline, it is necessary to convert the edges
| produced by these into one or more wires.
|
| When a set of edges is closed, CadQuery assumes it is safe to build
| the group of edges into a wire. This example builds a simple triangular
| prism::
|
| s = Workplane().lineTo(1, 0).lineTo(1, 1).close().extrude(0.2)
|
| combine(self: ~T, clean: bool = True, glue: bool = False, tol: Optional[float] = None) -> ~T
| Attempts to combine all of the items on the stack into a single item.
|
| WARNING: all of the items must be of the same type!
|
| :param clean: call :meth:`clean` afterwards to have a clean shape
| :param glue: use a faster gluing mode for non-overlapping shapes (default False)
| :param tol: tolerance value for fuzzy bool operation mode (default None)
| :raises: ValueError if there are no items on the stack, or if they cannot be combined
| :return: a CQ object with the resulting object selected
|
| compounds(self: ~T, selector: Union[str, cadquery.selectors.Selector, NoneType] = None, tag: Optional[str] = None) -> ~T
| Select compounds on the stack, optionally filtering the selection. If there are multiple
| objects on the stack, they are collected and a list of all the distinct compounds
| is returned.
|
| :param selector: optional Selector object, or string selector expression
| (see :class:`StringSyntaxSelector`)
| :param tag: if set, search the tagged object instead of self
| :return: a CQ object whose stack contains all of the *distinct* compounds of *all* objects on
| the current stack, filtered by the provided selector.
|
| A compound contains multiple CAD primitives that resulted from a single operation, such as
| a union, cut, split, or fillet. Compounds can contain multiple edges, wires, or solids.
|
| consolidateWires(self: ~T) -> ~T
| Attempt to consolidate wires on the stack into a single.
| If possible, a new object with the results are returned.
| if not possible, the wires remain separated
|
| copyWorkplane(self, obj: ~T) -> ~T
| Copies the workplane from obj.
|
| :param obj: an object to copy the workplane from
| :type obj: a CQ object
| :returns: a CQ object with obj's workplane
|
| cskHole(self: ~T, diameter: float, cskDiameter: float, cskAngle: float, depth: Optional[float] = None, clean: bool = True) -> ~T
| Makes a countersunk hole for each item on the stack.
|
| :param diameter: the diameter of the hole
| :type diameter: float > 0
| :param cskDiameter: the diameter of the countersink, must be greater than hole diameter
| :param cskAngle: angle of the countersink, in degrees ( 82 is common )
| :type cskAngle: float > 0
| :param depth: the depth of the hole
| :type depth: float > 0 or None to drill thru the entire part.
| :param clean: call :meth:`clean` afterwards to have a clean shape
|
| The surface of the hole is at the current workplane.
|
| One hole is created for each item on the stack. A very common use case is to use a
| construction rectangle to define the centers of a set of holes, like so::
|
| s = (
| Workplane()
| .box(2, 4, 0.5)
| .faces(">Z")
| .workplane()
| .rect(1.5, 3.5, forConstruction=True)
| .vertices()
| .cskHole(0.125, 0.25, 82, depth=None)
| )
|
| This sample creates a plate with a set of holes at the corners.
|
| **Plugin Note**: this is one example of the power of plugins. CounterSunk holes are quite
| time consuming to create, but are quite easily defined by users.
|
| see :meth:`cboreHole` to make counterbores instead of countersinks
|
| cut(self: ~T, toCut: Union[ForwardRef('Workplane'), cadquery.occ_impl.shapes.Solid, cadquery.occ_impl.shapes.Compound], clean: bool = True, tol: Optional[float] = None) -> ~T
| Cuts the provided solid from the current solid, IE, perform a solid subtraction.
|
| :param toCut: a solid object, or a Workplane object having a solid
| :param clean: call :meth:`clean` afterwards to have a clean shape
| :param tol: tolerance value for fuzzy bool operation mode (default None)
| :raises ValueError: if there is no solid to subtract from in the chain
| :return: a Workplane object with the resulting object selected
|
| cutBlind(self: ~T, until: Union[float, Literal['next', 'last'], cadquery.occ_impl.shapes.Face], clean: bool = True, both: bool = False, taper: Optional[float] = None) -> ~T
| Use all un-extruded wires in the parent chain to create a prismatic cut from existing solid.
|
| Specify either a distance value, or one of "next", "last" to indicate a face to cut to.
|
| Similar to extrude, except that a solid in the parent chain is required to remove material
| from. cutBlind always removes material from a part.
|
| :param until: The distance to cut to, normal to the workplane plane. When a negative float
| is passed the cut extends this far in the opposite direction to the normal of the plane
| (i.e in the solid). The string "next" cuts until the next face orthogonal to the wire
| normal. "last" cuts to the last face. If an object of type Face is passed, then the cut
| will extend until this face.
| :param clean: call :meth:`clean` afterwards to have a clean shape
| :param both: cut in both directions symmetrically
| :param taper: angle for optional tapered extrusion
| :raises ValueError: if there is no solid to subtract from in the chain
| :return: a CQ object with the resulting object selected
|
| see :meth:`cutThruAll` to cut material from the entire part
|
| cutEach(self: ~T, fcn: Callable[[cadquery.occ_impl.geom.Location], cadquery.occ_impl.shapes.Shape], useLocalCoords: bool = False, clean: bool = True) -> ~T
| Evaluates the provided function at each point on the stack (ie, eachpoint)
| and then cuts the result from the context solid.
|
| :param fcn: a function suitable for use in the eachpoint method: ie, that accepts a vector
| :param useLocalCoords: same as for :meth:`eachpoint`
| :param clean: call :meth:`clean` afterwards to have a clean shape
| :raises ValueError: if no solids or compounds are found in the stack or parent chain
| :return: a CQ object that contains the resulting solid
|
| cutThruAll(self: ~T, clean: bool = True, taper: float = 0) -> ~T
| Use all un-extruded wires in the parent chain to create a prismatic cut from existing solid.
| Cuts through all material in both normal directions of workplane.
|
| Similar to extrude, except that a solid in the parent chain is required to remove material
| from. cutThruAll always removes material from a part.
|
| :param clean: call :meth:`clean` afterwards to have a clean shape
| :raises ValueError: if there is no solid to subtract from in the chain
| :raises ValueError: if there are no pending wires to cut with
| :return: a CQ object with the resulting object selected
|
| see :meth:`cutBlind` to cut material to a limited depth
|
| cylinder(self: ~T, height: float, radius: float, direct: Union[Tuple[float, float, float], cadquery.occ_impl.geom.Vector] = Vector: (0.0, 0.0, 1.0), angle: float = 360, centered: Union[bool, Tuple[bool, bool, bool]] = True, combine: Union[bool, Literal['cut', 'a', 's']] = True, clean: bool = True) -> ~T
| Returns a cylinder with the specified radius and height for each point on the stack
|
| :param height: The height of the cylinder
| :param radius: The radius of the cylinder
| :param direct: The direction axis for the creation of the cylinder
| :type direct: A three-tuple
| :param angle: The angle to sweep the cylinder arc through
| :type angle: float > 0
| :param centered: If True, the cylinder will be centered around the reference point. If False,
| the corner of a bounding box around the cylinder will be on the reference point and it
| will extend in the positive x, y and z directions. Can also use a 3-tuple to specify
| centering along each axis.
| :param combine: Whether the results should be combined with other solids on the stack
| (and each other)
| :type combine: true to combine shapes, false otherwise
| :param clean: call :meth:`clean` afterwards to have a clean shape
| :return: A cylinder object for each point on the stack
|
| One cylinder is created for each item on the current stack. If no items are on the stack, one
| cylinder is created using the current workplane center.
|
| If combine is true, the result will be a single object on the stack. If a solid was found
| in the chain, the result is that solid with all cylinders produced fused onto it otherwise,
| the result is the combination of all the produced cylinders.
|
| If combine is false, the result will be a list of the cylinders produced.
|
| each(self: ~T, callback: Callable[[Union[cadquery.occ_impl.geom.Vector, cadquery.occ_impl.geom.Location, cadquery.occ_impl.shapes.Shape, cadquery.sketch.Sketch]], cadquery.occ_impl.shapes.Shape], useLocalCoordinates: bool = False, combine: Union[bool, Literal['cut', 'a', 's']] = True, clean: bool = True) -> ~T
| Runs the provided function on each value in the stack, and collects the return values into
| a new CQ object.
|
| Special note: a newly created workplane always has its center point as its only stack item
|
| :param callBackFunction: the function to call for each item on the current stack.
| :param useLocalCoordinates: should values be converted from local coordinates first?
| :param combine: True or "a" to combine the resulting solid with parent solids if found,
| "cut" or "s" to remove the resulting solid from the parent solids if found.
| False to keep the resulting solid separated from the parent solids.
| :param clean: call :meth:`clean` afterwards to have a clean shape
|
|
| The callback function must accept one argument, which is the item on the stack, and return
| one object, which is collected. If the function returns None, nothing is added to the stack.
| The object passed into the callBackFunction is potentially transformed to local coordinates,
| if useLocalCoordinates is true
|
| useLocalCoordinates is very useful for plugin developers.
|
| If false, the callback function is assumed to be working in global coordinates. Objects
| created are added as-is, and objects passed into the function are sent in using global
| coordinates
|
| If true, the calling function is assumed to be working in local coordinates. Objects are
| transformed to local coordinates before they are passed into the callback method, and result
| objects are transformed to global coordinates after they are returned.
|
| This allows plugin developers to create objects in local coordinates, without worrying
| about the fact that the working plane is different than the global coordinate system.
|
|
| TODO: wrapper object for Wire will clean up forConstruction flag everywhere
|
| eachpoint(self: ~T, arg: Union[cadquery.occ_impl.shapes.Shape, ForwardRef('Workplane'), Callable[[cadquery.occ_impl.geom.Location], cadquery.occ_impl.shapes.Shape]], useLocalCoordinates: bool = False, combine: Union[bool, Literal['cut', 'a', 's']] = False, clean: bool = True) -> ~T
| Same as each(), except arg is translated by the positions on the stack. If arg is a callback function, then the function is called for each point on the stack, and the resulting shape is used.
| :return: CadQuery object which contains a list of vectors (points ) on its stack.
|
| :param useLocalCoordinates: should points be in local or global coordinates
| :param combine: True or "a" to combine the resulting solid with parent solids if found,
| "cut" or "s" to remove the resulting solid from the parent solids if found.
| False to keep the resulting solid separated from the parent solids.
| :param clean: call :meth:`clean` afterwards to have a clean shape
|
|
| The resulting object has a point on the stack for each object on the original stack.
| Vertices and points remain a point. Faces, Wires, Solids, Edges, and Shells are converted
| to a point by using their center of mass.
|
| If the stack has zero length, a single point is returned, which is the center of the current
| workplane/coordinate system
|
| edges(self: ~T, selector: Union[str, cadquery.selectors.Selector, NoneType] = None, tag: Optional[str] = None) -> ~T
| Select the edges of objects on the stack, optionally filtering the selection. If there are
| multiple objects on the stack, the edges of all objects are collected and a list of all the
| distinct edges is returned.
|
| :param selector: optional Selector object, or string selector expression
| (see :class:`StringSyntaxSelector`)
| :param tag: if set, search the tagged object instead of self
| :return: a CQ object whose stack contains all of the *distinct* edges of *all* objects on
| the current stack, filtered by the provided selector.
|
| If there are no edges for any objects on the current stack, an empty CQ object is returned
|
| The typical use is to select the edges of a single object on the stack. For example::
|
| Workplane().box(1, 1, 1).faces("+Z").edges().size()
|
| returns 4, because the topmost face of a cube will contain four edges. Similarly::
|
| Workplane().box(1, 1, 1).edges().size()
|
| returns 12, because a cube has a total of 12 edges, And::
|
| Workplane().box(1, 1, 1).edges("|Z").size()
|
| returns 4, because a cube has 4 edges parallel to the z direction
|
| ellipse(self: ~T, x_radius: float, y_radius: float, rotation_angle: float = 0.0, forConstruction: bool = False) -> ~T
| Make an ellipse for each item on the stack.
|
| :param x_radius: x radius of the ellipse (x-axis of plane the ellipse should lie in)
| :param y_radius: y radius of the ellipse (y-axis of plane the ellipse should lie in)
| :param rotation_angle: angle to rotate the ellipse
| :param forConstruction: should the new wires be reference geometry only?
| :type forConstruction: true if the wires are for reference, false if they are creating
| part geometry
| :return: a new CQ object with the created wires on the stack
|
| *NOTE* Due to a bug in opencascade (https://tracker.dev.opencascade.org/view.php?id=31290)
| the center of mass (equals center for next shape) is shifted. To create concentric ellipses
| use::
|
| Workplane("XY").center(10, 20).ellipse(100, 10).center(0, 0).ellipse(50, 5)
|
| ellipseArc(self: ~T, x_radius: float, y_radius: float, angle1: float = 360, angle2: float = 360, rotation_angle: float = 0.0, sense: Literal[-1, 1] = 1, forConstruction: bool = False, startAtCurrent: bool = True, makeWire: bool = False) -> ~T
| Draw an elliptical arc with x and y radiuses either with start point at current point or
| or current point being the center of the arc
|
| :param x_radius: x radius of the ellipse (along the x-axis of plane the ellipse should lie in)
| :param y_radius: y radius of the ellipse (along the y-axis of plane the ellipse should lie in)
| :param angle1: start angle of arc
| :param angle2: end angle of arc (angle2 == angle1 return closed ellipse = default)
| :param rotation_angle: angle to rotate the created ellipse / arc
| :param sense: clockwise (-1) or counter clockwise (1)
| :param startAtCurrent: True: start point of arc is moved to current point; False: center of
| arc is on current point
| :param makeWire: convert the resulting arc edge to a wire
|
| end(self, n: int = 1) -> 'Workplane'
| Return the nth parent of this CQ element
|
| :param n: number of ancestor to return (default: 1)
| :rtype: a CQ object
| :raises: ValueError if there are no more parents in the chain.
|
| For example::
|
| CQ(obj).faces("+Z").vertices().end()
|
| will return the same as::
|
| CQ(obj).faces("+Z")
|
| export(self: ~T, fname: str, tolerance: float = 0.1, angularTolerance: float = 0.1, unit: Literal['MM', 'CM', 'M', 'KM', 'INCH', 'FT', 'MI', 'UM', 'NM'] = 'MM', outputUnit: Optional[Literal['MM', 'CM', 'M', 'KM', 'INCH', 'FT', 'MI', 'UM', 'NM']] = None, opt: Optional[Dict[str, Any]] = None) -> ~T
| Export Workplane to file.
|
| :param path: Filename.
| :param tolerance: the deflection tolerance, in model units. Default 0.1.
| :param angularTolerance: the angular tolerance, in radians. Default 0.1.
| :param unit: The internal unit of the model's geometry values. Only used for STEP. Default "MM".
| :type unit: UnitLiterals
| :param outputUnit: The unit to use in the STEP file header. If None, defaults to the value of ``unit``.
| Use this when you want the output file to declare a different unit than the model's internal unit,
| for example to export a MM model as a STEP file declaring meters.
| :type outputUnit: UnitLiterals or None
| :param opt: additional options passed to the specific exporter. Default None.
| :return: Self.
|
| exportSvg(self, fileName: str) -> None
| Exports the first item on the stack as an SVG file
|
| For testing purposes mainly.
|
| :param fileName: the filename to export, absolute path to the file
|
| extrude(self: ~T, until: Union[float, Literal['next', 'last'], cadquery.occ_impl.shapes.Face], combine: Union[bool, Literal['cut', 'a', 's']] = True, clean: bool = True, both: bool = False, taper: Optional[float] = None) -> ~T
| Use all un-extruded wires in the parent chain to create a prismatic solid.
|
| :param until: The distance to extrude, normal to the workplane plane. When a float is
| passed, the extrusion extends this far and a negative value is in the opposite direction
| to the normal of the plane. The string "next" extrudes until the next face orthogonal to
| the wire normal. "last" extrudes to the last face. If a object of type Face is passed then
| the extrusion will extend until this face. **Note that the Workplane must contain a Solid for extruding to a given face.**
| :param combine: True or "a" to combine the resulting solid with parent solids if found,
| "cut" or "s" to remove the resulting solid from the parent solids if found.
| False to keep the resulting solid separated from the parent solids.
| :param clean: call :meth:`clean` afterwards to have a clean shape
| :param both: extrude in both directions symmetrically
| :param taper: angle for optional tapered extrusion
| :return: a CQ object with the resulting solid selected.
|
| The returned object is always a CQ object, and depends on whether combine is True, and
| whether a context solid is already defined:
|
| * if combine is False, the new value is pushed onto the stack. Note that when extruding
| until a specified face, combine can not be False
| * if combine is true, the value is combined with the context solid if it exists,
| and the resulting solid becomes the new context solid.
|
| faces(self: ~T, selector: Union[str, cadquery.selectors.Selector, NoneType] = None, tag: Optional[str] = None) -> ~T
| Select the faces of objects on the stack, optionally filtering the selection. If there are
| multiple objects on the stack, the faces of all objects are collected and a list of all the
| distinct faces is returned.
|
| :param selector: optional Selector object, or string selector expression
| (see :class:`StringSyntaxSelector`)
| :param tag: if set, search the tagged object instead of self
| :return: a CQ object whose stack contains all of the *distinct* faces of *all* objects on
| the current stack, filtered by the provided selector.
|
| If there are no faces for any objects on the current stack, an empty CQ object
| is returned.
|
| The typical use is to select the faces of a single object on the stack. For example::
|
| Workplane().box(1, 1, 1).faces("+Z").size()
|
| returns 1, because a cube has one face with a normal in the +Z direction. Similarly::
|
| Workplane().box(1, 1, 1).faces().size()
|
| returns 6, because a cube has a total of 6 faces, And::
|
| Workplane().box(1, 1, 1).faces("|Z").size()
|
| returns 2, because a cube has 2 faces having normals parallel to the z direction
|
| fillet(self: ~T, radius: float) -> ~T
| Fillets a solid on the selected edges.
|
| The edges on the stack are filleted. The solid to which the edges belong must be in the
| parent chain of the selected edges.
|
| :param radius: the radius of the fillet, must be > zero
| :raises ValueError: if at least one edge is not selected
| :raises ValueError: if the solid containing the edge is not in the chain
| :returns: CQ object with the resulting solid selected.
|
| This example will create a unit cube, with the top edges filleted::
|
| s = Workplane().box(1, 1, 1).faces("+Z").edges().fillet(0.1)
|
| filter(self: ~T, f: Callable[[Union[cadquery.occ_impl.geom.Vector, cadquery.occ_impl.geom.Location, cadquery.occ_impl.shapes.Shape, cadquery.sketch.Sketch]], bool]) -> ~T
| Filter items using a boolean predicate.
|
| :param f: Callable to be used for filtering.
| :return: Workplane object with filtered items.
|
| findSolid(self, searchStack: bool = True, searchParents: bool = True) -> Union[cadquery.occ_impl.shapes.Solid, cadquery.occ_impl.shapes.Compound]
| Finds the first solid object in the chain, searching from the current node
| backwards through parents until one is found.
|
| :param searchStack: should objects on the stack be searched first?
| :param searchParents: should parents be searched?
| :raises ValueError: if no solid is found
|
| This function is very important for chains that are modifying a single parent object,
| most often a solid.
|
| Most of the time, a chain defines or selects a solid, and then modifies it using workplanes
| or other operations.
|
| Plugin Developers should make use of this method to find the solid that should be modified,
| if the plugin implements a unary operation, or if the operation will automatically merge its
| results with an object already on the stack.
|
| first(self: ~T) -> ~T
| Return the first item on the stack
|
| :returns: the first item on the stack.
| :rtype: a CQ object
|
| hLine(self: ~T, distance: float, forConstruction: bool = False) -> ~T
| Make a horizontal line from the current point the provided distance
|
| :param distance: (x) distance from current point
| :return: the Workplane object with the current point at the end of the new line
|
| hLineTo(self: ~T, xCoord: float, forConstruction: bool = False) -> ~T
| Make a horizontal line from the current point to the provided x coordinate.
|
| Useful if it is more convenient to specify the end location rather than distance,
| as in :meth:`hLine`
|
| :param xCoord: x coordinate for the end of the line
| :return: the Workplane object with the current point at the end of the new line
|
| hole(self: ~T, diameter: float, depth: Optional[float] = None, clean: bool = True) -> ~T
| Makes a hole for each item on the stack.
|
| :param diameter: the diameter of the hole
| :param depth: the depth of the hole
| :type depth: float > 0 or None to drill thru the entire part.
| :param clean: call :meth:`clean` afterwards to have a clean shape
|
| The surface of the hole is at the current workplane.
|
| One hole is created for each item on the stack. A very common use case is to use a
| construction rectangle to define the centers of a set of holes, like so::
|
| s = (
| Workplane()
| .box(2, 4, 0.5)
| .faces(">Z")
| .workplane()
| .rect(1.5, 3.5, forConstruction=True)
| .vertices()
| .hole(0.125, 82)
| )
|
| This sample creates a plate with a set of holes at the corners.
|
| **Plugin Note**: this is one example of the power of plugins. CounterSunk holes are quite
| time consuming to create, but are quite easily defined by users.
|
| see :meth:`cboreHole` and :meth:`cskHole` to make counterbores or countersinks
|
| interpPlate(self: ~T, surf_edges: Union[Sequence[Union[Tuple[float, float], Tuple[float, float, float], cadquery.occ_impl.geom.Vector]], Sequence[Union[cadquery.occ_impl.shapes.Edge, cadquery.occ_impl.shapes.Wire]], ForwardRef('Workplane')], surf_pts: Sequence[Union[Tuple[float, float], Tuple[float, float, float], cadquery.occ_impl.geom.Vector]] = [], thickness: float = 0, combine: Union[bool, Literal['cut', 'a', 's']] = False, clean: bool = True, degree: int = 3, nbPtsOnCur: int = 15, nbIter: int = 2, anisotropy: bool = False, tol2d: float = 1e-05, tol3d: float = 0.0001, tolAng: float = 0.01, tolCurv: float = 0.1, maxDeg: int = 8, maxSegments: int = 9) -> ~T
| Returns a plate surface that is 'thickness' thick, enclosed by 'surf_edge_pts' points, and going
| through 'surf_pts' points. Using pushPoints directly with interpPlate and combine=True, can be
| very resource intensive depending on the complexity of the shape. In this case set combine=False.
|
| :param surf_edges: list of [x,y,z] ordered coordinates or list of ordered or unordered edges, wires
| :param surf_pts: list of points (uses only edges if [])
| :param thickness: value may be negative or positive depending on thickening direction (2D surface if 0)
| :param combine: should the results be combined with other solids on the stack (and each other)?
| :param clean: call :meth:`clean` afterwards to have a clean shape
| :param degree: >= 2
| :param nbPtsOnCur: number of points on curve >= 15
| :param nbIter: number of iterations >= 2
| :param anisotropy: = bool Anisotropy
| :param tol2d: 2D tolerance
| :param tol3d: 3D tolerance
| :param tolAng: angular tolerance
| :param tolCurv: tolerance for curvature
| :param maxDeg: highest polynomial degree >= 2
| :param maxSegments: greatest number of segments >= 2
|
| intersect(self: ~T, toIntersect: Union[ForwardRef('Workplane'), cadquery.occ_impl.shapes.Solid, cadquery.occ_impl.shapes.Compound], clean: bool = True, tol: Optional[float] = None) -> ~T
| Intersects the provided solid from the current solid.
|
| :param toIntersect: a solid object, or a Workplane object having a solid
| :param clean: call :meth:`clean` afterwards to have a clean shape
| :param tol: tolerance value for fuzzy bool operation mode (default None)
| :raises ValueError: if there is no solid to intersect with in the chain
| :return: a Workplane object with the resulting object selected
|
| invoke(self: ~T, f: Union[Callable[[~T], ~T], Callable[[~T], NoneType], Callable[[], NoneType]]) -> ~T
| Invoke a callable mapping Workplane to Workplane or None. Supports also
| callables that take no arguments such as breakpoint. Returns self if callable
| returns None.
|
| :param f: Callable to be invoked.
| :return: Workplane object.
|
| item(self: ~T, i: int) -> ~T
| Return the ith item on the stack.
|
| :rtype: a CQ object
|
| largestDimension(self) -> float
| Finds the largest dimension in the stack.
|
| Used internally to create thru features, this is how you can compute
| how long or wide a feature must be to make sure to cut through all of the material
|
| :raises ValueError: if no solids or compounds are found
| :return: A value representing the largest dimension of the first solid on the stack
|
| last(self: ~T) -> ~T
| Return the last item on the stack.
|
| :rtype: a CQ object
|
| line(self: ~T, xDist: float, yDist: float, forConstruction: bool = False) -> ~T
| Make a line from the current point to the provided point, using
| dimensions relative to the current point
|
| :param xDist: x distance from current point
| :param yDist: y distance from current point
| :return: the workplane object with the current point at the end of the new line
|
| see :meth:`lineTo` if you want to use absolute coordinates to make a line instead.
|
| lineTo(self: ~T, x: float, y: float, forConstruction: bool = False) -> ~T
| Make a line from the current point to the provided point
|
| :param x: the x point, in workplane plane coordinates
| :param y: the y point, in workplane plane coordinates
| :return: the Workplane object with the current point at the end of the new line
|
| See :meth:`line` if you want to use relative dimensions to make a line instead.
|
| loft(self: ~T, ruled: bool = False, combine: Union[bool, Literal['cut', 'a', 's']] = True, clean: bool = True) -> ~T
| Make a lofted solid, through the set of wires.
|
| :param ruled: When set to `True` connects each section linearly and without continuity
| :param combine: True or "a" to combine the resulting solid with parent solids if found,
| "cut" or "s" to remove the resulting solid from the parent solids if found.
| False to keep the resulting solid separated from the parent solids.
| :param clean: call :meth:`clean` afterwards to have a clean shape
|
| :return: a Workplane object containing the created loft
|
| map(self: ~T, f: Callable[[Union[cadquery.occ_impl.geom.Vector, cadquery.occ_impl.geom.Location, cadquery.occ_impl.shapes.Shape, cadquery.sketch.Sketch]], Union[cadquery.occ_impl.geom.Vector, cadquery.occ_impl.geom.Location, cadquery.occ_impl.shapes.Shape, cadquery.sketch.Sketch]]) -> ~T
| Apply a callable to every item separately.
|
| :param f: Callable to be applied to every item separately.
| :return: Workplane object with f applied to all items.
|
| mirror(self: ~T, mirrorPlane: Union[Literal['XY', 'YX', 'XZ', 'ZX', 'YZ', 'ZY'], Tuple[float, float], Tuple[float, float, float], cadquery.occ_impl.geom.Vector, cadquery.occ_impl.shapes.Face, ForwardRef('Workplane')] = 'XY', basePointVector: Union[Tuple[float, float], Tuple[float, float, float], cadquery.occ_impl.geom.Vector, NoneType] = None, union: bool = False) -> ~T
| Mirror a single CQ object.
|
| :param mirrorPlane: the plane to mirror about
| :type mirrorPlane: string, one of "XY", "YX", "XZ", "ZX", "YZ", "ZY" the planes
| or the normal vector of the plane eg (1,0,0) or a Face object
| :param basePointVector: the base point to mirror about (this is overwritten if a Face is passed)
| :param union: If true will perform a union operation on the mirrored object
|
| mirrorX(self: ~T) -> ~T
| Mirror entities around the x axis of the workplane plane.
|
| :return: a new object with any free edges consolidated into as few wires as possible.
|
| All free edges are collected into a wire, and then the wire is mirrored,
| and finally joined into a new wire
|
| Typically used to make creating wires with symmetry easier.
|
| mirrorY(self: ~T) -> ~T
| Mirror entities around the y axis of the workplane plane.
|
| :return: a new object with any free edges consolidated into as few wires as possible.
|
| All free edges are collected into a wire, and then the wire is mirrored,
| and finally joined into a new wire
|
| Typically used to make creating wires with symmetry easier. This line of code::
|
| s = Workplane().lineTo(2, 2).threePointArc((3, 1), (2, 0)).mirrorX().extrude(0.25)
|
| Produces a flat, heart shaped object
|
| move(self: ~T, xDist: float = 0, yDist: float = 0) -> ~T
| Move the specified distance from the current point, without drawing.
|
| :param xDist: desired x distance, in local coordinates
| :type xDist: float, or none for zero
| :param yDist: desired y distance, in local coordinates
| :type yDist: float, or none for zero.
|
| Not to be confused with :meth:`center`, which moves the center of the entire
| workplane, this method only moves the current point ( and therefore does not affect objects
| already drawn ).
|
| See :meth:`moveTo` to do the same thing but using absolute coordinates
|
| moveTo(self: ~T, x: float = 0, y: float = 0) -> ~T
| Move to the specified point, without drawing.
|
| :param x: desired x location, in local coordinates
| :type x: float, or none for zero
| :param y: desired y location, in local coordinates
| :type y: float, or none for zero.
|
| Not to be confused with :meth:`center`, which moves the center of the entire
| workplane, this method only moves the current point ( and therefore does not affect objects
| already drawn ).
|
| See :meth:`move` to do the same thing but using relative dimensions
|
| newObject(self: ~T, objlist: Iterable[Union[cadquery.occ_impl.geom.Vector, cadquery.occ_impl.geom.Location, cadquery.occ_impl.shapes.Shape, cadquery.sketch.Sketch]]) -> ~T
| Create a new workplane object from this one.
|
| Overrides CQ.newObject, and should be used by extensions, plugins, and
| subclasses to create new objects.
|
| :param objlist: new objects to put on the stack
| :type objlist: a list of CAD primitives
| :return: a new Workplane object with the current workplane as a parent.
|
| offset2D(self: ~T, d: float, kind: Literal['arc', 'intersection', 'tangent'] = 'arc', forConstruction: bool = False) -> ~T
| Creates a 2D offset wire.
|
| :param d: thickness. Negative thickness denotes offset to inside.
| :param kind: offset kind. Use "arc" for rounded and "intersection" for sharp edges (default: "arc")
| :param forConstruction: Should the result be added to pending wires?
|
| :return: CQ object with resulting wire(s).
|
| parametricCurve(self: ~T, func: Callable[[float], Union[Tuple[float, float], Tuple[float, float, float], cadquery.occ_impl.geom.Vector]], N: int = 400, start: float = 0, stop: float = 1, tol: float = 1e-06, minDeg: int = 1, maxDeg: int = 6, smoothing: Optional[Tuple[float, float, float]] = (1, 1, 1), makeWire: bool = True) -> ~T
| Create a spline curve approximating the provided function.
|
| :param func: function f(t) that will generate (x,y,z) pairs
| :type func: float --> (float,float,float)
| :param N: number of points for discretization
| :param start: starting value of the parameter t
| :param stop: final value of the parameter t
| :param tol: tolerance of the algorithm (default: 1e-6)
| :param minDeg: minimum spline degree (default: 1)
| :param maxDeg: maximum spline degree (default: 6)
| :param smoothing: optional parameters for the variational smoothing algorithm (default: (1,1,1))
| :param makeWire: convert the resulting spline edge to a wire
| :return: a Workplane object with the current point unchanged
|
| parametricSurface(self: ~T, func: Callable[[float, float], Union[Tuple[float, float], Tuple[float, float, float], cadquery.occ_impl.geom.Vector]], N: int = 20, start: float = 0, stop: float = 1, tol: float = 0.01, minDeg: int = 1, maxDeg: int = 6, smoothing: Optional[Tuple[float, float, float]] = (1, 1, 1)) -> ~T
| Create a spline surface approximating the provided function.
|
| :param func: function f(u,v) that will generate (x,y,z) pairs
| :type func: (float,float) --> (float,float,float)
| :param N: number of points for discretization in one direction
| :param start: starting value of the parameters u,v
| :param stop: final value of the parameters u,v
| :param tol: tolerance used by the approximation algorithm (default: 1e-3)
| :param minDeg: minimum spline degree (default: 1)
| :param maxDeg: maximum spline degree (default: 3)
| :param smoothing: optional parameters for the variational smoothing algorithm (default: (1,1,1))
| :return: a Workplane object with the current point unchanged
|
| This method might be unstable and may require tuning of the tol parameter.
|
| placeSketch(self: ~T, *sketches: cadquery.sketch.Sketch) -> ~T
| Place the provided sketch(es) based on the current items on the stack.
|
| :return: Workplane object with the sketch added.
|
| polarArray(self: ~T, radius: float, startAngle: float, angle: float, count: int, fill: bool = True, rotate: bool = True) -> ~T
| Creates a polar array of points and pushes them onto the stack.
| The zero degree reference angle is located along the local X-axis.
|
| :param radius: Radius of the array.
| :param startAngle: Starting angle (degrees) of array. Zero degrees is
| situated along the local X-axis.
| :param angle: The angle (degrees) to fill with elements. A positive
| value will fill in the counter-clockwise direction. If fill is
| False, angle is the angle between elements.
| :param count: Number of elements in array. (count >= 1)
| :param fill: Interpret the angle as total if True (default: True).
| :param rotate: Rotate every item (default: True).
|
| polarLine(self: ~T, distance: float, angle: float, forConstruction: bool = False) -> ~T
| Make a line of the given length, at the given angle from the current point
|
| :param distance: distance of the end of the line from the current point
| :param angle: angle of the vector to the end of the line with the x-axis
| :return: the Workplane object with the current point at the end of the new line
|
| polarLineTo(self: ~T, distance: float, angle: float, forConstruction: bool = False) -> ~T
| Make a line from the current point to the given polar coordinates
|
| Useful if it is more convenient to specify the end location rather than
| the distance and angle from the current point
|
| :param distance: distance of the end of the line from the origin
| :param angle: angle of the vector to the end of the line with the x-axis
| :return: the Workplane object with the current point at the end of the new line
|
| polygon(self: ~T, nSides: int, diameter: float, forConstruction: bool = False, circumscribed: bool = False) -> ~T
| Make a polygon for each item on the stack.
|
| By default, each polygon is created by inscribing it in a circle of the
| specified diameter, such that the first vertex is oriented in the x direction.
| Alternatively, each polygon can be created by circumscribing it around
| a circle of the specified diameter, such that the midpoint of the first edge
| is oriented in the x direction. Circumscribed polygons are thus rotated by
| pi/nSides radians relative to the inscribed polygon. This ensures the extent
| of the polygon along the positive x-axis is always known.
| This has the advantage of not requiring additional formulae for purposes such as
| tiling on the x-axis (at least for even sided polygons).
|
| :param nSides: number of sides, must be >= 3
| :param diameter: the diameter of the circle for constructing the polygon
| :param circumscribed: circumscribe the polygon about a circle
| :type circumscribed: true to create the polygon by circumscribing it about a circle,
| false to create the polygon by inscribing it in a circle
| :return: a polygon wire
|
| polyline(self: ~T, listOfXYTuple: Sequence[Union[Tuple[float, float], Tuple[float, float, float], cadquery.occ_impl.geom.Vector]], forConstruction: bool = False, includeCurrent: bool = False) -> ~T
| Create a polyline from a list of points
|
| :param listOfXYTuple: a list of points in Workplane coordinates (2D or 3D)
| :param forConstruction: whether or not the edges are used for reference
| :type forConstruction: true if the edges are for reference, false if they are for creating geometry
| part geometry
| :param includeCurrent: use current point as a starting point of the polyline
| :return: a new CQ object with a list of edges on the stack
|
| *NOTE* most commonly, the resulting wire should be closed.
|
| pushPoints(self: ~T, pntList: Iterable[Union[Tuple[float, float], Tuple[float, float, float], cadquery.occ_impl.geom.Vector, cadquery.occ_impl.geom.Location]]) -> ~T
| Pushes a list of points onto the stack as vertices.
| The points are in the 2D coordinate space of the workplane face
|
| :param pntList: a list of points to push onto the stack
| :type pntList: list of 2-tuples, in *local* coordinates
| :return: a new workplane with the desired points on the stack.
|
| A common use is to provide a list of points for a subsequent operation, such as creating
| circles or holes. This example creates a cube, and then drills three holes through it,
| based on three points::
|
| s = (
| Workplane()
| .box(1, 1, 1)
| .faces(">Z")
| .workplane()
| .pushPoints([(-0.3, 0.3), (0.3, 0.3), (0, 0)])
| )
| body = s.circle(0.05).cutThruAll()
|
| Here the circle function operates on all three points, and is then extruded to create three
| holes. See :meth:`circle` for how it works.
|
| radiusArc(self: ~T, endPoint: Union[Tuple[float, float], Tuple[float, float, float], cadquery.occ_impl.geom.Vector], radius: float, forConstruction: bool = False) -> ~T
| Draw an arc from the current point to endPoint with an arc defined by the radius.
|
| :param endPoint: end point for the arc
| :type endPoint: 2-tuple, in workplane coordinates
| :param radius: the radius of the arc
| :type radius: float, the radius of the arc between start point and end point.
| :return: a workplane with the current point at the end of the arc
|
| Given that a closed contour is drawn clockwise;
| A positive radius means convex arc and negative radius means concave arc.
|
| rarray(self: ~T, xSpacing: float, ySpacing: float, xCount: int, yCount: int, center: Union[bool, Tuple[bool, bool]] = True) -> ~T
| Creates an array of points and pushes them onto the stack.
| If you want to position the array at another point, create another workplane
| that is shifted to the position you would like to use as a reference
|
| :param xSpacing: spacing between points in the x direction ( must be >= 0)
| :param ySpacing: spacing between points in the y direction ( must be >= 0)
| :param xCount: number of points ( > 0 )
| :param yCount: number of points ( > 0 )
| :param center: If True, the array will be centered around the workplane center.
| If False, the lower corner will be on the reference point and the array will
| extend in the positive x and y directions. Can also use a 2-tuple to specify
| centering along each axis.
|
| rect(self: ~T, xLen: float, yLen: float, centered: Union[bool, Tuple[bool, bool]] = True, forConstruction: bool = False) -> ~T
| Make a rectangle for each item on the stack.
|
| :param xLen: length in the x direction (in workplane coordinates)
| :param yLen: length in the y direction (in workplane coordinates)
| :param centered: If True, the rectangle will be centered around the reference
| point. If False, the corner of the rectangle will be on the reference point and
| it will extend in the positive x and y directions. Can also use a 2-tuple to
| specify centering along each axis.
| :param forConstruction: should the new wires be reference geometry only?
| :type forConstruction: true if the wires are for reference, false if they are creating part
| geometry
| :return: a new CQ object with the created wires on the stack
|
| A common use case is to use a for-construction rectangle to define the centers of a hole
| pattern::
|
| s = Workplane().rect(4.0, 4.0, forConstruction=True).vertices().circle(0.25)
|
| Creates 4 circles at the corners of a square centered on the origin.
|
| Negative values for xLen and yLen are permitted, although they only have an effect when
| centered is False.
|
| Future Enhancements:
| * project points not in the workplane plane onto the workplane plane
|
| revolve(self: ~T, angleDegrees: float = 360.0, axisStart: Union[Tuple[float, float], Tuple[float, float, float], cadquery.occ_impl.geom.Vector, NoneType] = None, axisEnd: Union[Tuple[float, float], Tuple[float, float, float], cadquery.occ_impl.geom.Vector, NoneType] = None, combine: Union[bool, Literal['cut', 'a', 's']] = True, clean: bool = True) -> ~T
| Use all un-revolved wires in the parent chain to create a solid.
|
| :param angleDegrees: the angle to revolve through.
| :type angleDegrees: float, anything less than 360 degrees will leave the shape open
| :param axisStart: the start point of the axis of rotation
| :param axisEnd: the end point of the axis of rotation
| :param combine: True or "a" to combine the resulting solid with parent solids if found,
| "cut" or "s" to remove the resulting solid from the parent solids if found.
| False to keep the resulting solid separated from the parent solids.
| :param clean: call :meth:`clean` afterwards to have a clean shape
| :return: a CQ object with the resulting solid selected.
|
| The returned object is always a CQ object, and depends on whether combine is True, and
| whether a context solid is already defined:
|
| * if combine is False, the new value is pushed onto the stack.
| * if combine is true, the value is combined with the context solid if it exists,
| and the resulting solid becomes the new context solid.
|
| .. note::
| Keep in mind that `axisStart` and `axisEnd` are defined relative to the current Workplane center position.
| So if for example you want to revolve a circle centered at (10,0,0) around the Y axis, be sure to either :meth:`move` (or :meth:`moveTo`)
| the current Workplane position or specify `axisStart` and `axisEnd` with the correct vector position.
| In this example (0,0,0), (0,1,0) as axis coords would fail.
|
| rotate(self: ~T, axisStartPoint: Union[Tuple[float, float], Tuple[float, float, float], cadquery.occ_impl.geom.Vector], axisEndPoint: Union[Tuple[float, float], Tuple[float, float, float], cadquery.occ_impl.geom.Vector], angleDegrees: float) -> ~T
| Returns a copy of all of the items on the stack rotated through and angle around the axis
| of rotation.
|
| :param axisStartPoint: The first point of the axis of rotation
| :type axisStartPoint: a 3-tuple of floats
| :param axisEndPoint: The second point of the axis of rotation
| :type axisEndPoint: a 3-tuple of floats
| :param angleDegrees: the rotation angle, in degrees
| :returns: a CQ object
|
| rotateAboutCenter(self: ~T, axisEndPoint: Union[Tuple[float, float], Tuple[float, float, float], cadquery.occ_impl.geom.Vector], angleDegrees: float) -> ~T
| Rotates all items on the stack by the specified angle, about the specified axis
|
| The center of rotation is a vector starting at the center of the object on the stack,
| and ended at the specified point.
|
| :param axisEndPoint: the second point of axis of rotation
| :type axisEndPoint: a three-tuple in global coordinates
| :param angleDegrees: the rotation angle, in degrees
| :returns: a CQ object, with all items rotated.
|
| WARNING: This version returns the same CQ object instead of a new one-- the
| old object is not accessible.
|
| Future Enhancements:
| * A version of this method that returns a transformed copy, rather than modifying
| the originals
| * This method doesn't expose a very good interface, because the axis of rotation
| could be inconsistent between multiple objects. This is because the beginning
| of the axis is variable, while the end is fixed. This is fine when operating on
| one object, but is not cool for multiple.
|
| sagittaArc(self: ~T, endPoint: Union[Tuple[float, float], Tuple[float, float, float], cadquery.occ_impl.geom.Vector], sag: float, forConstruction: bool = False) -> ~T
| Draw an arc from the current point to endPoint with an arc defined by the sag (sagitta).
|
| :param endPoint: end point for the arc
| :type endPoint: 2-tuple, in workplane coordinates
| :param sag: the sagitta of the arc
| :type sag: float, perpendicular distance from arc center to arc baseline.
| :return: a workplane with the current point at the end of the arc
|
| The sagitta is the distance from the center of the arc to the arc base.
| Given that a closed contour is drawn clockwise;
| A positive sagitta means convex arc and negative sagitta means concave arc.
| See `<https://en.wikipedia.org/wiki/Sagitta_(geometry)>`_ for more information.
|
| section(self: ~T, height: float = 0.0) -> ~T
| Slices current solid at the given height.
|
| :param height: height to slice at (default: 0)
| :raises ValueError: if no solids or compounds are found
| :return: a CQ object with the resulting face(s).
|
| shell(self: ~T, thickness: float, kind: Literal['arc', 'intersection'] = 'arc') -> ~T
| Remove the selected faces to create a shell of the specified thickness.
|
| To shell, first create a solid, and *in the same chain* select the faces you wish to remove.
|
| :param thickness: thickness of the desired shell.
| Negative values shell inwards, positive values shell outwards.
| :param kind: kind of join, arc or intersection (default: arc).
| :raises ValueError: if the current stack contains objects that are not faces of a solid
| further up in the chain.
| :returns: a CQ object with the resulting shelled solid selected.
|
| This example will create a hollowed out unit cube, where the top most face is open,
| and all other walls are 0.2 units thick::
|
| Workplane().box(1, 1, 1).faces("+Z").shell(0.2)
|
| You can also select multiple faces at once. Here is an example that creates a three-walled
| corner, by removing three faces of a cube::
|
| Workplane().box(10, 10, 10).faces(">Z or >X or <Y").shell(1)
|
| **Note**: When sharp edges are shelled inwards, they remain sharp corners, but **outward**
| shells are automatically filleted (unless kind="intersection"), because an outward offset
| from a corner generates a radius.
|
| shells(self: ~T, selector: Union[str, cadquery.selectors.Selector, NoneType] = None, tag: Optional[str] = None) -> ~T
| Select the shells of objects on the stack, optionally filtering the selection. If there are
| multiple objects on the stack, the shells of all objects are collected and a list of all the
| distinct shells is returned.
|
| :param selector: optional Selector object, or string selector expression
| (see :class:`StringSyntaxSelector`)
| :param tag: if set, search the tagged object instead of self
| :return: a CQ object whose stack contains all of the *distinct* shells of *all* objects on
| the current stack, filtered by the provided selector.
|
| If there are no shells for any objects on the current stack, an empty CQ object is returned
|
| Most solids will have a single shell, which represents the outer surface. A shell will
| typically be composed of multiple faces.
|
| siblings(self: ~T, kind: Literal['Vertex', 'Edge', 'Wire', 'Face', 'Shell', 'Solid', 'CompSolid', 'Compound'], level: int = 1, tag: Optional[str] = None) -> ~T
| Select topological siblings.
|
| :param kind: kind of linking element, e.g. "Vertex" or "Edge"
| :param level: level of relation - how many elements of kind are in the link
| :param tag: if set, search the tagged object instead of self
| :return: a Workplane object whose stack contains selected siblings.
|
| size(self) -> int
| Return the number of objects currently on the stack
|
| sketch(self: ~T) -> cadquery.sketch.Sketch
| Initialize and return a sketch
|
| :return: Sketch object with the current workplane as a parent.
|
| slot2D(self: ~T, length: float, diameter: float, angle: float = 0) -> ~T
| Creates a rounded slot for each point on the stack.
|
| :param diameter: desired diameter, or width, of slot
| :param length: desired end to end length of slot
| :param angle: angle of slot in degrees, with 0 being along x-axis
| :return: a new CQ object with the created wires on the stack
|
| Can be used to create arrays of slots, such as in cooling applications::
|
| Workplane().box(10, 25, 1).rarray(1, 2, 1, 10).slot2D(8, 1, 0).cutThruAll()
|
| solids(self: ~T, selector: Union[str, cadquery.selectors.Selector, NoneType] = None, tag: Optional[str] = None) -> ~T
| Select the solids of objects on the stack, optionally filtering the selection. If there are
| multiple objects on the stack, the solids of all objects are collected and a list of all the
| distinct solids is returned.
|
| :param selector: optional Selector object, or string selector expression
| (see :class:`StringSyntaxSelector`)
| :param tag: if set, search the tagged object instead of self
| :return: a CQ object whose stack contains all of the *distinct* solids of *all* objects on
| the current stack, filtered by the provided selector.
|
| If there are no solids for any objects on the current stack, an empty CQ object is returned
|
| The typical use is to select a single object on the stack. For example::
|
| Workplane().box(1, 1, 1).solids().size()
|
| returns 1, because a cube consists of one solid.
|
| It is possible for a single CQ object ( or even a single CAD primitive ) to contain
| multiple solids.
|
| sort(self: ~T, key: Callable[[Union[cadquery.occ_impl.geom.Vector, cadquery.occ_impl.geom.Location, cadquery.occ_impl.shapes.Shape, cadquery.sketch.Sketch]], Any]) -> ~T
| Sort items using a callable.
|
| :param key: Callable to be used for sorting.
| :return: Workplane object with items sorted.
|
| sphere(self: ~T, radius: float, direct: Union[Tuple[float, float], Tuple[float, float, float], cadquery.occ_impl.geom.Vector] = (0, 0, 1), angle1: float = -90, angle2: float = 90, angle3: float = 360, centered: Union[bool, Tuple[bool, bool, bool]] = True, combine: Union[bool, Literal['cut', 'a', 's']] = True, clean: bool = True) -> ~T
| Returns a 3D sphere with the specified radius for each point on the stack.
|
| :param radius: The radius of the sphere
| :param direct: The direction axis for the creation of the sphere
| :type direct: A three-tuple
| :param angle1: The first angle to sweep the sphere arc through
| :type angle1: float > 0
| :param angle2: The second angle to sweep the sphere arc through
| :type angle2: float > 0
| :param angle3: The third angle to sweep the sphere arc through
| :type angle3: float > 0
| :param centered: If True, the sphere will be centered around the reference point. If False,
| the corner of a bounding box around the sphere will be on the reference point and it
| will extend in the positive x, y and z directions. Can also use a 3-tuple to specify
| centering along each axis.
| :param combine: Whether the results should be combined with other solids on the stack
| (and each other)
| :type combine: true to combine shapes, false otherwise
| :param clean: call :meth:`clean` afterwards to have a clean shape
| :return: A sphere object for each point on the stack
|
| One sphere is created for each item on the current stack. If no items are on the stack, one
| box using the current workplane center is created.
|
| If combine is true, the result will be a single object on the stack. If a solid was found
| in the chain, the result is that solid with all spheres produced fused onto it otherwise,
| the result is the combination of all the produced spheres.
|
| If combine is false, the result will be a list of the spheres produced.
|
| spline(self: ~T, listOfXYTuple: Iterable[Union[Tuple[float, float], Tuple[float, float, float], cadquery.occ_impl.geom.Vector]], tangents: Optional[Sequence[Union[Tuple[float, float], Tuple[float, float, float], cadquery.occ_impl.geom.Vector]]] = None, periodic: bool = False, parameters: Optional[Sequence[float]] = None, scale: bool = True, tol: Optional[float] = None, forConstruction: bool = False, includeCurrent: bool = False, makeWire: bool = False) -> ~T
| Create a spline interpolated through the provided points (2D or 3D).
|
| :param listOfXYTuple: points to interpolate through
| :param tangents: vectors specifying the direction of the tangent to the
| curve at each of the specified interpolation points.
|
| If only 2 tangents are given, they will be used as the initial and
| final tangent.
|
| If some tangents are not specified (i.e., are None), no tangent
| constraint will be applied to the corresponding interpolation point.
|
| The spline will be C2 continuous at the interpolation points where
| no tangent constraint is specified, and C1 continuous at the points
| where a tangent constraint is specified.
| :param periodic: creation of periodic curves
| :param parameters: the value of the parameter at each interpolation point.
| (The interpolated curve is represented as a vector-valued function of a
| scalar parameter.)
|
| If periodic == True, then len(parameters) must be
| len(interpolation points) + 1, otherwise len(parameters) must be equal to
| len(interpolation points).
| :param scale: whether to scale the specified tangent vectors before
| interpolating.
|
| Each tangent is scaled, so it's length is equal to the derivative of
| the Lagrange interpolated curve.
|
| I.e., set this to True, if you want to use only the direction of
| the tangent vectors specified by ``tangents``, but not their magnitude.
| :param tol: tolerance of the algorithm (consult OCC documentation)
|
| Used to check that the specified points are not too close to each
| other, and that tangent vectors are not too short. (In either case
| interpolation may fail.)
|
| Set to None to use the default tolerance.
| :param includeCurrent: use current point as a starting point of the curve
| :param makeWire: convert the resulting spline edge to a wire
| :return: a Workplane object with the current point at the end of the spline
|
| The spline will begin at the current point, and end with the last point in the
| XY tuple list.
|
| This example creates a block with a spline for one side::
|
| s = Workplane(Plane.XY())
| sPnts = [
| (2.75, 1.5),
| (2.5, 1.75),
| (2.0, 1.5),
| (1.5, 1.0),
| (1.0, 1.25),
| (0.5, 1.0),
| (0, 1.0),
| ]
| r = s.lineTo(3.0, 0).lineTo(3.0, 1.0).spline(sPnts).close()
| r = r.extrude(0.5)
|
| *WARNING* It is fairly easy to create a list of points
| that cannot be correctly interpreted as a spline.
|
| splineApprox(self: ~T, points: Iterable[Union[Tuple[float, float], Tuple[float, float, float], cadquery.occ_impl.geom.Vector]], tol: Optional[float] = 1e-06, minDeg: int = 1, maxDeg: int = 6, smoothing: Optional[Tuple[float, float, float]] = (1, 1, 1), forConstruction: bool = False, includeCurrent: bool = False, makeWire: bool = False) -> ~T
| Create a spline interpolated through the provided points (2D or 3D).
|
| :param points: points to interpolate through
| :param tol: tolerance of the algorithm (default: 1e-6)
| :param minDeg: minimum spline degree (default: 1)
| :param maxDeg: maximum spline degree (default: 6)
| :param smoothing: optional parameters for the variational smoothing algorithm (default: (1,1,1))
| :param includeCurrent: use current point as a starting point of the curve
| :param makeWire: convert the resulting spline edge to a wire
| :return: a Workplane object with the current point at the end of the spline
|
| *WARNING* for advanced users.
|
| split(self: ~T, *args, **kwargs) -> ~T
| Splits a solid on the stack into two parts, optionally keeping the separate parts.
|
| :param bool keepTop: True to keep the top, False or None to discard it
| :param bool keepBottom: True to keep the bottom, False or None to discard it
| :raises ValueError: if keepTop and keepBottom are both false.
| :raises ValueError: if there is no solid in the current stack or parent chain
| :returns: CQ object with the desired objects on the stack.
|
| The most common operation splits a solid and keeps one half. This sample creates
| a split bushing::
|
| # drill a hole in the side
| c = Workplane().box(1, 1, 1).faces(">Z").workplane().circle(0.25).cutThruAll()
|
| # now cut it in half sideways
| c = c.faces(">Y").workplane(-0.5).split(keepTop=True)
|
| sweep(self: ~T, path: Union[ForwardRef('Workplane'), cadquery.occ_impl.shapes.Wire, cadquery.occ_impl.shapes.Edge], multisection: bool = False, sweepAlongWires: Optional[bool] = None, makeSolid: bool = True, isFrenet: bool = False, combine: Union[bool, Literal['cut', 'a', 's']] = True, clean: bool = True, transition: Literal['right', 'round', 'transformed'] = 'right', normal: Union[Tuple[float, float], Tuple[float, float, float], cadquery.occ_impl.geom.Vector, NoneType] = None, auxSpine: Optional[ForwardRef('Workplane')] = None) -> ~T
| Use all un-extruded wires in the parent chain to create a swept solid.
|
| :param path: A wire along which the pending wires will be swept
| :param multiSection: False to create multiple swept from wires on the chain along path.
| True to create only one solid swept along path with shape following the list of wires on the chain
| :param combine: True or "a" to combine the resulting solid with parent solids if found,
| "cut" or "s" to remove the resulting solid from the parent solids if found.
| False to keep the resulting solid separated from the parent solids.
| :param clean: call :meth:`clean` afterwards to have a clean shape
| :param transition: handling of profile orientation at C1 path discontinuities. Possible values are {'transformed','round', 'right'} (default: 'right').
| :param normal: optional fixed normal for extrusion
| :param auxSpine: a wire defining the binormal along the extrusion path
| :return: a CQ object with the resulting solid selected.
|
| tag(self: ~T, name: str) -> ~T
| Tags the current CQ object for later reference.
|
| :param name: the name to tag this object with
| :returns: self, a CQ object with tag applied
|
| tangentArcPoint(self: ~T, endpoint: Union[Tuple[float, float], Tuple[float, float, float], cadquery.occ_impl.geom.Vector], forConstruction: bool = False, relative: bool = True) -> ~T
| Draw an arc as a tangent from the end of the current edge to endpoint.
|
| :param endpoint: point for the arc to end at
| :type endpoint: 2-tuple, 3-tuple or Vector
| :param relative: True if endpoint is specified relative to the current point, False if endpoint is in workplane coordinates
| :return: a Workplane object with an arc on the stack
|
| Requires the the current first object on the stack is an Edge, as would
| be the case after a lineTo operation or similar.
|
| text(self: ~T, txt: str, fontsize: float, distance: float, combine: Union[bool, Literal['cut', 'a', 's']] = 'cut', clean: bool = True, font: str = 'Arial', fontPath: Optional[str] = None, kind: Literal['regular', 'bold', 'italic'] = 'regular', halign: Literal['center', 'left', 'right'] = 'center', valign: Literal['center', 'top', 'bottom'] = 'center') -> ~T
| Returns a 3D text.
|
| :param txt: text to be rendered
| :param fontsize: size of the font in model units
| :param distance: the distance to extrude or cut, normal to the workplane plane
| :type distance: float, negative means opposite the normal direction
| :param combine: True or "a" to combine the resulting solid with parent solids if found,
| "cut" or "s" to remove the resulting solid from the parent solids if found.
| False to keep the resulting solid separated from the parent solids.
| :param clean: call :meth:`clean` afterwards to have a clean shape
| :param font: font name
| :param fontPath: path to font file
| :param kind: font type
| :param halign: horizontal alignment
| :param valign: vertical alignment
| :return: a CQ object with the resulting solid selected
|
| The returned object is always a Workplane object, and depends on whether combine is True, and
| whether a context solid is already defined:
|
| * if combine is False, the new value is pushed onto the stack.
| * if combine is True, "a", "cut" or "s", the value is combined with the context solid if it exists,
| and the resulting solid becomes the new context solid.
|
| Examples::
|
| Create text::
|
| cq.Workplane().text("CadQuery", 5, 1)
|
| Specify the font (name), and kind to use an installed system font::
|
| cq.Workplane().text("CadQuery", 5, 1, font="Liberation Sans Narrow", kind="italic")
|
| Specify fontPath to use a font from a given file::
|
| cq.Workplane().text("CadQuery", 5, 1, fontPath="/opt/fonts/texgyrecursor-bold.otf")
|
| Cut text from a solid (default behavior when context solid exists and combine is not overridden)::
|
| cq.Workplane().box(8, 8, 8).faces(">Z").workplane().text("Z", 5, -1.0)
|
| Add text to a solid::
|
| cq.Workplane().box(8, 8, 8).faces(">Z").workplane().text("Z", 5, 1.0, combine="a")
|
| threePointArc(self: ~T, point1: Union[Tuple[float, float], Tuple[float, float, float], cadquery.occ_impl.geom.Vector], point2: Union[Tuple[float, float], Tuple[float, float, float], cadquery.occ_impl.geom.Vector], forConstruction: bool = False) -> ~T
| Draw an arc from the current point, through point1, and ending at point2
|
| :param point1: point to draw through
| :type point1: 2-tuple, in workplane coordinates
| :param point2: end point for the arc
| :type point2: 2-tuple, in workplane coordinates
| :return: a workplane with the current point at the end of the arc
|
| Future Enhancements:
| provide a version that allows an arc using relative measures
| provide a centerpoint arc
| provide tangent arcs
|
| toOCC(self) -> Any
| Directly returns the wrapped OCCT object.
|
| :return: The wrapped OCCT object
| :rtype: TopoDS_Shape or a subclass
|
| toPending(self: ~T) -> ~T
| Adds wires/edges to pendingWires/pendingEdges.
|
| :return: same CQ object with updated context.
|
| toSvg(self, opts: Any = None) -> str
| Returns svg text that represents the first item on the stack.
|
| for testing purposes.
|
| :param opts: svg formatting options
| :type opts: dictionary, width and height
| :return: a string that contains SVG that represents this item.
|
| transformed(self: ~T, rotate: Union[Tuple[float, float], Tuple[float, float, float], cadquery.occ_impl.geom.Vector] = (0, 0, 0), offset: Union[Tuple[float, float], Tuple[float, float, float], cadquery.occ_impl.geom.Vector] = (0, 0, 0)) -> ~T
| Create a new workplane based on the current one.
| The origin of the new plane is located at the existing origin+offset vector, where offset is
| given in coordinates local to the current plane
| The new plane is rotated through the angles specified by the components of the rotation
| vector.
|
| :param rotate: 3-tuple of angles to rotate, in degrees relative to work plane coordinates
| :param offset: 3-tuple to offset the new plane, in local work plane coordinates
| :return: a new work plane, transformed as requested
|
| translate(self: ~T, vec: Union[Tuple[float, float], Tuple[float, float, float], cadquery.occ_impl.geom.Vector]) -> ~T
| Returns a copy of all of the items on the stack moved by the specified translation vector.
|
| :param tupleDistance: distance to move, in global coordinates
| :type tupleDistance: a 3-tuple of float
| :returns: a CQ object
|
| twistExtrude(self: ~T, distance: float, angleDegrees: float, combine: Union[bool, Literal['cut', 'a', 's']] = True, clean: bool = True) -> ~T
| Extrudes a wire in the direction normal to the plane, but also twists by the specified
| angle over the length of the extrusion.
|
| The center point of the rotation will be the center of the workplane.
|
| See extrude for more details, since this method is the same except for the the addition
| of the angle. In fact, if angle=0, the result is the same as a linear extrude.
|
| **NOTE** This method can create complex calculations, so be careful using it with
| complex geometries
|
| :param distance: the distance to extrude normal to the workplane
| :param angle: angle (in degrees) to rotate through the extrusion
| :param combine: True or "a" to combine the resulting solid with parent solids if found,
| "cut" or "s" to remove the resulting solid from the parent solids if found.
| False to keep the resulting solid separated from the parent solids.
| :param clean: call :meth:`clean` afterwards to have a clean shape
| :return: a CQ object with the resulting solid selected.
|
| union(self: ~T, toUnion: Union[ForwardRef('Workplane'), cadquery.occ_impl.shapes.Solid, cadquery.occ_impl.shapes.Compound, NoneType] = None, clean: bool = True, glue: bool = False, tol: Optional[float] = None) -> ~T
| Unions all of the items on the stack of toUnion with the current solid.
| If there is no current solid, the items in toUnion are unioned together.
|
| :param toUnion: a solid object, or a Workplane object having a solid
| :param clean: call :meth:`clean` afterwards to have a clean shape (default True)
| :param glue: use a faster gluing mode for non-overlapping shapes (default False)
| :param tol: tolerance value for fuzzy bool operation mode (default None)
| :raises: ValueError if there is no solid to add to in the chain
| :return: a Workplane object with the resulting object selected
|
| vLine(self: ~T, distance: float, forConstruction: bool = False) -> ~T
| Make a vertical line from the current point the provided distance
|
| :param distance: (y) distance from current point
| :return: the Workplane object with the current point at the end of the new line
|
| vLineTo(self: ~T, yCoord: float, forConstruction: bool = False) -> ~T
| Make a vertical line from the current point to the provided y coordinate.
|
| Useful if it is more convenient to specify the end location rather than distance,
| as in :meth:`vLine`
|
| :param yCoord: y coordinate for the end of the line
| :return: the Workplane object with the current point at the end of the new line
|
| val(self) -> Union[cadquery.occ_impl.geom.Vector, cadquery.occ_impl.geom.Location, cadquery.occ_impl.shapes.Shape, cadquery.sketch.Sketch]
| Return the first value on the stack. If no value is present, current plane origin is returned.
|
| :return: the first value on the stack.
| :rtype: A CAD primitive
|
| vals(self) -> List[Union[cadquery.occ_impl.geom.Vector, cadquery.occ_impl.geom.Location, cadquery.occ_impl.shapes.Shape, cadquery.sketch.Sketch]]
| get the values in the current list
|
| :rtype: list of occ_impl objects
| :returns: the values of the objects on the stack.
|
| Contrast with :meth:`all`, which returns CQ objects for all of the items on the stack
|
| vertices(self: ~T, selector: Union[str, cadquery.selectors.Selector, NoneType] = None, tag: Optional[str] = None) -> ~T
| Select the vertices of objects on the stack, optionally filtering the selection. If there
| are multiple objects on the stack, the vertices of all objects are collected and a list of
| all the distinct vertices is returned.
|
| :param selector: optional Selector object, or string selector expression
| (see :class:`StringSyntaxSelector`)
| :param tag: if set, search the tagged object instead of self
| :return: a CQ object whose stack contains the *distinct* vertices of *all* objects on the
| current stack, after being filtered by the selector, if provided
|
| If there are no vertices for any objects on the current stack, an empty CQ object
| is returned
|
| The typical use is to select the vertices of a single object on the stack. For example::
|
| Workplane().box(1, 1, 1).faces("+Z").vertices().size()
|
| returns 4, because the topmost face of a cube will contain four vertices. While this::
|
| Workplane().box(1, 1, 1).faces().vertices().size()
|
| returns 8, because a cube has a total of 8 vertices
|
| **Note** Circles are peculiar, they have a single vertex at the center!
|
| wedge(self: ~T, dx: float, dy: float, dz: float, xmin: float, zmin: float, xmax: float, zmax: float, pnt: Union[Tuple[float, float], Tuple[float, float, float], cadquery.occ_impl.geom.Vector] = Vector: (0.0, 0.0, 0.0), dir: Union[Tuple[float, float], Tuple[float, float, float], cadquery.occ_impl.geom.Vector] = Vector: (0.0, 0.0, 1.0), centered: Union[bool, Tuple[bool, bool, bool]] = True, combine: Union[bool, Literal['cut', 'a', 's']] = True, clean: bool = True) -> ~T
| Returns a 3D wedge with the specified dimensions for each point on the stack.
|
| :param dx: Distance along the X axis
| :param dy: Distance along the Y axis
| :param dz: Distance along the Z axis
| :param xmin: The minimum X location
| :param zmin: The minimum Z location
| :param xmax: The maximum X location
| :param zmax: The maximum Z location
| :param pnt: A vector (or tuple) for the origin of the direction for the wedge
| :param dir: The direction vector (or tuple) for the major axis of the wedge
| :param centered: If True, the wedge will be centered around the reference point.
| If False, the corner of the wedge will be on the reference point and it will
| extend in the positive x, y and z directions. Can also use a 3-tuple to
| specify centering along each axis.
| :param combine: Whether the results should be combined with other solids on the stack
| (and each other)
| :param clean: True to attempt to have the kernel clean up the geometry, False otherwise
| :return: A wedge object for each point on the stack
|
| One wedge is created for each item on the current stack. If no items are on the stack, one
| wedge using the current workplane center is created.
|
| If combine is True, the result will be a single object on the stack. If a solid was found
| in the chain, the result is that solid with all wedges produced fused onto it otherwise,
| the result is the combination of all the produced wedges.
|
| If combine is False, the result will be a list of the wedges produced.
|
| wire(self: ~T, forConstruction: bool = False) -> ~T
| Returns a CQ object with all pending edges connected into a wire.
|
| All edges on the stack that can be combined will be combined into a single wire object,
| and other objects will remain on the stack unmodified. If there are no pending edges,
| this method will just return self.
|
| :param forConstruction: whether the wire should be used to make a solid, or if it is just
| for reference
|
| This method is primarily of use to plugin developers making utilities for 2D construction.
| This method should be called when a user operation implies that 2D construction is
| finished, and we are ready to begin working in 3d.
|
| SEE '2D construction concepts' for a more detailed explanation of how CadQuery handles
| edges, wires, etc.
|
| Any non edges will still remain.
|
| wires(self: ~T, selector: Union[str, cadquery.selectors.Selector, NoneType] = None, tag: Optional[str] = None) -> ~T
| Select the wires of objects on the stack, optionally filtering the selection. If there are
| multiple objects on the stack, the wires of all objects are collected and a list of all the
| distinct wires is returned.
|
| :param selector: optional Selector object, or string selector expression
| (see :class:`StringSyntaxSelector`)
| :param tag: if set, search the tagged object instead of self
| :return: a CQ object whose stack contains all of the *distinct* wires of *all* objects on
| the current stack, filtered by the provided selector.
|
| If there are no wires for any objects on the current stack, an empty CQ object is returned
|
| The typical use is to select the wires of a single object on the stack. For example::
|
| Workplane().box(1, 1, 1).faces("+Z").wires().size()
|
| returns 1, because a face typically only has one outer wire
|
| workplane(self: ~T, offset: float = 0.0, invert: bool = False, centerOption: Literal['CenterOfMass', 'ProjectedOrigin', 'CenterOfBoundBox'] = 'ProjectedOrigin', origin: Union[Tuple[float, float], Tuple[float, float, float], cadquery.occ_impl.geom.Vector, NoneType] = None) -> ~T
| Creates a new 2D workplane, located relative to the first face on the stack.
|
| :param offset: offset for the workplane in its normal direction . Default
| :param invert: invert the normal direction from that of the face.
| :param centerOption: how local origin of workplane is determined.
| :param origin: origin for plane center, requires 'ProjectedOrigin' centerOption.
| :type centerOption: string or None='ProjectedOrigin'
| :rtype: Workplane object
|
| The first element on the stack must be a face, a set of
| co-planar faces or a vertex. If a vertex, then the parent
| item on the chain immediately before the vertex must be a
| face.
|
| The result will be a 2D working plane
| with a new coordinate system set up as follows:
|
| * The centerOption parameter sets how the center is defined.
| Options are 'CenterOfMass', 'CenterOfBoundBox', or 'ProjectedOrigin'.
| 'CenterOfMass' and 'CenterOfBoundBox' are in relation to the selected
| face(s) or vertex (vertices). 'ProjectedOrigin' uses by default the current origin
| or the optional origin parameter (if specified) and projects it onto the plane
| defined by the selected face(s).
| * The Z direction will be the normal of the face, computed
| at the center point.
| * The X direction will be parallel to the x-y plane. If the workplane is parallel to
| the global x-y plane, the x direction of the workplane will co-incide with the
| global x direction.
|
| Most commonly, the selected face will be planar, and the workplane lies in the same plane
| of the face ( IE, offset=0). Occasionally, it is useful to define a face offset from
| an existing surface, and even more rarely to define a workplane based on a face that is
| not planar.
|
| workplaneFromTagged(self, name: str) -> 'Workplane'
| Copies the workplane from a tagged parent.
|
| :param name: tag to search for
| :returns: a CQ object with name's workplane
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __annotations__ = {'_tag': typing.Optional[str], 'ctx': <class 'cadque...
class CQContext(builtins.object)
| A shared context for modeling.
|
| All objects in the same CQ chain share a reference to this same object instance
| which allows for shared state when needed.
|
| Methods defined here:
|
| __init__(self)
| Initialize self. See help(type(self)) for accurate signature.
|
| popPendingEdges(self, errorOnEmpty: bool = True) -> List[cadquery.occ_impl.shapes.Edge]
| Get and clear pending edges.
|
| :raises ValueError: if errorOnEmpty is True and no edges are present.
|
| popPendingWires(self, errorOnEmpty: bool = True) -> List[cadquery.occ_impl.shapes.Wire]
| Get and clear pending wires.
|
| :raises ValueError: if errorOnEmpty is True and no wires are present.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __annotations__ = {'firstPoint': typing.Optional[cadquery.occ_impl.geo...
class Workplane(builtins.object)
| Workplane(inPlane='XY', origin=(0, 0, 0), obj=None)
|
| Defines a coordinate system in space, in which 2D coordinates can be used.
|
| :param plane: the plane in which the workplane will be done
| :type plane: a Plane object, or a string in (XY|YZ|XZ|front|back|top|bottom|left|right)
| :param origin: the desired origin of the new workplane
| :type origin: a 3-tuple in global coordinates, or None to default to the origin
| :param obj: an object to use initially for the stack
| :type obj: a CAD primitive, or None to use the centerpoint of the plane as the initial
| stack value.
| :raises: ValueError if the provided plane is not a plane, a valid named workplane
| :return: A Workplane object, with coordinate system matching the supplied plane.
|
| The most common use is::
|
| s = Workplane("XY")
|
| After creation, the stack contains a single point, the origin of the underlying plane,
| and the *current point* is on the origin.
|
| .. note::
| You can also create workplanes on the surface of existing faces using
| :meth:`workplane`
|
| Methods defined here:
|
| __add__(self: ~T, other: Union[ForwardRef('Workplane'), cadquery.occ_impl.shapes.Solid, cadquery.occ_impl.shapes.Compound]) -> ~T
| Syntactic sugar for union.
|
| Notice that :code:`r = a + b` is equivalent to :code:`r = a.union(b)` and :code:`r = a | b`.
|
| __and__(self: ~T, other: Union[ForwardRef('Workplane'), cadquery.occ_impl.shapes.Solid, cadquery.occ_impl.shapes.Compound]) -> ~T
| Syntactic sugar for intersect.
|
| Notice that :code:`r = a & b` is equivalent to :code:`r = a.intersect(b)`.
|
| Example::
|
| Box = Workplane("XY").box(1, 1, 1, centered=(False, False, False))
| Sphere = Workplane("XY").sphere(1)
| result = Box & Sphere
|
| __getitem__(self: ~T, item: Union[int, Sequence[int], slice]) -> ~T
|
| __init__(self, inPlane='XY', origin=(0, 0, 0), obj=None)
| make a workplane from a particular plane
|
| :param inPlane: the plane in which the workplane will be done
| :type inPlane: a Plane object, or a string in (XY|YZ|XZ|front|back|top|bottom|left|right)
| :param origin: the desired origin of the new workplane
| :type origin: a 3-tuple in global coordinates, or None to default to the origin
| :param obj: an object to use initially for the stack
| :type obj: a CAD primitive, or None to use the centerpoint of the plane as the initial
| stack value.
| :raises: ValueError if the provided plane is not a plane, or one of XY|YZ|XZ
| :return: A Workplane object, with coordinate system matching the supplied plane.
|
| The most common use is::
|
| s = Workplane("XY")
|
| After creation, the stack contains a single point, the origin of the underlying plane, and
| the *current point* is on the origin.
|
| __iter__(self: ~T) -> Iterator[cadquery.occ_impl.shapes.Shape]
| Special method for iterating over Shapes in objects
|
| __mul__(self: ~T, other: Union[ForwardRef('Workplane'), cadquery.occ_impl.shapes.Solid, cadquery.occ_impl.shapes.Compound]) -> ~T
| Syntactic sugar for intersect.
|
| Notice that :code:`r = a * b` is equivalent to :code:`r = a.intersect(b)`.
|
| Example::
|
| Box = Workplane("XY").box(1, 1, 1, centered=(False, False, False))
| Sphere = Workplane("XY").sphere(1)
| result = Box * Sphere
|
| __or__(self: ~T, other: Union[ForwardRef('Workplane'), cadquery.occ_impl.shapes.Solid, cadquery.occ_impl.shapes.Compound]) -> ~T
| Syntactic sugar for union.
|
| Notice that :code:`r = a | b` is equivalent to :code:`r = a.union(b)` and :code:`r = a + b`.
|
| Example::
|
| Box = Workplane("XY").box(1, 1, 1, centered=(False, False, False))
| Sphere = Workplane("XY").sphere(1)
| result = Box | Sphere
|
| __sub__(self: ~T, other: Union[ForwardRef('Workplane'), cadquery.occ_impl.shapes.Solid, cadquery.occ_impl.shapes.Compound]) -> ~T
| Syntactic sugar for cut.
|
| Notice that :code:`r = a - b` is equivalent to :code:`r = a.cut(b)`.
|
| Example::
|
| Box = Workplane("XY").box(1, 1, 1, centered=(False, False, False))
| Sphere = Workplane("XY").sphere(1)
| result = Box - Sphere
|
| __truediv__(self: ~T, other: Union[ForwardRef('Workplane'), cadquery.occ_impl.shapes.Solid, cadquery.occ_impl.shapes.Compound]) -> ~T
| Syntactic sugar for split.
|
| Notice that :code:`r = a / b` is equivalent to :code:`r = a.split(b)`.
|
| Example::
|
| Box = Workplane("XY").box(1, 1, 1, centered=(False, False, False))
| Sphere = Workplane("XY").sphere(1)
| result = Box / Sphere
|
| add(self, obj)
| Adds an object or a list of objects to the stack
|
| :param obj: an object to add
| :type obj: a Workplane, CAD primitive, or list of CAD primitives
| :return: a Workplane with the requested operation performed
|
| If a Workplane object, the values of that object's stack are added. If
| a list of cad primitives, they are all added. If a single CAD primitive
| then it is added.
|
| Used in rare cases when you need to combine the results of several CQ
| results into a single Workplane object.
|
| all(self: ~T) -> List[~T]
| Return a list of all CQ objects on the stack.
|
| useful when you need to operate on the elements
| individually.
|
| Contrast with vals, which returns the underlying
| objects for all of the items on the stack
|
| ancestors(self: ~T, kind: Literal['Vertex', 'Edge', 'Wire', 'Face', 'Shell', 'Solid', 'CompSolid', 'Compound'], tag: Optional[str] = None) -> ~T
| Select topological ancestors.
|
| :param kind: kind of ancestor, e.g. "Face" or "Edge"
| :param tag: if set, search the tagged object instead of self
| :return: a Workplane object whose stack contains selected ancestors.
|
| apply(self: ~T, f: Callable[[Iterable[Union[cadquery.occ_impl.geom.Vector, cadquery.occ_impl.geom.Location, cadquery.occ_impl.shapes.Shape, cadquery.sketch.Sketch]]], Iterable[Union[cadquery.occ_impl.geom.Vector, cadquery.occ_impl.geom.Location, cadquery.occ_impl.shapes.Shape, cadquery.sketch.Sketch]]]) -> ~T
| Apply a callable to all items at once.
|
| :param f: Callable to be applied.
| :return: Workplane object with f applied to all items.
|
| bezier(self: ~T, listOfXYTuple: Iterable[Union[Tuple[float, float], Tuple[float, float, float], cadquery.occ_impl.geom.Vector]], forConstruction: bool = False, includeCurrent: bool = False, makeWire: bool = False) -> ~T
| Make a cubic Bézier curve by the provided points (2D or 3D).
|
| :param listOfXYTuple: Bezier control points and end point.
| All points except the last point are Bezier control points,
| and the last point is the end point
| :param includeCurrent: Use the current point as a starting point of the curve
| :param makeWire: convert the resulting bezier edge to a wire
| :return: a Workplane object with the current point at the end of the bezier
|
| The Bézier Will begin at either current point or the first point
| of listOfXYTuple, and end with the last point of listOfXYTuple
|
| box(self: ~T, length: float, width: float, height: float, centered: Union[bool, Tuple[bool, bool, bool]] = True, combine: Union[bool, Literal['cut', 'a', 's']] = True, clean: bool = True) -> ~T
| Return a 3d box with specified dimensions for each object on the stack.
|
| :param length: box size in X direction
| :param width: box size in Y direction
| :param height: box size in Z direction
| :param centered: If True, the box will be centered around the reference point.
| If False, the corner of the box will be on the reference point and it will
| extend in the positive x, y and z directions. Can also use a 3-tuple to
| specify centering along each axis.
| :param combine: should the results be combined with other solids on the stack
| (and each other)?
| :param clean: call :meth:`clean` afterwards to have a clean shape
|
| One box is created for each item on the current stack. If no items are on the stack, one box
| using the current workplane center is created.
|
| If combine is true, the result will be a single object on the stack. If a solid was found
| in the chain, the result is that solid with all boxes produced fused onto it otherwise, the
| result is the combination of all the produced boxes.
|
| If combine is false, the result will be a list of the boxes produced.
|
| Most often boxes form the basis for a part::
|
| # make a single box with lower left corner at origin
| s = Workplane().box(1, 2, 3, centered=False)
|
| But sometimes it is useful to create an array of them::
|
| # create 4 small square bumps on a larger base plate:
| s = (
| Workplane()
| .box(4, 4, 0.5)
| .faces(">Z")
| .workplane()
| .rect(3, 3, forConstruction=True)
| .vertices()
| .box(0.25, 0.25, 0.25, combine=True)
| )
|
| cboreHole(self: ~T, diameter: float, cboreDiameter: float, cboreDepth: float, depth: Optional[float] = None, clean: bool = True) -> ~T
| Makes a counterbored hole for each item on the stack.
|
| :param diameter: the diameter of the hole
| :param cboreDiameter: the diameter of the cbore, must be greater than hole diameter
| :param cboreDepth: depth of the counterbore
| :type cboreDepth: float > 0
| :param depth: the depth of the hole
| :type depth: float > 0 or None to drill thru the entire part
| :param clean: call :meth:`clean` afterwards to have a clean shape
|
| The surface of the hole is at the current workplane plane.
|
| One hole is created for each item on the stack. A very common use case is to use a
| construction rectangle to define the centers of a set of holes, like so::
|
| s = (
| Workplane()
| .box(2, 4, 0.5)
| .faces(">Z")
| .workplane()
| .rect(1.5, 3.5, forConstruction=True)
| .vertices()
| .cboreHole(0.125, 0.25, 0.125, depth=None)
| )
|
| This sample creates a plate with a set of holes at the corners.
|
| **Plugin Note**: this is one example of the power of plugins. Counterbored holes are quite
| time consuming to create, but are quite easily defined by users.
|
| see :meth:`cskHole` to make countersinks instead of counterbores
|
| center(self: ~T, x: float, y: float) -> ~T
| Shift local coordinates to the specified location.
|
| The location is specified in terms of local coordinates.
|
| :param x: the new x location
| :param y: the new y location
| :returns: the Workplane object, with the center adjusted.
|
| The current point is set to the new center.
| This method is useful to adjust the center point after it has been created automatically on
| a face, but not where you'd like it to be.
|
| In this example, we adjust the workplane center to be at the corner of a cube, instead of
| the center of a face, which is the default::
|
| # this workplane is centered at x=0.5,y=0.5, the center of the upper face
| s = Workplane().box(1, 1, 1).faces(">Z").workplane()
|
| s = s.center(-0.5, -0.5) # move the center to the corner
| t = s.circle(0.25).extrude(0.2)
| assert t.faces().size() == 9 # a cube with a cylindrical nub at the top right corner
|
| The result is a cube with a round boss on the corner
|
| chamfer(self: ~T, length: float, length2: Optional[float] = None) -> ~T
| Chamfers a solid on the selected edges.
|
| The edges on the stack are chamfered. The solid to which the
| edges belong must be in the parent chain of the selected
| edges.
|
| Optional parameter `length2` can be supplied with a different
| value than `length` for a chamfer that is shorter on one side
| longer on the other side.
|
| :param length: the length of the chamfer, must be greater than zero
| :param length2: optional parameter for asymmetrical chamfer
| :raises ValueError: if at least one edge is not selected
| :raises ValueError: if the solid containing the edge is not in the chain
| :returns: CQ object with the resulting solid selected.
|
| This example will create a unit cube, with the top edges chamfered::
|
| s = Workplane("XY").box(1, 1, 1).faces("+Z").chamfer(0.1)
|
| This example will create chamfers longer on the sides::
|
| s = Workplane("XY").box(1, 1, 1).faces("+Z").chamfer(0.2, 0.1)
|
| circle(self: ~T, radius: float, forConstruction: bool = False) -> ~T
| Make a circle for each item on the stack.
|
| :param radius: radius of the circle
| :param forConstruction: should the new wires be reference geometry only?
| :type forConstruction: true if the wires are for reference, false if they are creating
| part geometry
| :return: a new CQ object with the created wires on the stack
|
| A common use case is to use a for-construction rectangle to define the centers of a
| hole pattern::
|
| s = Workplane().rect(4.0, 4.0, forConstruction=True).vertices().circle(0.25)
|
| Creates 4 circles at the corners of a square centered on the origin. Another common case is
| to use successive circle() calls to create concentric circles. This works because the
| center of a circle is its reference point::
|
| s = Workplane().circle(2.0).circle(1.0)
|
| Creates two concentric circles, which when extruded will form a ring.
|
| Future Enhancements:
| better way to handle forConstruction
| project points not in the workplane plane onto the workplane plane
|
| clean(self: ~T) -> ~T
| Cleans the current solid by removing unwanted edges from the
| faces.
|
| Normally you don't have to call this function. It is
| automatically called after each related operation. You can
| disable this behavior with `clean=False` parameter if method
| has any. In some cases this can improve performance
| drastically but is generally dis-advised since it may break
| some operations such as fillet.
|
| Note that in some cases where lots of solid operations are
| chained, `clean()` may actually improve performance since
| the shape is 'simplified' at each step and thus next operation
| is easier.
|
| Also note that, due to limitation of the underlying engine,
| `clean` may fail to produce a clean output in some cases such as
| spherical faces.
|
| close(self: ~T) -> ~T
| End construction, and attempt to build a closed wire.
|
| :return: a CQ object with a completed wire on the stack, if possible.
|
| After 2D (or 3D) drafting with methods such as lineTo, threePointArc,
| tangentArcPoint and polyline, it is necessary to convert the edges
| produced by these into one or more wires.
|
| When a set of edges is closed, CadQuery assumes it is safe to build
| the group of edges into a wire. This example builds a simple triangular
| prism::
|
| s = Workplane().lineTo(1, 0).lineTo(1, 1).close().extrude(0.2)
|
| combine(self: ~T, clean: bool = True, glue: bool = False, tol: Optional[float] = None) -> ~T
| Attempts to combine all of the items on the stack into a single item.
|
| WARNING: all of the items must be of the same type!
|
| :param clean: call :meth:`clean` afterwards to have a clean shape
| :param glue: use a faster gluing mode for non-overlapping shapes (default False)
| :param tol: tolerance value for fuzzy bool operation mode (default None)
| :raises: ValueError if there are no items on the stack, or if they cannot be combined
| :return: a CQ object with the resulting object selected
|
| compounds(self: ~T, selector: Union[str, cadquery.selectors.Selector, NoneType] = None, tag: Optional[str] = None) -> ~T
| Select compounds on the stack, optionally filtering the selection. If there are multiple
| objects on the stack, they are collected and a list of all the distinct compounds
| is returned.
|
| :param selector: optional Selector object, or string selector expression
| (see :class:`StringSyntaxSelector`)
| :param tag: if set, search the tagged object instead of self
| :return: a CQ object whose stack contains all of the *distinct* compounds of *all* objects on
| the current stack, filtered by the provided selector.
|
| A compound contains multiple CAD primitives that resulted from a single operation, such as
| a union, cut, split, or fillet. Compounds can contain multiple edges, wires, or solids.
|
| consolidateWires(self: ~T) -> ~T
| Attempt to consolidate wires on the stack into a single.
| If possible, a new object with the results are returned.
| if not possible, the wires remain separated
|
| copyWorkplane(self, obj: ~T) -> ~T
| Copies the workplane from obj.
|
| :param obj: an object to copy the workplane from
| :type obj: a CQ object
| :returns: a CQ object with obj's workplane
|
| cskHole(self: ~T, diameter: float, cskDiameter: float, cskAngle: float, depth: Optional[float] = None, clean: bool = True) -> ~T
| Makes a countersunk hole for each item on the stack.
|
| :param diameter: the diameter of the hole
| :type diameter: float > 0
| :param cskDiameter: the diameter of the countersink, must be greater than hole diameter
| :param cskAngle: angle of the countersink, in degrees ( 82 is common )
| :type cskAngle: float > 0
| :param depth: the depth of the hole
| :type depth: float > 0 or None to drill thru the entire part.
| :param clean: call :meth:`clean` afterwards to have a clean shape
|
| The surface of the hole is at the current workplane.
|
| One hole is created for each item on the stack. A very common use case is to use a
| construction rectangle to define the centers of a set of holes, like so::
|
| s = (
| Workplane()
| .box(2, 4, 0.5)
| .faces(">Z")
| .workplane()
| .rect(1.5, 3.5, forConstruction=True)
| .vertices()
| .cskHole(0.125, 0.25, 82, depth=None)
| )
|
| This sample creates a plate with a set of holes at the corners.
|
| **Plugin Note**: this is one example of the power of plugins. CounterSunk holes are quite
| time consuming to create, but are quite easily defined by users.
|
| see :meth:`cboreHole` to make counterbores instead of countersinks
|
| cut(self: ~T, toCut: Union[ForwardRef('Workplane'), cadquery.occ_impl.shapes.Solid, cadquery.occ_impl.shapes.Compound], clean: bool = True, tol: Optional[float] = None) -> ~T
| Cuts the provided solid from the current solid, IE, perform a solid subtraction.
|
| :param toCut: a solid object, or a Workplane object having a solid
| :param clean: call :meth:`clean` afterwards to have a clean shape
| :param tol: tolerance value for fuzzy bool operation mode (default None)
| :raises ValueError: if there is no solid to subtract from in the chain
| :return: a Workplane object with the resulting object selected
|
| cutBlind(self: ~T, until: Union[float, Literal['next', 'last'], cadquery.occ_impl.shapes.Face], clean: bool = True, both: bool = False, taper: Optional[float] = None) -> ~T
| Use all un-extruded wires in the parent chain to create a prismatic cut from existing solid.
|
| Specify either a distance value, or one of "next", "last" to indicate a face to cut to.
|
| Similar to extrude, except that a solid in the parent chain is required to remove material
| from. cutBlind always removes material from a part.
|
| :param until: The distance to cut to, normal to the workplane plane. When a negative float
| is passed the cut extends this far in the opposite direction to the normal of the plane
| (i.e in the solid). The string "next" cuts until the next face orthogonal to the wire
| normal. "last" cuts to the last face. If an object of type Face is passed, then the cut
| will extend until this face.
| :param clean: call :meth:`clean` afterwards to have a clean shape
| :param both: cut in both directions symmetrically
| :param taper: angle for optional tapered extrusion
| :raises ValueError: if there is no solid to subtract from in the chain
| :return: a CQ object with the resulting object selected
|
| see :meth:`cutThruAll` to cut material from the entire part
|
| cutEach(self: ~T, fcn: Callable[[cadquery.occ_impl.geom.Location], cadquery.occ_impl.shapes.Shape], useLocalCoords: bool = False, clean: bool = True) -> ~T
| Evaluates the provided function at each point on the stack (ie, eachpoint)
| and then cuts the result from the context solid.
|
| :param fcn: a function suitable for use in the eachpoint method: ie, that accepts a vector
| :param useLocalCoords: same as for :meth:`eachpoint`
| :param clean: call :meth:`clean` afterwards to have a clean shape
| :raises ValueError: if no solids or compounds are found in the stack or parent chain
| :return: a CQ object that contains the resulting solid
|
| cutThruAll(self: ~T, clean: bool = True, taper: float = 0) -> ~T
| Use all un-extruded wires in the parent chain to create a prismatic cut from existing solid.
| Cuts through all material in both normal directions of workplane.
|
| Similar to extrude, except that a solid in the parent chain is required to remove material
| from. cutThruAll always removes material from a part.
|
| :param clean: call :meth:`clean` afterwards to have a clean shape
| :raises ValueError: if there is no solid to subtract from in the chain
| :raises ValueError: if there are no pending wires to cut with
| :return: a CQ object with the resulting object selected
|
| see :meth:`cutBlind` to cut material to a limited depth
|
| cylinder(self: ~T, height: float, radius: float, direct: Union[Tuple[float, float, float], cadquery.occ_impl.geom.Vector] = Vector: (0.0, 0.0, 1.0), angle: float = 360, centered: Union[bool, Tuple[bool, bool, bool]] = True, combine: Union[bool, Literal['cut', 'a', 's']] = True, clean: bool = True) -> ~T
| Returns a cylinder with the specified radius and height for each point on the stack
|
| :param height: The height of the cylinder
| :param radius: The radius of the cylinder
| :param direct: The direction axis for the creation of the cylinder
| :type direct: A three-tuple
| :param angle: The angle to sweep the cylinder arc through
| :type angle: float > 0
| :param centered: If True, the cylinder will be centered around the reference point. If False,
| the corner of a bounding box around the cylinder will be on the reference point and it
| will extend in the positive x, y and z directions. Can also use a 3-tuple to specify
| centering along each axis.
| :param combine: Whether the results should be combined with other solids on the stack
| (and each other)
| :type combine: true to combine shapes, false otherwise
| :param clean: call :meth:`clean` afterwards to have a clean shape
| :return: A cylinder object for each point on the stack
|
| One cylinder is created for each item on the current stack. If no items are on the stack, one
| cylinder is created using the current workplane center.
|
| If combine is true, the result will be a single object on the stack. If a solid was found
| in the chain, the result is that solid with all cylinders produced fused onto it otherwise,
| the result is the combination of all the produced cylinders.
|
| If combine is false, the result will be a list of the cylinders produced.
|
| each(self: ~T, callback: Callable[[Union[cadquery.occ_impl.geom.Vector, cadquery.occ_impl.geom.Location, cadquery.occ_impl.shapes.Shape, cadquery.sketch.Sketch]], cadquery.occ_impl.shapes.Shape], useLocalCoordinates: bool = False, combine: Union[bool, Literal['cut', 'a', 's']] = True, clean: bool = True) -> ~T
| Runs the provided function on each value in the stack, and collects the return values into
| a new CQ object.
|
| Special note: a newly created workplane always has its center point as its only stack item
|
| :param callBackFunction: the function to call for each item on the current stack.
| :param useLocalCoordinates: should values be converted from local coordinates first?
| :param combine: True or "a" to combine the resulting solid with parent solids if found,
| "cut" or "s" to remove the resulting solid from the parent solids if found.
| False to keep the resulting solid separated from the parent solids.
| :param clean: call :meth:`clean` afterwards to have a clean shape
|
|
| The callback function must accept one argument, which is the item on the stack, and return
| one object, which is collected. If the function returns None, nothing is added to the stack.
| The object passed into the callBackFunction is potentially transformed to local coordinates,
| if useLocalCoordinates is true
|
| useLocalCoordinates is very useful for plugin developers.
|
| If false, the callback function is assumed to be working in global coordinates. Objects
| created are added as-is, and objects passed into the function are sent in using global
| coordinates
|
| If true, the calling function is assumed to be working in local coordinates. Objects are
| transformed to local coordinates before they are passed into the callback method, and result
| objects are transformed to global coordinates after they are returned.
|
| This allows plugin developers to create objects in local coordinates, without worrying
| about the fact that the working plane is different than the global coordinate system.
|
|
| TODO: wrapper object for Wire will clean up forConstruction flag everywhere
|
| eachpoint(self: ~T, arg: Union[cadquery.occ_impl.shapes.Shape, ForwardRef('Workplane'), Callable[[cadquery.occ_impl.geom.Location], cadquery.occ_impl.shapes.Shape]], useLocalCoordinates: bool = False, combine: Union[bool, Literal['cut', 'a', 's']] = False, clean: bool = True) -> ~T
| Same as each(), except arg is translated by the positions on the stack. If arg is a callback function, then the function is called for each point on the stack, and the resulting shape is used.
| :return: CadQuery object which contains a list of vectors (points ) on its stack.
|
| :param useLocalCoordinates: should points be in local or global coordinates
| :param combine: True or "a" to combine the resulting solid with parent solids if found,
| "cut" or "s" to remove the resulting solid from the parent solids if found.
| False to keep the resulting solid separated from the parent solids.
| :param clean: call :meth:`clean` afterwards to have a clean shape
|
|
| The resulting object has a point on the stack for each object on the original stack.
| Vertices and points remain a point. Faces, Wires, Solids, Edges, and Shells are converted
| to a point by using their center of mass.
|
| If the stack has zero length, a single point is returned, which is the center of the current
| workplane/coordinate system
|
| edges(self: ~T, selector: Union[str, cadquery.selectors.Selector, NoneType] = None, tag: Optional[str] = None) -> ~T
| Select the edges of objects on the stack, optionally filtering the selection. If there are
| multiple objects on the stack, the edges of all objects are collected and a list of all the
| distinct edges is returned.
|
| :param selector: optional Selector object, or string selector expression
| (see :class:`StringSyntaxSelector`)
| :param tag: if set, search the tagged object instead of self
| :return: a CQ object whose stack contains all of the *distinct* edges of *all* objects on
| the current stack, filtered by the provided selector.
|
| If there are no edges for any objects on the current stack, an empty CQ object is returned
|
| The typical use is to select the edges of a single object on the stack. For example::
|
| Workplane().box(1, 1, 1).faces("+Z").edges().size()
|
| returns 4, because the topmost face of a cube will contain four edges. Similarly::
|
| Workplane().box(1, 1, 1).edges().size()
|
| returns 12, because a cube has a total of 12 edges, And::
|
| Workplane().box(1, 1, 1).edges("|Z").size()
|
| returns 4, because a cube has 4 edges parallel to the z direction
|
| ellipse(self: ~T, x_radius: float, y_radius: float, rotation_angle: float = 0.0, forConstruction: bool = False) -> ~T
| Make an ellipse for each item on the stack.
|
| :param x_radius: x radius of the ellipse (x-axis of plane the ellipse should lie in)
| :param y_radius: y radius of the ellipse (y-axis of plane the ellipse should lie in)
| :param rotation_angle: angle to rotate the ellipse
| :param forConstruction: should the new wires be reference geometry only?
| :type forConstruction: true if the wires are for reference, false if they are creating
| part geometry
| :return: a new CQ object with the created wires on the stack
|
| *NOTE* Due to a bug in opencascade (https://tracker.dev.opencascade.org/view.php?id=31290)
| the center of mass (equals center for next shape) is shifted. To create concentric ellipses
| use::
|
| Workplane("XY").center(10, 20).ellipse(100, 10).center(0, 0).ellipse(50, 5)
|
| ellipseArc(self: ~T, x_radius: float, y_radius: float, angle1: float = 360, angle2: float = 360, rotation_angle: float = 0.0, sense: Literal[-1, 1] = 1, forConstruction: bool = False, startAtCurrent: bool = True, makeWire: bool = False) -> ~T
| Draw an elliptical arc with x and y radiuses either with start point at current point or
| or current point being the center of the arc
|
| :param x_radius: x radius of the ellipse (along the x-axis of plane the ellipse should lie in)
| :param y_radius: y radius of the ellipse (along the y-axis of plane the ellipse should lie in)
| :param angle1: start angle of arc
| :param angle2: end angle of arc (angle2 == angle1 return closed ellipse = default)
| :param rotation_angle: angle to rotate the created ellipse / arc
| :param sense: clockwise (-1) or counter clockwise (1)
| :param startAtCurrent: True: start point of arc is moved to current point; False: center of
| arc is on current point
| :param makeWire: convert the resulting arc edge to a wire
|
| end(self, n: int = 1) -> 'Workplane'
| Return the nth parent of this CQ element
|
| :param n: number of ancestor to return (default: 1)
| :rtype: a CQ object
| :raises: ValueError if there are no more parents in the chain.
|
| For example::
|
| CQ(obj).faces("+Z").vertices().end()
|
| will return the same as::
|
| CQ(obj).faces("+Z")
|
| export(self: ~T, fname: str, tolerance: float = 0.1, angularTolerance: float = 0.1, unit: Literal['MM', 'CM', 'M', 'KM', 'INCH', 'FT', 'MI', 'UM', 'NM'] = 'MM', outputUnit: Optional[Literal['MM', 'CM', 'M', 'KM', 'INCH', 'FT', 'MI', 'UM', 'NM']] = None, opt: Optional[Dict[str, Any]] = None) -> ~T
| Export Workplane to file.
|
| :param path: Filename.
| :param tolerance: the deflection tolerance, in model units. Default 0.1.
| :param angularTolerance: the angular tolerance, in radians. Default 0.1.
| :param unit: The internal unit of the model's geometry values. Only used for STEP. Default "MM".
| :type unit: UnitLiterals
| :param outputUnit: The unit to use in the STEP file header. If None, defaults to the value of ``unit``.
| Use this when you want the output file to declare a different unit than the model's internal unit,
| for example to export a MM model as a STEP file declaring meters.
| :type outputUnit: UnitLiterals or None
| :param opt: additional options passed to the specific exporter. Default None.
| :return: Self.
|
| exportSvg(self, fileName: str) -> None
| Exports the first item on the stack as an SVG file
|
| For testing purposes mainly.
|
| :param fileName: the filename to export, absolute path to the file
|
| extrude(self: ~T, until: Union[float, Literal['next', 'last'], cadquery.occ_impl.shapes.Face], combine: Union[bool, Literal['cut', 'a', 's']] = True, clean: bool = True, both: bool = False, taper: Optional[float] = None) -> ~T
| Use all un-extruded wires in the parent chain to create a prismatic solid.
|
| :param until: The distance to extrude, normal to the workplane plane. When a float is
| passed, the extrusion extends this far and a negative value is in the opposite direction
| to the normal of the plane. The string "next" extrudes until the next face orthogonal to
| the wire normal. "last" extrudes to the last face. If a object of type Face is passed then
| the extrusion will extend until this face. **Note that the Workplane must contain a Solid for extruding to a given face.**
| :param combine: True or "a" to combine the resulting solid with parent solids if found,
| "cut" or "s" to remove the resulting solid from the parent solids if found.
| False to keep the resulting solid separated from the parent solids.
| :param clean: call :meth:`clean` afterwards to have a clean shape
| :param both: extrude in both directions symmetrically
| :param taper: angle for optional tapered extrusion
| :return: a CQ object with the resulting solid selected.
|
| The returned object is always a CQ object, and depends on whether combine is True, and
| whether a context solid is already defined:
|
| * if combine is False, the new value is pushed onto the stack. Note that when extruding
| until a specified face, combine can not be False
| * if combine is true, the value is combined with the context solid if it exists,
| and the resulting solid becomes the new context solid.
|
| faces(self: ~T, selector: Union[str, cadquery.selectors.Selector, NoneType] = None, tag: Optional[str] = None) -> ~T
| Select the faces of objects on the stack, optionally filtering the selection. If there are
| multiple objects on the stack, the faces of all objects are collected and a list of all the
| distinct faces is returned.
|
| :param selector: optional Selector object, or string selector expression
| (see :class:`StringSyntaxSelector`)
| :param tag: if set, search the tagged object instead of self
| :return: a CQ object whose stack contains all of the *distinct* faces of *all* objects on
| the current stack, filtered by the provided selector.
|
| If there are no faces for any objects on the current stack, an empty CQ object
| is returned.
|
| The typical use is to select the faces of a single object on the stack. For example::
|
| Workplane().box(1, 1, 1).faces("+Z").size()
|
| returns 1, because a cube has one face with a normal in the +Z direction. Similarly::
|
| Workplane().box(1, 1, 1).faces().size()
|
| returns 6, because a cube has a total of 6 faces, And::
|
| Workplane().box(1, 1, 1).faces("|Z").size()
|
| returns 2, because a cube has 2 faces having normals parallel to the z direction
|
| fillet(self: ~T, radius: float) -> ~T
| Fillets a solid on the selected edges.
|
| The edges on the stack are filleted. The solid to which the edges belong must be in the
| parent chain of the selected edges.
|
| :param radius: the radius of the fillet, must be > zero
| :raises ValueError: if at least one edge is not selected
| :raises ValueError: if the solid containing the edge is not in the chain
| :returns: CQ object with the resulting solid selected.
|
| This example will create a unit cube, with the top edges filleted::
|
| s = Workplane().box(1, 1, 1).faces("+Z").edges().fillet(0.1)
|
| filter(self: ~T, f: Callable[[Union[cadquery.occ_impl.geom.Vector, cadquery.occ_impl.geom.Location, cadquery.occ_impl.shapes.Shape, cadquery.sketch.Sketch]], bool]) -> ~T
| Filter items using a boolean predicate.
|
| :param f: Callable to be used for filtering.
| :return: Workplane object with filtered items.
|
| findSolid(self, searchStack: bool = True, searchParents: bool = True) -> Union[cadquery.occ_impl.shapes.Solid, cadquery.occ_impl.shapes.Compound]
| Finds the first solid object in the chain, searching from the current node
| backwards through parents until one is found.
|
| :param searchStack: should objects on the stack be searched first?
| :param searchParents: should parents be searched?
| :raises ValueError: if no solid is found
|
| This function is very important for chains that are modifying a single parent object,
| most often a solid.
|
| Most of the time, a chain defines or selects a solid, and then modifies it using workplanes
| or other operations.
|
| Plugin Developers should make use of this method to find the solid that should be modified,
| if the plugin implements a unary operation, or if the operation will automatically merge its
| results with an object already on the stack.
|
| first(self: ~T) -> ~T
| Return the first item on the stack
|
| :returns: the first item on the stack.
| :rtype: a CQ object
|
| hLine(self: ~T, distance: float, forConstruction: bool = False) -> ~T
| Make a horizontal line from the current point the provided distance
|
| :param distance: (x) distance from current point
| :return: the Workplane object with the current point at the end of the new line
|
| hLineTo(self: ~T, xCoord: float, forConstruction: bool = False) -> ~T
| Make a horizontal line from the current point to the provided x coordinate.
|
| Useful if it is more convenient to specify the end location rather than distance,
| as in :meth:`hLine`
|
| :param xCoord: x coordinate for the end of the line
| :return: the Workplane object with the current point at the end of the new line
|
| hole(self: ~T, diameter: float, depth: Optional[float] = None, clean: bool = True) -> ~T
| Makes a hole for each item on the stack.
|
| :param diameter: the diameter of the hole
| :param depth: the depth of the hole
| :type depth: float > 0 or None to drill thru the entire part.
| :param clean: call :meth:`clean` afterwards to have a clean shape
|
| The surface of the hole is at the current workplane.
|
| One hole is created for each item on the stack. A very common use case is to use a
| construction rectangle to define the centers of a set of holes, like so::
|
| s = (
| Workplane()
| .box(2, 4, 0.5)
| .faces(">Z")
| .workplane()
| .rect(1.5, 3.5, forConstruction=True)
| .vertices()
| .hole(0.125, 82)
| )
|
| This sample creates a plate with a set of holes at the corners.
|
| **Plugin Note**: this is one example of the power of plugins. CounterSunk holes are quite
| time consuming to create, but are quite easily defined by users.
|
| see :meth:`cboreHole` and :meth:`cskHole` to make counterbores or countersinks
|
| interpPlate(self: ~T, surf_edges: Union[Sequence[Union[Tuple[float, float], Tuple[float, float, float], cadquery.occ_impl.geom.Vector]], Sequence[Union[cadquery.occ_impl.shapes.Edge, cadquery.occ_impl.shapes.Wire]], ForwardRef('Workplane')], surf_pts: Sequence[Union[Tuple[float, float], Tuple[float, float, float], cadquery.occ_impl.geom.Vector]] = [], thickness: float = 0, combine: Union[bool, Literal['cut', 'a', 's']] = False, clean: bool = True, degree: int = 3, nbPtsOnCur: int = 15, nbIter: int = 2, anisotropy: bool = False, tol2d: float = 1e-05, tol3d: float = 0.0001, tolAng: float = 0.01, tolCurv: float = 0.1, maxDeg: int = 8, maxSegments: int = 9) -> ~T
| Returns a plate surface that is 'thickness' thick, enclosed by 'surf_edge_pts' points, and going
| through 'surf_pts' points. Using pushPoints directly with interpPlate and combine=True, can be
| very resource intensive depending on the complexity of the shape. In this case set combine=False.
|
| :param surf_edges: list of [x,y,z] ordered coordinates or list of ordered or unordered edges, wires
| :param surf_pts: list of points (uses only edges if [])
| :param thickness: value may be negative or positive depending on thickening direction (2D surface if 0)
| :param combine: should the results be combined with other solids on the stack (and each other)?
| :param clean: call :meth:`clean` afterwards to have a clean shape
| :param degree: >= 2
| :param nbPtsOnCur: number of points on curve >= 15
| :param nbIter: number of iterations >= 2
| :param anisotropy: = bool Anisotropy
| :param tol2d: 2D tolerance
| :param tol3d: 3D tolerance
| :param tolAng: angular tolerance
| :param tolCurv: tolerance for curvature
| :param maxDeg: highest polynomial degree >= 2
| :param maxSegments: greatest number of segments >= 2
|
| intersect(self: ~T, toIntersect: Union[ForwardRef('Workplane'), cadquery.occ_impl.shapes.Solid, cadquery.occ_impl.shapes.Compound], clean: bool = True, tol: Optional[float] = None) -> ~T
| Intersects the provided solid from the current solid.
|
| :param toIntersect: a solid object, or a Workplane object having a solid
| :param clean: call :meth:`clean` afterwards to have a clean shape
| :param tol: tolerance value for fuzzy bool operation mode (default None)
| :raises ValueError: if there is no solid to intersect with in the chain
| :return: a Workplane object with the resulting object selected
|
| invoke(self: ~T, f: Union[Callable[[~T], ~T], Callable[[~T], NoneType], Callable[[], NoneType]]) -> ~T
| Invoke a callable mapping Workplane to Workplane or None. Supports also
| callables that take no arguments such as breakpoint. Returns self if callable
| returns None.
|
| :param f: Callable to be invoked.
| :return: Workplane object.
|
| item(self: ~T, i: int) -> ~T
| Return the ith item on the stack.
|
| :rtype: a CQ object
|
| largestDimension(self) -> float
| Finds the largest dimension in the stack.
|
| Used internally to create thru features, this is how you can compute
| how long or wide a feature must be to make sure to cut through all of the material
|
| :raises ValueError: if no solids or compounds are found
| :return: A value representing the largest dimension of the first solid on the stack
|
| last(self: ~T) -> ~T
| Return the last item on the stack.
|
| :rtype: a CQ object
|
| line(self: ~T, xDist: float, yDist: float, forConstruction: bool = False) -> ~T
| Make a line from the current point to the provided point, using
| dimensions relative to the current point
|
| :param xDist: x distance from current point
| :param yDist: y distance from current point
| :return: the workplane object with the current point at the end of the new line
|
| see :meth:`lineTo` if you want to use absolute coordinates to make a line instead.
|
| lineTo(self: ~T, x: float, y: float, forConstruction: bool = False) -> ~T
| Make a line from the current point to the provided point
|
| :param x: the x point, in workplane plane coordinates
| :param y: the y point, in workplane plane coordinates
| :return: the Workplane object with the current point at the end of the new line
|
| See :meth:`line` if you want to use relative dimensions to make a line instead.
|
| loft(self: ~T, ruled: bool = False, combine: Union[bool, Literal['cut', 'a', 's']] = True, clean: bool = True) -> ~T
| Make a lofted solid, through the set of wires.
|
| :param ruled: When set to `True` connects each section linearly and without continuity
| :param combine: True or "a" to combine the resulting solid with parent solids if found,
| "cut" or "s" to remove the resulting solid from the parent solids if found.
| False to keep the resulting solid separated from the parent solids.
| :param clean: call :meth:`clean` afterwards to have a clean shape
|
| :return: a Workplane object containing the created loft
|
| map(self: ~T, f: Callable[[Union[cadquery.occ_impl.geom.Vector, cadquery.occ_impl.geom.Location, cadquery.occ_impl.shapes.Shape, cadquery.sketch.Sketch]], Union[cadquery.occ_impl.geom.Vector, cadquery.occ_impl.geom.Location, cadquery.occ_impl.shapes.Shape, cadquery.sketch.Sketch]]) -> ~T
| Apply a callable to every item separately.
|
| :param f: Callable to be applied to every item separately.
| :return: Workplane object with f applied to all items.
|
| mirror(self: ~T, mirrorPlane: Union[Literal['XY', 'YX', 'XZ', 'ZX', 'YZ', 'ZY'], Tuple[float, float], Tuple[float, float, float], cadquery.occ_impl.geom.Vector, cadquery.occ_impl.shapes.Face, ForwardRef('Workplane')] = 'XY', basePointVector: Union[Tuple[float, float], Tuple[float, float, float], cadquery.occ_impl.geom.Vector, NoneType] = None, union: bool = False) -> ~T
| Mirror a single CQ object.
|
| :param mirrorPlane: the plane to mirror about
| :type mirrorPlane: string, one of "XY", "YX", "XZ", "ZX", "YZ", "ZY" the planes
| or the normal vector of the plane eg (1,0,0) or a Face object
| :param basePointVector: the base point to mirror about (this is overwritten if a Face is passed)
| :param union: If true will perform a union operation on the mirrored object
|
| mirrorX(self: ~T) -> ~T
| Mirror entities around the x axis of the workplane plane.
|
| :return: a new object with any free edges consolidated into as few wires as possible.
|
| All free edges are collected into a wire, and then the wire is mirrored,
| and finally joined into a new wire
|
| Typically used to make creating wires with symmetry easier.
|
| mirrorY(self: ~T) -> ~T
| Mirror entities around the y axis of the workplane plane.
|
| :return: a new object with any free edges consolidated into as few wires as possible.
|
| All free edges are collected into a wire, and then the wire is mirrored,
| and finally joined into a new wire
|
| Typically used to make creating wires with symmetry easier. This line of code::
|
| s = Workplane().lineTo(2, 2).threePointArc((3, 1), (2, 0)).mirrorX().extrude(0.25)
|
| Produces a flat, heart shaped object
|
| move(self: ~T, xDist: float = 0, yDist: float = 0) -> ~T
| Move the specified distance from the current point, without drawing.
|
| :param xDist: desired x distance, in local coordinates
| :type xDist: float, or none for zero
| :param yDist: desired y distance, in local coordinates
| :type yDist: float, or none for zero.
|
| Not to be confused with :meth:`center`, which moves the center of the entire
| workplane, this method only moves the current point ( and therefore does not affect objects
| already drawn ).
|
| See :meth:`moveTo` to do the same thing but using absolute coordinates
|
| moveTo(self: ~T, x: float = 0, y: float = 0) -> ~T
| Move to the specified point, without drawing.
|
| :param x: desired x location, in local coordinates
| :type x: float, or none for zero
| :param y: desired y location, in local coordinates
| :type y: float, or none for zero.
|
| Not to be confused with :meth:`center`, which moves the center of the entire
| workplane, this method only moves the current point ( and therefore does not affect objects
| already drawn ).
|
| See :meth:`move` to do the same thing but using relative dimensions
|
| newObject(self: ~T, objlist: Iterable[Union[cadquery.occ_impl.geom.Vector, cadquery.occ_impl.geom.Location, cadquery.occ_impl.shapes.Shape, cadquery.sketch.Sketch]]) -> ~T
| Create a new workplane object from this one.
|
| Overrides CQ.newObject, and should be used by extensions, plugins, and
| subclasses to create new objects.
|
| :param objlist: new objects to put on the stack
| :type objlist: a list of CAD primitives
| :return: a new Workplane object with the current workplane as a parent.
|
| offset2D(self: ~T, d: float, kind: Literal['arc', 'intersection', 'tangent'] = 'arc', forConstruction: bool = False) -> ~T
| Creates a 2D offset wire.
|
| :param d: thickness. Negative thickness denotes offset to inside.
| :param kind: offset kind. Use "arc" for rounded and "intersection" for sharp edges (default: "arc")
| :param forConstruction: Should the result be added to pending wires?
|
| :return: CQ object with resulting wire(s).
|
| parametricCurve(self: ~T, func: Callable[[float], Union[Tuple[float, float], Tuple[float, float, float], cadquery.occ_impl.geom.Vector]], N: int = 400, start: float = 0, stop: float = 1, tol: float = 1e-06, minDeg: int = 1, maxDeg: int = 6, smoothing: Optional[Tuple[float, float, float]] = (1, 1, 1), makeWire: bool = True) -> ~T
| Create a spline curve approximating the provided function.
|
| :param func: function f(t) that will generate (x,y,z) pairs
| :type func: float --> (float,float,float)
| :param N: number of points for discretization
| :param start: starting value of the parameter t
| :param stop: final value of the parameter t
| :param tol: tolerance of the algorithm (default: 1e-6)
| :param minDeg: minimum spline degree (default: 1)
| :param maxDeg: maximum spline degree (default: 6)
| :param smoothing: optional parameters for the variational smoothing algorithm (default: (1,1,1))
| :param makeWire: convert the resulting spline edge to a wire
| :return: a Workplane object with the current point unchanged
|
| parametricSurface(self: ~T, func: Callable[[float, float], Union[Tuple[float, float], Tuple[float, float, float], cadquery.occ_impl.geom.Vector]], N: int = 20, start: float = 0, stop: float = 1, tol: float = 0.01, minDeg: int = 1, maxDeg: int = 6, smoothing: Optional[Tuple[float, float, float]] = (1, 1, 1)) -> ~T
| Create a spline surface approximating the provided function.
|
| :param func: function f(u,v) that will generate (x,y,z) pairs
| :type func: (float,float) --> (float,float,float)
| :param N: number of points for discretization in one direction
| :param start: starting value of the parameters u,v
| :param stop: final value of the parameters u,v
| :param tol: tolerance used by the approximation algorithm (default: 1e-3)
| :param minDeg: minimum spline degree (default: 1)
| :param maxDeg: maximum spline degree (default: 3)
| :param smoothing: optional parameters for the variational smoothing algorithm (default: (1,1,1))
| :return: a Workplane object with the current point unchanged
|
| This method might be unstable and may require tuning of the tol parameter.
|
| placeSketch(self: ~T, *sketches: cadquery.sketch.Sketch) -> ~T
| Place the provided sketch(es) based on the current items on the stack.
|
| :return: Workplane object with the sketch added.
|
| polarArray(self: ~T, radius: float, startAngle: float, angle: float, count: int, fill: bool = True, rotate: bool = True) -> ~T
| Creates a polar array of points and pushes them onto the stack.
| The zero degree reference angle is located along the local X-axis.
|
| :param radius: Radius of the array.
| :param startAngle: Starting angle (degrees) of array. Zero degrees is
| situated along the local X-axis.
| :param angle: The angle (degrees) to fill with elements. A positive
| value will fill in the counter-clockwise direction. If fill is
| False, angle is the angle between elements.
| :param count: Number of elements in array. (count >= 1)
| :param fill: Interpret the angle as total if True (default: True).
| :param rotate: Rotate every item (default: True).
|
| polarLine(self: ~T, distance: float, angle: float, forConstruction: bool = False) -> ~T
| Make a line of the given length, at the given angle from the current point
|
| :param distance: distance of the end of the line from the current point
| :param angle: angle of the vector to the end of the line with the x-axis
| :return: the Workplane object with the current point at the end of the new line
|
| polarLineTo(self: ~T, distance: float, angle: float, forConstruction: bool = False) -> ~T
| Make a line from the current point to the given polar coordinates
|
| Useful if it is more convenient to specify the end location rather than
| the distance and angle from the current point
|
| :param distance: distance of the end of the line from the origin
| :param angle: angle of the vector to the end of the line with the x-axis
| :return: the Workplane object with the current point at the end of the new line
|
| polygon(self: ~T, nSides: int, diameter: float, forConstruction: bool = False, circumscribed: bool = False) -> ~T
| Make a polygon for each item on the stack.
|
| By default, each polygon is created by inscribing it in a circle of the
| specified diameter, such that the first vertex is oriented in the x direction.
| Alternatively, each polygon can be created by circumscribing it around
| a circle of the specified diameter, such that the midpoint of the first edge
| is oriented in the x direction. Circumscribed polygons are thus rotated by
| pi/nSides radians relative to the inscribed polygon. This ensures the extent
| of the polygon along the positive x-axis is always known.
| This has the advantage of not requiring additional formulae for purposes such as
| tiling on the x-axis (at least for even sided polygons).
|
| :param nSides: number of sides, must be >= 3
| :param diameter: the diameter of the circle for constructing the polygon
| :param circumscribed: circumscribe the polygon about a circle
| :type circumscribed: true to create the polygon by circumscribing it about a circle,
| false to create the polygon by inscribing it in a circle
| :return: a polygon wire
|
| polyline(self: ~T, listOfXYTuple: Sequence[Union[Tuple[float, float], Tuple[float, float, float], cadquery.occ_impl.geom.Vector]], forConstruction: bool = False, includeCurrent: bool = False) -> ~T
| Create a polyline from a list of points
|
| :param listOfXYTuple: a list of points in Workplane coordinates (2D or 3D)
| :param forConstruction: whether or not the edges are used for reference
| :type forConstruction: true if the edges are for reference, false if they are for creating geometry
| part geometry
| :param includeCurrent: use current point as a starting point of the polyline
| :return: a new CQ object with a list of edges on the stack
|
| *NOTE* most commonly, the resulting wire should be closed.
|
| pushPoints(self: ~T, pntList: Iterable[Union[Tuple[float, float], Tuple[float, float, float], cadquery.occ_impl.geom.Vector, cadquery.occ_impl.geom.Location]]) -> ~T
| Pushes a list of points onto the stack as vertices.
| The points are in the 2D coordinate space of the workplane face
|
| :param pntList: a list of points to push onto the stack
| :type pntList: list of 2-tuples, in *local* coordinates
| :return: a new workplane with the desired points on the stack.
|
| A common use is to provide a list of points for a subsequent operation, such as creating
| circles or holes. This example creates a cube, and then drills three holes through it,
| based on three points::
|
| s = (
| Workplane()
| .box(1, 1, 1)
| .faces(">Z")
| .workplane()
| .pushPoints([(-0.3, 0.3), (0.3, 0.3), (0, 0)])
| )
| body = s.circle(0.05).cutThruAll()
|
| Here the circle function operates on all three points, and is then extruded to create three
| holes. See :meth:`circle` for how it works.
|
| radiusArc(self: ~T, endPoint: Union[Tuple[float, float], Tuple[float, float, float], cadquery.occ_impl.geom.Vector], radius: float, forConstruction: bool = False) -> ~T
| Draw an arc from the current point to endPoint with an arc defined by the radius.
|
| :param endPoint: end point for the arc
| :type endPoint: 2-tuple, in workplane coordinates
| :param radius: the radius of the arc
| :type radius: float, the radius of the arc between start point and end point.
| :return: a workplane with the current point at the end of the arc
|
| Given that a closed contour is drawn clockwise;
| A positive radius means convex arc and negative radius means concave arc.
|
| rarray(self: ~T, xSpacing: float, ySpacing: float, xCount: int, yCount: int, center: Union[bool, Tuple[bool, bool]] = True) -> ~T
| Creates an array of points and pushes them onto the stack.
| If you want to position the array at another point, create another workplane
| that is shifted to the position you would like to use as a reference
|
| :param xSpacing: spacing between points in the x direction ( must be >= 0)
| :param ySpacing: spacing between points in the y direction ( must be >= 0)
| :param xCount: number of points ( > 0 )
| :param yCount: number of points ( > 0 )
| :param center: If True, the array will be centered around the workplane center.
| If False, the lower corner will be on the reference point and the array will
| extend in the positive x and y directions. Can also use a 2-tuple to specify
| centering along each axis.
|
| rect(self: ~T, xLen: float, yLen: float, centered: Union[bool, Tuple[bool, bool]] = True, forConstruction: bool = False) -> ~T
| Make a rectangle for each item on the stack.
|
| :param xLen: length in the x direction (in workplane coordinates)
| :param yLen: length in the y direction (in workplane coordinates)
| :param centered: If True, the rectangle will be centered around the reference
| point. If False, the corner of the rectangle will be on the reference point and
| it will extend in the positive x and y directions. Can also use a 2-tuple to
| specify centering along each axis.
| :param forConstruction: should the new wires be reference geometry only?
| :type forConstruction: true if the wires are for reference, false if they are creating part
| geometry
| :return: a new CQ object with the created wires on the stack
|
| A common use case is to use a for-construction rectangle to define the centers of a hole
| pattern::
|
| s = Workplane().rect(4.0, 4.0, forConstruction=True).vertices().circle(0.25)
|
| Creates 4 circles at the corners of a square centered on the origin.
|
| Negative values for xLen and yLen are permitted, although they only have an effect when
| centered is False.
|
| Future Enhancements:
| * project points not in the workplane plane onto the workplane plane
|
| revolve(self: ~T, angleDegrees: float = 360.0, axisStart: Union[Tuple[float, float], Tuple[float, float, float], cadquery.occ_impl.geom.Vector, NoneType] = None, axisEnd: Union[Tuple[float, float], Tuple[float, float, float], cadquery.occ_impl.geom.Vector, NoneType] = None, combine: Union[bool, Literal['cut', 'a', 's']] = True, clean: bool = True) -> ~T
| Use all un-revolved wires in the parent chain to create a solid.
|
| :param angleDegrees: the angle to revolve through.
| :type angleDegrees: float, anything less than 360 degrees will leave the shape open
| :param axisStart: the start point of the axis of rotation
| :param axisEnd: the end point of the axis of rotation
| :param combine: True or "a" to combine the resulting solid with parent solids if found,
| "cut" or "s" to remove the resulting solid from the parent solids if found.
| False to keep the resulting solid separated from the parent solids.
| :param clean: call :meth:`clean` afterwards to have a clean shape
| :return: a CQ object with the resulting solid selected.
|
| The returned object is always a CQ object, and depends on whether combine is True, and
| whether a context solid is already defined:
|
| * if combine is False, the new value is pushed onto the stack.
| * if combine is true, the value is combined with the context solid if it exists,
| and the resulting solid becomes the new context solid.
|
| .. note::
| Keep in mind that `axisStart` and `axisEnd` are defined relative to the current Workplane center position.
| So if for example you want to revolve a circle centered at (10,0,0) around the Y axis, be sure to either :meth:`move` (or :meth:`moveTo`)
| the current Workplane position or specify `axisStart` and `axisEnd` with the correct vector position.
| In this example (0,0,0), (0,1,0) as axis coords would fail.
|
| rotate(self: ~T, axisStartPoint: Union[Tuple[float, float], Tuple[float, float, float], cadquery.occ_impl.geom.Vector], axisEndPoint: Union[Tuple[float, float], Tuple[float, float, float], cadquery.occ_impl.geom.Vector], angleDegrees: float) -> ~T
| Returns a copy of all of the items on the stack rotated through and angle around the axis
| of rotation.
|
| :param axisStartPoint: The first point of the axis of rotation
| :type axisStartPoint: a 3-tuple of floats
| :param axisEndPoint: The second point of the axis of rotation
| :type axisEndPoint: a 3-tuple of floats
| :param angleDegrees: the rotation angle, in degrees
| :returns: a CQ object
|
| rotateAboutCenter(self: ~T, axisEndPoint: Union[Tuple[float, float], Tuple[float, float, float], cadquery.occ_impl.geom.Vector], angleDegrees: float) -> ~T
| Rotates all items on the stack by the specified angle, about the specified axis
|
| The center of rotation is a vector starting at the center of the object on the stack,
| and ended at the specified point.
|
| :param axisEndPoint: the second point of axis of rotation
| :type axisEndPoint: a three-tuple in global coordinates
| :param angleDegrees: the rotation angle, in degrees
| :returns: a CQ object, with all items rotated.
|
| WARNING: This version returns the same CQ object instead of a new one-- the
| old object is not accessible.
|
| Future Enhancements:
| * A version of this method that returns a transformed copy, rather than modifying
| the originals
| * This method doesn't expose a very good interface, because the axis of rotation
| could be inconsistent between multiple objects. This is because the beginning
| of the axis is variable, while the end is fixed. This is fine when operating on
| one object, but is not cool for multiple.
|
| sagittaArc(self: ~T, endPoint: Union[Tuple[float, float], Tuple[float, float, float], cadquery.occ_impl.geom.Vector], sag: float, forConstruction: bool = False) -> ~T
| Draw an arc from the current point to endPoint with an arc defined by the sag (sagitta).
|
| :param endPoint: end point for the arc
| :type endPoint: 2-tuple, in workplane coordinates
| :param sag: the sagitta of the arc
| :type sag: float, perpendicular distance from arc center to arc baseline.
| :return: a workplane with the current point at the end of the arc
|
| The sagitta is the distance from the center of the arc to the arc base.
| Given that a closed contour is drawn clockwise;
| A positive sagitta means convex arc and negative sagitta means concave arc.
| See `<https://en.wikipedia.org/wiki/Sagitta_(geometry)>`_ for more information.
|
| section(self: ~T, height: float = 0.0) -> ~T
| Slices current solid at the given height.
|
| :param height: height to slice at (default: 0)
| :raises ValueError: if no solids or compounds are found
| :return: a CQ object with the resulting face(s).
|
| shell(self: ~T, thickness: float, kind: Literal['arc', 'intersection'] = 'arc') -> ~T
| Remove the selected faces to create a shell of the specified thickness.
|
| To shell, first create a solid, and *in the same chain* select the faces you wish to remove.
|
| :param thickness: thickness of the desired shell.
| Negative values shell inwards, positive values shell outwards.
| :param kind: kind of join, arc or intersection (default: arc).
| :raises ValueError: if the current stack contains objects that are not faces of a solid
| further up in the chain.
| :returns: a CQ object with the resulting shelled solid selected.
|
| This example will create a hollowed out unit cube, where the top most face is open,
| and all other walls are 0.2 units thick::
|
| Workplane().box(1, 1, 1).faces("+Z").shell(0.2)
|
| You can also select multiple faces at once. Here is an example that creates a three-walled
| corner, by removing three faces of a cube::
|
| Workplane().box(10, 10, 10).faces(">Z or >X or <Y").shell(1)
|
| **Note**: When sharp edges are shelled inwards, they remain sharp corners, but **outward**
| shells are automatically filleted (unless kind="intersection"), because an outward offset
| from a corner generates a radius.
|
| shells(self: ~T, selector: Union[str, cadquery.selectors.Selector, NoneType] = None, tag: Optional[str] = None) -> ~T
| Select the shells of objects on the stack, optionally filtering the selection. If there are
| multiple objects on the stack, the shells of all objects are collected and a list of all the
| distinct shells is returned.
|
| :param selector: optional Selector object, or string selector expression
| (see :class:`StringSyntaxSelector`)
| :param tag: if set, search the tagged object instead of self
| :return: a CQ object whose stack contains all of the *distinct* shells of *all* objects on
| the current stack, filtered by the provided selector.
|
| If there are no shells for any objects on the current stack, an empty CQ object is returned
|
| Most solids will have a single shell, which represents the outer surface. A shell will
| typically be composed of multiple faces.
|
| siblings(self: ~T, kind: Literal['Vertex', 'Edge', 'Wire', 'Face', 'Shell', 'Solid', 'CompSolid', 'Compound'], level: int = 1, tag: Optional[str] = None) -> ~T
| Select topological siblings.
|
| :param kind: kind of linking element, e.g. "Vertex" or "Edge"
| :param level: level of relation - how many elements of kind are in the link
| :param tag: if set, search the tagged object instead of self
| :return: a Workplane object whose stack contains selected siblings.
|
| size(self) -> int
| Return the number of objects currently on the stack
|
| sketch(self: ~T) -> cadquery.sketch.Sketch
| Initialize and return a sketch
|
| :return: Sketch object with the current workplane as a parent.
|
| slot2D(self: ~T, length: float, diameter: float, angle: float = 0) -> ~T
| Creates a rounded slot for each point on the stack.
|
| :param diameter: desired diameter, or width, of slot
| :param length: desired end to end length of slot
| :param angle: angle of slot in degrees, with 0 being along x-axis
| :return: a new CQ object with the created wires on the stack
|
| Can be used to create arrays of slots, such as in cooling applications::
|
| Workplane().box(10, 25, 1).rarray(1, 2, 1, 10).slot2D(8, 1, 0).cutThruAll()
|
| solids(self: ~T, selector: Union[str, cadquery.selectors.Selector, NoneType] = None, tag: Optional[str] = None) -> ~T
| Select the solids of objects on the stack, optionally filtering the selection. If there are
| multiple objects on the stack, the solids of all objects are collected and a list of all the
| distinct solids is returned.
|
| :param selector: optional Selector object, or string selector expression
| (see :class:`StringSyntaxSelector`)
| :param tag: if set, search the tagged object instead of self
| :return: a CQ object whose stack contains all of the *distinct* solids of *all* objects on
| the current stack, filtered by the provided selector.
|
| If there are no solids for any objects on the current stack, an empty CQ object is returned
|
| The typical use is to select a single object on the stack. For example::
|
| Workplane().box(1, 1, 1).solids().size()
|
| returns 1, because a cube consists of one solid.
|
| It is possible for a single CQ object ( or even a single CAD primitive ) to contain
| multiple solids.
|
| sort(self: ~T, key: Callable[[Union[cadquery.occ_impl.geom.Vector, cadquery.occ_impl.geom.Location, cadquery.occ_impl.shapes.Shape, cadquery.sketch.Sketch]], Any]) -> ~T
| Sort items using a callable.
|
| :param key: Callable to be used for sorting.
| :return: Workplane object with items sorted.
|
| sphere(self: ~T, radius: float, direct: Union[Tuple[float, float], Tuple[float, float, float], cadquery.occ_impl.geom.Vector] = (0, 0, 1), angle1: float = -90, angle2: float = 90, angle3: float = 360, centered: Union[bool, Tuple[bool, bool, bool]] = True, combine: Union[bool, Literal['cut', 'a', 's']] = True, clean: bool = True) -> ~T
| Returns a 3D sphere with the specified radius for each point on the stack.
|
| :param radius: The radius of the sphere
| :param direct: The direction axis for the creation of the sphere
| :type direct: A three-tuple
| :param angle1: The first angle to sweep the sphere arc through
| :type angle1: float > 0
| :param angle2: The second angle to sweep the sphere arc through
| :type angle2: float > 0
| :param angle3: The third angle to sweep the sphere arc through
| :type angle3: float > 0
| :param centered: If True, the sphere will be centered around the reference point. If False,
| the corner of a bounding box around the sphere will be on the reference point and it
| will extend in the positive x, y and z directions. Can also use a 3-tuple to specify
| centering along each axis.
| :param combine: Whether the results should be combined with other solids on the stack
| (and each other)
| :type combine: true to combine shapes, false otherwise
| :param clean: call :meth:`clean` afterwards to have a clean shape
| :return: A sphere object for each point on the stack
|
| One sphere is created for each item on the current stack. If no items are on the stack, one
| box using the current workplane center is created.
|
| If combine is true, the result will be a single object on the stack. If a solid was found
| in the chain, the result is that solid with all spheres produced fused onto it otherwise,
| the result is the combination of all the produced spheres.
|
| If combine is false, the result will be a list of the spheres produced.
|
| spline(self: ~T, listOfXYTuple: Iterable[Union[Tuple[float, float], Tuple[float, float, float], cadquery.occ_impl.geom.Vector]], tangents: Optional[Sequence[Union[Tuple[float, float], Tuple[float, float, float], cadquery.occ_impl.geom.Vector]]] = None, periodic: bool = False, parameters: Optional[Sequence[float]] = None, scale: bool = True, tol: Optional[float] = None, forConstruction: bool = False, includeCurrent: bool = False, makeWire: bool = False) -> ~T
| Create a spline interpolated through the provided points (2D or 3D).
|
| :param listOfXYTuple: points to interpolate through
| :param tangents: vectors specifying the direction of the tangent to the
| curve at each of the specified interpolation points.
|
| If only 2 tangents are given, they will be used as the initial and
| final tangent.
|
| If some tangents are not specified (i.e., are None), no tangent
| constraint will be applied to the corresponding interpolation point.
|
| The spline will be C2 continuous at the interpolation points where
| no tangent constraint is specified, and C1 continuous at the points
| where a tangent constraint is specified.
| :param periodic: creation of periodic curves
| :param parameters: the value of the parameter at each interpolation point.
| (The interpolated curve is represented as a vector-valued function of a
| scalar parameter.)
|
| If periodic == True, then len(parameters) must be
| len(interpolation points) + 1, otherwise len(parameters) must be equal to
| len(interpolation points).
| :param scale: whether to scale the specified tangent vectors before
| interpolating.
|
| Each tangent is scaled, so it's length is equal to the derivative of
| the Lagrange interpolated curve.
|
| I.e., set this to True, if you want to use only the direction of
| the tangent vectors specified by ``tangents``, but not their magnitude.
| :param tol: tolerance of the algorithm (consult OCC documentation)
|
| Used to check that the specified points are not too close to each
| other, and that tangent vectors are not too short. (In either case
| interpolation may fail.)
|
| Set to None to use the default tolerance.
| :param includeCurrent: use current point as a starting point of the curve
| :param makeWire: convert the resulting spline edge to a wire
| :return: a Workplane object with the current point at the end of the spline
|
| The spline will begin at the current point, and end with the last point in the
| XY tuple list.
|
| This example creates a block with a spline for one side::
|
| s = Workplane(Plane.XY())
| sPnts = [
| (2.75, 1.5),
| (2.5, 1.75),
| (2.0, 1.5),
| (1.5, 1.0),
| (1.0, 1.25),
| (0.5, 1.0),
| (0, 1.0),
| ]
| r = s.lineTo(3.0, 0).lineTo(3.0, 1.0).spline(sPnts).close()
| r = r.extrude(0.5)
|
| *WARNING* It is fairly easy to create a list of points
| that cannot be correctly interpreted as a spline.
|
| splineApprox(self: ~T, points: Iterable[Union[Tuple[float, float], Tuple[float, float, float], cadquery.occ_impl.geom.Vector]], tol: Optional[float] = 1e-06, minDeg: int = 1, maxDeg: int = 6, smoothing: Optional[Tuple[float, float, float]] = (1, 1, 1), forConstruction: bool = False, includeCurrent: bool = False, makeWire: bool = False) -> ~T
| Create a spline interpolated through the provided points (2D or 3D).
|
| :param points: points to interpolate through
| :param tol: tolerance of the algorithm (default: 1e-6)
| :param minDeg: minimum spline degree (default: 1)
| :param maxDeg: maximum spline degree (default: 6)
| :param smoothing: optional parameters for the variational smoothing algorithm (default: (1,1,1))
| :param includeCurrent: use current point as a starting point of the curve
| :param makeWire: convert the resulting spline edge to a wire
| :return: a Workplane object with the current point at the end of the spline
|
| *WARNING* for advanced users.
|
| split(self: ~T, *args, **kwargs) -> ~T
| Splits a solid on the stack into two parts, optionally keeping the separate parts.
|
| :param bool keepTop: True to keep the top, False or None to discard it
| :param bool keepBottom: True to keep the bottom, False or None to discard it
| :raises ValueError: if keepTop and keepBottom are both false.
| :raises ValueError: if there is no solid in the current stack or parent chain
| :returns: CQ object with the desired objects on the stack.
|
| The most common operation splits a solid and keeps one half. This sample creates
| a split bushing::
|
| # drill a hole in the side
| c = Workplane().box(1, 1, 1).faces(">Z").workplane().circle(0.25).cutThruAll()
|
| # now cut it in half sideways
| c = c.faces(">Y").workplane(-0.5).split(keepTop=True)
|
| sweep(self: ~T, path: Union[ForwardRef('Workplane'), cadquery.occ_impl.shapes.Wire, cadquery.occ_impl.shapes.Edge], multisection: bool = False, sweepAlongWires: Optional[bool] = None, makeSolid: bool = True, isFrenet: bool = False, combine: Union[bool, Literal['cut', 'a', 's']] = True, clean: bool = True, transition: Literal['right', 'round', 'transformed'] = 'right', normal: Union[Tuple[float, float], Tuple[float, float, float], cadquery.occ_impl.geom.Vector, NoneType] = None, auxSpine: Optional[ForwardRef('Workplane')] = None) -> ~T
| Use all un-extruded wires in the parent chain to create a swept solid.
|
| :param path: A wire along which the pending wires will be swept
| :param multiSection: False to create multiple swept from wires on the chain along path.
| True to create only one solid swept along path with shape following the list of wires on the chain
| :param combine: True or "a" to combine the resulting solid with parent solids if found,
| "cut" or "s" to remove the resulting solid from the parent solids if found.
| False to keep the resulting solid separated from the parent solids.
| :param clean: call :meth:`clean` afterwards to have a clean shape
| :param transition: handling of profile orientation at C1 path discontinuities. Possible values are {'transformed','round', 'right'} (default: 'right').
| :param normal: optional fixed normal for extrusion
| :param auxSpine: a wire defining the binormal along the extrusion path
| :return: a CQ object with the resulting solid selected.
|
| tag(self: ~T, name: str) -> ~T
| Tags the current CQ object for later reference.
|
| :param name: the name to tag this object with
| :returns: self, a CQ object with tag applied
|
| tangentArcPoint(self: ~T, endpoint: Union[Tuple[float, float], Tuple[float, float, float], cadquery.occ_impl.geom.Vector], forConstruction: bool = False, relative: bool = True) -> ~T
| Draw an arc as a tangent from the end of the current edge to endpoint.
|
| :param endpoint: point for the arc to end at
| :type endpoint: 2-tuple, 3-tuple or Vector
| :param relative: True if endpoint is specified relative to the current point, False if endpoint is in workplane coordinates
| :return: a Workplane object with an arc on the stack
|
| Requires the the current first object on the stack is an Edge, as would
| be the case after a lineTo operation or similar.
|
| text(self: ~T, txt: str, fontsize: float, distance: float, combine: Union[bool, Literal['cut', 'a', 's']] = 'cut', clean: bool = True, font: str = 'Arial', fontPath: Optional[str] = None, kind: Literal['regular', 'bold', 'italic'] = 'regular', halign: Literal['center', 'left', 'right'] = 'center', valign: Literal['center', 'top', 'bottom'] = 'center') -> ~T
| Returns a 3D text.
|
| :param txt: text to be rendered
| :param fontsize: size of the font in model units
| :param distance: the distance to extrude or cut, normal to the workplane plane
| :type distance: float, negative means opposite the normal direction
| :param combine: True or "a" to combine the resulting solid with parent solids if found,
| "cut" or "s" to remove the resulting solid from the parent solids if found.
| False to keep the resulting solid separated from the parent solids.
| :param clean: call :meth:`clean` afterwards to have a clean shape
| :param font: font name
| :param fontPath: path to font file
| :param kind: font type
| :param halign: horizontal alignment
| :param valign: vertical alignment
| :return: a CQ object with the resulting solid selected
|
| The returned object is always a Workplane object, and depends on whether combine is True, and
| whether a context solid is already defined:
|
| * if combine is False, the new value is pushed onto the stack.
| * if combine is True, "a", "cut" or "s", the value is combined with the context solid if it exists,
| and the resulting solid becomes the new context solid.
|
| Examples::
|
| Create text::
|
| cq.Workplane().text("CadQuery", 5, 1)
|
| Specify the font (name), and kind to use an installed system font::
|
| cq.Workplane().text("CadQuery", 5, 1, font="Liberation Sans Narrow", kind="italic")
|
| Specify fontPath to use a font from a given file::
|
| cq.Workplane().text("CadQuery", 5, 1, fontPath="/opt/fonts/texgyrecursor-bold.otf")
|
| Cut text from a solid (default behavior when context solid exists and combine is not overridden)::
|
| cq.Workplane().box(8, 8, 8).faces(">Z").workplane().text("Z", 5, -1.0)
|
| Add text to a solid::
|
| cq.Workplane().box(8, 8, 8).faces(">Z").workplane().text("Z", 5, 1.0, combine="a")
|
| threePointArc(self: ~T, point1: Union[Tuple[float, float], Tuple[float, float, float], cadquery.occ_impl.geom.Vector], point2: Union[Tuple[float, float], Tuple[float, float, float], cadquery.occ_impl.geom.Vector], forConstruction: bool = False) -> ~T
| Draw an arc from the current point, through point1, and ending at point2
|
| :param point1: point to draw through
| :type point1: 2-tuple, in workplane coordinates
| :param point2: end point for the arc
| :type point2: 2-tuple, in workplane coordinates
| :return: a workplane with the current point at the end of the arc
|
| Future Enhancements:
| provide a version that allows an arc using relative measures
| provide a centerpoint arc
| provide tangent arcs
|
| toOCC(self) -> Any
| Directly returns the wrapped OCCT object.
|
| :return: The wrapped OCCT object
| :rtype: TopoDS_Shape or a subclass
|
| toPending(self: ~T) -> ~T
| Adds wires/edges to pendingWires/pendingEdges.
|
| :return: same CQ object with updated context.
|
| toSvg(self, opts: Any = None) -> str
| Returns svg text that represents the first item on the stack.
|
| for testing purposes.
|
| :param opts: svg formatting options
| :type opts: dictionary, width and height
| :return: a string that contains SVG that represents this item.
|
| transformed(self: ~T, rotate: Union[Tuple[float, float], Tuple[float, float, float], cadquery.occ_impl.geom.Vector] = (0, 0, 0), offset: Union[Tuple[float, float], Tuple[float, float, float], cadquery.occ_impl.geom.Vector] = (0, 0, 0)) -> ~T
| Create a new workplane based on the current one.
| The origin of the new plane is located at the existing origin+offset vector, where offset is
| given in coordinates local to the current plane
| The new plane is rotated through the angles specified by the components of the rotation
| vector.
|
| :param rotate: 3-tuple of angles to rotate, in degrees relative to work plane coordinates
| :param offset: 3-tuple to offset the new plane, in local work plane coordinates
| :return: a new work plane, transformed as requested
|
| translate(self: ~T, vec: Union[Tuple[float, float], Tuple[float, float, float], cadquery.occ_impl.geom.Vector]) -> ~T
| Returns a copy of all of the items on the stack moved by the specified translation vector.
|
| :param tupleDistance: distance to move, in global coordinates
| :type tupleDistance: a 3-tuple of float
| :returns: a CQ object
|
| twistExtrude(self: ~T, distance: float, angleDegrees: float, combine: Union[bool, Literal['cut', 'a', 's']] = True, clean: bool = True) -> ~T
| Extrudes a wire in the direction normal to the plane, but also twists by the specified
| angle over the length of the extrusion.
|
| The center point of the rotation will be the center of the workplane.
|
| See extrude for more details, since this method is the same except for the the addition
| of the angle. In fact, if angle=0, the result is the same as a linear extrude.
|
| **NOTE** This method can create complex calculations, so be careful using it with
| complex geometries
|
| :param distance: the distance to extrude normal to the workplane
| :param angle: angle (in degrees) to rotate through the extrusion
| :param combine: True or "a" to combine the resulting solid with parent solids if found,
| "cut" or "s" to remove the resulting solid from the parent solids if found.
| False to keep the resulting solid separated from the parent solids.
| :param clean: call :meth:`clean` afterwards to have a clean shape
| :return: a CQ object with the resulting solid selected.
|
| union(self: ~T, toUnion: Union[ForwardRef('Workplane'), cadquery.occ_impl.shapes.Solid, cadquery.occ_impl.shapes.Compound, NoneType] = None, clean: bool = True, glue: bool = False, tol: Optional[float] = None) -> ~T
| Unions all of the items on the stack of toUnion with the current solid.
| If there is no current solid, the items in toUnion are unioned together.
|
| :param toUnion: a solid object, or a Workplane object having a solid
| :param clean: call :meth:`clean` afterwards to have a clean shape (default True)
| :param glue: use a faster gluing mode for non-overlapping shapes (default False)
| :param tol: tolerance value for fuzzy bool operation mode (default None)
| :raises: ValueError if there is no solid to add to in the chain
| :return: a Workplane object with the resulting object selected
|
| vLine(self: ~T, distance: float, forConstruction: bool = False) -> ~T
| Make a vertical line from the current point the provided distance
|
| :param distance: (y) distance from current point
| :return: the Workplane object with the current point at the end of the new line
|
| vLineTo(self: ~T, yCoord: float, forConstruction: bool = False) -> ~T
| Make a vertical line from the current point to the provided y coordinate.
|
| Useful if it is more convenient to specify the end location rather than distance,
| as in :meth:`vLine`
|
| :param yCoord: y coordinate for the end of the line
| :return: the Workplane object with the current point at the end of the new line
|
| val(self) -> Union[cadquery.occ_impl.geom.Vector, cadquery.occ_impl.geom.Location, cadquery.occ_impl.shapes.Shape, cadquery.sketch.Sketch]
| Return the first value on the stack. If no value is present, current plane origin is returned.
|
| :return: the first value on the stack.
| :rtype: A CAD primitive
|
| vals(self) -> List[Union[cadquery.occ_impl.geom.Vector, cadquery.occ_impl.geom.Location, cadquery.occ_impl.shapes.Shape, cadquery.sketch.Sketch]]
| get the values in the current list
|
| :rtype: list of occ_impl objects
| :returns: the values of the objects on the stack.
|
| Contrast with :meth:`all`, which returns CQ objects for all of the items on the stack
|
| vertices(self: ~T, selector: Union[str, cadquery.selectors.Selector, NoneType] = None, tag: Optional[str] = None) -> ~T
| Select the vertices of objects on the stack, optionally filtering the selection. If there
| are multiple objects on the stack, the vertices of all objects are collected and a list of
| all the distinct vertices is returned.
|
| :param selector: optional Selector object, or string selector expression
| (see :class:`StringSyntaxSelector`)
| :param tag: if set, search the tagged object instead of self
| :return: a CQ object whose stack contains the *distinct* vertices of *all* objects on the
| current stack, after being filtered by the selector, if provided
|
| If there are no vertices for any objects on the current stack, an empty CQ object
| is returned
|
| The typical use is to select the vertices of a single object on the stack. For example::
|
| Workplane().box(1, 1, 1).faces("+Z").vertices().size()
|
| returns 4, because the topmost face of a cube will contain four vertices. While this::
|
| Workplane().box(1, 1, 1).faces().vertices().size()
|
| returns 8, because a cube has a total of 8 vertices
|
| **Note** Circles are peculiar, they have a single vertex at the center!
|
| wedge(self: ~T, dx: float, dy: float, dz: float, xmin: float, zmin: float, xmax: float, zmax: float, pnt: Union[Tuple[float, float], Tuple[float, float, float], cadquery.occ_impl.geom.Vector] = Vector: (0.0, 0.0, 0.0), dir: Union[Tuple[float, float], Tuple[float, float, float], cadquery.occ_impl.geom.Vector] = Vector: (0.0, 0.0, 1.0), centered: Union[bool, Tuple[bool, bool, bool]] = True, combine: Union[bool, Literal['cut', 'a', 's']] = True, clean: bool = True) -> ~T
| Returns a 3D wedge with the specified dimensions for each point on the stack.
|
| :param dx: Distance along the X axis
| :param dy: Distance along the Y axis
| :param dz: Distance along the Z axis
| :param xmin: The minimum X location
| :param zmin: The minimum Z location
| :param xmax: The maximum X location
| :param zmax: The maximum Z location
| :param pnt: A vector (or tuple) for the origin of the direction for the wedge
| :param dir: The direction vector (or tuple) for the major axis of the wedge
| :param centered: If True, the wedge will be centered around the reference point.
| If False, the corner of the wedge will be on the reference point and it will
| extend in the positive x, y and z directions. Can also use a 3-tuple to
| specify centering along each axis.
| :param combine: Whether the results should be combined with other solids on the stack
| (and each other)
| :param clean: True to attempt to have the kernel clean up the geometry, False otherwise
| :return: A wedge object for each point on the stack
|
| One wedge is created for each item on the current stack. If no items are on the stack, one
| wedge using the current workplane center is created.
|
| If combine is True, the result will be a single object on the stack. If a solid was found
| in the chain, the result is that solid with all wedges produced fused onto it otherwise,
| the result is the combination of all the produced wedges.
|
| If combine is False, the result will be a list of the wedges produced.
|
| wire(self: ~T, forConstruction: bool = False) -> ~T
| Returns a CQ object with all pending edges connected into a wire.
|
| All edges on the stack that can be combined will be combined into a single wire object,
| and other objects will remain on the stack unmodified. If there are no pending edges,
| this method will just return self.
|
| :param forConstruction: whether the wire should be used to make a solid, or if it is just
| for reference
|
| This method is primarily of use to plugin developers making utilities for 2D construction.
| This method should be called when a user operation implies that 2D construction is
| finished, and we are ready to begin working in 3d.
|
| SEE '2D construction concepts' for a more detailed explanation of how CadQuery handles
| edges, wires, etc.
|
| Any non edges will still remain.
|
| wires(self: ~T, selector: Union[str, cadquery.selectors.Selector, NoneType] = None, tag: Optional[str] = None) -> ~T
| Select the wires of objects on the stack, optionally filtering the selection. If there are
| multiple objects on the stack, the wires of all objects are collected and a list of all the
| distinct wires is returned.
|
| :param selector: optional Selector object, or string selector expression
| (see :class:`StringSyntaxSelector`)
| :param tag: if set, search the tagged object instead of self
| :return: a CQ object whose stack contains all of the *distinct* wires of *all* objects on
| the current stack, filtered by the provided selector.
|
| If there are no wires for any objects on the current stack, an empty CQ object is returned
|
| The typical use is to select the wires of a single object on the stack. For example::
|
| Workplane().box(1, 1, 1).faces("+Z").wires().size()
|
| returns 1, because a face typically only has one outer wire
|
| workplane(self: ~T, offset: float = 0.0, invert: bool = False, centerOption: Literal['CenterOfMass', 'ProjectedOrigin', 'CenterOfBoundBox'] = 'ProjectedOrigin', origin: Union[Tuple[float, float], Tuple[float, float, float], cadquery.occ_impl.geom.Vector, NoneType] = None) -> ~T
| Creates a new 2D workplane, located relative to the first face on the stack.
|
| :param offset: offset for the workplane in its normal direction . Default
| :param invert: invert the normal direction from that of the face.
| :param centerOption: how local origin of workplane is determined.
| :param origin: origin for plane center, requires 'ProjectedOrigin' centerOption.
| :type centerOption: string or None='ProjectedOrigin'
| :rtype: Workplane object
|
| The first element on the stack must be a face, a set of
| co-planar faces or a vertex. If a vertex, then the parent
| item on the chain immediately before the vertex must be a
| face.
|
| The result will be a 2D working plane
| with a new coordinate system set up as follows:
|
| * The centerOption parameter sets how the center is defined.
| Options are 'CenterOfMass', 'CenterOfBoundBox', or 'ProjectedOrigin'.
| 'CenterOfMass' and 'CenterOfBoundBox' are in relation to the selected
| face(s) or vertex (vertices). 'ProjectedOrigin' uses by default the current origin
| or the optional origin parameter (if specified) and projects it onto the plane
| defined by the selected face(s).
| * The Z direction will be the normal of the face, computed
| at the center point.
| * The X direction will be parallel to the x-y plane. If the workplane is parallel to
| the global x-y plane, the x direction of the workplane will co-incide with the
| global x direction.
|
| Most commonly, the selected face will be planar, and the workplane lies in the same plane
| of the face ( IE, offset=0). Occasionally, it is useful to define a face offset from
| an existing surface, and even more rarely to define a workplane based on a face that is
| not planar.
|
| workplaneFromTagged(self, name: str) -> 'Workplane'
| Copies the workplane from a tagged parent.
|
| :param name: tag to search for
| :returns: a CQ object with name's workplane
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __annotations__ = {'_tag': typing.Optional[str], 'ctx': <class 'cadque...
DATA
CQObject = typing.Union[cadquery.occ_impl.geom.Vector, cadq...ry.occ_i...
Callable = typing.Callable
Deprecated alias to collections.abc.Callable.
Callable[[int], str] signifies a function that takes a single
parameter of type int and returns a str.
The subscription syntax must always be used with exactly two
values: the argument list and the return type.
The argument list must be a list of types, a ParamSpec,
Concatenate or ellipsis. The return type must be a single type.
There is no syntax to indicate optional or keyword arguments;
such function types are rarely used as callback types.
CombineMode = typing.Union[bool, typing.Literal['cut', 'a', 's']]
Dict = typing.Dict
A generic version of dict.
Iterable = typing.Iterable
A generic version of collections.abc.Iterable.
Iterator = typing.Iterator
A generic version of collections.abc.Iterator.
List = typing.List
A generic version of list.
Literal = typing.Literal
Special typing form to define literal types (a.k.a. value types).
This form can be used to indicate to type checkers that the corresponding
variable or function parameter has a value equivalent to the provided
literal (or one of several literals)::
def validate_simple(data: Any) -> Literal[True]: # always returns True
...
MODE = Literal['r', 'rb', 'w', 'wb']
def open_helper(file: str, mode: MODE) -> str:
...
open_helper('/some/path', 'r') # Passes type check
open_helper('/other/path', 'typo') # Error in type checker
Literal[...] cannot be subclassed. At runtime, an arbitrary value
is allowed as type argument to Literal[...], but type checkers may
impose restrictions.
Optional = typing.Optional
Optional[X] is equivalent to Union[X, None].
Sequence = typing.Sequence
A generic version of collections.abc.Sequence.
Shapes = typing.Literal['Vertex', 'Edge', 'Wire', 'Face', 'Shell', 'So...
T = ~T
TOL = 1e-06
Tuple = typing.Tuple
Deprecated alias to builtins.tuple.
Tuple[X, Y] is the cross-product type of X and Y.
Example: Tuple[T1, T2] is a tuple of two elements corresponding
to type variables T1 and T2. Tuple[int, float, str] is a tuple
of an int, a float and a string.
To specify a variable-length tuple of homogeneous type, use Tuple[T, ...].
Union = typing.Union
Union type; Union[X, Y] means either X or Y.
On Python 3.10 and higher, the | operator
can also be used to denote unions;
X | Y means the same thing to the type checker as Union[X, Y].
To define a union, use e.g. Union[int, str]. Details:
- The arguments must be types and there must be at least one.
- None as an argument is a special case and is replaced by
type(None).
- Unions of unions are flattened, e.g.::
assert Union[Union[int, str], float] == Union[int, str, float]
- Unions of a single argument vanish, e.g.::
assert Union[int] == int # The constructor actually returns int
- Redundant arguments are skipped, e.g.::
assert Union[int, str, int] == Union[int, str]
- When comparing unions, the argument order is ignored, e.g.::
assert Union[int, str] == Union[str, int]
- You cannot subclass or instantiate a union.
- You can use Optional[X] as a shorthand for Union[X, None].
UnitLiterals = typing.Literal['MM', 'CM', 'M', 'KM', 'INCH', 'FT', 'MI...
VectorLike = typing.Union[typing.Tuple[float, float], typing....at, fl...
FILE
c:\users\youse\appdata\local\programs\python\python312\lib\site-packages\cadquery\cq.py
cadquery.exporters
Python Library Documentation: package cadquery.occ_impl.exporters in cadquery.occ_impl
NAME
cadquery.occ_impl.exporters
PACKAGE CONTENTS
amf
assembly
dxf
json
svg
threemf
vtk
CLASSES
builtins.object
ExportTypes
class ExportTypes(builtins.object)
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| AMF = 'AMF'
|
| BIN = 'BIN'
|
| BREP = 'BREP'
|
| DXF = 'DXF'
|
| STEP = 'STEP'
|
| STL = 'STL'
|
| SVG = 'SVG'
|
| THREEMF = '3MF'
|
| TJS = 'TJS'
|
| VRML = 'VRML'
|
| VTP = 'VTP'
FUNCTIONS
export(w: Union[cadquery.occ_impl.shapes.Shape, Iterable[cadquery.occ_impl.shapes.Shape]], fname: str, exportType: Optional[Literal['STL', 'STEP', 'AMF', 'SVG', 'TJS', 'DXF', 'VRML', 'VTP', '3MF', 'BREP', 'BIN']] = None, tolerance: float = 0.1, angularTolerance: float = 0.1, unit: Literal['MM', 'CM', 'M', 'KM', 'INCH', 'FT', 'MI', 'UM', 'NM'] = 'MM', outputUnit: Optional[Literal['MM', 'CM', 'M', 'KM', 'INCH', 'FT', 'MI', 'UM', 'NM']] = None, opt: Optional[Dict[str, Any]] = None)
Export Workplane or Shape to file. Multiple entities are converted to compound.
:param w: Shape or Iterable[Shape] (e.g. Workplane) to be exported.
:param fname: output filename.
:param exportType: the exportFormat to use. If None will be inferred from the extension. Default: None.
:param tolerance: the deflection tolerance, in model units. Default 0.1.
:param angularTolerance: the angular tolerance, in radians. Default 0.1.
:param unit: The internal unit of the model's geometry values. Only used for STEP. Default "MM".
:type unit: UnitLiterals
:param outputUnit: The unit to use in the STEP file header. If None, defaults to the value of ``unit``.
Use this when you want the output file to declare a different unit than the model's internal unit,
for example to export a MM model as a STEP file declaring meters.
:type outputUnit: UnitLiterals or None
:param opt: additional options passed to the specific exporter. Default None.
DATA
Dict = typing.Dict
A generic version of dict.
ExportLiterals = typing.Literal['STL', 'STEP', 'AMF', 'SVG', 'TJS', 'D...
Iterable = typing.Iterable
A generic version of collections.abc.Iterable.
Literal = typing.Literal
Special typing form to define literal types (a.k.a. value types).
This form can be used to indicate to type checkers that the corresponding
variable or function parameter has a value equivalent to the provided
literal (or one of several literals)::
def validate_simple(data: Any) -> Literal[True]: # always returns True
...
MODE = Literal['r', 'rb', 'w', 'wb']
def open_helper(file: str, mode: MODE) -> str:
...
open_helper('/some/path', 'r') # Passes type check
open_helper('/other/path', 'typo') # Error in type checker
Literal[...] cannot be subclassed. At runtime, an arbitrary value
is allowed as type argument to Literal[...], but type checkers may
impose restrictions.
Optional = typing.Optional
Optional[X] is equivalent to Union[X, None].
Union = typing.Union
Union type; Union[X, Y] means either X or Y.
On Python 3.10 and higher, the | operator
can also be used to denote unions;
X | Y means the same thing to the type checker as Union[X, Y].
To define a union, use e.g. Union[int, str]. Details:
- The arguments must be types and there must be at least one.
- None as an argument is a special case and is replaced by
type(None).
- Unions of unions are flattened, e.g.::
assert Union[Union[int, str], float] == Union[int, str, float]
- Unions of a single argument vanish, e.g.::
assert Union[int] == int # The constructor actually returns int
- Redundant arguments are skipped, e.g.::
assert Union[int, str, int] == Union[int, str]
- When comparing unions, the argument order is ignored, e.g.::
assert Union[int, str] == Union[str, int]
- You cannot subclass or instantiate a union.
- You can use Optional[X] as a shorthand for Union[X, None].
UnitLiterals = typing.Literal['MM', 'CM', 'M', 'KM', 'INCH', 'FT', 'MI...
FILE
c:\users\youse\appdata\local\programs\python\python312\lib\site-packages\cadquery\occ_impl\exporters\__init__.py
cadquery.hull
Python Library Documentation: module cadquery.hull in cadquery
NAME
cadquery.hull
CLASSES
builtins.object
Arc
Point
Segment
class Arc(builtins.object)
| Arc(c: cadquery.hull.Point, r: float, a1: float, a2: float)
|
| Methods defined here:
|
| __init__(self, c: cadquery.hull.Point, r: float, a1: float, a2: float)
| Initialize self. See help(type(self)) for accurate signature.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __annotations__ = {'a1': <class 'float'>, 'a2': <class 'float'>, 'ac':...
class Point(builtins.object)
| Point(x: float, y: float)
|
| Methods defined here:
|
| __eq__(self, other)
| Return self==value.
|
| __hash__(self)
| Return hash(self).
|
| __init__(self, x: float, y: float)
| Initialize self. See help(type(self)) for accurate signature.
|
| __repr__(self)
| Return repr(self).
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __annotations__ = {'x': <class 'float'>, 'y': <class 'float'>}
class Segment(builtins.object)
| Segment(a: cadquery.hull.Point, b: cadquery.hull.Point)
|
| Methods defined here:
|
| __init__(self, a: cadquery.hull.Point, b: cadquery.hull.Point)
| Initialize self. See help(type(self)) for accurate signature.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __annotations__ = {'a': <class 'cadquery.hull.Point'>, 'b': <class 'ca...
FUNCTIONS
arc_arc(a1: cadquery.hull.Arc, a2: cadquery.hull.Arc) -> Tuple[float, cadquery.hull.Segment]
arc_pt(a: cadquery.hull.Arc, p: cadquery.hull.Point) -> Tuple[float, cadquery.hull.Segment]
atan2(y, x, /)
Return the arc tangent (measured in radians) of y/x.
Unlike atan(y/x), the signs of both x and y are considered.
atan2p(x, y)
convert_and_validate(edges: Iterable[cadquery.occ_impl.shapes.Edge]) -> Tuple[List[cadquery.hull.Arc], List[cadquery.hull.Point]]
cos(x, /)
Return the cosine of x (measured in radians).
degrees(x, /)
Convert angle x from radians to degrees.
finalize_hull(hull: List[Union[ForwardRef('Arc'), ForwardRef('Point'), ForwardRef('Segment')]]) -> cadquery.occ_impl.shapes.Wire
find_hull(edges: Iterable[cadquery.occ_impl.shapes.Edge]) -> cadquery.occ_impl.shapes.Wire
get_angle(current: Union[ForwardRef('Arc'), ForwardRef('Point')], e: Union[ForwardRef('Arc'), ForwardRef('Point')]) -> Tuple[float, cadquery.hull.Segment]
pt_arc(p: cadquery.hull.Point, a: cadquery.hull.Arc) -> Tuple[float, cadquery.hull.Segment]
pt_pt(p1: cadquery.hull.Point, p2: cadquery.hull.Point) -> Tuple[float, cadquery.hull.Segment]
select_lowest(arcs: List[ForwardRef('Arc')], points: List[ForwardRef('Point')]) -> Union[ForwardRef('Arc'), ForwardRef('Point')]
select_lowest_arc(arcs: List[ForwardRef('Arc')]) -> Tuple[cadquery.hull.Point, cadquery.hull.Arc]
select_lowest_point(points: List[ForwardRef('Point')]) -> Tuple[cadquery.hull.Point, int]
sin(x, /)
Return the sine of x (measured in radians).
sqrt(x, /)
Return the square root of x.
update_hull(current_e: Union[ForwardRef('Arc'), ForwardRef('Point')], ix: int, entities: List[Union[ForwardRef('Arc'), ForwardRef('Point')]], angles: List[float], segments: List[cadquery.hull.Segment], hull: List[Union[ForwardRef('Arc'), ForwardRef('Point'), ForwardRef('Segment')]]) -> Tuple[Union[ForwardRef('Arc'), ForwardRef('Point')], float, bool]
DATA
Arcs = typing.List[ForwardRef('Arc')]
Entity = typing.Union[ForwardRef('Arc'), ForwardRef('Point')]
Hull = typing.List[typing.Union[ForwardRef('Arc'), ForwardRef('Point')...
Iterable = typing.Iterable
A generic version of collections.abc.Iterable.
List = typing.List
A generic version of list.
Points = typing.List[ForwardRef('Point')]
Set = typing.Set
A generic version of set.
Tuple = typing.Tuple
Deprecated alias to builtins.tuple.
Tuple[X, Y] is the cross-product type of X and Y.
Example: Tuple[T1, T2] is a tuple of two elements corresponding
to type variables T1 and T2. Tuple[int, float, str] is a tuple
of an int, a float and a string.
To specify a variable-length tuple of homogeneous type, use Tuple[T, ...].
Union = typing.Union
Union type; Union[X, Y] means either X or Y.
On Python 3.10 and higher, the | operator
can also be used to denote unions;
X | Y means the same thing to the type checker as Union[X, Y].
To define a union, use e.g. Union[int, str]. Details:
- The arguments must be types and there must be at least one.
- None as an argument is a special case and is replaced by
type(None).
- Unions of unions are flattened, e.g.::
assert Union[Union[int, str], float] == Union[int, str, float]
- Unions of a single argument vanish, e.g.::
assert Union[int] == int # The constructor actually returns int
- Redundant arguments are skipped, e.g.::
assert Union[int, str, int] == Union[int, str]
- When comparing unions, the argument order is ignored, e.g.::
assert Union[int, str] == Union[str, int]
- You cannot subclass or instantiate a union.
- You can use Optional[X] as a shorthand for Union[X, None].
inf = inf
pi = 3.141592653589793
FILE
c:\users\youse\appdata\local\programs\python\python312\lib\site-packages\cadquery\hull.py
cadquery.importers
Python Library Documentation: package cadquery.occ_impl.importers in cadquery.occ_impl
NAME
cadquery.occ_impl.importers
PACKAGE CONTENTS
assembly
dxf
CLASSES
builtins.object
ImportTypes
UNITS
class ImportTypes(builtins.object)
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| BIN = 'BIN'
|
| BREP = 'BREP'
|
| DXF = 'DXF'
|
| STEP = 'STEP'
class UNITS(builtins.object)
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| IN = 'in'
|
| MM = 'mm'
FUNCTIONS
importBin(fileName: str) -> 'cq.Workplane'
Loads the binary BREP file as a single shape into a cadquery Workplane.
:param fileName: The path and name of the BREP file to be imported
importBrep(fileName: str) -> 'cq.Workplane'
Loads the BREP file as a single shape into a cadquery Workplane.
:param fileName: The path and name of the BREP file to be imported
importDXF(filename: str, tol: float = 1e-06, exclude: List[str] = [], include: List[str] = []) -> 'cq.Workplane'
Loads a DXF file into a Workplane.
All layers are imported by default. Provide a layer include or exclude list
to select layers. Layer names are handled as case-insensitive.
:param filename: The path and name of the DXF file to be imported
:param tol: The tolerance used for merging edges into wires
:param exclude: a list of layer names not to import
:param include: a list of layer names to import
importShape(importType: Literal['STEP', 'DXF', 'BREP', 'BIN'], fileName: str, unit: Literal['MM', 'CM', 'M', 'KM', 'INCH', 'FT', 'MI', 'UM', 'NM'] = 'MM', *args, **kwargs) -> 'cq.Workplane'
Imports a file based on the type (STEP, STL, etc)
:param importType: The type of file that we're importing
:param fileName: The name of the file that we're importing
:param unit: The unit of measurement for the STEP file. Default "MM".
:type unit: UnitLiterals
importStep(fileName: str, unit: Literal['MM', 'CM', 'M', 'KM', 'INCH', 'FT', 'MI', 'UM', 'NM'] = 'MM') -> 'cq.Workplane'
Accepts a file name and loads the STEP file into a cadquery Workplane
:param fileName: The path and name of the STEP file to be imported
:param unit: Sets the target OpenCASCADE unit - OCCT scales from the file's
declared unit to this unit. Default "MM".
:type unit: UnitLiterals
DATA
List = typing.List
A generic version of list.
Literal = typing.Literal
Special typing form to define literal types (a.k.a. value types).
This form can be used to indicate to type checkers that the corresponding
variable or function parameter has a value equivalent to the provided
literal (or one of several literals)::
def validate_simple(data: Any) -> Literal[True]: # always returns True
...
MODE = Literal['r', 'rb', 'w', 'wb']
def open_helper(file: str, mode: MODE) -> str:
...
open_helper('/some/path', 'r') # Passes type check
open_helper('/other/path', 'typo') # Error in type checker
Literal[...] cannot be subclassed. At runtime, an arbitrary value
is allowed as type argument to Literal[...], but type checkers may
impose restrictions.
RAD2DEG = 57.29577951308232
UnitLiterals = typing.Literal['MM', 'CM', 'M', 'KM', 'INCH', 'FT', 'MI...
pi = 3.141592653589793
FILE
c:\users\youse\appdata\local\programs\python\python312\lib\site-packages\cadquery\occ_impl\importers\__init__.py
cadquery.occ_impl
Python Library Documentation: package cadquery.occ_impl in cadquery
NAME
cadquery.occ_impl
PACKAGE CONTENTS
assembly
exporters (package)
geom
importers (package)
jupyter_tools
nurbs
shape_protocols
shapes
sketch_solver
solver
FILE
c:\users\youse\appdata\local\programs\python\python312\lib\site-packages\cadquery\occ_impl\__init__.py
cadquery.plugins
Python Library Documentation: package cadquery.plugins in cadquery
NAME
cadquery.plugins
PACKAGE CONTENTS
FILE
c:\users\youse\appdata\local\programs\python\python312\lib\site-packages\cadquery\plugins\__init__.py
cadquery.selectors
Python Library Documentation: module cadquery.selectors in cadquery
NAME
cadquery.selectors
CLASSES
builtins.object
Selector
BaseDirSelector
DirectionSelector
ParallelDirSelector
DirectionNthSelector(ParallelDirSelector, CenterNthSelector)
PerpendicularDirSelector
BinarySelector
AndSelector
SubtractSelector
SumSelector
BoxSelector
InverseSelector
NearestToPointSelector
NearestToShapeSelector
StringSyntaxSelector
TypeSelector
_NthSelector(Selector, abc.ABC)
AreaNthSelector
CenterNthSelector
DirectionMinMaxSelector
LengthNthSelector
RadiusNthSelector
class AndSelector(BinarySelector)
| AndSelector(left, right)
|
| Intersection selector. Returns objects that is selected by both selectors.
|
| Method resolution order:
| AndSelector
| BinarySelector
| Selector
| builtins.object
|
| Methods defined here:
|
| filterResults(self, r_left, r_right)
|
| ----------------------------------------------------------------------
| Methods inherited from BinarySelector:
|
| __init__(self, left, right)
| Initialize self. See help(type(self)) for accurate signature.
|
| filter(self, objectList: Sequence[~Shape])
| Filter the provided list.
|
| The default implementation returns the original list unfiltered.
|
| :param objectList: list to filter
| :type objectList: list of OCCT primitives
| :return: filtered list
|
| ----------------------------------------------------------------------
| Methods inherited from Selector:
|
| __add__(self, other)
|
| __and__(self, other)
|
| __neg__(self)
|
| __sub__(self, other)
|
| ----------------------------------------------------------------------
| Data descriptors inherited from Selector:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
class AreaNthSelector(_NthSelector)
| AreaNthSelector(n: int, directionMax: bool = True, tolerance: float = 0.0001)
|
| Selects the object(s) with Nth area
|
| Applicability:
| - Faces, Shells, Solids - Shape.Area() is used to compute area
| - closed planar Wires - a temporary face is created to compute area
|
| Will ignore non-planar or non-closed wires.
|
| Among other things can be used to select one of
| the nested coplanar wires or faces.
|
| For example to create a fillet on a shank::
|
| result = (
| cq.Workplane("XY")
| .circle(5)
| .extrude(2)
| .circle(2)
| .extrude(10)
| .faces(">Z[-2]")
| .wires(AreaNthSelector(0))
| .fillet(2)
| )
|
| Or to create a lip on a case seam::
|
| result = (
| cq.Workplane("XY")
| .rect(20, 20)
| .extrude(10)
| .edges("|Z or <Z")
| .fillet(2)
| .faces(">Z")
| .shell(2)
| .faces(">Z")
| .wires(AreaNthSelector(-1))
| .toPending()
| .workplane()
| .offset2D(-1)
| .extrude(1)
| .faces(">Z[-2]")
| .wires(AreaNthSelector(0))
| .toPending()
| .workplane()
| .cutBlind(2)
| )
|
| Method resolution order:
| AreaNthSelector
| _NthSelector
| Selector
| abc.ABC
| builtins.object
|
| Methods defined here:
|
| key(self, obj: ~Shape) -> float
| Return the key for ordering. Can raise a ValueError if obj can not be
| used to create a key, which will result in obj being dropped by the
| clustering method.
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __abstractmethods__ = frozenset()
|
| ----------------------------------------------------------------------
| Methods inherited from _NthSelector:
|
| __init__(self, n: int, directionMax: bool = True, tolerance: float = 0.0001)
| Initialize self. See help(type(self)) for accurate signature.
|
| cluster(self, objectlist: Sequence[~Shape]) -> List[List[~Shape]]
| Clusters the elements of objectlist if they are within tolerance.
|
| filter(self, objectlist: Sequence[~Shape]) -> List[~Shape]
| Return the nth object in the objectlist sorted by self.key and
| clustered if within self.tolerance.
|
| ----------------------------------------------------------------------
| Methods inherited from Selector:
|
| __add__(self, other)
|
| __and__(self, other)
|
| __neg__(self)
|
| __sub__(self, other)
|
| ----------------------------------------------------------------------
| Data descriptors inherited from Selector:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
class BaseDirSelector(Selector)
| BaseDirSelector(vector: cadquery.occ_impl.geom.Vector, tolerance: float = 0.0001)
|
| A selector that handles selection on the basis of a single direction vector.
|
| Method resolution order:
| BaseDirSelector
| Selector
| builtins.object
|
| Methods defined here:
|
| __init__(self, vector: cadquery.occ_impl.geom.Vector, tolerance: float = 0.0001)
| Initialize self. See help(type(self)) for accurate signature.
|
| filter(self, objectList: Sequence[~Shape]) -> List[~Shape]
| There are lots of kinds of filters, but for planes they are always
| based on the normal of the plane, and for edges on the tangent vector
| along the edge
|
| test(self, vec: cadquery.occ_impl.geom.Vector) -> bool
| Test a specified vector. Subclasses override to provide other implementations
|
| ----------------------------------------------------------------------
| Methods inherited from Selector:
|
| __add__(self, other)
|
| __and__(self, other)
|
| __neg__(self)
|
| __sub__(self, other)
|
| ----------------------------------------------------------------------
| Data descriptors inherited from Selector:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
class BinarySelector(Selector)
| BinarySelector(left, right)
|
| Base class for selectors that operates with two other
| selectors. Subclass must implement the :filterResults(): method.
|
| Method resolution order:
| BinarySelector
| Selector
| builtins.object
|
| Methods defined here:
|
| __init__(self, left, right)
| Initialize self. See help(type(self)) for accurate signature.
|
| filter(self, objectList: Sequence[~Shape])
| Filter the provided list.
|
| The default implementation returns the original list unfiltered.
|
| :param objectList: list to filter
| :type objectList: list of OCCT primitives
| :return: filtered list
|
| filterResults(self, r_left, r_right)
|
| ----------------------------------------------------------------------
| Methods inherited from Selector:
|
| __add__(self, other)
|
| __and__(self, other)
|
| __neg__(self)
|
| __sub__(self, other)
|
| ----------------------------------------------------------------------
| Data descriptors inherited from Selector:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
class BoxSelector(Selector)
| BoxSelector(point0, point1, boundingbox=False)
|
| Selects objects inside the 3D box defined by 2 points.
|
| If `boundingbox` is True only the objects that have their bounding
| box inside the given box is selected. Otherwise only center point
| of the object is tested.
|
| Applicability: all types of shapes
|
| Example::
|
| CQ(aCube).edges(BoxSelector((0, 1, 0), (1, 2, 1)))
|
| Method resolution order:
| BoxSelector
| Selector
| builtins.object
|
| Methods defined here:
|
| __init__(self, point0, point1, boundingbox=False)
| Initialize self. See help(type(self)) for accurate signature.
|
| filter(self, objectList: Sequence[~Shape])
| Filter the provided list.
|
| The default implementation returns the original list unfiltered.
|
| :param objectList: list to filter
| :type objectList: list of OCCT primitives
| :return: filtered list
|
| ----------------------------------------------------------------------
| Methods inherited from Selector:
|
| __add__(self, other)
|
| __and__(self, other)
|
| __neg__(self)
|
| __sub__(self, other)
|
| ----------------------------------------------------------------------
| Data descriptors inherited from Selector:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
class CenterNthSelector(_NthSelector)
| CenterNthSelector(vector: cadquery.occ_impl.geom.Vector, n: int, directionMax: bool = True, tolerance: float = 0.0001)
|
| Sorts objects into a list with order determined by the distance of their center projected onto the specified direction.
|
| Applicability:
| All Shapes.
|
| Method resolution order:
| CenterNthSelector
| _NthSelector
| Selector
| abc.ABC
| builtins.object
|
| Methods defined here:
|
| __init__(self, vector: cadquery.occ_impl.geom.Vector, n: int, directionMax: bool = True, tolerance: float = 0.0001)
| Initialize self. See help(type(self)) for accurate signature.
|
| key(self, obj: ~Shape) -> float
| Return the key for ordering. Can raise a ValueError if obj can not be
| used to create a key, which will result in obj being dropped by the
| clustering method.
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __abstractmethods__ = frozenset()
|
| ----------------------------------------------------------------------
| Methods inherited from _NthSelector:
|
| cluster(self, objectlist: Sequence[~Shape]) -> List[List[~Shape]]
| Clusters the elements of objectlist if they are within tolerance.
|
| filter(self, objectlist: Sequence[~Shape]) -> List[~Shape]
| Return the nth object in the objectlist sorted by self.key and
| clustered if within self.tolerance.
|
| ----------------------------------------------------------------------
| Methods inherited from Selector:
|
| __add__(self, other)
|
| __and__(self, other)
|
| __neg__(self)
|
| __sub__(self, other)
|
| ----------------------------------------------------------------------
| Data descriptors inherited from Selector:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
class DirectionMinMaxSelector(CenterNthSelector)
| DirectionMinMaxSelector(vector: cadquery.occ_impl.geom.Vector, directionMax: bool = True, tolerance: float = 0.0001)
|
| Selects objects closest or farthest in the specified direction.
|
| Applicability:
| All object types. for a vertex, its point is used. for all other kinds
| of objects, the center of mass of the object is used.
|
| You can use the string shortcuts >(X|Y|Z) or <(X|Y|Z) if you want to select
| based on a cardinal direction.
|
| For example this::
|
| CQ(aCube).faces(DirectionMinMaxSelector((0, 0, 1), True))
|
| Means to select the face having the center of mass farthest in the positive
| z direction, and is the same as::
|
| CQ(aCube).faces(">Z")
|
| Method resolution order:
| DirectionMinMaxSelector
| CenterNthSelector
| _NthSelector
| Selector
| abc.ABC
| builtins.object
|
| Methods defined here:
|
| __init__(self, vector: cadquery.occ_impl.geom.Vector, directionMax: bool = True, tolerance: float = 0.0001)
| Initialize self. See help(type(self)) for accurate signature.
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __abstractmethods__ = frozenset()
|
| ----------------------------------------------------------------------
| Methods inherited from CenterNthSelector:
|
| key(self, obj: ~Shape) -> float
| Return the key for ordering. Can raise a ValueError if obj can not be
| used to create a key, which will result in obj being dropped by the
| clustering method.
|
| ----------------------------------------------------------------------
| Methods inherited from _NthSelector:
|
| cluster(self, objectlist: Sequence[~Shape]) -> List[List[~Shape]]
| Clusters the elements of objectlist if they are within tolerance.
|
| filter(self, objectlist: Sequence[~Shape]) -> List[~Shape]
| Return the nth object in the objectlist sorted by self.key and
| clustered if within self.tolerance.
|
| ----------------------------------------------------------------------
| Methods inherited from Selector:
|
| __add__(self, other)
|
| __and__(self, other)
|
| __neg__(self)
|
| __sub__(self, other)
|
| ----------------------------------------------------------------------
| Data descriptors inherited from Selector:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
class DirectionNthSelector(ParallelDirSelector, CenterNthSelector)
| DirectionNthSelector(vector: cadquery.occ_impl.geom.Vector, n: int, directionMax: bool = True, tolerance: float = 0.0001)
|
| Filters for objects parallel (or normal) to the specified direction then returns the Nth one.
|
| Applicability:
| Linear Edges
| Planar Faces
|
| Method resolution order:
| DirectionNthSelector
| ParallelDirSelector
| BaseDirSelector
| CenterNthSelector
| _NthSelector
| Selector
| abc.ABC
| builtins.object
|
| Methods defined here:
|
| __init__(self, vector: cadquery.occ_impl.geom.Vector, n: int, directionMax: bool = True, tolerance: float = 0.0001)
| Initialize self. See help(type(self)) for accurate signature.
|
| filter(self, objectlist: Sequence[~Shape]) -> List[~Shape]
| There are lots of kinds of filters, but for planes they are always
| based on the normal of the plane, and for edges on the tangent vector
| along the edge
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __abstractmethods__ = frozenset()
|
| ----------------------------------------------------------------------
| Methods inherited from ParallelDirSelector:
|
| test(self, vec: cadquery.occ_impl.geom.Vector) -> bool
| Test a specified vector. Subclasses override to provide other implementations
|
| ----------------------------------------------------------------------
| Methods inherited from CenterNthSelector:
|
| key(self, obj: ~Shape) -> float
| Return the key for ordering. Can raise a ValueError if obj can not be
| used to create a key, which will result in obj being dropped by the
| clustering method.
|
| ----------------------------------------------------------------------
| Methods inherited from _NthSelector:
|
| cluster(self, objectlist: Sequence[~Shape]) -> List[List[~Shape]]
| Clusters the elements of objectlist if they are within tolerance.
|
| ----------------------------------------------------------------------
| Methods inherited from Selector:
|
| __add__(self, other)
|
| __and__(self, other)
|
| __neg__(self)
|
| __sub__(self, other)
|
| ----------------------------------------------------------------------
| Data descriptors inherited from Selector:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
class DirectionSelector(BaseDirSelector)
| DirectionSelector(vector: cadquery.occ_impl.geom.Vector, tolerance: float = 0.0001)
|
| Selects objects aligned with the provided direction.
|
| Applicability:
| Linear Edges
| Planar Faces
|
| Use the string syntax shortcut +/-(X|Y|Z) if you want to select based on a cardinal direction.
|
| Example::
|
| CQ(aCube).faces(DirectionSelector((0, 0, 1)))
|
| selects faces with the normal in the z direction, and is equivalent to::
|
| CQ(aCube).faces("+Z")
|
| Method resolution order:
| DirectionSelector
| BaseDirSelector
| Selector
| builtins.object
|
| Methods defined here:
|
| test(self, vec: cadquery.occ_impl.geom.Vector) -> bool
| Test a specified vector. Subclasses override to provide other implementations
|
| ----------------------------------------------------------------------
| Methods inherited from BaseDirSelector:
|
| __init__(self, vector: cadquery.occ_impl.geom.Vector, tolerance: float = 0.0001)
| Initialize self. See help(type(self)) for accurate signature.
|
| filter(self, objectList: Sequence[~Shape]) -> List[~Shape]
| There are lots of kinds of filters, but for planes they are always
| based on the normal of the plane, and for edges on the tangent vector
| along the edge
|
| ----------------------------------------------------------------------
| Methods inherited from Selector:
|
| __add__(self, other)
|
| __and__(self, other)
|
| __neg__(self)
|
| __sub__(self, other)
|
| ----------------------------------------------------------------------
| Data descriptors inherited from Selector:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
class InverseSelector(Selector)
| InverseSelector(selector)
|
| Inverts the selection of given selector. In other words, selects
| all objects that is not selected by given selector.
|
| Method resolution order:
| InverseSelector
| Selector
| builtins.object
|
| Methods defined here:
|
| __init__(self, selector)
| Initialize self. See help(type(self)) for accurate signature.
|
| filter(self, objectList: Sequence[~Shape])
| Filter the provided list.
|
| The default implementation returns the original list unfiltered.
|
| :param objectList: list to filter
| :type objectList: list of OCCT primitives
| :return: filtered list
|
| ----------------------------------------------------------------------
| Methods inherited from Selector:
|
| __add__(self, other)
|
| __and__(self, other)
|
| __neg__(self)
|
| __sub__(self, other)
|
| ----------------------------------------------------------------------
| Data descriptors inherited from Selector:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
class LengthNthSelector(_NthSelector)
| LengthNthSelector(n: int, directionMax: bool = True, tolerance: float = 0.0001)
|
| Select the object(s) with the Nth length
|
| Applicability:
| All Edge and Wire objects
|
| Method resolution order:
| LengthNthSelector
| _NthSelector
| Selector
| abc.ABC
| builtins.object
|
| Methods defined here:
|
| key(self, obj: ~Shape) -> float
| Return the key for ordering. Can raise a ValueError if obj can not be
| used to create a key, which will result in obj being dropped by the
| clustering method.
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __abstractmethods__ = frozenset()
|
| ----------------------------------------------------------------------
| Methods inherited from _NthSelector:
|
| __init__(self, n: int, directionMax: bool = True, tolerance: float = 0.0001)
| Initialize self. See help(type(self)) for accurate signature.
|
| cluster(self, objectlist: Sequence[~Shape]) -> List[List[~Shape]]
| Clusters the elements of objectlist if they are within tolerance.
|
| filter(self, objectlist: Sequence[~Shape]) -> List[~Shape]
| Return the nth object in the objectlist sorted by self.key and
| clustered if within self.tolerance.
|
| ----------------------------------------------------------------------
| Methods inherited from Selector:
|
| __add__(self, other)
|
| __and__(self, other)
|
| __neg__(self)
|
| __sub__(self, other)
|
| ----------------------------------------------------------------------
| Data descriptors inherited from Selector:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
NearestToPoint = class NearestToPointSelector(Selector)
| NearestToPoint(pnt)
|
| Selects object nearest the provided point.
|
| If the object is a vertex or point, the distance
| is used. For other kinds of shapes, the center of mass
| is used to to compute which is closest.
|
| Applicability: All Types of Shapes
|
| Example::
|
| CQ(aCube).vertices(NearestToPointSelector((0, 1, 0)))
|
| returns the vertex of the unit cube closest to the point x=0,y=1,z=0
|
| Method resolution order:
| NearestToPointSelector
| Selector
| builtins.object
|
| Methods defined here:
|
| __init__(self, pnt)
| Initialize self. See help(type(self)) for accurate signature.
|
| filter(self, objectList: Sequence[~Shape])
| Filter the provided list.
|
| The default implementation returns the original list unfiltered.
|
| :param objectList: list to filter
| :type objectList: list of OCCT primitives
| :return: filtered list
|
| ----------------------------------------------------------------------
| Methods inherited from Selector:
|
| __add__(self, other)
|
| __and__(self, other)
|
| __neg__(self)
|
| __sub__(self, other)
|
| ----------------------------------------------------------------------
| Data descriptors inherited from Selector:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
class NearestToPointSelector(Selector)
| NearestToPointSelector(pnt)
|
| Selects object nearest the provided point.
|
| If the object is a vertex or point, the distance
| is used. For other kinds of shapes, the center of mass
| is used to to compute which is closest.
|
| Applicability: All Types of Shapes
|
| Example::
|
| CQ(aCube).vertices(NearestToPointSelector((0, 1, 0)))
|
| returns the vertex of the unit cube closest to the point x=0,y=1,z=0
|
| Method resolution order:
| NearestToPointSelector
| Selector
| builtins.object
|
| Methods defined here:
|
| __init__(self, pnt)
| Initialize self. See help(type(self)) for accurate signature.
|
| filter(self, objectList: Sequence[~Shape])
| Filter the provided list.
|
| The default implementation returns the original list unfiltered.
|
| :param objectList: list to filter
| :type objectList: list of OCCT primitives
| :return: filtered list
|
| ----------------------------------------------------------------------
| Methods inherited from Selector:
|
| __add__(self, other)
|
| __and__(self, other)
|
| __neg__(self)
|
| __sub__(self, other)
|
| ----------------------------------------------------------------------
| Data descriptors inherited from Selector:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
NearestToShape = class NearestToShapeSelector(Selector)
| NearestToShape(s: ~Shape)
|
| Selects object nearest the provided Shape.
|
| Applicability: All Types of Shapes
|
| Method resolution order:
| NearestToShapeSelector
| Selector
| builtins.object
|
| Methods defined here:
|
| __init__(self, s: ~Shape)
| Initialize self. See help(type(self)) for accurate signature.
|
| filter(self, objectList: Sequence[~Shape])
| Filter the provided list.
|
| The default implementation returns the original list unfiltered.
|
| :param objectList: list to filter
| :type objectList: list of OCCT primitives
| :return: filtered list
|
| ----------------------------------------------------------------------
| Methods inherited from Selector:
|
| __add__(self, other)
|
| __and__(self, other)
|
| __neg__(self)
|
| __sub__(self, other)
|
| ----------------------------------------------------------------------
| Data descriptors inherited from Selector:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
class NearestToShapeSelector(Selector)
| NearestToShapeSelector(s: ~Shape)
|
| Selects object nearest the provided Shape.
|
| Applicability: All Types of Shapes
|
| Method resolution order:
| NearestToShapeSelector
| Selector
| builtins.object
|
| Methods defined here:
|
| __init__(self, s: ~Shape)
| Initialize self. See help(type(self)) for accurate signature.
|
| filter(self, objectList: Sequence[~Shape])
| Filter the provided list.
|
| The default implementation returns the original list unfiltered.
|
| :param objectList: list to filter
| :type objectList: list of OCCT primitives
| :return: filtered list
|
| ----------------------------------------------------------------------
| Methods inherited from Selector:
|
| __add__(self, other)
|
| __and__(self, other)
|
| __neg__(self)
|
| __sub__(self, other)
|
| ----------------------------------------------------------------------
| Data descriptors inherited from Selector:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
Parallel = class ParallelDirSelector(BaseDirSelector)
| Parallel(vector: cadquery.occ_impl.geom.Vector, tolerance: float = 0.0001)
|
| Selects objects parallel with the provided direction.
|
| Applicability:
| Linear Edges
| Planar Faces
|
| Use the string syntax shortcut \|(X|Y|Z) if you want to select based on a cardinal direction.
|
| Example::
|
| CQ(aCube).faces(ParallelDirSelector((0, 0, 1)))
|
| selects faces with the normal parallel to the z direction, and is equivalent to::
|
| CQ(aCube).faces("|Z")
|
| Method resolution order:
| ParallelDirSelector
| BaseDirSelector
| Selector
| builtins.object
|
| Methods defined here:
|
| test(self, vec: cadquery.occ_impl.geom.Vector) -> bool
| Test a specified vector. Subclasses override to provide other implementations
|
| ----------------------------------------------------------------------
| Methods inherited from BaseDirSelector:
|
| __init__(self, vector: cadquery.occ_impl.geom.Vector, tolerance: float = 0.0001)
| Initialize self. See help(type(self)) for accurate signature.
|
| filter(self, objectList: Sequence[~Shape]) -> List[~Shape]
| There are lots of kinds of filters, but for planes they are always
| based on the normal of the plane, and for edges on the tangent vector
| along the edge
|
| ----------------------------------------------------------------------
| Methods inherited from Selector:
|
| __add__(self, other)
|
| __and__(self, other)
|
| __neg__(self)
|
| __sub__(self, other)
|
| ----------------------------------------------------------------------
| Data descriptors inherited from Selector:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
class ParallelDirSelector(BaseDirSelector)
| ParallelDirSelector(vector: cadquery.occ_impl.geom.Vector, tolerance: float = 0.0001)
|
| Selects objects parallel with the provided direction.
|
| Applicability:
| Linear Edges
| Planar Faces
|
| Use the string syntax shortcut \|(X|Y|Z) if you want to select based on a cardinal direction.
|
| Example::
|
| CQ(aCube).faces(ParallelDirSelector((0, 0, 1)))
|
| selects faces with the normal parallel to the z direction, and is equivalent to::
|
| CQ(aCube).faces("|Z")
|
| Method resolution order:
| ParallelDirSelector
| BaseDirSelector
| Selector
| builtins.object
|
| Methods defined here:
|
| test(self, vec: cadquery.occ_impl.geom.Vector) -> bool
| Test a specified vector. Subclasses override to provide other implementations
|
| ----------------------------------------------------------------------
| Methods inherited from BaseDirSelector:
|
| __init__(self, vector: cadquery.occ_impl.geom.Vector, tolerance: float = 0.0001)
| Initialize self. See help(type(self)) for accurate signature.
|
| filter(self, objectList: Sequence[~Shape]) -> List[~Shape]
| There are lots of kinds of filters, but for planes they are always
| based on the normal of the plane, and for edges on the tangent vector
| along the edge
|
| ----------------------------------------------------------------------
| Methods inherited from Selector:
|
| __add__(self, other)
|
| __and__(self, other)
|
| __neg__(self)
|
| __sub__(self, other)
|
| ----------------------------------------------------------------------
| Data descriptors inherited from Selector:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
Perpendicular = class PerpendicularDirSelector(BaseDirSelector)
| Perpendicular(vector: cadquery.occ_impl.geom.Vector, tolerance: float = 0.0001)
|
| Selects objects perpendicular with the provided direction.
|
| Applicability:
| Linear Edges
| Planar Faces
|
| Use the string syntax shortcut #(X|Y|Z) if you want to select based on a
| cardinal direction.
|
| Example::
|
| CQ(aCube).faces(PerpendicularDirSelector((0, 0, 1)))
|
| selects faces with the normal perpendicular to the z direction, and is equivalent to::
|
| CQ(aCube).faces("#Z")
|
| Method resolution order:
| PerpendicularDirSelector
| BaseDirSelector
| Selector
| builtins.object
|
| Methods defined here:
|
| test(self, vec: cadquery.occ_impl.geom.Vector) -> bool
| Test a specified vector. Subclasses override to provide other implementations
|
| ----------------------------------------------------------------------
| Methods inherited from BaseDirSelector:
|
| __init__(self, vector: cadquery.occ_impl.geom.Vector, tolerance: float = 0.0001)
| Initialize self. See help(type(self)) for accurate signature.
|
| filter(self, objectList: Sequence[~Shape]) -> List[~Shape]
| There are lots of kinds of filters, but for planes they are always
| based on the normal of the plane, and for edges on the tangent vector
| along the edge
|
| ----------------------------------------------------------------------
| Methods inherited from Selector:
|
| __add__(self, other)
|
| __and__(self, other)
|
| __neg__(self)
|
| __sub__(self, other)
|
| ----------------------------------------------------------------------
| Data descriptors inherited from Selector:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
class PerpendicularDirSelector(BaseDirSelector)
| PerpendicularDirSelector(vector: cadquery.occ_impl.geom.Vector, tolerance: float = 0.0001)
|
| Selects objects perpendicular with the provided direction.
|
| Applicability:
| Linear Edges
| Planar Faces
|
| Use the string syntax shortcut #(X|Y|Z) if you want to select based on a
| cardinal direction.
|
| Example::
|
| CQ(aCube).faces(PerpendicularDirSelector((0, 0, 1)))
|
| selects faces with the normal perpendicular to the z direction, and is equivalent to::
|
| CQ(aCube).faces("#Z")
|
| Method resolution order:
| PerpendicularDirSelector
| BaseDirSelector
| Selector
| builtins.object
|
| Methods defined here:
|
| test(self, vec: cadquery.occ_impl.geom.Vector) -> bool
| Test a specified vector. Subclasses override to provide other implementations
|
| ----------------------------------------------------------------------
| Methods inherited from BaseDirSelector:
|
| __init__(self, vector: cadquery.occ_impl.geom.Vector, tolerance: float = 0.0001)
| Initialize self. See help(type(self)) for accurate signature.
|
| filter(self, objectList: Sequence[~Shape]) -> List[~Shape]
| There are lots of kinds of filters, but for planes they are always
| based on the normal of the plane, and for edges on the tangent vector
| along the edge
|
| ----------------------------------------------------------------------
| Methods inherited from Selector:
|
| __add__(self, other)
|
| __and__(self, other)
|
| __neg__(self)
|
| __sub__(self, other)
|
| ----------------------------------------------------------------------
| Data descriptors inherited from Selector:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
class RadiusNthSelector(_NthSelector)
| RadiusNthSelector(n: int, directionMax: bool = True, tolerance: float = 0.0001)
|
| Select the object with the Nth radius.
|
| Applicability:
| All Edge and Wires.
|
| Will ignore any shape that can not be represented as a circle or an arc of
| a circle.
|
| Method resolution order:
| RadiusNthSelector
| _NthSelector
| Selector
| abc.ABC
| builtins.object
|
| Methods defined here:
|
| key(self, obj: ~Shape) -> float
| Return the key for ordering. Can raise a ValueError if obj can not be
| used to create a key, which will result in obj being dropped by the
| clustering method.
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __abstractmethods__ = frozenset()
|
| ----------------------------------------------------------------------
| Methods inherited from _NthSelector:
|
| __init__(self, n: int, directionMax: bool = True, tolerance: float = 0.0001)
| Initialize self. See help(type(self)) for accurate signature.
|
| cluster(self, objectlist: Sequence[~Shape]) -> List[List[~Shape]]
| Clusters the elements of objectlist if they are within tolerance.
|
| filter(self, objectlist: Sequence[~Shape]) -> List[~Shape]
| Return the nth object in the objectlist sorted by self.key and
| clustered if within self.tolerance.
|
| ----------------------------------------------------------------------
| Methods inherited from Selector:
|
| __add__(self, other)
|
| __and__(self, other)
|
| __neg__(self)
|
| __sub__(self, other)
|
| ----------------------------------------------------------------------
| Data descriptors inherited from Selector:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
class Selector(builtins.object)
| Filters a list of objects.
|
| Filters must provide a single method that filters objects.
|
| Methods defined here:
|
| __add__(self, other)
|
| __and__(self, other)
|
| __neg__(self)
|
| __sub__(self, other)
|
| filter(self, objectList: Sequence[~Shape]) -> List[~Shape]
| Filter the provided list.
|
| The default implementation returns the original list unfiltered.
|
| :param objectList: list to filter
| :type objectList: list of OCCT primitives
| :return: filtered list
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
class StringSyntaxSelector(Selector)
| StringSyntaxSelector(selectorString)
|
| Filter lists objects using a simple string syntax. All of the filters available in the string syntax
| are also available ( usually with more functionality ) through the creation of full-fledged
| selector objects. see :py:class:`Selector` and its subclasses
|
| Filtering works differently depending on the type of object list being filtered.
|
| :param selectorString: A two-part selector string, [selector][axis]
|
| :return: objects that match the specified selector
|
| ***Modifiers*** are ``('|','+','-','<','>','%')``
|
| :\|:
| parallel to ( same as :py:class:`ParallelDirSelector` ). Can return multiple objects.
| :#:
| perpendicular to (same as :py:class:`PerpendicularDirSelector` )
| :+:
| positive direction (same as :py:class:`DirectionSelector` )
| :-:
| negative direction (same as :py:class:`DirectionSelector` )
| :>:
| maximize (same as :py:class:`DirectionMinMaxSelector` with directionMax=True)
| :<:
| minimize (same as :py:class:`DirectionMinMaxSelector` with directionMax=False )
| :%:
| curve/surface type (same as :py:class:`TypeSelector`)
|
| ***axisStrings*** are: ``X,Y,Z,XY,YZ,XZ`` or ``(x,y,z)`` which defines an arbitrary direction
|
| It is possible to combine simple selectors together using logical operations.
| The following operations are supported
|
| :and:
| Logical AND, e.g. >X and >Y
| :or:
| Logical OR, e.g. \|X or \|Y
| :not:
| Logical NOT, e.g. not #XY
| :exc(ept):
| Set difference (equivalent to AND NOT): \|X exc >Z
|
| Finally, it is also possible to use even more complex expressions with nesting
| and arbitrary number of terms, e.g.
|
| (not >X[0] and #XY) or >XY[0]
|
| Selectors are a complex topic: see :ref:`selector_reference` for more information
|
| Method resolution order:
| StringSyntaxSelector
| Selector
| builtins.object
|
| Methods defined here:
|
| __init__(self, selectorString)
| Feed the input string through the parser and construct an relevant complex selector object
|
| filter(self, objectList: Sequence[~Shape])
| Filter give object list through th already constructed complex selector object
|
| ----------------------------------------------------------------------
| Methods inherited from Selector:
|
| __add__(self, other)
|
| __and__(self, other)
|
| __neg__(self)
|
| __sub__(self, other)
|
| ----------------------------------------------------------------------
| Data descriptors inherited from Selector:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
class SubtractSelector(BinarySelector)
| SubtractSelector(left, right)
|
| Difference selector. Subtract results of a selector from another
| selectors results.
|
| Method resolution order:
| SubtractSelector
| BinarySelector
| Selector
| builtins.object
|
| Methods defined here:
|
| filterResults(self, r_left, r_right)
|
| ----------------------------------------------------------------------
| Methods inherited from BinarySelector:
|
| __init__(self, left, right)
| Initialize self. See help(type(self)) for accurate signature.
|
| filter(self, objectList: Sequence[~Shape])
| Filter the provided list.
|
| The default implementation returns the original list unfiltered.
|
| :param objectList: list to filter
| :type objectList: list of OCCT primitives
| :return: filtered list
|
| ----------------------------------------------------------------------
| Methods inherited from Selector:
|
| __add__(self, other)
|
| __and__(self, other)
|
| __neg__(self)
|
| __sub__(self, other)
|
| ----------------------------------------------------------------------
| Data descriptors inherited from Selector:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
class SumSelector(BinarySelector)
| SumSelector(left, right)
|
| Union selector. Returns the sum of two selectors results.
|
| Method resolution order:
| SumSelector
| BinarySelector
| Selector
| builtins.object
|
| Methods defined here:
|
| filterResults(self, r_left, r_right)
|
| ----------------------------------------------------------------------
| Methods inherited from BinarySelector:
|
| __init__(self, left, right)
| Initialize self. See help(type(self)) for accurate signature.
|
| filter(self, objectList: Sequence[~Shape])
| Filter the provided list.
|
| The default implementation returns the original list unfiltered.
|
| :param objectList: list to filter
| :type objectList: list of OCCT primitives
| :return: filtered list
|
| ----------------------------------------------------------------------
| Methods inherited from Selector:
|
| __add__(self, other)
|
| __and__(self, other)
|
| __neg__(self)
|
| __sub__(self, other)
|
| ----------------------------------------------------------------------
| Data descriptors inherited from Selector:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
class TypeSelector(Selector)
| TypeSelector(typeString: str)
|
| Selects objects having the prescribed geometry type.
|
| Applicability:
| Faces: PLANE, CYLINDER, CONE, SPHERE, TORUS, BEZIER, BSPLINE, REVOLUTION, EXTRUSION, OFFSET, OTHER
| Edges: LINE, CIRCLE, ELLIPSE, HYPERBOLA, PARABOLA, BEZIER, BSPLINE, OFFSET, OTHER
|
| You can use the string selector syntax. For example this::
|
| CQ(aCube).faces(TypeSelector("PLANE"))
|
| will select 6 faces, and is equivalent to::
|
| CQ(aCube).faces("%PLANE")
|
| Method resolution order:
| TypeSelector
| Selector
| builtins.object
|
| Methods defined here:
|
| __init__(self, typeString: str)
| Initialize self. See help(type(self)) for accurate signature.
|
| filter(self, objectList: Sequence[~Shape]) -> List[~Shape]
| Filter the provided list.
|
| The default implementation returns the original list unfiltered.
|
| :param objectList: list to filter
| :type objectList: list of OCCT primitives
| :return: filtered list
|
| ----------------------------------------------------------------------
| Methods inherited from Selector:
|
| __add__(self, other)
|
| __and__(self, other)
|
| __neg__(self)
|
| __sub__(self, other)
|
| ----------------------------------------------------------------------
| Data descriptors inherited from Selector:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
FUNCTIONS
reduce(...)
reduce(function, iterable[, initial]) -> value
Apply a function of two arguments cumulatively to the items of a sequence
or iterable, from left to right, so as to reduce the iterable to a single
value. For example, reduce(lambda x, y: x+y, [1, 2, 3, 4, 5]) calculates
((((1+2)+3)+4)+5). If initial is present, it is placed before the items
of the iterable in the calculation, and serves as a default when the
iterable is empty.
DATA
Iterable = typing.Iterable
A generic version of collections.abc.Iterable.
List = typing.List
A generic version of list.
Sequence = typing.Sequence
A generic version of collections.abc.Sequence.
Shape = ~Shape
geom_LUT_EDGE = {<GeomAbs_CurveType.GeomAbs_Line: 0>: 'LINE', <GeomAbs...
geom_LUT_FACE = {<GeomAbs_SurfaceType.GeomAbs_Plane: 0>: 'PLANE', <Geo...
nums = '0123456789'
FILE
c:\users\youse\appdata\local\programs\python\python312\lib\site-packages\cadquery\selectors.py
cadquery.sketch
Python Library Documentation: module cadquery.sketch in cadquery
NAME
cadquery.sketch
CLASSES
builtins.object
Constraint
Sketch
class Constraint(builtins.object)
| Constraint(tags: Tuple[str, ...], args: Tuple[cadquery.occ_impl.shapes.Edge, ...], kind: Literal['Fixed', 'FixedPoint', 'Coincident', 'Angle', 'Length', 'Distance', 'Radius', 'Orientation', 'ArcAngle'], param: Any = None)
|
| Methods defined here:
|
| __init__(self, tags: Tuple[str, ...], args: Tuple[cadquery.occ_impl.shapes.Edge, ...], kind: Literal['Fixed', 'FixedPoint', 'Coincident', 'Angle', 'Length', 'Distance', 'Radius', 'Orientation', 'ArcAngle'], param: Any = None)
| Initialize self. See help(type(self)) for accurate signature.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __annotations__ = {'args': typing.Tuple[cadquery.occ_impl.shapes.Edge,...
class Sketch(builtins.object)
| Sketch(parent: Any = None, locs: Iterable[cadquery.occ_impl.geom.Location] = (<cadquery.occ_impl.geom.Location object at 0x000001B8DA2193D0>,), obj: Optional[cadquery.occ_impl.shapes.Compound] = None)
|
| 2D sketch. Supports faces, edges and edges with constraints based construction.
|
| Methods defined here:
|
| __add__(self: ~T, other: 'Sketch') -> ~T
| Fuse self and other.
|
| __getitem__(self: ~T, item: Union[int, Sequence[int], slice]) -> ~T
|
| __init__(self: ~T, parent: Any = None, locs: Iterable[cadquery.occ_impl.geom.Location] = (<cadquery.occ_impl.geom.Location object at 0x000001B8DA2193D0>,), obj: Optional[cadquery.occ_impl.shapes.Compound] = None)
| Construct an empty sketch.
|
| __iter__(self) -> Union[Iterator[cadquery.occ_impl.shapes.Face], Iterator[cadquery.occ_impl.shapes.Edge]]
| Iterate over faces-locations combinations. If not faces are present
| iterate over edges:
|
| __mul__(self: ~T, other: 'Sketch') -> ~T
| Intersect self and other.
|
| __sub__(self: ~T, other: 'Sketch') -> ~T
| Subtract other from self.
|
| __truediv__(self: ~T, other: 'Sketch') -> ~T
| Split self with other.
|
| add(self: ~T) -> ~T
| Add selection to the underlying faces.
|
| apply(self: ~T, f: Callable[[Iterable[Union[cadquery.occ_impl.shapes.Shape, cadquery.occ_impl.geom.Location]]], Iterable[Union[cadquery.occ_impl.shapes.Shape, cadquery.occ_impl.geom.Location]]])
| Apply a callable to all items at once.
|
| :param f: Callable to be applied.
| :return: Sketch object with f applied to all items.
|
| arc(self: ~T, p1: Union[cadquery.occ_impl.geom.Vector, Tuple[Union[int, float], Union[int, float]]], p2: Union[cadquery.occ_impl.geom.Vector, Tuple[Union[int, float], Union[int, float]]], p3: Union[cadquery.occ_impl.geom.Vector, Tuple[Union[int, float], Union[int, float]]], tag: Optional[str] = None, forConstruction: bool = False) -> ~T
| arc(self: ~T, p1: Union[cadquery.occ_impl.geom.Vector, Tuple[Union[int, float], Union[int, float]]], p2: Union[cadquery.occ_impl.geom.Vector, Tuple[Union[int, float], Union[int, float]]], p3: Union[cadquery.occ_impl.geom.Vector, Tuple[Union[int, float], Union[int, float]]], tag: Optional[str] = None, forConstruction: bool = False) -> ~T
|
| Construct an arc.
|
| assemble(self: ~T, mode: Literal['a', 's', 'i', 'c', 'r'] = 'a', tag: Optional[str] = None) -> ~T
| Assemble edges into faces.
|
| bezier(self: ~T, pts: Iterable[Union[cadquery.occ_impl.geom.Vector, Tuple[Union[int, float], Union[int, float]]]], tag: Optional[str] = None, forConstruction: bool = False) -> ~T
| Construct an bezier curve.
|
| The edge will pass through the last points, and the inner points
| are bezier control points.
|
| chamfer(self: ~T, d: Union[int, float]) -> ~T
| Add a chamfer based on current selection.
|
| circle(self: ~T, r: Union[int, float], mode: Literal['a', 's', 'i', 'c', 'r'] = 'a', tag: Optional[str] = None) -> ~T
| Construct a circular face.
|
| clean(self: ~T) -> ~T
| Remove internal wires.
|
| close(self: ~T, tag: Optional[str] = None) -> ~T
| Connect last edge to the first one.
|
| constrain(self: ~T, tag: str, constraint: Literal['Fixed', 'FixedPoint', 'Coincident', 'Angle', 'Length', 'Distance', 'Radius', 'Orientation', 'ArcAngle'], arg: Any) -> ~T
| constrain(self: ~T, tag: str, constraint: Literal['Fixed', 'FixedPoint', 'Coincident', 'Angle', 'Length', 'Distance', 'Radius', 'Orientation', 'ArcAngle'], arg: Any) -> ~T
|
| Add a constraint.
|
| copy(self: ~T) -> ~T
| Create a partial copy of the sketch.
|
| delete(self: ~T) -> ~T
| Delete selected object.
|
| distribute(self: ~T, n: int, start: Union[int, float] = 0, stop: Union[int, float] = 1, rotate: bool = True) -> ~T
| Distribute locations along selected edges or wires.
|
| each(self: ~T, callback: Callable[[cadquery.occ_impl.geom.Location], Union[cadquery.occ_impl.shapes.Face, ForwardRef('Sketch'), cadquery.occ_impl.shapes.Compound]], mode: Literal['a', 's', 'i', 'c', 'r'] = 'a', tag: Optional[str] = None, ignore_selection: bool = False) -> ~T
| Apply a callback on all applicable entities.
|
| edge(self: ~T, val: cadquery.occ_impl.shapes.Edge, tag: Optional[str] = None, forConstruction: bool = False) -> ~T
| Add an edge to the sketch.
|
| edges(self: ~T, s: Union[str, cadquery.selectors.Selector, NoneType] = None, tag: Optional[str] = None) -> ~T
| Select edges.
|
| ellipse(self: ~T, a1: Union[int, float], a2: Union[int, float], angle: Union[int, float] = 0, mode: Literal['a', 's', 'i', 'c', 'r'] = 'a', tag: Optional[str] = None) -> ~T
| Construct an elliptical face.
|
| export(self: ~T, fname: str, tolerance: float = 0.1, angularTolerance: float = 0.1, unit: Literal['MM', 'CM', 'M', 'KM', 'INCH', 'FT', 'MI', 'UM', 'NM'] = 'MM', outputUnit: Optional[Literal['MM', 'CM', 'M', 'KM', 'INCH', 'FT', 'MI', 'UM', 'NM']] = None, opt: Optional[Dict[str, Any]] = None) -> ~T
| Export Sketch to file.
|
| :param path: Filename.
| :param tolerance: the deflection tolerance, in model units. Default 0.1.
| :param angularTolerance: the angular tolerance, in radians. Default 0.1.
| :param unit: The internal unit of the model's geometry values. Only used for STEP. Default "MM".
| :type unit: UnitLiterals
| :param outputUnit: The unit to use in the STEP file header. If None, defaults to the value of ``unit``.
| Use this when you want the output file to declare a different unit than the model's internal unit,
| for example to export a MM model as a STEP file declaring meters.
| :type outputUnit: UnitLiterals or None
| :param opt: additional options passed to the specific exporter. Default None.
| :return: Self.
|
| face(self: ~T, b: Union[cadquery.occ_impl.shapes.Wire, Iterable[cadquery.occ_impl.shapes.Edge], cadquery.occ_impl.shapes.Shape, ~T], angle: Union[int, float] = 0, mode: Literal['a', 's', 'i', 'c', 'r'] = 'a', tag: Optional[str] = None, ignore_selection: bool = False) -> ~T
| Construct a face from a wire or edges.
|
| faces(self: ~T, s: Union[str, cadquery.selectors.Selector, NoneType] = None, tag: Optional[str] = None) -> ~T
| Select faces.
|
| fillet(self: ~T, d: Union[int, float]) -> ~T
| Add a fillet based on current selection.
|
| filter(self: ~T, f: Callable[[Union[cadquery.occ_impl.shapes.Shape, cadquery.occ_impl.geom.Location]], bool]) -> ~T
| Filter items using a boolean predicate.
|
| :param f: Callable to be used for filtering.
| :return: Sketch object with filtered items.
|
| finalize(self) -> Any
| Finish sketch construction and return the parent.
|
| hull(self: ~T, mode: Literal['a', 's', 'i', 'c', 'r'] = 'a', tag: Optional[str] = None) -> ~T
| Generate a convex hull from current selection or all objects.
|
| importDXF(self: ~T, filename: str, tol: float = 1e-06, exclude: List[str] = [], include: List[str] = [], angle: Union[int, float] = 0, mode: Literal['a', 's', 'i', 'c', 'r'] = 'a', tag: Optional[str] = None) -> ~T
| Import a DXF file and construct face(s)
|
| invoke(self: ~T, f: Union[Callable[[~T], ~T], Callable[[~T], NoneType], Callable[[], NoneType]])
| Invoke a callable mapping Sketch to Sketch or None. Supports also
| callables that take no arguments such as breakpoint. Returns self if callable
| returns None.
|
| :param f: Callable to be invoked.
| :return: Sketch object.
|
| located(self: ~T, loc: cadquery.occ_impl.geom.Location) -> ~T
| Create a partial copy of the sketch with a new location.
|
| map(self: ~T, f: Callable[[Union[cadquery.occ_impl.shapes.Shape, cadquery.occ_impl.geom.Location]], Union[cadquery.occ_impl.shapes.Shape, cadquery.occ_impl.geom.Location]])
| Apply a callable to every item separately.
|
| :param f: Callable to be applied to every item separately.
| :return: Sketch object with f applied to all items.
|
| moved(self: ~T, *args, **kwargs) -> ~T
| Create a partial copy of the sketch with moved _faces.
|
| offset(self: ~T, d: Union[int, float], mode: Literal['a', 's', 'i', 'c', 'r'] = 'a', tag: Optional[str] = None) -> ~T
| Offset selected wires or edges.
|
| parray(self: ~T, r: Union[int, float], a1: Union[int, float], da: Union[int, float], n: int, rotate: bool = True) -> ~T
| Generate a polar array of locations.
|
| polygon(self: ~T, pts: Iterable[Union[cadquery.occ_impl.geom.Vector, Tuple[Union[int, float], Union[int, float]]]], angle: Union[int, float] = 0, mode: Literal['a', 's', 'i', 'c', 'r'] = 'a', tag: Optional[str] = None) -> ~T
| Construct a polygonal face.
|
| push(self: ~T, locs: Iterable[Union[cadquery.occ_impl.geom.Location, cadquery.occ_impl.geom.Vector, Tuple[Union[int, float], Union[int, float]]]], tag: Optional[str] = None) -> ~T
| Set current selection to given locations or points.
|
| rarray(self: ~T, xs: Union[int, float], ys: Union[int, float], nx: int, ny: int) -> ~T
| Generate a rectangular array of locations.
|
| rect(self: ~T, w: Union[int, float], h: Union[int, float], angle: Union[int, float] = 0, mode: Literal['a', 's', 'i', 'c', 'r'] = 'a', tag: Optional[str] = None) -> ~T
| Construct a rectangular face.
|
| regularPolygon(self: ~T, r: Union[int, float], n: int, angle: Union[int, float] = 0, mode: Literal['a', 's', 'i', 'c', 'r'] = 'a', tag: Optional[str] = None) -> ~T
| Construct a regular polygonal face.
|
| replace(self: ~T) -> ~T
| Replace the underlying faces with the selection.
|
| reset(self: ~T) -> ~T
| Reset current selection.
|
| segment(self: ~T, p1: Union[cadquery.occ_impl.geom.Vector, Tuple[Union[int, float], Union[int, float]]], p2: Union[cadquery.occ_impl.geom.Vector, Tuple[Union[int, float], Union[int, float]]], tag: Optional[str] = None, forConstruction: bool = False) -> ~T
| segment(self: ~T, p1: Union[cadquery.occ_impl.geom.Vector, Tuple[Union[int, float], Union[int, float]]], p2: Union[cadquery.occ_impl.geom.Vector, Tuple[Union[int, float], Union[int, float]]], tag: Optional[str] = None, forConstruction: bool = False) -> ~T
|
| Construct a segment.
|
| select(self: ~T, *tags: str) -> ~T
| Select based on tags.
|
| slot(self: ~T, w: Union[int, float], h: Union[int, float], angle: Union[int, float] = 0, mode: Literal['a', 's', 'i', 'c', 'r'] = 'a', tag: Optional[str] = None) -> ~T
| Construct a slot-shaped face.
|
| solve(self: ~T) -> ~T
| Solve current constraints and update edge positions.
|
| sort(self: ~T, key: Callable[[Union[cadquery.occ_impl.shapes.Shape, cadquery.occ_impl.geom.Location]], Any]) -> ~T
| Sort items using a callable.
|
| :param key: Callable to be used for sorting.
| :return: Sketch object with items sorted.
|
| spline(self: ~T, pts: Iterable[Union[cadquery.occ_impl.geom.Vector, Tuple[Union[int, float], Union[int, float]]]], tangents: Optional[Iterable[Union[cadquery.occ_impl.geom.Vector, Tuple[Union[int, float], Union[int, float]]]]], periodic: bool, tag: Optional[str] = None, forConstruction: bool = False) -> ~T
| spline(self: ~T, pts: Iterable[Union[cadquery.occ_impl.geom.Vector, Tuple[Union[int, float], Union[int, float]]]], tangents: Optional[Iterable[Union[cadquery.occ_impl.geom.Vector, Tuple[Union[int, float], Union[int, float]]]]], periodic: bool, tag: Optional[str] = None, forConstruction: bool = False) -> ~T
|
| Construct a spline edge.
|
| subtract(self: ~T) -> ~T
| Subtract selection from the underlying faces.
|
| tag(self: ~T, tag: str) -> ~T
| Tag current selection.
|
| trapezoid(self: ~T, w: Union[int, float], h: Union[int, float], a1: Union[int, float], a2: Optional[float] = None, angle: Union[int, float] = 0, mode: Literal['a', 's', 'i', 'c', 'r'] = 'a', tag: Optional[str] = None) -> ~T
| Construct a trapezoidal face.
|
| val(self: ~T) -> Union[cadquery.occ_impl.shapes.Shape, cadquery.occ_impl.geom.Location]
| Return the first selected item, underlying compound or first edge.
|
| vals(self: ~T) -> List[Union[cadquery.occ_impl.shapes.Shape, cadquery.occ_impl.geom.Location]]
| Return all selected items, underlying compound or all edges.
|
| vertices(self: ~T, s: Union[str, cadquery.selectors.Selector, NoneType] = None, tag: Optional[str] = None) -> ~T
| Select vertices.
|
| wires(self: ~T, s: Union[str, cadquery.selectors.Selector, NoneType] = None, tag: Optional[str] = None) -> ~T
| Select wires.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __annotations__ = {'_constraints': typing.List[cadquery.sketch.Constra...
FUNCTIONS
cos(x, /)
Return the cosine of x (measured in radians).
radians(x, /)
Convert angle x from degrees to radians.
remainder(x, y, /)
Difference between x and the closest integer multiple of y.
Return x - n*y where n*y is the closest integer multiple of y.
In the case where x is exactly halfway between two multiples of
y, the nearest even value of n is used. The result is always exact.
sin(x, /)
Return the sine of x (measured in radians).
tan(x, /)
Return the tangent of x (measured in radians).
DATA
Callable = typing.Callable
Deprecated alias to collections.abc.Callable.
Callable[[int], str] signifies a function that takes a single
parameter of type int and returns a str.
The subscription syntax must always be used with exactly two
values: the argument list and the return type.
The argument list must be a list of types, a ParamSpec,
Concatenate or ellipsis. The return type must be a single type.
There is no syntax to indicate optional or keyword arguments;
such function types are rarely used as callback types.
ConstraintInvariants = {'Angle': (2, ('CIRCLE', 'LINE'), typing.Union[...
ConstraintKind = typing.Literal['Fixed', 'FixedPoint', 'Coinciden... '...
DOF = typing.Union[typing.Tuple[float, float, float, f... typing.Tuple...
Dict = typing.Dict
A generic version of dict.
Iterable = typing.Iterable
A generic version of collections.abc.Iterable.
Iterator = typing.Iterator
A generic version of collections.abc.Iterator.
List = typing.List
A generic version of list.
Literal = typing.Literal
Special typing form to define literal types (a.k.a. value types).
This form can be used to indicate to type checkers that the corresponding
variable or function parameter has a value equivalent to the provided
literal (or one of several literals)::
def validate_simple(data: Any) -> Literal[True]: # always returns True
...
MODE = Literal['r', 'rb', 'w', 'wb']
def open_helper(file: str, mode: MODE) -> str:
...
open_helper('/some/path', 'r') # Passes type check
open_helper('/other/path', 'typo') # Error in type checker
Literal[...] cannot be subclassed. At runtime, an arbitrary value
is allowed as type argument to Literal[...], but type checkers may
impose restrictions.
Modes = typing.Literal['a', 's', 'i', 'c', 'r']
Optional = typing.Optional
Optional[X] is equivalent to Union[X, None].
Point = typing.Union[cadquery.occ_impl.geom.Vector, typi...ing.Union[i...
Real = typing.Union[int, float]
Sequence = typing.Sequence
A generic version of collections.abc.Sequence.
SketchVal = typing.Union[cadquery.occ_impl.shapes.Shape, cadquery.occ_...
T = ~T
TOL = 1e-06
Tuple = typing.Tuple
Deprecated alias to builtins.tuple.
Tuple[X, Y] is the cross-product type of X and Y.
Example: Tuple[T1, T2] is a tuple of two elements corresponding
to type variables T1 and T2. Tuple[int, float, str] is a tuple
of an int, a float and a string.
To specify a variable-length tuple of homogeneous type, use Tuple[T, ...].
Union = typing.Union
Union type; Union[X, Y] means either X or Y.
On Python 3.10 and higher, the | operator
can also be used to denote unions;
X | Y means the same thing to the type checker as Union[X, Y].
To define a union, use e.g. Union[int, str]. Details:
- The arguments must be types and there must be at least one.
- None as an argument is a special case and is replaced by
type(None).
- Unions of unions are flattened, e.g.::
assert Union[Union[int, str], float] == Union[int, str, float]
- Unions of a single argument vanish, e.g.::
assert Union[int] == int # The constructor actually returns int
- Redundant arguments are skipped, e.g.::
assert Union[int, str, int] == Union[int, str]
- When comparing unions, the argument order is ignored, e.g.::
assert Union[int, str] == Union[str, int]
- You cannot subclass or instantiate a union.
- You can use Optional[X] as a shorthand for Union[X, None].
UnitLiterals = typing.Literal['MM', 'CM', 'M', 'KM', 'INCH', 'FT', 'MI...
VectorLike = typing.Union[ForwardRef('Vector'), typing.Tuple[...ing.Un...
pi = 3.141592653589793
FILE
c:\users\youse\appdata\local\programs\python\python312\lib\site-packages\cadquery\sketch.py
cadquery.sortWiresByBuildOrder
Python Library Documentation: function sortWiresByBuildOrder in module cadquery.occ_impl.shapes
sortWiresByBuildOrder(wireList: 'list[Wire]') -> 'list[list[Wire]]'
Tries to determine how wires should be combined into faces.
Assume:
The wires make up one or more faces, which could have 'holes'
Outer wires are listed ahead of inner wires
there are no wires inside wires inside wires
( IE, islands -- we can deal with that later on )
none of the wires are construction wires
Compute:
one or more sets of wires, with the outer wire listed first, and inner
ones
Returns, list of lists.
cadquery.types
Python Library Documentation: module cadquery.types in cadquery
NAME
cadquery.types
DATA
Literal = typing.Literal
Special typing form to define literal types (a.k.a. value types).
This form can be used to indicate to type checkers that the corresponding
variable or function parameter has a value equivalent to the provided
literal (or one of several literals)::
def validate_simple(data: Any) -> Literal[True]: # always returns True
...
MODE = Literal['r', 'rb', 'w', 'wb']
def open_helper(file: str, mode: MODE) -> str:
...
open_helper('/some/path', 'r') # Passes type check
open_helper('/other/path', 'typo') # Error in type checker
Literal[...] cannot be subclassed. At runtime, an arbitrary value
is allowed as type argument to Literal[...], but type checkers may
impose restrictions.
Real = typing.Union[int, float]
Union = typing.Union
Union type; Union[X, Y] means either X or Y.
On Python 3.10 and higher, the | operator
can also be used to denote unions;
X | Y means the same thing to the type checker as Union[X, Y].
To define a union, use e.g. Union[int, str]. Details:
- The arguments must be types and there must be at least one.
- None as an argument is a special case and is replaced by
type(None).
- Unions of unions are flattened, e.g.::
assert Union[Union[int, str], float] == Union[int, str, float]
- Unions of a single argument vanish, e.g.::
assert Union[int] == int # The constructor actually returns int
- Redundant arguments are skipped, e.g.::
assert Union[int, str, int] == Union[int, str]
- When comparing unions, the argument order is ignored, e.g.::
assert Union[int, str] == Union[str, int]
- You cannot subclass or instantiate a union.
- You can use Optional[X] as a shorthand for Union[X, None].
UnitLiterals = typing.Literal['MM', 'CM', 'M', 'KM', 'INCH', 'FT', 'MI...
FILE
c:\users\youse\appdata\local\programs\python\python312\lib\site-packages\cadquery\types.py
cadquery.units
Python Library Documentation: module cadquery.units in cadquery
NAME
cadquery.units
DATA
DEG2RAD = 0.017453292519943295
RAD2DEG = 57.29577951308232
pi = 3.141592653589793
FILE
c:\users\youse\appdata\local\programs\python\python312\lib\site-packages\cadquery\units.py
cadquery.utils
Python Library Documentation: module cadquery.utils in cadquery
NAME
cadquery.utils
CLASSES
builtins.object
deprecate
deprecate_kwarg
deprecate_kwarg_name
collections.UserDict(collections.abc.MutableMapping)
BiDict
multimethod.multidispatch(multimethod.multimethod, builtins.dict)
multidispatch
class BiDict(collections.UserDict)
| BiDict(*args, **kwargs)
|
| Bi-directional dictionary.
|
| Method resolution order:
| BiDict
| collections.UserDict
| collections.abc.MutableMapping
| collections.abc.Mapping
| collections.abc.Collection
| collections.abc.Sized
| collections.abc.Iterable
| collections.abc.Container
| builtins.object
|
| Methods defined here:
|
| __delitem__(self, k: ~K)
|
| __init__(self, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| __setitem__(self, k: ~K, v: ~V)
|
| clear(self)
| D.clear() -> None. Remove all items from D.
|
| ----------------------------------------------------------------------
| Readonly properties defined here:
|
| inv
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __abstractmethods__ = frozenset()
|
| __annotations__ = {'_inv': dict[~V, list[~K]]}
|
| __orig_bases__ = (collections.UserDict[~K, ~V],)
|
| ----------------------------------------------------------------------
| Methods inherited from collections.UserDict:
|
| __contains__(self, key)
| # Modify __contains__ and get() to work like dict
| # does when __missing__ is present.
|
| __copy__(self)
|
| __getitem__(self, key)
|
| __ior__(self, other)
|
| __iter__(self)
|
| __len__(self)
|
| __or__(self, other)
| Return self|value.
|
| __repr__(self)
| Return repr(self).
|
| __ror__(self, other)
| Return value|self.
|
| copy(self)
|
| get(self, key, default=None)
| D.get(k[,d]) -> D[k] if k in D, else d. d defaults to None.
|
| ----------------------------------------------------------------------
| Class methods inherited from collections.UserDict:
|
| fromkeys(iterable, value=None)
|
| ----------------------------------------------------------------------
| Data descriptors inherited from collections.UserDict:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Methods inherited from collections.abc.MutableMapping:
|
| pop(self, key, default=<object object at 0x000001B8C9B781F0>)
| D.pop(k[,d]) -> v, remove specified key and return the corresponding value.
| If key is not found, d is returned if given, otherwise KeyError is raised.
|
| popitem(self)
| D.popitem() -> (k, v), remove and return some (key, value) pair
| as a 2-tuple; but raise KeyError if D is empty.
|
| setdefault(self, key, default=None)
| D.setdefault(k[,d]) -> D.get(k,d), also set D[k]=d if k not in D
|
| update(self, other=(), /, **kwds)
| D.update([E, ]**F) -> None. Update D from mapping/iterable E and F.
| If E present and has a .keys() method, does: for k in E: D[k] = E[k]
| If E present and lacks .keys() method, does: for (k, v) in E: D[k] = v
| In either case, this is followed by: for k, v in F.items(): D[k] = v
|
| ----------------------------------------------------------------------
| Methods inherited from collections.abc.Mapping:
|
| __eq__(self, other)
| Return self==value.
|
| items(self)
| D.items() -> a set-like object providing a view on D's items
|
| keys(self)
| D.keys() -> a set-like object providing a view on D's keys
|
| values(self)
| D.values() -> an object providing a view on D's values
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from collections.abc.Mapping:
|
| __hash__ = None
|
| __reversed__ = None
|
| ----------------------------------------------------------------------
| Class methods inherited from collections.abc.Collection:
|
| __subclasshook__(C)
| Abstract classes can override this to customize issubclass().
|
| This is invoked early on by abc.ABCMeta.__subclasscheck__().
| It should return True, False or NotImplemented. If it returns
| NotImplemented, the normal algorithm is used. Otherwise, it
| overrides the normal algorithm (and the outcome is cached).
|
| ----------------------------------------------------------------------
| Class methods inherited from collections.abc.Iterable:
|
| __class_getitem__ = GenericAlias(...)
| Represent a PEP 585 generic type
|
| E.g. for t = list[int], t.__origin__ is list and t.__args__ is (int,).
class deprecate(builtins.object)
| Methods defined here:
|
| __call__(self, f)
| Call self as a function.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
class deprecate_kwarg(builtins.object)
| deprecate_kwarg(name, new_value)
|
| Methods defined here:
|
| __call__(self, f: ~TCallable) -> ~TCallable
| Call self as a function.
|
| __init__(self, name, new_value)
| Initialize self. See help(type(self)) for accurate signature.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
class deprecate_kwarg_name(builtins.object)
| deprecate_kwarg_name(name, new_name)
|
| Methods defined here:
|
| __call__(self, f: ~TCallable) -> ~TCallable
| Call self as a function.
|
| __init__(self, name, new_name)
| Initialize self. See help(type(self)) for accurate signature.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
class multidispatch(multimethod.multidispatch)
| multidispatch(func)
|
| Multidispatch without register.
|
| Method resolution order:
| multidispatch
| multimethod.multidispatch
| multimethod.multimethod
| builtins.dict
| builtins.object
|
| Methods defined here:
|
| __init__(self, func: Callable[..., ~RETURN]) -> None
| Initialize self. See help(type(self)) for accurate signature.
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| __new__(cls, func)
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __annotations__ = {}
|
| ----------------------------------------------------------------------
| Methods inherited from multimethod.multidispatch:
|
| __call__(self, *args: Any, **kwargs: Any) -> ~RETURN
| Resolve and dispatch to best method.
|
| __get__(self, instance, owner) -> collections.abc.Callable[..., ~RETURN]
|
| __setitem__(self, types: tuple, func: collections.abc.Callable)
| Set self[key] to value.
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from multimethod.multidispatch:
|
| __orig_bases__ = (<class 'multimethod.multimethod'>, dict[tuple[type, ...
|
| ----------------------------------------------------------------------
| Methods inherited from multimethod.multimethod:
|
| __delitem__(self, types: tuple)
| Delete self[key].
|
| __missing__(self, types: tuple) -> collections.abc.Callable
| Find and cache the next applicable method of given types.
|
| clean(self)
| Empty the cache.
|
| copy(self)
| Return a new multimethod with the same methods.
|
| dispatch(self, *args) -> collections.abc.Callable
|
| evaluate(self)
| Evaluate any pending forward references.
|
| parents(self, types: tuple) -> set
| Find immediate parents of potential key.
|
| register(self, *args) -> collections.abc.Callable
| Decorator for registering a function.
|
| Optionally call with types to return a decorator for unannotated functions.
|
| select(self, types: tuple, keys: set[multimethod.signature]) -> collections.abc.Callable
|
| ----------------------------------------------------------------------
| Readonly properties inherited from multimethod.multimethod:
|
| docstring
| a descriptive docstring of all registered functions
|
| ----------------------------------------------------------------------
| Data descriptors inherited from multimethod.multimethod:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.dict:
|
| __contains__(self, key, /)
| True if the dictionary has the specified key, else False.
|
| __eq__(self, value, /)
| Return self==value.
|
| __ge__(self, value, /)
| Return self>=value.
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __getitem__(self, key, /)
| Return self[key].
|
| __gt__(self, value, /)
| Return self>value.
|
| __ior__(self, value, /)
| Return self|=value.
|
| __iter__(self, /)
| Implement iter(self).
|
| __le__(self, value, /)
| Return self<=value.
|
| __len__(self, /)
| Return len(self).
|
| __lt__(self, value, /)
| Return self<value.
|
| __ne__(self, value, /)
| Return self!=value.
|
| __or__(self, value, /)
| Return self|value.
|
| __repr__(self, /)
| Return repr(self).
|
| __reversed__(self, /)
| Return a reverse iterator over the dict keys.
|
| __ror__(self, value, /)
| Return value|self.
|
| __sizeof__(...)
| D.__sizeof__() -> size of D in memory, in bytes
|
| clear(...)
| D.clear() -> None. Remove all items from D.
|
| get(self, key, default=None, /)
| Return the value for key if key is in the dictionary, else default.
|
| items(...)
| D.items() -> a set-like object providing a view on D's items
|
| keys(...)
| D.keys() -> a set-like object providing a view on D's keys
|
| pop(...)
| D.pop(k[,d]) -> v, remove specified key and return the corresponding value.
|
| If the key is not found, return the default if given; otherwise,
| raise a KeyError.
|
| popitem(self, /)
| Remove and return a (key, value) pair as a 2-tuple.
|
| Pairs are returned in LIFO (last-in, first-out) order.
| Raises KeyError if the dict is empty.
|
| setdefault(self, key, default=None, /)
| Insert key with a value of default if key is not in the dictionary.
|
| Return the value for key if key is in the dictionary, else default.
|
| update(...)
| D.update([E, ]**F) -> None. Update D from dict/iterable E and F.
| If E is present and has a .keys() method, then does: for k in E: D[k] = E[k]
| If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v
| In either case, this is followed by: for k in F: D[k] = F[k]
|
| values(...)
| D.values() -> an object providing a view on D's values
|
| ----------------------------------------------------------------------
| Class methods inherited from builtins.dict:
|
| __class_getitem__(...)
| See PEP 585
|
| fromkeys(iterable, value=None, /)
| Create a new dictionary with keys from iterable and values set to value.
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from builtins.dict:
|
| __hash__ = None
FUNCTIONS
get_arity(f: ~TCallable) -> int
instance_of(obj: object, *args: object) -> bool
Replacement for the instance_of method of typish, which
now uses the isa method of the runtype package.
mypyclassmethod lambda x
warn(...)
Issue a warning, or maybe ignore it or raise an exception.
message
Text of the warning message.
category
The Warning category subclass. Defaults to UserWarning.
stacklevel
How far up the call stack to make this warning appear. A value of 2 for
example attributes the warning to the caller of the code calling warn().
source
If supplied, the destroyed object which emitted a ResourceWarning
skip_file_prefixes
An optional tuple of module filename prefixes indicating frames to skip
during stacklevel computations for stack frame attribution.
DATA
Callable = typing.Callable
Deprecated alias to collections.abc.Callable.
Callable[[int], str] signifies a function that takes a single
parameter of type int and returns a str.
The subscription syntax must always be used with exactly two
values: the argument list and the return type.
The argument list must be a list of types, a ParamSpec,
Concatenate or ellipsis. The return type must be a single type.
There is no syntax to indicate optional or keyword arguments;
such function types are rarely used as callback types.
K = ~K
RETURN = ~RETURN
TCallable = ~TCallable
TYPE_CHECKING = False
V = ~V
FILE
c:\users\youse\appdata\local\programs\python\python312\lib\site-packages\cadquery\utils.py
cadquery.version
Python Library Documentation: function version in module importlib.metadata
version(distribution_name)
Get the version string for the named package.
:param distribution_name: The name of the distribution package to query.
:return: The version string for the package as defined in the package's
"Version" metadata key.