Region

Hi Matthias,

I was wondering why there is no DRegion class?

Cheers,

Tomas

Comments

  • Good question :)

    But the reason is the same as there is no DCell, no DLayout etc. Region is only conceptually a collection of Polygons - internally it stores them as Shapes or even Layouts with DBU units. So a DRegion would be the same as a Region while a DPolygon for example is really something different than Polygon - it can store floating-point coordinates.

    Region could accept and deliver DPolygon if it had a DBU attribute - converting them into integer objects before it stores them. That is basically a small step, but it's simply not done yet.

    A convenient way to emulate that is to use a transformation:

    to_um = pya.CplxTrans(dbu)
    from_um = to_um.inverted()
    
    region = pya.Region()
    dpolygon = pya.DPolygon(...)
    region.insert(from_um * dpolygon)
    ...
    
    for polygon in region.each():
      dpolygon = to_um * polygon
      ...
    

    Matthias

  • Ok, thanks for the info!

    Cheers,

    Tomas

Sign In or Register to comment.