pCell not drawn using scripting

spispi
edited March 2020 in Ruby Scripting

Dear all

While creating a pCell "CIRCLE" it will add it to the top cell, but showing radius of "0". Only after selecting it, opening the properties and close it by 'ok' it will draw the actual layer and setting the radius correctly.

This prevents me to use the pCell for example in scripts, where they will maintain the radius "0" although I've set a real value.
Is there a way to activate the radius somehow?
Thank you very much,
Martin

ly = pya.Application.instance().main_window().current_view().active_cellview().layout()
ly.dbu = 0.001

layer1 = pya.LayerInfo(1,0)
pCell1 = ly.create_cell("CIRCLE", "Basic", { "radius": 30, "layer": layer1 } )

testCell = ly.create_cell('testCell')
t = pya.Trans(0, 0)
testCell.insert(pya.CellInstArray(pCell1.cell_index(), t))

Comments

  • edited March 2020

    Hi Martin,

    the actual radius is called "actual_radius". "radius" is what you enter in the text box. As there is also the handle to manipulate the radius, both inputs are consolidated into "actual_radius". This is the value that controls the radius of the circle drawn.

    To make things perfect, you could also set "radius" to the same value and you could also configure a handle by setting the "handle" parameter to a pya.DPoint object indicating the handle position as one point on the circle, like (x_center - radius, y_center).

    Matthias

  • Hi Matthias

    Thank you very much for the prompt response. I very much appreciate your help.
    It did perfectly solve my issue.

    dp = pya.DPoint(x_center - radius, y_center)
    pCellName = ly.create_cell("CIRCLE", "Basic", { "actual_radius": radius, "radius": radius, "handle": dp, "layer": pya.LayerInfo(2,1) } )

    Martin

  • edited May 2021

    Hello,

    I'm trying to make an Arc, and I can't seem to find the correct parameter names. Could you please help?
    For example, I tried to make the following function work:

    def CreateArc(Cell, Layer, x, y, Rin, Rout, deg1, deg2, num=10000):
    "Creates an arc starting from deg1and ending at deg2 whose center is in x,y and has inner and outer radii Rin, Rout."
    param = {"layer":Layer, "actual_radius1":Rin-1, "actual_radius2":Rin+1000, "actual_start_angle":deg1, "actual_end_angle":deg2, "npoints": num}
    ccell = LAYOUT.create_cell("ARC", "Basic",param)
    trans = pya.Trans(0, False, x, y)
    Cell.insert(pya.CellInstArray.new(ccell.cell_index(), trans))

    This creates an invisible tiny square in the Cell I tried to use.
    I run it with layer = L7, Rin = 9999, Rout=11000, deg1=60, deg2=80.
    When clicked, it shows "Basic.ARC(l=7,r=9999..11000,a=0..90,n=10000)".
    When double-clicked, it opens the normal Arc GUI, with the layer correct, number of points correct, but radii at 0.1 and 0.2 and angles at 0 and 90.

  • Hi,

    I'd appreciate if you'd open a new discussion instead of adding to an existing one.

    Layer is a layer index (get it from "layout.layer(7, 0)" for GDS layer 7/0). Did you consider this?

    My recommendation to set "radius1" to the same value than "actual_radius1" (same for radius2) is valid as well for the ARC.

    Matthias

  • Hello,
    I figured this is practically the same issue, so I posted it here. I'll open another thread, thanks and let you know of the progress.

    Shoval

Sign In or Register to comment.