iqm-finland / KQCircuits

KLayout Python library for integrated quantum circuit design.
GNU General Public License v3.0
126 stars 71 forks source link

Macro to open a tutorial layout #90

Closed qpavsmi closed 1 month ago

qpavsmi commented 2 months ago

Prerequisites

KQCircuits GUI installation required

Description

In top tool bar for KQCircuits section, there should be a Tutorial entry that when selected, opens a new layout containing a step-by-step instructions on designing a simple chip.

Use case

Would lower the barrier of entry for people interested in working with KQCircuits.

Prerequisites

KQCircuits GUI installation required

How to get started

Let's take as example the Online documentation macro. This is a XML file with some python code embedded into it. KLayout relies on such macro files to populate the top toolbar of KLayout in whatever order we wish (+ separator lines etc). So a suggestion is to copy-paste such macro as template and to transform it into a Tutorial entry. Modify some values of the XML entry in a way that makes sense.

The tutorial macro should in essence open a tutorial.oas file in a new KLayout page and apply layer properties from tutorial.lyp file. The files are not hosted in the repository yet but are available in below link. tutorial.zip You can open the tutorial manually by double clicking the tutorial.oas file and then drag-and-dropping the tutorial.lyp file into the KLayout window. The point of this exercise is that running the macro causes this to happen automatically.

Some useful code:

view = KLayoutView()                        # Opens new layout in KLayout
view.layout.read(file_path)                 # Load .oas file from file path as string
top_cell = view.layout.top_cells()[-1]      # Get top cell
view.focus(top_cell)                        # Zoom out enough to see all content of the file

Then it seems that to load the layer properties you will have to read more about the LayerProperties class in KLayout.

Definition of done

AbdullahKazi500 commented 1 month ago

@qpavsmi Hi I gave it a try and updated the XML File if the code looks good I will carry on with the next steps let me know the review