diff --git a/src/lay/doc/programming/database_api.xml b/src/lay/doc/programming/database_api.xml index 56aedf83f..a6b01b89d 100644 --- a/src/lay/doc/programming/database_api.xml +++ b/src/lay/doc/programming/database_api.xml @@ -112,6 +112,15 @@ layout.write("my_layout.gds") in every cell and inside a cell, a shape storage for each layer is provided.
+
+ Inside the layout object, shapes are kept with integer coordinates. The physical units can be obtained
+ by multiplying the integer coordinates with the database unit. The integer type objects are
A Layout object provides some basic layout manipulation and query methods. For example, it provides a method to retrieve shapes touching or overlapping a certain rectangular region of a cell. It also provides a clip method which @@ -222,9 +231,26 @@ non_editable_layout = RBA::Layout.new(false) created, the editable mode cannot be changed.
+A layout object can keep arbitrary meta data in the form of key/value pairs. This meta data is + extracted during the reading of a layout and will reflect special properties of the layout file. + For example, the GDS2 library name is available as meta information with key "libname". +
+ +The layout object offers methods to retrieve that information:
+ Meta information is a different concept than properties. +
+Cells can be created using the
Cells can be created using the
A list of the indexes for all layers inside the layout can be obtained with
@@ -480,6 +510,11 @@ shape.set_property(1, "NewValue") number are specified, the name matches exactly.
+
+ LayerInfo objects supply a hash value (
+ If the cell is a library cell (a "proxy"), it will have a database name (something like "TEXT$1") and a qualified
+ name which states the library and the cell name separated with a dot (i.e. "Basic.TEXT"). The qualified name
+ is not neccessarily unique. The qualified name of the cell can be obtained with
A cell that represents a cell imported from a library or a PCell variant (or both) is called a proxy cell.
For such cells,
+ Interfaces to floating-point working classes such as
+ A floating-point integer class exists too (
If a cell is a cell imported from a library,
+ The floating-point variant (
A Shapes container is usually obtained from a cell with a given layer index and is filled with
geometrical primitives using one of the
# cell = a Cell object @@ -873,6 +935,15 @@ endshapes = cell.shapes(layer_index) shapes.insert(RBA::Box::new(0, 0, 1000, 2000)) +
+ With floating-point objects: +
+ +# cell = a Cell object +# layer_index = the index of a the layer +shapes = cell.shapes(layer_index) +shapes.insert(RBA::DBox::new(0.0, 0.0, 1.0, 2.0))+
A Shapes object can also be created without a cell:
@@ -1040,7 +1111,13 @@ end
- The layer index a shape is on can be derived with
+ The layer index a shape is on can be obtained with
+ For the floating-point equivalents in micrometer units see the
+ For the floating-point equivalents in micrometer units see the
A Shape object represents a path if it returns true on
+ For the floating-point equivalents in micrometer units see the
A Shape object represents a text object if it returns true on
+ For the floating-point equivalents in micrometer units see the
@@ -1142,6 +1235,10 @@ end
getter and
+ For the floating-point equivalents in micrometer units see the
+ Next to points there is a corresponding vector class (
+ As points, vectors have an x and a y component which can be accessed with
+ Vectors don't transform the same way than points. On transformation, only rotation, mirror and scaling (if applicable) + is applied. Displacement is not applied. This way, the following two forms are equivalent: +
+ +(p1 - p2).transformed(t) == p1.transformed(t) - p2.transformed(t)+
# Wrong result box = RBA::Box::new(0, 0, 100, 200) -transformed_box = box.transformed_cplx(RBA::ICplxTrans::new(1, 45, false, RBA::Point::new)) +transformed_box = box.transformed_cplx(RBA::ICplxTrans::new(1, 45, false, RBA::Vector::new)) # -> (-141,0;71,212) # Correct result -transformed_box_as_polygon = RBA::Polygon::new(box).transformed_cplx(RBA::ICplxTrans::new(1, 45, false, RBA::Point::new)) +transformed_box_as_polygon = RBA::Polygon::new(box).transformed_cplx(RBA::ICplxTrans::new(1, 45, false, RBA::Vector::new)) # -> (0,0;-141,141;-71,212;71,71)@@ -119,9 +148,16 @@ transformed_box_as_polygon = RBA::Polygon::new(box).transformed_cplx(RBA::ICplxT -
The class method
A box object can be constructed from a floating-point object (for floating-point objects see below). + Lacking a database unit, no conversion from micrometer units + to database units is performed. Instead, the floating-point coordinates are rounded to the nearest integer coordinates:
+ +dbox = RBA::DBox::new(2.1, 3.1, 10.7, 11.8) +box = RBA::Box::new(dbox) +# -> (2,3;11,12)+ +
An integer box can be turned into a floating-point unit box using
- Because of that, operations that depend on the equality of coordinates (like "box.touches(other_box)") may not work as - expected unless the coordinates can be expressed precisely. - For the same reason, some operations which are implemented on integer coordinates (like the removal of holes in polygons) + Because of that, direct comparison of coordinate values should be avoided. + The internal precision used is 0.00001. By convention, floating-point type objects are supposed to + be used for micrometer-unit objects, hence this precision corresponds to 0.01 nm which corresponds to + the tenth of an atom and should be well below physical tolerances. +
+ ++ Some operations which are implemented on integer coordinates (like the removal of holes in polygons) are not available for the floating-point type objects.
- All floating-point type objects have class methods like "from_i.." (i.e.
- For the point object there is also a floating-point equivalent (DPoint, see
- Transformations in KLayout are restricted affine transformations which lack shear transformations and the ability to apply - an anisotropic scaling. A transformation in KLayout follows the conventions implied by the GDS2 and OASIS formats and include in that order: + Transformations in KLayout are restricted affine transformations. Shear transformations and anisotropic scaling is not + supported. + All transformation in KLayout follows the conventions implied by the GDS2 and OASIS formats and include in that order:
- For memory performance, unless necessary a restricted version of that transformation is used. In that restricted version, the
+ For memory performance, a restricted version of that transformation is used if possible. In that restricted version, the
rotation angles are confined to a multiple of 90 degree and scaling is not supported. This restricted affine transformation
is provided through the
For transforming floating-point coordinates, the
To support more complex affine transformations include arbitrary-angle rotations and scaling, the complex transformation objects - are provided. The precise representation of a coordinate transformed with such a transformation requires floating-point - precision. Since that is not practical, different versions of transformations exists which render different output types and - work on different input types: + are provided. In addition, the complex transformation object can translate between integer and floating-point coordinate types.
+ Multiplication of a transformation with an object renders the transformed object: +
+ +t = ... # a transformation +p = ... # some point + +# compute the transformed point: +q = t * p+ +
+ Multiplication of two transformations corresponds to concatenation of two transformations: +
+ +t1 = ... # a transformation +t2 = ... # another transformation + +# Multiplication of t2 and t1 renders an equivalent transformation +# that corresponds to "apply t1 first and then t2": +(t2 * t1) * p == t2 * (t1 * p)+ +
+ When multiplying two complex transformations, the resulting transformation type will + have the corresponding input and output types. For example when multiplying a VCplxTrans with + a CplxTrans, a ICplxTrans object will be created. This is because the first transformation + takes integers and the second one delivers integers. Hence the resulting transformation + is ICplxTrans. +
+