It looks like you're new here. If you want to get involved, click one of these buttons!
I tried the following script, but the region is not taken in account : what did I miss ?
app = RBA::Application.instance
mw = app.main_window
lv = mw.current_view
if lv == nil
raise "No view selected"
end
cv = lv.active_cellview
if !cv.is_valid?
raise "No cell or no layout found"
end
begin
# implement undo
lv.transaction("Undo Boolean")
ly = cv.layout
li1 = ly.layer(1, 0)
li2 = ly.layer(2, 0)
li3 = ly.layer(3, 0)
lout = ly.layer(5, 0)
ly.each_cell do |cell|
r1 = RBA::Region(cell.begin_shapes_rec(li1))
r2 = RBA::Region(cell.begin_shapes_rec(li2))
r3 = RBA::Region(cell.begin_shapes_rec(li3))
selection = r1 & r2 - r3
layout.clear_layer(li1)
layout.clear_layer(li2)
layout.clear_layer(li3)
cell.shapes(lout).insert(selection)
end
ensure
# implements undo: done.
lv.update_content
lv.commit
end
Comments
Hi Laurent,
with "begin_shapes_rec", the shapes plus the ones from the subcells are pulled
Also "layout.clear_layer(li)" will clear the shapes from all cells, not just the ones from the cell you're working on. So eventually the result will depend on the order the cells are called (which is undefined in "each_cell".
I assume you're looking for a pure "cell-local" boolean. In this case you'll need to use per-cell shapes for Region input and need to clear shapes on cell level:
Best regards,
Matthias