It looks like you're new here. If you want to get involved, click one of these buttons!
Hi admins:
recently, I'm using klayout standalone python module to do some scripting works。But I am really confused about the DCplxTrans/DTrans behaviour.
In my script, I use some code like below to insert some polygon Text in my layout.
layer = layout.layer(layer_info[0], layer_info[1])
text = textGen.text(string, dbu)
trans = db.DCplxTrans(db.DTrans(3, False, coord_info[0]-5, coord_info[1]+5), 10) #coord_info is a list which contains two float numbers
topCell.shapes(layer).insert(text, trans)
And thoes codes work fine, polygon Text is placed in the float-number coordinate correctly.
But, when I use some code shown as below to insert CellInstArray in topcell
letter_top = layout.cell(letterTopName)
letter_top_index = letter_top.cell_index()
trans = db.DCplxTrans(1, 270, False, x, y)# x, y both are float number
topCell.insert(db.CellInstArray(letter_top_index, trans))
instances cannot be placed in the float-number coordinate correctly, except I provide parameter x/dbu, y/dbu to DCplxTrans as coordinates
It seems cell.insert function always handles DCplxTrans/DTrans as an interger transfomation.
Is it a bug?
Comments
@frostchu You'll need to use "db.DCellInstArray" (note the "D")
The "D" types are operating with micron-unit coordinates while the "non-D" type are working with integer units (multiples of the DBU). You'll need to stay in one of the worlds consistently. Please note that KLayout has the concept of "database objects" (Cell, Shape, Shapes, ...) and working objects (copies): Box, Polygon, Point etc. Database objects are integer-units internally but as they are connected with a Layout object they are able to translate to micron units and back. Hence they offer a dual interface for micron and integer-unit types.
I'll try to summarize this here:
Matthias
@Matthias thanks a lot, that really helps.