Module openscad_py.circle
-Classes
--
-
-class Circle -(r: float, fn: int | None = None) -
--
--
A 2D primitive, circle. -Creates a circle (or regular polygon) at the origin.
-See https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/The_OpenSCAD_Language#circle
---Expand source code -
-
-class Circle(Object): - """A 2D primitive, circle. - Creates a circle (or regular polygon) at the origin. - - See https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/The_OpenSCAD_Language#circle - """ - - def __init__(self, r: float, fn: TUnion[int, None] = None): - self.r = r - self.fn = fn - # $fa, $fs, $fn - - @classmethod - def triangle(cls, r): - """Create a regular triangle""" - return cls(r=r, fn=3) - - @classmethod - def regular_polygon(cls, r, sides: int): - """Create a regular polygon""" - return cls(r=r, fn=sides) - - def render(self) -> str: - """Render the object into OpenSCAD code""" - fnstr = '' if self.fn is None else f", $fn={self.fn}" - return f"circle(r={self.r}{fnstr});"
Ancestors
--
-
- Object -
Static methods
--
-
-def regular_polygon(r, sides: int) -
--
--
Create a regular polygon
- -def triangle(r) -
--
--
Create a regular triangle
-
Methods
--
-
-def color(self, r, g, b, a=1.0) ‑> Object -
--
-
-Inherited from: -
-Object
.color
--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_offset
--Return 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 -
--
-
-Inherited from: -
-Object
.diff
--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
.extrude
--Apply a linear extrusion and return a new object. -If
center
is false, the linear extrusion Z range is from 0 to height; -if it is true, the range is …
- -def intersection(self,
objects: list | ForwardRef('Object')) ‑> Object -
--
-
-Inherited from: -
-Object
.intersection
--Get the intersection of self and an object of list of objects, and return a new object. -See …
- -def move(self,
v: list | Point) ‑> Object -
--
-
-Inherited from: -
-Object
.move
--Apply a translation and return a new object. Synonym of
translate()
- -def radial_offset(self, r) -
--
-
-Inherited from: -
-Object
.radial_offset
--Return 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 -
--
-
-Inherited from: -
-Object
.render
--Render the object into OpenSCAD code
- -def rotate(self,
a,
v: list | Point) ‑> Object -
--
-
-Inherited from: -
-Object
.rotate
--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_extrude
--Apply 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 -
--
-
-Inherited from: -
-Object
.scale
--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
.translate
--Apply 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')) ‑> Object -
--
-
-Inherited from: -
-Object
.union
--Form the union of self and an object or list of objects, and return a new object. -See …
-
-