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 to False for rendering the individual cubes of the menger sponge as MESH entities.

Parameters:
  • layout – DXF target layout

  • mergeTrue for one MESH entity, False for individual MESH entities per cube

  • dxfattribs – 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:

../_images/menger_sponge_0.png

Menger Sponge kind=1:

../_images/menger_sponge_1.png

Menger Sponge kind=2:

../_images/menger_sponge_2.png

Jerusalem Cube kind=3:

../_images/jerusalem_cube.png

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 to False for individual pyramids as MESH entities.

Parameters:
  • layout – DXF target layout

  • mergeTrue for one MESH entity, False for individual MESH entities per pyramid

  • dxfattribs – 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:

../_images/sierpinski_pyramid_3.png

Sierpinsky Pyramid with square base:

../_images/sierpinski_pyramid_4.png