polygon with hole

megmeg
edited January 2017 in Python scripting
Hi,
I am trying to design gaurd rings for a silicon strip detector using python. I used the following ways but it doesn't seem to work.

hull = [pya.Point(0/0.001,0/0.001), pya.Point(6000/0.001,0/0.001), pya.Point(6000/0.001,3000/0.001), pya.Point(0/0.001, 3000/0.001)]

hole1 = [pya.Point(1000/0.001,1000/0.001), pya.Point(2000/0.001,1000/0.001), pya.Point(2000/0.001,2000/0.001), pya.Point(1000/0.001,2000/0.001)]

1---->poly = pya.Polygon(hull).insert_hole(hole1)

2----->top.region(l1).insert(pya.Polygon(hull).insert_hole(hole1))

3------>l1.insert(pya.Polygon(hull).insert_hole(hole1))

4------>poly = pya.Region(pya.Polygon(hull).insert_hole(hole1))

Comments

  • edited November -1

    Hi

    the right way is

    poly = pya.Polygon(hull)
    poly.insert_hole(hole1)
    region.insert(poly)
    

    Matthias

Sign In or Register to comment.