Hello,
I've to developp a Ruby script in order to change layer parameters or layer views from a GDS2 file. I use first the begin_layer/end_layer instruction to iterate a read loop on all layers. When I try to modify the visible state or only the name of the current layer (Class LayerPropertiesNode), Klayout displays an error message (a conflict with Const Ref for example when visible=true). How to do that with a RBA script for a pre-existing layer ?
Thanks for your answer
Jean-Yves
Comments
Hi Jean-Yves,
I assume you are trying to do something like that:
This will fail because "l.current" is basically just a pointer to an internal structure and it is not allowed to directly modify this structure. Hence the pointer is "const" meaning it cannot be modified.
To solve that problem, the code needs to be rewritten like that:
I admit that is not very intuitive but this scheme is a tribute to the linking of ruby's dynamic objects with static C++ structures. BTW this scheme is used in different places, i.e. for the modification of geometrical properties of shapes.
Hopefully that helps.
Best regards,
Matthias
your code suits me perfectly. Thank you for yout help.
Jean-Yves