Module openscad_py.collection
Classes
class Collection (coll: list)-
Expand source code
class Collection(Object): """Represents a collection of objects""" def __init__(self, coll: list): self.collection = coll @classmethod def c(cls, coll: TUnion[list, Object, None]) -> Object: """Ensure the list of objects is a Collection (idempotent). If coll is None, return an empty collection.""" if coll is None: return cls([]) if isinstance(coll, Object): return coll return cls(coll) def _add(self, obj): return self.__class__(self.collection + [obj]) def render(self) -> str: """Render the object into OpenSCAD code""" return "\n".join([o.render() for o in self.collection])Represents a collection of objects
Ancestors
Static methods
def c(coll: list | Object | None) ‑> Object-
Ensure the list of objects is a Collection (idempotent). If coll is None, return an empty collection.
Methods
def color(self, r, g, b, a=1.0) ‑> Object-
Apply a color and return a new object. See https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Transformations#color
def delta_offset(self, delta, chamfer=False)-
Inherited from:
Object.delta_offsetReturn a new 2D interior or exterior outline from an existing outline. See https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Transformations#offset
def diff(self,
tool: list | ForwardRef('Object')) ‑> Object-
Remove from the object using a difference operator, and return a new object. See …
def extrude(self, height, convexity=10, center: bool = False) ‑> Object-
Inherited from:
Object.extrudeApply a linear extrusion and return a new object. If
centeris false, the linear extrusion Z range is from 0 to height; if it is true, the range is … def hull(self,
objects: list | ForwardRef('Object') | None = None) ‑> Object-
Get the convex hull of self and an optional object or list of objects, and return a new object. See …
def intersection(self,
objects: list | ForwardRef('Object')) ‑> Object-
Inherited from:
Object.intersectionGet the intersection of self and an object of list of objects, and return a new object. See …
def move(self,
v: list | Point) ‑> Object-
Apply a translation and return a new object. Synonym of
translate() def radial_offset(self, r)-
Inherited from:
Object.radial_offsetReturn a new 2D interior or exterior outline from an existing outline. See https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Transformations#offset
def render(self) ‑> str-
Expand source code
def render(self) -> str: """Render the object into OpenSCAD code""" return "\n".join([o.render() for o in self.collection])Render the object into OpenSCAD code
def rotate(self,
a,
v: list | Point) ‑> Object-
Apply a rotation and return a new object. See https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Transformations#rotate
def rotate_extrude(self, angle, convexity=10) ‑> Object-
Inherited from:
Object.rotate_extrudeApply a rotational extrusion and return a new object. For all points x >= 0 must be true. See …
def scale(self,
v: list | Point | float) ‑> Object-
Apply scaling and return a new object. Accepts a vector (a Point object or a list of floats) or a single float for uniform scaling. See …
def translate(self,
v: list | Point) ‑> Object-
Inherited from:
Object.translateApply a translation and return a new object. See https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Transformations#translate
def union(self,
objects: list | ForwardRef('Object') | None = None) ‑> Object-
Form the union of self and an optional object or list of objects, and return a new object. See …