insert one more box in the unit cell without array the whole pattern.

edited July 2015 in Ruby Scripting
Hi
I got a question here about how to use ruby to draw a box in the unit.cell with out being arrayed.
Wrong layout.
https://www.dropbox.com/s/ktsyhflgafiow4j/wrong%20result.png?dl=0

Correct layout (desired)
https://www.dropbox.com/s/jthj8a0zwhi7208/correct%20result.png?dl=0
Thanks you.


#making Islands x2

class Generator
def initialize
@layout = RBA::Layout::new
@layout.dbu = 0.001
@top = @layout.create_cell("TOPCELL")
@layer_index = @layout.insert_layer(RBA::LayerInfo::new(988,0))
@layer_index2 = @layout.insert_layer(RBA::LayerInfo::new(2,99))
@layer_index3 = @layout.insert_layer(RBA::LayerInfo::new(10,0))
@layer_index4 = @layout.insert_layer(RBA::LayerInfo::new(4,99))
@lib = RBA::Library.library_by_name("Basic")
@lib || raise("Unknown lib 'Basic'");
@pcell_decl = @lib.layout.pcell_declaration("TEXT");
@pcell_decl || raise("Unknown PCell 'TEXT'");
@chars = {}
# create one cell for "-" and the digits
"0123456789-abcdefghijk".split("").each do |c|
param = {
"text" => c,
"layer" => RBA::LayerInfo::new(15,94),
"mag" =>3
}
pv = @pcell_decl.get_parameters.collect do |p|
param[p.name] || p.default
end
# fake a PCell by creating a normal cell and using the production code
# of the PCell to generate the layout
char_cell = @layout.create_cell("C#{c}")
@pcell_decl.produce(@layout, [ @layer_index ], pv, char_cell)
@chars[c] = char_cell
end
end
#=============================
def make_pattern( a ,b,xpos,ypos)#,c ,d ,e ,f ,g ,h ,i ,j ,k ,l
dx = a+b
dy = 3*(a+b)
arx = (50000*0.48 / dx ) .to_i
ary = (50000*0.4 / dy ) .to_i
nx = 1
ny = ary
unit_cell = @layout.create_cell("1")
kkk = [
RBA::Point::new( 0 , 0 ),
RBA::Point::new( 10*a , 0 ),
RBA::Point::new( 10*a , 2* b ),
RBA::Point::new( 0 , 2* b ),

]

unit_cell.shapes(@layer_index).insert(RBA::Polygon::new(kkk))
ox = xpos
oy = ypos
trans1 = RBA::Trans::new(RBA::Point::new(ox, oy,))
trans2 = RBA::Trans::new(RBA::Point::new(ox, oy,))
trans3 = RBA::Trans::new(RBA::Point::new(ox, oy,))
trans4 = RBA::Trans::new(RBA::Point::new(ox, oy,))
#trans5 = RBA::Trans::new(RBA::Box::new(0, 0, 1000000, 2000000))
ax = RBA::Point::new(dx, 0)
ay = RBA::Point::new(0, dy)
@top.insert(RBA::CellInstArray::new(unit_cell.cell_index, trans1, ax, ay, nx, ny))
@top.insert(RBA::CellInstArray::new(unit_cell.cell_index, trans2, ax*-1, ay, nx, ny))
@top.insert(RBA::CellInstArray::new(unit_cell.cell_index, trans3, ax*-1, ay*-1, nx, ny))
@top.insert(RBA::CellInstArray::new(unit_cell.cell_index, trans4, ax, ay*-1, nx, ny))

#====HERE!! try to add only one single box to the unit cell. ( no array)



unit_cell.shapes(@layer_index3).insert(RBA::Box::new(0,0,-5*(b), a))

text = ( "a%03d-b%03d" % [ a ,b ])
xt0 = xt =xpos-24000
yt =-24700 +ypos
text.split("").each do |tc|
if tc == "\n"
xt = xt0
yt -=3000
else
char_cell = @chars[tc]
if char_cell
@top.insert(RBA::CellInstArray::new(char_cell.cell_index, RBA::Trans::new(RBA::Trans::r0, xt, yt)))

xt +=2000
end

end

end

end

def done(filename)
@layout.write(filename)
puts "Output file written: "+filename
end

end
#===============================================================================
g = Generator::new
g.make_pattern( 40 , 40 , 0 , 0 )
end
g.done("TEST1.oas")

Comments

  • edited November -1

    Hi Mattseng,

    If I understand your problem correctly, you want to create a single instance of a cell containing a shape on layer 10 and an array instance of a cell containing shapes on other layers.

    You cannot use the same cell for that (unit cell). You'll have to create a new unit cell, place a shape on layer 10 (@layer_index3) and instantiate that cell once (without the array specification).

    Matthias

Sign In or Register to comment.