PCell not active (visible) after generation

edited June 2017 in Ruby Scripting
I create with the following script a circle in my layout, in the hiearchy and visible as a small point in my layout.
When I select it and without any changes click ok the pcell becomes visible as expected.
I assume I miss soemthing in my script to "activate" the pcell.
The radius is always 0.1 um independent which value I provide.

Any feedback is highly appriciated.

Thanks,
Andy

include RBA

layout_view = Application.instance.main_window.current_view
layout = layout_view.active_cellview.layout
top = layout_view.active_cellview.cell

$myLayerCircle = layout.layer(2, 0)
$radius = 100

# to get um
dbu=layout.dbu

pcell = layout.create_cell("CIRCLE", "Basic", {"layer" => $myLayerCircle, "actual_radius" => $radius, "npoints" => 64 } )

layout_view.add_missing_layers

trans = Trans.new(Trans::R0, 0, 0)
top.insert(CellInstArray.new(pcell.cell_index(), trans))

# write to gds
layout.write("circle.gds")

Comments

  • edited November -1

    Hi Andy,

    I don't know what's going on precisely, but this is working code:

    include RBA
    
    layout = Layout::new
    top = layout.create_cell("TOP")
    
    # The layer as a LayerInfo object
    layer = LayerInfo::new(2, 0)
    
    # The radius in micrometers
    radius = 1.5
    
    pcell = layout.create_cell("CIRCLE", "Basic", {"layer" => layer, "actual_radius" => radius, "npoints" => 64 } )
    
    trans = Trans.new(Trans::R0, 0, 0)
    top.insert(CellInstArray.new(pcell.cell_index, trans))
    
    layout.write("circle.gds") 
    

    In general, I discourage from using the Basic PCell's in code. They were provided with editing in mind.

    A circle can be created much easier as a polygon this way:

    include RBA
    
    layout = Layout::new
    top = layout.create_cell("TOP")
    
    layer = layout.layer(2, 0)
    top.shapes(layer).insert(Polygon::ellipse(Box::new(-1500, -1500, 1500, 1500), 64))
    
    layout.write("circle2.gds") 
    

    Kind regards,

    Matthias

  • edited November -1
    Thanks Matthias,
    The layer generation made the difference.
    Idea and long term project behind is on how parametrized shapes could be used e.g. for a basic transistor layout.
    The pcell intend to be placed in concunction with donut to layout them in a larger array with slightly changing the radius for the donut and circle.

    Cheers,
    Andy
Sign In or Register to comment.