cqmore/polyhedron.py
def hexahedron(radius: float, detail: int = 0) -> Polyhedron:
    '''
    Create a hexahedron.

    ## Parameters

    - `radius`: radius of the hexahedron.
    - `detail`: setting this to a value greater than 0 adds vertices making it no longer a hexahedron.

    ## Examples 

        from cqmore.polyhedron import hexahedron
        from cqmore import Workplane

        radius = 1
        polyhedra = Workplane()
        for detail in range(5):
            polyhedra.add(
                Workplane()
                    .polyhedron(*hexahedron(radius, detail))
                    .translate((2 * radius * detail, 0, 0))
            )

    '''

    t = 1 / (3 ** 0.5)
    vectors = (
        Vector(t, t, t), Vector(-t, t, t), Vector(-t, -t, t), Vector(t, -t, t),
        Vector(t, t, -t), Vector(-t, t, -t), Vector(-t, -t, -t), Vector(t, -t, -t)
    )
    faces = (
        (3, 7, 0), (7, 4, 0), 
        (0, 4, 1), (4, 5, 1),
        (5, 6, 2), (1, 5, 2),
        (6, 7, 3), (2, 6, 3),
        (2, 3, 0), (1, 2, 0),
        (7, 6, 5), (4, 7, 5)
    )
    return _divide_project(vectors, faces, radius, detail)

    Create a hexahedron.

    ## Parameters

    - `radius`: radius of the hexahedron.
    - `detail`: setting this to a value greater than 0 adds vertices making it no longer a hexahedron.

    ## Examples 

        from cqmore.polyhedron import hexahedron
        from cqmore import Workplane

        radius = 1
        polyhedra = Workplane()
        for detail in range(5):
            polyhedra.add(
                Workplane()
                    .polyhedron(*hexahedron(radius, detail))
                    .translate((2 * radius * detail, 0, 0))
            )

    
Create a hexahedron.
Parameters

`radius`: radius of the hexahedron.
`detail`: setting this to a value greater than 0 adds vertices making it no longer a hexahedron.

Examples

from cqmore.polyhedron import hexahedron
from cqmore import Workplane


Create a hexahedron . Parameters ` radius ` : radius of the hexahedron . ` detail ` : setting this to a value greater than 0 adds vertices making it no longer a hexahedron . Examples from cqmore . polyhedron import hexahedron from cqmore import Workplane
def hexahedron(radius: float, detail: int = 0) -> Polyhedron:
    t = 1 / (3 ** 0.5)
    vectors = (
        Vector(t, t, t), Vector(-t, t, t), Vector(-t, -t, t), Vector(t, -t, t),
        Vector(t, t, -t), Vector(-t, t, -t), Vector(-t, -t, -t), Vector(t, -t, -t)
    )
    faces = (
        (3, 7, 0), (7, 4, 0), 
        (0, 4, 1), (4, 5, 1),
        (5, 6, 2), (1, 5, 2),
        (6, 7, 3), (2, 6, 3),
        (2, 3, 0), (1, 2, 0),
        (7, 6, 5), (4, 7, 5)
    )
    return _divide_project(vectors, faces, radius, detail)
def hexahedron ( radius : float , detail : int = 0 ) -> Polyhedron : t = 1 / ( 3 ** 0.5 ) vectors = ( Vector ( t , t , t ) , Vector ( - t , t , t ) , Vector ( - t , - t , t ) , Vector ( t , - t , t ) , Vector ( t , t , - t ) , Vector ( - t , t , - t ) , Vector ( - t , - t , - t ) , Vector ( t , - t , - t ) ) faces = ( ( 3 , 7 , 0 ) , ( 7 , 4 , 0 ) , ( 0 , 4 , 1 ) , ( 4 , 5 , 1 ) , ( 5 , 6 , 2 ) , ( 1 , 5 , 2 ) , ( 6 , 7 , 3 ) , ( 2 , 6 , 3 ) , ( 2 , 3 , 0 ) , ( 1 , 2 , 0 ) , ( 7 , 6 , 5 ) , ( 4 , 7 , 5 ) ) return _divide_project ( vectors , faces , radius , detail )
Create a hexahedron.
Create a hexahedron .
'''
    Create a hexahedron.

    ## Parameters

    - `radius`: radius of the hexahedron.
    - `detail`: setting this to a value greater than 0 adds vertices making it no longer a hexahedron.

    ## Examples 

        from cqmore.polyhedron import hexahedron
        from cqmore import Workplane

        radius = 1
        polyhedra = Workplane()
        for detail in range(5):
            polyhedra.add(
                Workplane()
                    .polyhedron(*hexahedron(radius, detail))
                    .translate((2 * radius * detail, 0, 0))
            )

    '''
radius
float
detail
int