#  Copyright (c) 2022, Manfred Moitzi
#  License: MIT License
from pathlib import Path
import math
import ezdxf

from ezdxf.math import Matrix44

CWD = Path("~/Desktop/Outbox").expanduser()
if not CWD.exists():
    CWD = Path(".")


def simple_helix(filename: str):
    doc = ezdxf.new()
    msp = doc.modelspace()
    msp.add_helix(radius=5, pitch=1, turns=5)
    doc.saveas(CWD / filename)


def transform_helix(filename: str):
    doc = ezdxf.new()
    msp = doc.modelspace()
    helix = msp.add_helix(radius=5, pitch=1, turns=5)
    helix.transform(Matrix44.x_rotate(math.pi/4) @ Matrix44.translate(2, 4, 6))
    doc.saveas(CWD / filename)


if __name__ == "__main__":
    simple_helix("simple_helix.dxf")
    transform_helix("transform_helix.dxf")

@@ -225,16 +225,292 @@
 h(%22.%22)%0A%0A
+# ------------------------------------------------------------------------------%0A# this example shows how to create a HELIX entity.%0A#%0A# docs: https://ezdxf.mozman.at/docs/dxfentities/helix.html%0A# ------------------------------------------------------------------------------%0A%0A
 %0Adef sim

refactor example helix.py