Showcase Forms¶
MengerSponge¶
Build a 3D Menger sponge.
- class ezdxf.addons.MengerSponge(location: UVec = (0.0, 0.0, 0.0), length: float = 1.0, level: int = 1, kind: int = 0)¶
- Parameters:
location – location of lower left corner as (x, y, z) tuple
length – side length
level – subdivide level
kind – type of menger sponge
0
Original Menger Sponge
1
Variant XOX
2
Variant OXO
3
Jerusalem Cube
- render(layout: GenericLayoutType, merge: bool = False, dxfattribs=None, matrix: Matrix44 | None = None, ucs: UCS | None = None) None ¶
Renders the menger sponge into layout, set merge to
True
for rendering the whole menger sponge into one MESH entity, set merge toFalse
for rendering the individual cubes of the menger sponge as MESH entities.- Parameters:
layout – DXF target layout
merge –
True
for one MESH entity,False
for individual MESH entities per cubedxfattribs – DXF attributes for the MESH entities
matrix – apply transformation matrix at rendering
ucs – apply UCS transformation at rendering
- cubes() Iterator[MeshTransformer] ¶
Yields all cubes of the menger sponge as individual
MeshTransformer
objects.
- mesh() MeshTransformer ¶
Returns geometry as one
MeshTransformer
object.
Menger Sponge kind=0
:
Menger Sponge kind=1
:
Menger Sponge kind=2
:
Jerusalem Cube kind=3
:
SierpinskyPyramid¶
Build a 3D Sierpinsky Pyramid.
- class ezdxf.addons.SierpinskyPyramid(location: UVec = (0.0, 0.0, 0.0), length: float = 1.0, level: int = 1, sides: int = 4)¶
- Parameters:
location – location of base center as (x, y, z) tuple
length – side length
level – subdivide level
sides – sides of base geometry
- render(layout: GenericLayoutType, merge: bool = False, dxfattribs=None, matrix: Matrix44 | None = None, ucs: UCS | None = None) None ¶
Renders the sierpinsky pyramid into layout, set merge to
True
for rendering the whole sierpinsky pyramid into one MESH entity, set merge toFalse
for individual pyramids as MESH entities.- Parameters:
layout – DXF target layout
merge –
True
for one MESH entity,False
for individual MESH entities per pyramiddxfattribs – DXF attributes for the MESH entities
matrix – apply transformation matrix at rendering
ucs – apply UCS at rendering
- pyramids() Iterable[MeshTransformer] ¶
Yields all pyramids of the sierpinsky pyramid as individual
MeshTransformer
objects.
- mesh() MeshTransformer ¶
Returns geometry as one
MeshTransformer
object.
Sierpinsky Pyramid with triangle base:
Sierpinsky Pyramid with square base: