PCell contents not selectable

edited May 2015 in General

Hi Matthias,

Here is another question for you regarding the PCells in 0.24-python-eval: I noticed that the contents (i.e. geometry or instances) within a PCell variant cannot be selected. Even when View / Select Top Level Objects is not active.

Is there an option somewhere to make the contents selectable? I am planning to write a script to query some layout objects which are within an instance (using the add_selection_changed_observer method) and this would probably work for normal instances, but if a PCell variant's contents can't be selected, it wouldn't work for PCell instances.

Or can you think of another workaround?

Thanks, Chris

Comments

  • edited November -1

    Hi Chris,

    I'm afraid, but that's intentional. It gave me too much headache thinking about the implications of selectable subshapes and instances from within PCell's and library cells. Such shapes and instances must not be edited, hence I'd had to provide some way of distinguishing between editable and non-editable shapes and instances in all edit functions.

    I could provide selections inside PCell's in viewer mode though. Would that be helpful?

    Matthias

  • edited November -1

    Hi Matthias,

    That is unfortunate. Since we use KLayout in edit mode at least 99% of the time, I cannot rely on functionality which only works in viewer mode.

    Therefore I am looking for a possible workaround. Since the shapes of a PCell variant are still accessible via scripting, I am hoping there is a way to emulate selectability of at least text shapes within a PCell instance. For showing the "selected" item, I think I could probably use the guiding shapes layer, but the question is if I can somehow intercept the selection box (ideally when the mouse button is released) from a script. Using that box, the script could then look if it overlaps one (or more) PCell instance(s) and draws something on the guiding shapes layer to emulate a selected item?

    Regards, Chris

  • edited May 2015

    Hi Chris,

    I think emulating the selection is pretty tedious. I can provide an option that enables selection of objects inside PCell's/library cells, but I'd disable that initially because of the implications I mentioned.

    I'd like to put that into 0.24, but right now I still have a huge pile of requests still waiting for implementation ...

    Matthias

  • edited June 2015

    Hi Matthias,

    Apart from being tedious, I am not really sure whether it is even possible currently as I don't know if the "selection rectangle" can somehow be retrieved from within a script when the left mouse button is released.

    I'd like to put that into 0.24...

    That would be awesome, thanks for considering this addition!

    ...but right now I still have a huge pile of requests still waiting for implementation ...

    I understand. Do you think I (or this nice community in general) could help with that in any way?

    Regards, Chris

  • edited November -1

    Well, help is always appreciated :-)

    If there are source code contributions I can of course integrate them. I just can't open the source code repository right now, basically because I integrated proprietary IP in the testcase area and the configuration management system I am using (SubVersion) will not let me delete this information without a trace. And sadly our industry is very picky about disclosing the smallest details.

    So far I'm happy with users testing things and being patient :-)

    It's more about making a cut and leaving features for the next release.

    Matthias

  • edited November -1

    Hi Matthias,

    You probably know already, but just in case: you could migrate your repository to git first and then rewrite the history with git filter-branch to remove the sensitive files before publishing the cleaned up git repository. Hell, you could even migrate it back to subversion.

    I'm sure Chris is not the only one who would give a hand.

    Thank you so much for KLayout!

    Seb

  • edited November -1

    Hi Seb,

    I know that path exists - although my experiences are bad with that. I got damaged binary files when I tried it previously. That was some time ago and maybe it's working better now.

    Still I accept patches. If you have one you think is worth integrating, send it to me.

    Thanks,

    Matthias

  • edited November -1

    Hi Matthias,

    Something changed for me in the behaviour of "PCell content is selectable (Caution: PCell recomputation may conflict with edits)".

    Previously (up to a couple of days ago, perhaps after I reset my klayoutrc file), I operated with this option enabled. The behaviour was as follows:

    • if I select a PCell, the entire cell would be selected. But I could not select individual shapes.
    • if I drop down into the PCell, then I can select individual shapes, or select sub-cells and keep dropping down.

    Now, it works as follows:

    • I can select a shape in the PCell, even when at the highest level.
    • I can drop down into the PCell, all the way to the bottom of the tree, for a selected shape.

    I preferred the first method, where I had to intentionally drop down into a cell to examine polygons...

    I wonder which of the above is your intention. And if there is a way get the first method working? Perhaps there was something in my klayoutrc that enabled this, so I'm curious how I can get this back.

    I'm able to switch between the two klayoutrc files, and switch between the two modes of operation... Here are the two files:

    I'd love to find out if there is a setting I'm missing.

    diff gives me some clues:

    <  <sel-inside-pcells-mode>false</sel-inside-pcells-mode>
    ---
    >  <sel-inside-pcells-mode>true</sel-inside-pcells-mode>
    

    that must be "PCell content is selectable (Caution: PCell recomputation may conflict with edits)".

    Perhaps it is one of these?

    <  <edit-top-level-selection>true</edit-top-level-selection>
    ---
    >  <edit-top-level-selection>false</edit-top-level-selection>
    

    Indeed! if I edit klayoutrc, and change it to true, it returns it back to how it worked earlier. Is there a preferences item somewhere I couldn't find?

    thanks

    Lukas

  • edited November -1

    You'll find it when you press F3.

    There are three ways to edit shapes that are not on the top level:

    1. Descend
    2. Right click on the cell name in the hierarchy on the left, and Show As New Top
    3. F3, uncheck Select Top Only

    Each has benefits. For example #3 is useful if you want to simultaneously select sub-shapes inside multiple cells, say to run some action. But #3 is also dangerous. 1 and 3 are my personal favorites, but when 1 gets confusing then I can fall back to 2 which is simpler because only that cell is shown.

    I noticed in an earlier post you are using the key bindings from The Red Toolbox (even if you are not using TRT actively, it's key bindings can remain if you didn't reset it afterwards). "Select Top Level Objects Only" is mapped to letter T in that toolbox. Probably, a wayward finger hit T...

    David

  • edited November -1

    Ah yes. Selection mode - hierarchy "Select top level objects only" in the Object Editor Options.

    Thank you

Sign In or Register to comment.