-
Notifications
You must be signed in to change notification settings - Fork 1
/
test_draw_new_gds.rb
31 lines (23 loc) · 960 Bytes
/
test_draw_new_gds.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# Enter your Ruby code here
layout = RBA::Layout::new
# database unit 1nm:
layout.dbu = 0.001
# create a top cell
top = layout.cell(layout.add_cell("TOP"))
# create a layer: layer number 1, datatype 0
layer = layout.insert_layer(RBA::LayerInfo::new(1, 0))
# create one rectangle with lower-left coordinates at 0,0
# and width of 1um and heigth of 2um (coordinates are in
# database units)
hull = [ RBA::Point::new(0, 0), RBA::Point::new(6000, 0),
RBA::Point::new(6000, 3000), RBA::Point::new(0, 3000) ]
hole1 = [ RBA::Point::new(1000, 1000), RBA::Point::new(2000, 1000),
RBA::Point::new(2000, 2000), RBA::Point::new(1000, 2000) ]
hole2 = [ RBA::Point::new(3000, 1000), RBA::Point::new(4000, 1000),
RBA::Point::new(4000, 2000), RBA::Point::new(3000, 2000) ]
poly = RBA::Polygon::new(hull)
poly.insert_hole(hole1)
poly.insert_hole(hole2)
top.shapes(layer).insert(poly)
# write to x.gds
layout.write("/test/x4.gds")