Marker database

edited April 2013 in Ruby Scripting
Hello Matthias,
This is a very useful program. I would like to use it to perform boolean operations and some resizing but am having newbie difficulties. 'Tools : Processing Scripts' is installed - when I try to run an example, a dialog titled "Marker Database Browser" appears. It is requesting a database file. I don't know what file it needs or why. I just want to perform some modifications eg: input("m2 14/0").size(1) where 'm2 14' is the name of a layer.
Thanks,
Dean

Comments

  • edited November -1

    Hi Dean,

    the marker browser is not requesting something - it is just shown in case you were sending your output to a marker database. It is somewhat confusing that it will pop up even if there is no database created. I have updated the layer_proc.rbm script so the marker browser only pops up if there is a marker database created.

    Your script is lacking the output statements, that's why nothing is generated. You have basically two choices:

    If you want to send the results to a marker database, your code looks like this:

    report("Some description")
    input("14/0").size(1).rdb("category_name")
    

    If you want to send the results to a different layer (i.e. 15/0), use

    input("14/0").size(1).output("15/0")
    

    One word regarding the layer specification: you cannot use "m2 14/0". You can specify a named layer, i.e. for DXF or CIF using a spec like "m2". If you want to specify a layer for GDS, you'll have to use "layer/datatype" (i.e. "14/0"). You can use both specifications like "m2 (14/0)" (note the brackets). In that case, it will take "m2" for DXF or CIF and 14/0 for GDS.

    Regards,

    Matthias

  • edited November -1
    Hello Matthias,

    I have some relatively complicated logical operations that I would like to implement in KLayout.
    The objective is to generate a layer in a new layout based upon something like the following:

    ((((((((((((NN NOT GP) AND OL) AND NW) SIZING 0.15) AND ((NOT NW) SIZING 0.25)) OR (NN NOT GP)) SIZING 0.20) SIZING -0.20) NOT ((((((PN NOT GP) AND OL)NOT NW)SIZING 0.1)) SIZING -0.12)SIZING 0.12) OR (NN AND GP))

    Is there a method to translate something this ugly into KLayout statements?

    Thanks,
    Dean
  • edited September 2013

    Hi Dean,

    that expression is ugly, right :-)

    My suggestion is to decompose it into binary expressions:

    l1 = NN NOT GP
    l2 = l1 AND OL
    l3 = l2 AND NW
    l4 = l3 SIZING 0.15
    l5 = NOT NW
    l6 = l5 SIZING 0.25
    l7 = l4 AND l6
    l8 = l7 OR l1
    l9 = l8 SIZING 0.20
    l10 = l9 SIZING -0.20
    l11 = PN NOT GP
    l12 = l11 AND OL
    l13 = l12 NOT NW
    l14 = l13 SIZING 0.1
    l15 = l14 SIZING -0.12
    l16 = l15 SIZING 0.12
    l17 = l10 NOT l16
    result = l17 NOT l1
    

    (I am nor sure about operator precedence in your example - please check). "NN NOT GP" appears three times and now it's computed once - hence that is also an optimization.

    Then the translation is straightforward (AND -> *, NOT -> -, OR -> +, SIZING -> .size) except the unary "NOT" for l5. There is not "inversion", but you can subtract the layer from the bounding box:

    # Assign inputs to NN, NP, OL, GP ...
    NN = input(10, 0)  # just a sample
    NP = input(11, 0)  
    ...
    
    l1 = NN - GP
    l2 = l1 * OL
    l3 = l2 * NW
    l4 = l3.size(0.15)
    l5 = bbox - NW  # (see above)
    l6 = l5.size(0.25)
    l7 = l4 * l6
    l8 = l7 + l1
    l9 = l8.size(0.20)
    l10 = l9.size(-0.20)
    l11 = PN - GP
    l12 = l11 * OL
    l13 = l12 - NW
    l14 = l13.size(0.1)
    l15 = l14.size(-0.12)
    l16 = l15.size(0.12)
    l17 = l10 - l16
    result = l17 - l1
    
    result.output(100, 0)  # just a sample
    

    I'd suggest to regroup the expressions and use nice names instead of lx, but that depends on what is meant. I assume it has something to do with well and bulk contacts, but that is just a guess ...

    Matthias

Sign In or Register to comment.