Not signed in (Sign In)

Vanilla 1.1.4 is a product of Lussumo. More Information: Documentation, Community Support.

    • CommentAuthorhpishvai
    • CommentTimeJan 19th 2018
     
    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
    • CommentAuthorMatthias
    • CommentTimeJan 23rd 2018 edited
     

    Hi Hamed,

    The recommended approach is to use the Region class:

    shape = ... the input shape 1 ...
    shape2 = ... the input shape 2 ...
    region = RBA::Region::new(shape1.polygon)
    region2 = RBA::Region::new(shape2.polygon)
    region &= region2   # or whichever operation you plan
    

    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

    • CommentAuthorhpishvai
    • CommentTimeJan 24th 2018
     
    Hi 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
    • CommentAuthorMatthias
    • CommentTimeJan 24th 2018
     

    Sorry, typo. Should be "shape1.polygon" (answer edited).

    Matthias

    • CommentAuthorhpishvai
    • CommentTimeJan 25th 2018 edited
     
    Hi 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
    • CommentAuthorMatthias
    • CommentTimeJan 27th 2018 edited
     

    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.

    • CommentAuthorhpishvai
    • CommentTimeJan 27th 2018
     
    I totally understand Matthias. Sorry for sending you three lines of code. My program is quite long that's why I could not copy it here. If you do not mind I will attach it to an e-mail and send it to you.

    Regards,
    Hamed
    • CommentAuthorhpishvai
    • CommentTimeFeb 1st 2018
     
    Problem is solved now.