Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Converting edges to polygons without resolving holes

I need to convert a big set of edges forming polygons into polygons. I need only the resulting polygons without resolving holes (adding connectors). Setting resolve_holes=False in simple_merge_e2p does not help - I still see the connectors in the result. I can of course do this in a loop over edges and creating a polygon every time the edges close. Maybe I am overlooking something and there is a simpler way?

Thanks,

Mikhail

Comments

  • Hi Mikhail,

    I can't confirm that simple_merge_e2p doesn't work, but if you're using keyword arguments: that's not supported currently. The arguments are mandatory ones.

    ep = pya.EdgeProcessor()
    edges = ep.boolean_p2e([ pya.Polygon(pya.Box(0, 0, 1000, 1000)) ], [ pya.Polygon(pya.Box(100, 100, 900, 900)) ], pya.EdgeProcessor.ModeANotB)
    
    # prints [(0,0;0,1000;1000,1000;1000,0/100,100;900,100;900,900;100,900)] (with holes)
    print(str(ep.simple_merge_e2p(edges, False, False)))
    
    # prints [(0,0;0,900;100,900;100,100;900,100;900,900;0,900;0,1000;1000,1000;1000,0)] (resolved holes)
    print(str(ep.simple_merge_e2p(edges, True, False)))
    

    Matthias

Sign In or Register to comment.