Howdy, Stranger!

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

Erase shapes with Ruby

Hi,
I created a certain geometry and since it had a feature with a square hole I used the "erase" tool. I also needed to have a 1-shaped hole, so first I created the 1 and then with Edit-->Layer-->Boolean operation, I managed to carve it from an overlapping shape.
The problem is that now I have to recreate the whole design just using scripts. I could find the way to insert the text geometry but I can't create holes (square ones or 1-shaped). Is there a similar "erase" formula in Ruby, or is it more complex?
Thank you

Comments

  • Hi,

    "Erase" is actually just another word for "boolean not". "RBA::Region" is a convenient class for using boolean operations.

    I'd suggest you collect the background polygon in one RBA::Region (i.e. "background"), the "1"s in another one (i.e. "ones") and then use "background - ones" to compute the boolean NOT. This will render the background polygons and punch out the ones as holes. Finally you can insert the result of the "-" operation into your layout using "Shapes#insert".

    Matthias

  • Thank you, it works

Sign In or Register to comment.