File: circle_2d.py

package info (click to toggle)
ezdxf 1.4.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 104,528 kB
  • sloc: python: 182,341; makefile: 116; lisp: 20; ansic: 4
file content (30 lines) | stat: -rw-r--r-- 818 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# Copyright (c) 2016-2022 Manfred Moitzi
# License: MIT License
import pathlib
import ezdxf

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

# ------------------------------------------------------------------------------
# This example adds a circle to the modelspace.
#
# docs: https://ezdxf.mozman.at/docs/dxfentities/circle.html
# ------------------------------------------------------------------------------

# setup=True is required to get the DASHED linetype.
doc = ezdxf.new("R12", setup=True)
modelspace = doc.modelspace()
modelspace.add_circle(
    center=(0, 0),
    radius=1.5,
    dxfattribs={
        "layer": "test",
        "linetype": "DASHED",
    },
)

filename = CWD / "circle.dxf"
doc.saveas(filename)
print(f"drawing '{filename}' created.")