View layers and shapes

Dear all,

I wish to apologise in advance for the simple question, but I am a beginner to both Python/Klayout so I am struggling with some basics to which I could not find an answer myself in the current forum. I have created a test script to create a basic layout, cell (set as top), layers and a box:

import pya

# For updating
initialize_new = True

# Initialize layout
def initialize():
  global mw, layout, cv, layout_view

  mw = pya.Application.instance().main_window()
  layout = mw.create_layout(1).layout()
  cv = pya.CellView().active()
  cv.name = "Wafer Design"
  layout_view = mw.current_view()
  layout.dbu = 1
  dbu = 1/layout.dbu
  print('Layout created: '+cv.name)

if(initialize_new==True):
  initialize()

# Create new cell and set as top cell 
active_layout = pya.CellView().active().layout()
cell = active_layout.create_cell('Template')
pya.CellView.active().cell = cell

# Layer info's
l1_info = pya.LayerInfo.new(1, 0, 'Substrate')
l2_info = pya.LayerInfo.new(2, 0, 'Material')
l3_info = pya.LayerInfo.new(3, 0, 'Gold')

l_1=layout.insert_layer(l1_info)
l_2=layout.insert_layer(l2_info)
l_3=layout.insert_layer(l3_info)

cell.shapes(l_1).insert(pya.Box.new(0, 0, 3, 3))

This seems to work, but I have found no way to view the actual created layers / shape in this layer, which makes me doubt if I have actually created them. If someone can help me with this basic problem I wish to thank you in advance!

Kind regards,
Don

Comments

  • Hi Don,

    No need to apologize. The script isn't wrong :)

    It's just that layers are not automatically shown. The "layer list" is actually a configurable view and not a plain list.

    To make it show the new layers, right-click the layer list and chose "Add Other Layer Entries" or use LayoutView#add_missing_layers in your script.

    Regards,

    Matthias

Sign In or Register to comment.