Hi,
In my Ruby code I am planning to do Boolean between different shapes. I know that Boolean between layers is straight forward and could be done by two lines of the code. However, is there an easy way of doing Boolean between shapes which are already specified by a shape index?
I was thinking of calling the shapes in a method, manually changing their layers (if similar), doing the Boolean and then converting the result to the original layer. Would that make sense?
Regards,
Hamedp
Comments
Hi Hamed,
The recommended approach is to use the
Regionclass:The result of an AND operation can be zero, one or many polygons. Hence there is no
"polygon & polygon -> polygon" operation. The region object accommodates zero to many
polygons, so it's the natural representation for input and output to an AND operation.
Matthias
Thank you so much for the hint.
In order to test what you proposed, I am inserting a BOX into the layout:
shape1 = lyo.layout.cell( @cell_index[@cell_name] ).shapes( call_layer( lyo, @layer_name,fab_name ) ).insert(RBA::Box::new(0, -50/0.001, 2000/0.001, 50/0.001))
and then use:
region = RBA::Region::new(shape1.to_polygon)
for some reason I get an error "undefined method "to_polygon" for BOX(0,-50,100,50):RBA::Shape"
Any idea what is causing the issue?
Thank you,
Haed
Sorry, typo. Should be "shape1.polygon" (answer edited).
Matthias
Thank you so much for looking into this.
I really do not understand why but this is not working for me
shape1 = lyo.layout.cell( @cell_index[@cell_name] ).shapes( call_layer( lyo, @layer_name,fab_name ) ).insert(RBA::Box::new(0, 80/0.001, 20/0.001, 100/0.001))
region = RBA::Region::new(shape1.polygon)
shape2 = lyo.layout.cell( @cell_index[@cell_name] ).shapes( call_layer( lyo, @layer_name,fab_name ) ).insert(RBA::Box::new(0, 90/0.001, 30/0.001, 120/0.001))
region2 = RBA::Region::new(shape2.polygon)
region &= region2
How should I?
I can't see what call_layer will do, neither what @cell_index really contains ... if it's an array or a hash at all.
And I don't print error messages just for fun. Don't be shy and tell me what they say.
Regards,
Hamed