Home Forums Nazca Questions and Answers Mask layer management

This topic contains 3 replies, has 2 voices, and was last updated by  Ronald 1 month ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #5419

    Chenhui
    Member

    Hello Nazca team,

    Is there a built-in mask layer system, which I can directly use them?

    How can I call the different layer name, and put the pattern on the different layers, without using the number? It is easy to mess up the layers by only using the number.

    Thanks.

    Chenhui

    #5438

    Ronald
    Keymaster

    Dear Chenhui,

    Yes there is a mask layer system in Nazca. You can either load layers from a csv file or add them in your script via add_layer(). A layer can be given a layer_name too, e.g.

    import nazca as nd
    nd.add_layer(name='my_layer', layer= (2, 5))
    nd.Polygon(points=[(0, 0), (10, 0), (0, 10)], layer='my_layer')
    nd.export_gds()

    As of Nazca-0.5, released Feb 20 ’19, there are some useful updates:
    The layers are no longer primarily organized in layers and datatypes, but by an ID. You can still call a layer as previously, however, you can now also have multiple names for the same (layer, datatype) combination without ambiguity. If you refer to a layer by number and it has multiple layer_names Nazca will issue a warning and ask you to use the unique layer_name instead.

    import nazca as nd
    nd.add_layer(name='my_layer1', layer= (2, 5))
    nd.add_layer(name='my_layer2', layer= (2, 5))
    nd.Polygon(points=[(0, 0), (10, 0), (0, 10)], layer='my_layer1')
    nd.Polygon(points=[(0, 0), (10, 0), (0, 10)], layer=(2, 5)) # This will trigger a warning
    
    # warning message:
    WARNING: Non-unique layer identifier used: (2, 5).
    Matching layer_names for (2, 5) are ['my_layer1', 'my_layer2'].
    Continuing here with layer_name = 'my_layer1'.
    
    nd.export_gds()

    Ronald

    #5439

    Chenhui
    Member

    Hello Ronald,

    Thanks for your help. It is very convenient to use the name.

    Chenhui

    #5444

    Ronald
    Keymaster

    Dear Chenhui,

    For using a csv file to define mask layers:

    # csv file content example 'my_layers.csv'
    # (no spaces after the comma's)
    # remove these comment lines
    layer_name,layer,datatype,accuracy,origin,remark
    name1,2,10,0.001,,
    name2,5,0,0.001,,
    name3,100,0,0.001,,
    import nazca as nd
    nd.load_layers(filename='my_layers.csv')
    nd.show_layers()

    Ronald

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.