It looks like you're new here. If you want to get involved, click one of these buttons!
Hi Sir,
I want to create a function in tool bar , and reference to other sample , I make that as below.
But , look like I can't call DRC functin in Ruby , May I know how to do that?
class MenuAction < RBA::Action
def initialize( title, shortcut, &action )
self.title = title
self.shortcut = shortcut
@action = action
end
def triggered
@action.call( self )
end
private
@action
end
$Check_bump_pitch = MenuAction.new( "Check min. bump pitch", "" ) do
app = RBA::Application.instance
mw = app.main_window
lv = mw.current_view
if lv == nil
raise "No view selected"
end
ly = pya.CellView.active().layout()
# equivalent of "a = input(7, 0)"
layer_a = ly.layer(94, 0)
UBM = pya.Region(ly.top_cell().begin_shapes_rec(layer_a))
layer_b = ly.layer(71, 0)
DIE = pya.Region(ly.top_cell().begin_shapes_rec(layer_b))
############################################
ubmcount=0
UBM.each {
ubmcount +=1
}
############################################
minPitch=Array.new
x=0
LayerList=[[0.0,0.0,0.25,0.25],[0.0,0.25,0.25,0.5],[0.0,0.5,0.25,0.75],[0.0,0.75,0.25,1.0] \
,[0.25,0.0,0.5,0.25],[0.25,0.25,0.5,0.5],[0.25,0.5,0.5,0.75],[0.25,0.75,0.5,1.0] \
,[0.5,0.0,0.75,0.25],[0.5,0.25,0.75,0.5],[0.5,0.5,0.75,0.75],[0.5,0.75,0.75,1.0] \
,[0.75,0.0,1.0,0.25],[0.75,0.25,1.0,0.5],[0.75,0.5,1.0,0.75],[0.75,0.75,1.0,1.0]]
LayerList.each { |n|
x1 = n[0].to_f
y1 = n[1].to_f
x2 = n[2].to_f
y2 = n[3].to_f
DIE.extent_refs(x1,y1,x2,y2).output(1000,x)
outline1=input(1000,x)
UBM.interacting(outline1).output(50000,x)
ubm1=input(50000,x)
outputdataX=Array.new
outputdataY=Array.new
pitchValue=Array.new
count=0
ubm1.each do |obj|
outputdataX << "#{obj.bbox.center.x.round(3)},#{obj.bbox.center.y.round(3)}"
outputdataY << "#{obj.bbox.center.x.round(3)},#{obj.bbox.center.y.round(3)}"
end
outputdataX.each do |out1|
point1 = out1.split(",")
xvalue1 = point1 [0]
yvalue1 = point1 [1]
outputdataY.each do |out2|
point2 = out2.split(",")
xvalue2 = point2 [0]
yvalue2 = point2 [1]
distance=Math.sqrt(( ( xvalue1.to_f - xvalue2.to_f ) * ( xvalue1.to_f - xvalue2.to_f )) + (( yvalue1.to_f - yvalue2.to_f ) * ( yvalue1.to_f - yvalue2.to_f ) ))
if distance > 0 then
pitchValue << distance.round(3)
end
end
end
minBumppitch = pitchValue.uniq.sort[0]
minPitch << minBumppitch
#puts "Area #{x} ,min bump pitch is #{minBumppitch} ; layer is 50000/#{x}"
x+=1
}
RBA::MessageBox.info("min. Bump pitch", "The min. bump pitch is {minPitch.sort[0]}", RBA::MessageBox.b_ok)
end
app = RBA::Application.instance
mw = app.main_window
menu = mw.menu
menu.insert_separator("tools_menu.end", "name")
menu.insert_item("tools_menu.end", "Check_bump_pitch", $Check_bump_pitch)
Comments
You have to use
RBA::Region
instead ofpya.Region
. "pya" is Python, "RBA" is Ruby.Plus, creating the Region in Ruby is done by using "new":
I'd also recommend not to use upper-case variable names such as "UBM", because Ruby will treat these variables as constants.
Regards,
Matthias
Hi Matthias,
After change the code as ..
I get error message as this one.
how can I do to debug this issue?
and , If it is a multi-top cell case , and I just want to process current cell view in script.
how to do that?
In Ruby, you need to call "new" to create a new object. So it's
in both places.
Matthias
Hi Matthias,
after change code as..
I still get a message as attahced.
Can you please help it ?
Thanks.
Region#extent_refs
is an undocumented method for use in DRC's "extent_refs" implementation. It expects the four relative dimension arguments plus an x and y oversize value. You can set these values to 0 in your case:Matthias
@Matthias
after change the code , it still get same result...
It does not work this way ... "output" isn't a method of the Region class. It's a DRC method. The (flat) equivalent is to insert the Region into a Shapes object like this:
Matthias
@mathine
Thanks for your answer , I will check it.
Do you have idea for how to make a cellS inputer?
As this code , I can enter 1 cell in input only. how to make multi input ?(I have many cells need to process...)
@jiunnweiyeh A QComboBox cannot be used to select multiple cells. You'll need a QListWidget for this (https://doc.qt.io/qt-5/qlistwidget.html).
Matthias
@Matthias
Got it , Thanks your help ,
as this code , I can choose 1 cell in list only , how can I choose multi cell in the list?
(even I clicked the cell item with "Shift" key , I still can't select multi -cell in the list....)
And , how to get the values (cell name list as this case) after we choose that?
You're getting closer ..
You have to enable multi-selection on the list widget:
Regards,
Matthias
@Matthias
Here was my code , I can make choose as a list.
But I can't get the result...I means that I can't get what the cell name been choose.
"selectedItems" is the right way ... but you need to collect the "text" attributes.
Here is an example:
Matthias
Hi Matthias,
Got it , Thanks.