Designing rectangle array with random spacing and height

Hello There,
I'm trying to generate a single column rectangle array with random spacing and height. There are three cases. In the first, the rectangle height and width are constant, and the spacing between each rectangle must be altered based on the random spacing specified in a csv file. In the second scenario, the rectangle height varies depending on the width specified in the csv file. In the third scenario, the height and spacing change according to the columns in the csv file. In all the cases, the width of the rectangle is kept fixed. Please assist me with importing the csv file and creating the necessary design.
This is an interesting design problem, but I'm having trouble finding a solution.
Thanks in advance
Krish

Comments

  • edited September 3

    Hi,

    I would suggest to use an Excel sheet instead of a CSV file because:
    1. you can use any equations in it
    2. verification is easy

    See the attached f2579.py file that uses the KLayout Python Module.
    Note that you need to install pandas, numpy, and their dependencies.

    -------------------------------------------------------------------------------------
    f2579.py
      << To design rectangle array with random spacing and height >>
         See https://www.klayout.de/forum/discussion/2579/ for requirements.
    
    $ [python3] f2579.py
       option & argument : comment on option if any           default value
       ------------------------------------------------------+-----------------------
        <-e|--excel <*.xlsx>>: Excel file with one sheet     | ''
        [-b|--BL <x,y>]: bottom-left coordinate in [um]      | '0,0'
        [-t|--topcell <name>]: top cell name                 | TOP
        [-l|--layer <L,D>]: layer, dtype                     | '1,0'
        [-o|--output <design_file>]: output file name        | derived from the Excel
        [-d|--debug  <level>]                                | 0
        [-?|--?] : print this usage and exit                 | disabled
    ---------------------------------------------------------+-----------------------
      [example] $ ./f2579.py -e Scenario-1.xlsx -d 1
    -------------------------------------------------------------------------------------
    
    MacBookPro2{sekigawa} Forum2579 (1)% ./f2579.py -e Scenario-1.xlsx -d 1
    Scenario-1.xlsx
        Floor  Width [um]  Height [um]  Space [um]  Verification  Y_bottom  Y_top
    0       1          20           10         NaN           NaN         0     10
    1       2          20           10        14.0           NaN        24     34
    2       3          20           10        21.0           NaN        55     65
    3       4          20           10        26.0           NaN        91    101
    4       5          20           10        29.0           NaN       130    140
    5       6          20           10        30.0           NaN       170    180
    6       7          20           10        29.0           NaN       209    219
    7       8          20           10        26.0           NaN       245    255
    8       9          20           10        21.0           NaN       276    286
    9      10          20           10        14.0           NaN       300    310
    10     11          20           10         5.0           NaN       315    325
    

    Tested on Linux

    Update:2024-09-03

  • Hi @sekigawa

    Thank you for your time, I downloaded the zip file, which was quite useful. Now I understand how to write Python scripts to generate the desired layout.

    Thanks again
    Krish

Sign In or Register to comment.