Howdy, Stranger!

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

Transforming Regions vs. Shapes


I wanted to draw a couple shapes in my GDS and then transform (mirror and shift) the combined shapes and have used the following code:

cospath1_l = RBA::DPath::new(path_arr1, width)
cospath2_l = RBA::DPath::new(path_arr2, width)
cospath_wg_l  = RBA::Region::new(cospath1_l) + RBA::Region::new(cospath2_l)

cospath1_r = RBA::Trans::new(2, true, 100000, 0).trans(cospath1_l)
cospath2_r = RBA::Trans::new(2, true, 100000, 0).trans(cospath2_l)
cospath_wg_r  = RBA::Region::new(cospath1_r) + RBA::Region::new(cospath2_r)

Note: I would have preferred to apply the transformation once on the "Region" and do the transformation on the "cospath_wg_l" variable. However, I get an error when I do the transformation on the Region. Hence I have taken the brute force approach and transformed each shape. Is there a way of doing the transformation on the Region?

I would have preferred the following if possible:

cospath1 = RBA::DPath::new(path_arr1, width)
cospath2 = RBA::DPath::new(path_arr2, width)
cospath_wg_l  = RBA::Region::new(cospath1) + RBA::Region::new(cospath2)
cospath_wg_r  = RBA::Trans::new(2, true, 100000, 0).trans(cospath_wg_l)

Please note that in the actual code I am combining a lot of shapes and for the sake of efficiency, I would prefer doing one transformation after combining all the shapes.




  • edited February 9

    Hi Vikas,

    the solution is very simple:

    cospath1 = RBA::Path::new(path_arr1, width)
    cospath2 = RBA::Path::new(path_arr2, width)
    cospath_wg_l  = RBA::Region::new(cospath1) + RBA::Region::new(cospath2)
    cospath_tr_r  = cospath_wg_l.transformed(RBA::Trans::new(2, true, 100000, 0))

    The "transformed" method will create a transformed copy.

    Please note that I changed "DPath" to "Path". For Region, there is no benefit using DPath. In the context of layout objects, the "D" type objects are interpreted as micron-unit objects. Region objects can't perform micron-to-database unit conversions themselves, so DPath and Path are essentially the same thing.



  • Thank you very much Matthias! Clearly I need to do a better job of going through the scripting documentation....

    Really appreciate your help.


Sign In or Register to comment.