It looks like you're new here. If you want to get involved, click one of these buttons!
So I am adding new shapes to the layout
is there a way by ruby too keep track of these new added shapes.
Or just in general get the new added shapes.
Curious.
Comments
Maybe you can assign the current time (Time.now) to a user property using the set_property method of the Shape class??? Never used properties but should be feasible...
Well, you can simply keep the new shapes (Shape objects) in a Ruby array or other object ...
Are you going to manipulate them or what's the plan?
Matthias
Matthais,
Idea is to get the newly created shapes , selected then process further in Ruby
I am following the example in this thread
https://www.klayout.de/forum/discussion/747/selecting-newly-created-shapes
Here is my current code for testing purposes based on the above thread
the lv.object_selection = [ p ] deletes the shape, not select
Regards
Tracy
I am wondering whether in the GDS data, shapes'
sequence of creation has any relation to their position
in the local data structure? One might imagine so.
Of course this is not a real "timestamp". But maybe
you could read from the bottom up in the present
structure and get the "last N"?
If I knew the "new shapes" were and were to remain
related, I'd work with a new call, edit-in-place style,
at the present level. You can flatten it later.
Well kick me in the a** Code does work just had too add it to my personal menu
Hmm ... possibilities
Well, no. I'm sorry. The shape sequence is not related to the order of creation. The shape container is not an ordered one.
The shapes are sorted internally for quick region lookup and this order my even change during the lifetime of the shape container. Even if small shape sets show a certain ordered behaviour, the same is not guaranteed for larger shape sets. Properties are one way to add a time stamp (or just an integer for some "generation index"), but these properties will show up in files if you save the layout. I'm not sure if you can create special property keys which are not saved. I need to check this.
BTW: I just tried your code, but to me it works. Maybe you can check if the layer 9/0 has been created but is not shown yet. You can try adding "lv.add_missing_layers" to the end of the "addpath" function.
Regards,
Matthias
Matthias,
thanks for the tip adding the lv.add_missing_layers worked.
Kudos
Tracy