Skip to content

Is it possible to defined a filled circle/ellipse? #1161

Answered by mozman
johnthagen asked this question in Q&A
Discussion options

You must be logged in to vote

You have to create a HATCH with an EdgePath as boundary.

See HATCH tutorial, 3rd example: https://ezdxf.mozman.at/docs/tutorials/hatch.html

import ezdxf

doc = ezdxf.new("R2000")
msp = doc.modelspace()
msp.add_ellipse((0, 0), major_axis=(0, 10), ratio=0.5)

hatch = msp.add_hatch(color=2)
edge_path = hatch.paths.add_edge_path()

# each edge path can contain line, arc, ellipse and spline elements
# important: major axis >= minor axis (ratio <= 1.)
edge_path.add_ellipse((0, 0), major_axis=(0, 10), ratio=0.5)

doc.saveas("solid_hatch_ellipse.dxf")
  • line EdgePath.add_line()
  • arc EdgePath.add_arc()
  • ellipse EdgePath.add_ellipse()
  • spline EdgePath.add_spline()

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by johnthagen
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants