RegularPolyhedron¶
⚙️ Spec sheet → — visual schematic and metrics measured from a real rendered STL.
The five Platonic solids from BOSL2’s polyhedra.scad, built as watertight polyhedra.
RegularPolyhedron builds tetrahedron / cube /
octahedron / dodecahedron / icosahedron (with named convenience methods too), sized by
circumradius, diameter, inradius or side length. The dodecahedron is derived as the dual of the
icosahedron. The Archimedean, Catalan and stellated families are a follow-up.
-
class pybosl2.parts.polyhedra.RegularPolyhedron(name=
PlatonicSolid.CUBE, radius=None, diameter=None, inner_radius=None, side=None)[source]¶ Bases:
objectA regular Platonic solid, sized by circumradius, diameter, inradius, or side.
name is a
PlatonicSolidenum. The convenience class methodstetrahedron(),cube(),octahedron(),dodecahedron()andicosahedron()construct the corresponding solid without requiring the enum.Examples
A dodecahedron:
from pybosl2.parts.polyhedra import RegularPolyhedron, PlatonicSolid RegularPolyhedron(PlatonicSolid.DODECAHEDRON, side=12).show()Loading 3-D preview…- Parameters:¶
- property name : PlatonicSolid¶
The Platonic solid type.
- info()[source]¶
Return vertex/face data for this solid.
- Returns:¶
A
PolyhedronInfoobject containing vertex and face lists.- Return type:¶
-
classmethod tetrahedron(radius=
None, diameter=None, inner_radius=None, side=None)[source]¶ Return a regular tetrahedron (4 triangular faces).
- Parameters:¶
- Returns:¶
A
RegularPolyhedronconfigured as a tetrahedron.- Return type:¶
-
classmethod cube(radius=
None, diameter=None, inner_radius=None, side=None)[source]¶ Return a cube / regular hexahedron (6 square faces).
- Parameters:¶
- Returns:¶
A
RegularPolyhedronconfigured as a cube.- Return type:¶
-
classmethod octahedron(radius=
None, diameter=None, inner_radius=None, side=None)[source]¶ Return a regular octahedron (8 triangular faces).
- Parameters:¶
- Returns:¶
A
RegularPolyhedronconfigured as an octahedron.- Return type:¶
-
classmethod dodecahedron(radius=
None, diameter=None, inner_radius=None, side=None)[source]¶ Return a regular dodecahedron (12 pentagonal faces).
- Parameters:¶
- Returns:¶
A
RegularPolyhedronconfigured as a dodecahedron.- Return type:¶
-
classmethod icosahedron(radius=
None, diameter=None, inner_radius=None, side=None)[source]¶ Return a regular icosahedron (20 triangular faces).
- Parameters:¶
- Returns:¶
A
RegularPolyhedronconfigured as an icosahedron.- Return type:¶
Examples
from pybosl2.parts.polyhedra import RegularPolyhedron RegularPolyhedron.icosahedron(side=20).show()Loading 3-D preview…
- class pybosl2.parts.polyhedra.PolyhedronInfo(solid)[source]¶
Bases:
objectVertex and face data for a Platonic solid.
The constructor takes a
PlatonicSolidenum and looks up the geometry, equivalent to the oldPolyhedra.regular_polyhedron_info().- name : str¶
- vertices : list[list[float]]¶
- faces : list[list[int]]¶
- num_vertices : int¶
- num_faces : int¶
Examples¶
These mirror the examples in BOSL2’s polyhedra.scad, rendered live through PythonSCAD.
Examples that rely on BOSL2’s attachment/anchor system, or on features not in this port, are omitted.
regular_polyhedron
Tetrahedron:
from pybosl2.parts.polyhedra import RegularPolyhedron
RegularPolyhedron("tetrahedron", radius=12).shape().show()
Cube:
from pybosl2.parts.polyhedra import RegularPolyhedron
RegularPolyhedron("cube", radius=12).shape().show()
Octahedron:
from pybosl2.parts.polyhedra import RegularPolyhedron
RegularPolyhedron("octahedron", radius=12).shape().show()
Dodecahedron:
from pybosl2.parts.polyhedra import RegularPolyhedron
RegularPolyhedron("dodecahedron", radius=12).shape().show()
Icosahedron:
from pybosl2.parts.polyhedra import RegularPolyhedron
RegularPolyhedron("icosahedron", radius=12).shape().show()