pCell not drawn using scripting

spispi
edited March 23 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 24

    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

Sign In or Register to comment.