Map Layer to Multiple layer

I have a design and I would need to map the layers such as:

  • some layers would map to several layers
  • several layers would map to one layer
  • only the declared layers have to be mapped

I could not find a way to do this without using multiple intermediate designs.
I block mainly when I try to map one layer to several layers.

here is a starting code but not working:

lo = pya.LoadLayoutOptions()
lm = pya.LayerMap()
lm.map(pya.LayerInfo(9, 70), 0, pya.LayerInfo(1000, 0, "lay1"))
lm.map(pya.LayerInfo(9, 70), 1, pya.LayerInfo(1001, 0, "lay2"))
lm.map(pya.LayerInfo(160, 0), 2, pya.LayerInfo(1000, 0, "lay1"))
lo.read_all_other_layers = False
lo.layer_map = lm

the issue in this code are:

  • layer 9.70 is not remapped to 1000.0 (but mapped to 1001.0)
  • all other layers are still loaded.

Thanks in advance for any help

Comments

  • edited October 22

    Have you already read the LayerMap docstring? From that I understand that multiple physical layers can be mapped to a single logical on but the reverse does not makes sense. If you just want to "see" the stuff in the GUI on the same "layer view" you can do so by selecting corresponding source. See about layer sources and LayerProperties. If you actually need the two layers in the database with the same geometry, you should copy the database layer I guess. Perhaps it helps if you would describe more what you actually need to do.

  • edited October 22

    Thanks for the link and the reply

    unfortunately the reverse does make sense to me, maybe the example above is not complete enough we could add a layer to map 1.0 -> 1001.0

    because of such map the copy would force me to create an intermediate layer then copy it to two layers, then delete it. I would rather avoid intermediate layers, therefore my question if there is a way to map directly.

    I also don't plan to "see" anything, it is solely about having one design input and remapping the layers to other layers.

    My question may not be so clear so we could also put it like this:

    I have a design1, I need to convert the layers to design2 with a mapping:

    • 9.70->1.0
    • 9.70->11.0
    • 1.0 -> 11.0
    • 160.0 -> 1.0

    what do you think it is the best path to go? Just an advice would be enough.

  • @jonathan I'm sorry, but real n:m mapping isn't supported currently. You can't map a single source layout to multiple destination layers. I know this may be desired, but the reader's code simply doesn't support this application currently.

    You can duplicate or merge the layer in a later step however using Layout#copy_layer.

    Matthias

Sign In or Register to comment.