Now that we know how to import a reference library from our Scripting How-To: How Can I Import an Artwork Cell Library for Use in my Design . Let's build on this by creating a new library with a new cell and adding some cell instances from the reference library into the newly created cell. The script code for this looks like the following:
We'll go through this code line by line and explain each step. The first part should look familiar from our description of importing a reference library: Scripting How-To: How Can I Import an Artwork Cell Library for Use in my Design :
In this line we are importing the GDSII reference library located at "C:\ReferenceLibs\CCADC.GDS" into the project and giving it the name "MyRefLib". We'll use a cell from this library to start us off on the new cell. Since this is a reference library we'll probably want to create our cell in a different library so we don't disturb the reference library which others may be using in their designs.
The next step is to create a new library to hold our new cell.
This creates a new GDSII cell library in the project called "MyLib". Well use this library to hold our new cells for this design project. Note here we retained a reference to the cell library in the variable 'cellLib' so we can use this to create a new cell in the cells collection of this library. This is done as follows:
Here we've use the Cells collection of the cell library to add a new empty cell called "MyCell". Note here again we keep a reference to the new cell in the variable 'libCell' so we can use this add the cell instances.
The next step is to populate this cell with some instances of a cell from our reference library. We do that in the a loop like this:
Here we create two variables x and y to represent the cell origin location and use these inside a double loop to loop over the rows and columns each time incrementing x by 100um in the outer loop to locate the column position and thin in the inner loop we increment the y by 100um to traverse up each column populating the rows.
Finally, so we can see the resulting cell we open the cell into an editor
The resulting libary cell looks as follows:
Figure 1 New Library Cell with Cell Instances added from a Reference Library
These steps can be used to provide a quick head-start for standard designs which use cells from a cell library as a starting point. Once the reference cell library is imported you can easily create a new library with a new cell and populate it with cells from the reference library. Finally you can open the newly create cell in an editor ready for further layout.