It looks like you're new here. If you want to get involved, click one of these buttons!
Dear all,
I want to check if cut_box is not empty, i will save cut_box to image
cut_box = db.DBox(sub_x2, sub_y2, sub_x1, sub_y1)
if cut_box is empty:
print("box is empty")
else:
print("box is not empty")
layout_view.save_image_with_options(sub_image_path, pixel_size, pixel_size, 0, 0, 0, cut_box, False)
Here is an example of cut_box is empty images (just a full white image)
Thanks and best regard,
HieuND
Comments
Hi hieund,
begin_shapes_rec_overlapping
function returns a list of object that overlapped with given box.Thank Mr @RawrRanger,
I try to using shapeInRange function, but this function always return True in every cut_box, May I wrong anything ?
Hi hieund,
begin_shapes_rec_overlapping
is not suitable for filtering shapes with holes,if shapes with holes is overlapped with the box this function will still returns True,
so additional check is using
polygon.touches
is required.rsi.shape().polygon.transformed(rsi.trans()).to_dtype(unit).touches(detectBox)
Another thing is this function does not check the layer visibility, so hidden layer will requires additional check.
following test case using three cut box 1~3 corrosbonded to the three white boxes placed in left to rignt order.

without
polygon.touches
check, the output for L0/0 (bule) will beTrue, True, False
with
polygon.touches
added, the output for L0/0 (bule) will beFalse, True, False
Thanks you, Mr @RawrRanger , it works for me !!