How to do a scripe to base on pattern (layer) to make cell instance?

Hi sir,
Here was my code
I want to base on pattern in layer 86,0 . to create a cell instance into that location.
But it is don't work . could you please help to check where is wrong?
Thanks.

#########user need to input the cell name  (UBM....)######
instance_cell = "UBM_feature"
################################################
include RBA
mw = Application::instance.main_window
lv =mw.current_view
out_cell = lv.active_cellview.cell
layer = lv.layer(86, 0)  
main_window = RBA::Application::instance.main_window
layout = RBA::CellView::active.layout
layout_view = main_window.current_view
dbu = layout.dbu.round(3) *10

subcell_index = layout.cell(instance_cell).cell_index()
layer.data.each do |sel|
 if !sel.is_cell_inst?
 shape = sel.shape
 point=shape.dbbox.center.to_s
 location=point.split(',')
 locationx=(location[0].to_f)
 locationy=(location[1].to_f)
 out_cell.insert(RBA::DCellInstArray::new(subcell_index, RBA::DTrans::new(locationx , locationy)))
  end
 end
RBA::QMessageBox::information(mw, "Instance", "Make instance ")

Comments

  • here was the error message.

  • @jiunnweiyeh You should take the layer from the Layout object, not from the LayoutView:

    ...
    out_cell = lv.active_cellview.cell
    layout = lv.active_cellview.layout
    layer = layout.layer(86, 0)  
    ...
    

    Matthias

  • Hi Matthias,
    Thanks , here is my update code , and it is not-workable.
    could you please help ?

    #########user need to input the cell name  (UBM....)######
    instance_cell = "UBM_feature"
    ################################################
    include RBA
    main_window = RBA::Application::instance.main_window
    layout_view = main_window.current_view
    dbu = layout.dbu.round(3) *10
    
    out_cell = layout_view.active_cellview.cell
    layout = layout_view.active_cellview.layout
    layer = layout.layer(86, 0)  
    
    subcell_index = layout.cell(instance_cell).cell_index()
    layer.data.each do |sel|
     if !sel.is_cell_inst?
     shape = sel.shape
     point=shape.dbbox.center.to_s
     location=point.split(',')
     locationx=(location[0].to_f)
     locationy=(location[1].to_f)
     out_cell.insert(RBA::DCellInstArray::new(subcell_index, RBA::DTrans::new(locationx , locationy)))
      end
     end
    RBA::QMessageBox::information(mw, "Instance", "Make instance ")
    

  • @jiunnweiyeh A don't see the layout, but I assume there is no cell called "UBM_feature". In this case, "layout.cell(instance_cell)" will return nil and this error will happen.

    Matthias

Sign In or Register to comment.