Still erase polygons in Viewing mode

edited November 2019 in Python scripting

I am making a program who draws/erase markers and labels on a design, and I would like to make sure that the design is not saved at the end.
I was wondering If it was possible to enable this with klayout without having to force the file a read-only:

  • the files are located in a repository with a lot of dynamic having read-only file is not the best in general
  • if I use klayout editor on read-only file and modify it, I will still be prompted if I want to save

in viewing mode:

  • I can create shapes with Myshape = .shapes(layer).insert(shape)
  • I cannot erase this created shape .shapes(layer).erase(Myshape) (main issue)
  • no possible saving

in editing mode:

  • I can create shapes with Myshape = .shapes(layer).insert(shape)
  • I can erase this created shape .shapes(layer).erase(Myshape)
  • if I modify the design, I am prompted to save and may save if the file is not protected (main issue)

My ideal mode:

  • I can create polygones with Myshape = .shapes(layer).insert(shape)
  • I can erase this created shape .shapes(layer).erase(Myshape)
  • no possible saving

Comments

  • Hello,

    formally, in viewer mode, even insert should not be possible :)

    The reason why erase isn't possible is not the mode, but the memory layout: in viewer mode, a compact memory layout is used and shapes may be stored as shape repetitions (specifically with OASIS input). Adding single shapes isn't a problem then, but erasing a shape potentially involved resolving these arrays. There are manifold data consistency issues lurking, so I did not implement this.

    But I think maybe there is a different solution: if you application is to provide some overlay layout (markers?), you could create a second layout (editable), fill that with your shapes and overlay this layout in the view (as a second cellview). So you have one view essentially and one is view-only, the other one is editable.

    Matthias

Sign In or Register to comment.