Hello,
In the following script, shape s disappears even though it is still bound to an identifier. Is it normal? Can it be improved?
import pya
import time
layout_view = pya.LayoutView.current()
def get_selection():
return layout_view.object_selection
# We suppose that the selection contains shapes
shapes = [opath.shape for opath in get_selection()]
s = shapes[0]
print("Shape: {}".format(s)) # Shape: box (x;y)
time.sleep(1)
print("Shape: {}".format(s)) # Shape: null
Note: A workaround is to keep a reference to layout_view.object_selection. But, as said, it is a workaround. The shape object should normally survive without this workaround, no?