<commit_before>#  Copyright (c) 2022, <NAME>
#  License: MIT License
import pathlib
import math
import ezdxf
from ezdxf.render import forms


CWD = pathlib.Path("~/Desktop/Outbox").expanduser()
if not CWD.exists():
    CWD = pathlib.Path(".")
DEBUG_COLOR = ezdxf.colors.CYAN

doc = ezdxf.new()
msp = doc.modelspace()


circle = list(forms.translate(forms.circle(8), (1, 0, 0)))
extrusion_path = [(0, 0, 0), (1, 0, 10)]
mesh = forms.extrude_twist_scale(
    circle, extrusion_path, close=True, caps=True, scale=2, twist=math.pi / 2
)
mesh.render_mesh(msp, dxfattribs={"color": ezdxf.colors.MAGENTA})
doc.saveas(CWD / "extrude_twist_scale_profile.dxf")<commit_msg>refactor example extrude_twist_scale_profile.py<commit_after>#  Copyright (c) 2022, <NAME>
#  License: MIT License
import pathlib
import math
import ezdxf
from ezdxf.render import forms


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

# ------------------------------------------------------------------------------
# This example shows how to use the extended ezdxf.forms.extrude_twist_scale
# method to create a 3D figure from a base polygon (profile).
# ------------------------------------------------------------------------------

DEBUG_COLOR = ezdxf.colors.CYAN

doc = ezdxf.new()
msp = doc.modelspace()


circle = list(forms.translate(forms.circle(8), (1, 0, 0)))
extrusion_path = [(0, 0, 0), (1, 0, 10)]
mesh = forms.extrude_twist_scale(
    circle, extrusion_path, close=True, caps=True, scale=2, twist=math.pi / 2
)
mesh.render_mesh(msp, dxfattribs={"color": ezdxf.colors.MAGENTA})
doc.saveas(CWD / "extrude_twist_scale_profile.dxf")
{'fraction_non_alphanumeric': 0.2275737507525587, 'fraction_numerical': 0.02107164358819988, 'mean_word_length': 3.1240694789081886, 'pattern_counts': {'":': 2, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '362254', 'n_tokens_mistral': 607, 'n_tokens_neox': 588, 'n_words': 135}