What happens when a Region is constructed from a rounded path?

Hi there,
My design requires structures that I wish to make out of circles subtracted from one another (to effectively get a donut shape). I saw from another forum post that an easy way to make an "exact" circle is to use a rounded path around a single point:
Circle = pya.Path.new([ pya.Point.new(xLoc, yLoc) ], Diameter, Diameter / 2, Diameter / 2, True)
This results in a circle defined from a single point and is defined as round.
However, in order to do boolean operations with it, I cast it into a region:
CircleRegion = pya.Region.new(Circle)
This results in a polygon with 32 sides. I understand that in order to ensure GDS compatibility, the best circle I can expect is a circle approximated by a polygon with N sides. However, is there any way to control how many sides the polygon gets when we construct the region from the rounded path? I want far more than 32 sides.
I was able to achieve my desired effect by writing a few lines that calculated the sin and cos for N angles and created a polygon (I wanted N~500), but would it have been possible to control the number of sides when constructing the region from a rounded path?

Comments

  • Hi eric,

    use "Polygon#ellipse" to create a polygon representing a circle or ellipse:

    # circle with radius 100, 50 points:
    pya.Polygon.ellipse(pya.Box(-100, -100, 100, 100), 50)
    

    the round-ended, single-point path trick is an attempt to fool GDS into providing "real" circles. But booleans operate on polygons only.

    Matthias

Sign In or Register to comment.