DRC Reference: Layer Object

The layer object represents a collection of polygons, edges or edge pairs.

"&" - Boolean AND operation

Usage:

The method computes a boolean AND between self and other.

This method is available for polygon and edge layers. An alias is "and". See there for a description of the function.

"+" - Join layers

Usage:

The method includes the edges or polygons from the other layer into this layer. The "+" operator is an alias for the join method.

This method is available for polygon, edge and edge pair layers. An alias is "join". See there for a description of the function.

"-" - Boolean NOT operation

Usage:

The method computes a boolean NOT between self and other.

This method is available for polygon and edge layers. An alias is "not". See there for a description of the function.

"^" - Boolean XOR operation

Usage:

The method computes a boolean XOR between self and other.

This method is available for polygon and edge layers. An alias is "xor". See there for a description of the function.

"and" - Boolean AND operation

Usage:

The method computes a boolean AND between self and other. It is an alias for the "&" operator.

This method is available for polygon and edge layers. If the first operand is an edge layer and the second is a polygon layer, the result will be the edges of the first operand which are inside or on the borders of the polygons of the second operand.

The following images show the effect of the "and" method on polygons and edges (layer1: red, layer2: blue):

"area" - Returns the total area of the polygons in the region

Usage:

This method requires a polygon layer. It returns the total area of all polygons in square micron. Merged semantics applies, i.e. before computing the area, the polygons are merged unless raw mode is chosen (see raw). Hence, in clean mode, overlapping polygons are not counted twice.

The returned value gives the area in square micrometer units.

"bbox" - Returns the overall bounding box of the layer

Usage:

The return value is a DBox object giving the bounding box in micrometer units.

"centers" - Returns the center parts of the edges

Usage:

Similar to start_segments and end_segments, this method will return partial edges for each given edge in the input. For the description of the parameters see start_segments or end_segments.

The following images show the effect of the method:

"clean" - Marks a layer as clean

Usage:

A layer marked as clean will provide "merged" semantics, i.e. overlapping or touching polygons are considered as single polygons. Inner edges are removed and collinear edges are connected. Clean state is the default.

See raw for some remarks about how this state is propagated.

"collect" - Transforms a layer

Usage:

This method evaluates the block for each object in the layer and returns a new layer with the objects returned from the block. It is available for edge, polygon and edge pair layers. The corresponding objects are DPolygon, DEdge or DEdgePair.

If the block evaluates to nil, no object is added to the output layer. If it returns an array, each of the objects in the array is added. The returned layer is of the original type and will only accept objects of the respective type. Hence, for polygon layers, DPolygon objects need to be returned. For edge layers those need to be DEdge and for edge pair layers, they need to be DEdgePair objects. For convenience, Polygon, Edge and EdgePair objects are accepted too and are scaled by the database unit to render micrometer-unit objects. Region, Edges and EdgePair objects are accepted as well and the corresponding content of that collections is inserted into the output layer.

Other versions are available that allow translation of objects into other types (collect_to_polygons, collect_to_edges and collect_to_edge_pairs).

Because this method executes inside the interpreter, it's inherently slow. Tiling does not apply to this method.

Here is a slow equivalent of the rotated method

# Rotates by 45 degree
t = DCplxTrans(1.0, 45.0, false, DVector::new)
new_layer = layer.collect { |polygon| polygon.transformed(t) }

"collect_to_edge_pairs" - Transforms a layer into edge pair objects

Usage:

This method is similar to collect, but creates an edge pair layer. It expects the block to deliver EdgePair, DEdgePair or EdgePairs objects.

"collect_to_edges" - Transforms a layer into edge objects

Usage:

This method is similar to collect, but creates an edge layer. It expects the block to deliver objects that can be converted into edges. If polygon-like objects are returned, their contours will be turned into edge sequences.

"collect_to_region" - Transforms a layer into polygon objects

Usage:

This method is similar to collect, but creates a polygon layer. It expects the block to deliver objects that can be converted into polygons. Such objects are of class DPolygon, DBox, DPath, Polygon, Path, Box and Region.

"corners" - Selects corners of polygons

Usage:

This method produces markers on the corners of the polygons. An angle criterion can be given which selects corners based on the angle of the connecting edges. Positive angles indicate a left turn while negative angles indicate a right turn. Since polygons are oriented clockwise, positive angles indicate concave corners while negative ones indicate convex corners.

The markers generated can be point-like edges or small 2x2 DBU boxes. The latter is the default.

The options available are:

The following images show the effect of this method:

"data" - Gets the low-level data object

Usage:

This method returns a Region, Edges or EdgePairs object representing the underlying RBA object for the data. Access to these objects is provided to support low-level iteration and manipulation of the layer's data.

"dup" - Duplicates a layer

Usage:

Duplicates the layer. This basically will create a copy and modifications of the original layer will not affect the duplicate. Please note that just assigning the layer to another variable will not create a copy but rather a pointer to the original layer. Hence modifications will then be visible on the original and derived layer. Using the dup method will avoid that.

However, dup will double the memory required to hold the data and performing the deep copy may be expensive in terms of CPU time.

"each" - Iterates over the objects from the layer

Usage:

This method evaluates the block on each object of the layer. Depending on the layer type, these objects are of DPolygon, DEdge or DEdgePair type.

Because this method executes inside the interpreter, it's inherently slow. Tiling does not apply to this method.

"edge_pairs?" - Returns true, if the layer is an edge pair collection

Usage:

"edges" - Decomposes the layer into single edges

Edge pair collections are decomposed into the individual edges that make up the edge pairs. Polygon layers are decomposed into the edges making up the polygons. This method returns an edge layer but will not modify the layer it is called on.

Merged semantics applies, i.e. the result reflects merged polygons rather than individual ones unless raw mode is chosen.

"edges?" - Returns true, if the layer is an edge layer

Usage:

"enc" - An alias for "enclosing"

Usage:

See enclosing for a description of that method

"enclosing" - An enclosing check

Usage:

This method checks whether layer encloses (is bigger than) other_layer by the given dimension. Locations, where this is not the case will be reported in form of edge pair error markers. Locations, where both edges coincide will be reported as errors as well. Formally such locations form an enclosure with a distance of 0. Locations, where other_layer extends outside layer will not be reported as errors. Such regions can be detected by not_inside or a boolean "not" operation.

The enclosing method can be applied to both edge or polygon layers. On edge layers the orientation of the edges matters and only edges looking into the same direction are checked.

As for the other DRC methods, merged semantics applies. The options available are the same than for width. Distance values can be given as floating-point values (in micron) or integer values (in database units). To explicitly specify the unit, use the unit denominators.

The following images show the effect of two enclosing checks (red: input1, blue: input2):

"end_segments" - Returns the part at the end of each edge

Usage:

This method will return a partial edge for each edge in the input, located and the end of the original edge. The new edges will share the end point with the original edges, but not necessarily their start point. This method applies to edge layers only. The direction of edges is defined by the clockwise orientation of a polygon: the end point of the edges will be the terminal point of each edge when walking a polygon in clockwise direction. Or in other words: when looking from start to the end point of an edge, the filled part of the polygon is to the right.

The length of the new edge can be given in two ways: as a fixed length, or a fraction, or both. In the latter case, the length of the resulting edge will be either the fraction or the fixed length, whichever is larger. To specify a length only, omit the fraction argument or leave it at 0. To specify a fraction only, pass 0 to the length argument and specify the fraction in the second parameter. A fraction of 0.5 will result in edges which cover the end half of the edge.

The following images show the effect of the method:

"extended" - Returns polygons describing an area along the edges of the input

Usage:

This method is available for edge layers only. It will create a polygon for each edge tracing the edge with certain offsets to the edge. "o" is the offset applied to the outer side of the edge, "i" is the offset applied to the inner side of the edge. "b" is the offset applied at the beginning and "e" is the offset applied at the end.

When looking from start to end point, the "inside" side is to the right, while the "outside" side is to the left.

"joined" is a flag, which, if present, will make connected edges behave as a continuous line. Start and end offsets are applied to the first and last unconnected point respectively. Please note that in order to specify joined mode, you'll need to specify "joined" as a keyword in the third form of the method.

The following images show the effects of some parameters:

"extended_in" - Returns polygons describing an area along the edges of the input

Usage:

This method applies to edge layers only. Polygons are generated for each edge describing the edge drawn with a certain width extending into the "inside" (the right side when looking from start to end). This method is basically equivalent to the extended method: "extended(0, 0, 0, dist)". A version extending to the outside is extended_out.

"extended_out" - Returns polygons describing an area along the edges of the input

Usage:

This method applies to edge layers only. Polygons are generated for each edge describing the edge drawn with a certain width extending into the "outside" (the left side when looking from start to end). This method is basically equivalent to the extended method: "extended(0, 0, dist, 0)". A version extending to the inside is extended_in.

"extent_refs" - Returns partial references to the boundings boxes of the polygons

Usage:

This method produces parts of the bounding box of the polygons. It can select either edges, certain points or partial boxes. It can be used the following ways:

The formal specifiers are for points:

The formal specifiers for lines are:

Dots are represented by small (2x2 DBU) boxes or point-like edges with edge output. Lines are represented by narrow or flat (2 DBU) boxes or edges for edge output. Edges will follow the orientation convention for the corresponding edges - i.e. "inside" of the bounding box is on the right side of the edge.

The following additional option controls the output format:

The following table shows a few applications:

"extents" - Returns the bounding box of each input object

Usage:

Applies to edge layers, polygon layers on edge pair collections. Returns a polygon layer consisting of boxes for each input object. The boxes enclose the original object.

Merged semantics applies, so the box encloses the merged polygons or edges unless raw mode is chosen (see raw).

The enlargement parameter specifies an optional enlargement which will make zero width/zero height object render valid polygons (i.e. horizontal/vertical edges).

The following images show the effect of the extents method:

"first_edges" - Returns the first edges of an edge pair collection

Usage:

Applies to edge pair collections only. Returns the first edges of the edge pairs in the collection.

"flatten" - Flattens the layer

Usage:

If the layer already is a flat one, this method does nothing. If the layer is a hierarchical layer (an original layer or a derived layer in deep mode), this method will convert it to a flat collection of polygons, edges or edge pairs.

"holes" - Selects all polygon holes from the input

Usage:

This method is available for polygon layers. It will create polygons from all holes inside polygons of the input. Although it is possible, running this method on raw polygon layers will usually not render the expected result, since raw layers do not contain polygons with holes in most cases.

The following image shows the effects of the holes method:

"hulls" - Selects all polygon hulls from the input

Usage:

This method is available for polygon layers. It will remove all holes from the input and render the hull polygons only. Although it is possible, running this method on raw polygon layers will usually not render the expected result, since raw layers do not contain polygons with holes in most cases.

The following image shows the effects of the hulls method:

"in" - Selects shapes or regions of self which are contained in the other layer

Usage:

This method selects all shapes or regions from self which are contained the other region exactly. It will use individual shapes from self or other if the respective region is in raw mode. If not, it will use coherent regions or combined edges from self or other.

It will return a new layer containing the selected shapes. A method which selects all shapes not contained in the other layer is not_in.

This method is available for polygon and edge layers.

The following image shows the effect of the "in" method (input1: red, input2: blue):

"insert" - Inserts one or many objects into the layer

Usage:

Objects that can be inserted are Edge objects (into edge layers) or DPolygon, DSimplePolygon, Path, DBox (into polygon layers). Convenience methods exist to create such objects (global#edge, global#polygon, global#box and #global#path). However, RBA constructors can used as well.

The insert method is useful in combination with the global#polygon_layer or global#edge_layer functions:

el = edge_layer
el.insert(edge(0.0, 0.0, 100.0, 0.0)

pl = polygon_layer
pl.insert(box(0.0, 0.0, 100.0, 200.0)

"inside" - Selects shapes or regions of self which are inside the other region

Usage:

This method selects all shapes or regions from self which are inside the other region. completely (completely covered by polygons from the other region). If self is in raw mode, this method will select individual shapes. Otherwise, this method will select coherent regions and no part of these regions may be outside the other region. It returns a new layer containing the selected shapes. A version which modifies self is select_inside.

This method is available for polygon layers.

The following image shows the effect of the "inside" method (input1: red, input2: blue):

"inside_part" - Returns the parts of the edges inside the given region

Usage:

This method returns the parts of the edges which are inside the given region. This is similar to the "&" operator, but this method does not return edges that are exactly on the boundaries of the polygons of the region.

This method is available for edge layers. The argument must be a polygon layer.

"interacting" - Selects shapes or regions of self which touch or overlap shapes from the other region

Usage:

This method selects all shapes or regions from self which touch or overlap shapes from the other region. Unless self is in raw mode (see raw), coherent regions are selected from self, otherwise individual shapes are selected. It returns a new layer containing the selected shapes. A version which modifies self is select_interacting.

This method is available for polygon and edge layers. Edges can be selected with respect to other edges or polygons.

The following image shows the effect of the "interacting" method (input1: red, input2: blue):

"intersections" - Returns the intersection points of intersecting edge segments for two edge collections

Usage:

This operation is similar to the "&" operator, but it does also report intersection points between non-colinear, but intersection edges. Such points are reported as point-like, degenerated edge objects.

This method is available for edge layers. The argument must be an edge layer.

"is_box?" - Returns true, if the region contains a single box

Usage:

The method returns true, if the region consists of a single box only. Merged semantics does not apply - if the region forms a box which is composed of multiple pieces, this method will not return true.

"is_clean?" - Returns true, if the layer is clean state

Usage:

See clean for a discussion of the clean state.

"is_deep?" - Returns true, if the layer is a deep (hierarchical) layer

Usage:

"is_empty?" - Returns true, if the layer is empty

Usage:

"is_merged?" - Returns true, if the polygons of the layer are merged

Usage:

This method will return true, if the polygons of this layer are merged, i.e. they don't overlap and form single continuous polygons. In clean mode, this is ensured implicitly. In raw mode (see raw), merging can be achieved by using the merge method. is_merged? tells, whether calling merge is necessary.

"is_raw?" - Returns true, if the layer is raw state

Usage:

See clean for a discussion of the raw state.

"iso" - An alias for "isolated"

Usage:

See isolated for a description of that method

"isolated" - An isolation check

Usage:

See space for a description of this method. In contrast to space, this method is available for polygon layers only, since only on such layers different polygons can be identified.

The following image shows the effect of the isolated check:

"join" - Joins the layer with another layer

Usage:

The method includes the edges or polygons from the other layer into this layer. It is an alias for the "+" operator.

This method is available for polygon, edge and edge pair layers.

The following images show the effect of the "join" method on polygons and edges (layer1: red, layer2: blue):

"length" - Returns the total length of the edges in the edge layer

Usage:

This method requires an edge layer. It returns the total length of all edges in micron. Merged semantics applies, i.e. before computing the length, the edges are merged unless raw mode is chosen (see raw). Hence in clean mode (see clean), overlapping edges are not counted twice.

"merge" - Merges the layer (modifies the layer)

Usage:

Like merged, but modifies the input and returns a reference to the new layer.

"merged" - Returns the merged layer

Usage:

Returns the merged input. Usually, merging is done implicitly using the clean state (which is default). However, in raw state, merging can be enforced by using this method. In addition, this method allows specification of a minimum overlap count, i.e. only where at least the given number of polygons overlap, output is produced. See sized for an application of that.

This method works both on edge or polygon layers. Edge merging forms single, continuous edges from coincident and connected individual edges.

A version that modifies the input layer is merge.

The following images show the effect of various forms of the "merged" method:

"middle" - Returns the center points of the bounding boxes of the polygons

Usage:

This method produces markers on the centers of the polygon's bounding box centers. These markers can be point-like edges or small 2x2 DBU boxes. The latter is the default. A more generic function is extent_refs. "middle" is basically a synonym for "extent_refs(:center)".

The options available are:

The following image shows the effect of this method

"move" - Moves (shifts, translates) a layer (modifies the layer)

Usage:

Moved the input by the given distance. The layer that this method is called upon is modified and the modified version is returned for further processing.

Shift distances can be given as floating-point values (in micron) or integer values (in database units). To explicitly specify the unit, use the unit denominators.

"moved" - Moves (shifts, translates) a layer

Usage:

Moves the input layer by the given distance (x, y) and returns the moved layer. The layer that this method is called upon is not modified.

Shift distances can be given as floating-point values (in micron) or integer values (in database units). To explicitly specify the unit, use the unit denominators.

The following images shows the effect of the "moved" method:

"non_rectangles" - Selects all polygons from the input which are not rectangles

Usage:

This method is available for polygon layers. By default "merged" semantics applies, i.e. all polygons are merged before non-rectangles are selected (see clean and raw).

"non_rectilinear" - Selects all non-rectilinear polygons from the input

Usage:

This method is available for polygon layers. By default "merged" semantics applies, i.e. all polygons are merged before non-rectilinear polygons are selected (see clean and raw).

"non_strict" - Marks a layer for non-strict handling

Usage:

See strict for details about this option.

This feature has been introduced in version 0.23.2.

"not" - Boolean NOT operation

Usage:

The method computes a boolean NOT between self and other. It is an alias for the "-" operator.

This method is available for polygon and edge layers. If the first operand is an edge layer and the second is an edge layer, the result will be the edges of the first operand which are outside the polygons of the second operand.

The following images show the effect of the "not" method on polygons and edges (layer1: red, layer2: blue):

"not_in" - Selects shapes or regions of self which are not contained in the other layer

Usage:

This method selects all shapes or regions from self which are not contained the other region exactly. It will use individual shapes from self or other if the respective region is in raw mode. If not, it will use coherent regions or combined edges from self or other.

It will return a new layer containing the selected shapes. A method which selects all shapes contained in the other layer is in.

This method is available for polygon and edge layers.

The following image shows the effect of the "not_in" method (input1: red, input2: blue):

"not_inside" - Selects shapes or regions of self which are not inside the other region

Usage:

This method selects all shapes or regions from self which are not inside the other region. completely (completely covered by polygons from the other region). If self is in raw mode, this method will select individual shapes. Otherwise, this method will select coherent regions and no part of these regions may be outside the other region. It returns a new layer containing the selected shapes. A version which modifies self is select_not_inside.

This method is available for polygon layers.

The following image shows the effect of the "not_inside" method (input1: red, input2: blue):

"not_interacting" - Selects shapes or regions of self which do not touch or overlap shapes from the other region

Usage:

This method selects all shapes or regions from self which do not touch or overlap shapes from the other region. Unless self is in raw mode (see raw), coherent regions are selected from self, otherwise individual shapes are selected. It returns a new layer containing the selected shapes. A version which modifies self is select_not_interacting.

This method is available for polygon and edge layers. Edges can be selected with respect to other edges or polygons.

The following image shows the effect of the "not_interacting" method (input1: red, input2: blue):

"not_outside" - Selects shapes or regions of self which are not outside the other region

Usage:

This method selects all shapes or regions from self which are not completely outside the other region (part of these shapes or regions may be covered by shapes from the other region). If self is in raw mode, this method will select individual shapes. Otherwise, this method will select coherent regions and no part of these regions may overlap with shapes from the other region. It returns a new layer containing the selected shapes. A version which modifies self is select_not_outside.

This method is available for polygon layers.

The following image shows the effect of the "not_outside" method (input1: red, input2: blue):

"not_overlapping" - Selects shapes or regions of self which do not overlap shapes from the other region

Usage:

This method selects all shapes or regions from self which do not overlap shapes from the other region. Unless self is in raw mode (see raw), coherent regions are selected from self, otherwise individual shapes are selected.

The "not_overlapping" method is equivalent to the outside method. It is provided as an alias for consistency.

This method is available for polygon and edge layers. Edges can be selected with respect to other edges or polygons. It returns a new layer containing the selected shapes. A version which modifies self is select_not_overlapping.

"notch" - An intra-region spacing check

Usage:

See space for a description of this method. In contrast to space, this method is available for polygon layers only, since only on such layers different polygons can be identified.

The following image shows the effect of the notch check:

"odd_polygons" - Checks for odd polygons (self-overlapping, non-orientable)

Usage:

Returns the parts of the polygons which are not orientable (i.e. "8" configuration) or self-overlapping. Merged semantics does not apply for this method. Always the raw polygons are taken (see raw).

"ongrid" - Checks for on-grid vertices

Usage:

Returns a single-vertex marker for each vertex whose x coordinate is not a multiple of g or gx or whose y coordinate is not a multiple of g or gy. The single-vertex markers are edge pair objects which describe a single point. When setting the grid to 0, no grid check is performed in that specific direction.

This method requires a polygon layer. Merged semantics applies (see raw and clean).

"or" - Boolean OR operation

Usage:

The method computes a boolean OR between self and other. It is an alias for the "|" operator.

This method is available for polygon and edge layers.

The following images show the effect of the "or" method on polygons and edges (layer1: red, layer2: blue):

"output" - Outputs the content of the layer

Usage:

This method will copy the content of the layer to the specified output.

If a report database is selected for the output, the specification has to include a category name and optionally a category description.

If the layout is selected for the output, the specification can consist of one to three parameters: a layer number, a data type (optional, default is 0) and a layer name (optional). Alternatively, the output can be specified by a single LayerInfo object.

See global#report and global#target on how to configure output to a target layout or report database.

"outside" - Selects shapes or regions of self which are outside the other region

Usage:

This method selects all shapes or regions from self which are completely outside the other region (no part of these shapes or regions may be covered by shapes from the other region). If self is in raw mode, this method will select individual shapes. Otherwise, this method will select coherent regions and no part of these regions may overlap with shapes from the other region. It returns a new layer containing the selected shapes. A version which modifies self is select_outside.

This method is available for polygon layers.

The following image shows the effect of the "outside" method (input1: red, input2: blue):

"outside_part" - Returns the parts of the edges outside the given region

Usage:

This method returns the parts of the edges which are outside the given region. This is similar to the "&" operator, but this method does not remove edges that are exactly on the boundaries of the polygons of the region.

This method is available for edge layers. The argument must be a polygon layer.

"overlap" - An overlap check

Usage:

This method checks whether layer and other_layer overlap by at least the given length. Locations, where this is not the case will be reported in form of edge pair error markers. Locations, where both layers touch will be reported as errors as well. Formally such locations form an overlap with a value of 0. Locations, where both regions do not overlap or touch will not be reported. Such regions can be detected with outside or by a boolean "not".

Formally, the overlap method is a two-layer width check. In contrast to the single- layer width method (width), the zero value also triggers an error and separate polygons are checked against each other, while for the single-layer width, only single polygons are considered.

The overlap method can be applied to both edge or polygon layers. On edge layers the orientation of the edges matters: only edges which run back to back with their inside side pointing towards each other are checked for distance.

As for the other DRC methods, merged semantics applies. The options available are the same than for width. Distance values can be given as floating-point values (in micron) or integer values (in database units). To explicitly specify the unit, use the unit denominators.

The following images show the effect of the overlap check (layer1: red, layer2: blue):

"overlapping" - Selects shapes or regions of self which overlap shapes from the other region

Usage:

This method selects all shapes or regions from self which overlap shapes from the other region. Unless self is in raw mode (see raw), coherent regions are selected from self, otherwise individual shapes are selected. It returns a new layer containing the selected shapes. A version which modifies self is select_overlapping.

This method is available for polygon and edge layers. Edges can be selected with respect to other edges or polygons.

The following image shows the effect of the "overlapping" method:

"perimeter" - Returns the total perimeter of the polygons in the region

Usage:

This method requires a polygon layer. It returns the total perimeter of all polygons in micron. Merged semantics applies, i.e. before computing the perimeter, the polygons are merged unless raw mode is chosen (see raw).

The returned value gives the perimeter in micrometer units.

"polygons" - Returns polygons from edge pairs

Usage:

This method applies to edge pair collections. The edge pairs will be converted into polygons connecting the edges the edge pairs are made of. In order to properly handle special edge pairs (coincident edges, point-like edges etc.) an enlargement parameter can be specified which will make the resulting polygon somewhat larger than the original edge pair. If the enlargement parameter is 0, special edge pairs with an area of 0 will be dropped.

"polygons?" - Returns true, if the layer is a polygon layer

Usage:

"pull_inside" - Selects shapes or regions of other which are inside polygons from the this region

Usage:

This method selects all shapes or regions from other which are inside polygons from this region. Unless other is in raw mode (see raw), coherent regions are selected from other, otherwise individual shapes are selected.

The functionality is similar to select_inside, but chosing shapes from other rather than from self. Because in deep mode the hierarchy reference comes from self, this method provides a way to pull shapes from other to the hierarchy to self.

This method is available for polygon layers. Other needs to be a polygon layer too.

"pull_interacting" - Selects shapes or edges of other which touch or overlap shapes from the this region

Usage:

This method selects all shapes or regions from other which touch or overlap shapes from this region. Unless other is in raw mode (see raw), coherent regions are selected from other, otherwise individual shapes are selected.

The functionality is similar to select_interacting, but chosing shapes from other rather than from self. Because in deep mode the hierarchy reference comes from self, this method provides a way to pull shapes from other to the hierarchy to self.

This method will neither modify self nor other.

This method is available for polygon layers. Other can be an edge or polygon layer. Edges or polygons can be selected with respect to polygons of self.

"pull_overlapping" - Selects shapes or regions of other which overlap shapes from the this region

Usage:

This method selects all shapes or regions from other which overlap shapes from this region. Unless other is in raw mode (see raw), coherent regions are selected from other, otherwise individual shapes are selected.

The functionality is similar to select_overlapping, but chosing shapes from other rather than from self. Because in deep mode the hierarchy reference comes from self, this method provides a way to pull shapes from other to the hierarchy to self.

This method is available for polygon layers. Other needs to be a polygon layer too.

"raw" - Marks a layer as raw

Usage:

A raw layer basically is the opposite of a "clean" layer (see clean). Polygons on a raw layer are considered "as is", i.e. overlapping polygons are not connected and inner edges may occur due to cut lines. Holes may not exists if the polygons are derived from a representation that does not allow holes (i.e. GDS2 files).

Note that this method will set the state of the layer. In combination with the fact, that copied layers are references to the original layer, this may lead to unexpected results:

l = ...
l2 = l1
... do something
l.raw
# now l2 is also a raw layer

To avoid that, use the dup method to create a real (deep) copy.

"rectangles" - Selects all rectangle polygons from the input

Usage:

This method is available for polygon layers. By default "merged" semantics applies, i.e. all polygons are merged before rectangles are selected (see clean and raw). non_rectangles will select all non-rectangles.

"rectilinear" - Selects all rectilinear polygons from the input

Usage:

This method is available for polygon layers. By default "merged" semantics applies, i.e. all polygons are merged before rectilinear polygons are selected (see clean and raw). non_rectilinear will select all non-rectangles.

"rotate" - Rotates a layer (modifies the layer)

Usage:

Rotates the input by the given angle (in degree). The layer that this method is called upon is modified and the modified version is returned for further processing.

"rotated" - Rotates a layer

Usage:

Rotates the input layer by the given angle (in degree) and returns the rotated layer. The layer that this method is called upon is not modified.

The following image shows the effect of the "rotated" method:

"rounded_corners" - Applies corner rounding to each corner of the polygon

Usage:

Inner (concave) corners are replaced by circle segments with a radius given by the "inner" parameter. Outer (convex) corners are relaced by circle segments with a radius given by the "outer" parameter.

The circles are approximated by polygons. "n" segments are used to approximate a full circle.

This method return a layer wit the modified polygons. Merged semantics applies for this method (see raw and clean). If used with tiling, the rounded_corners function may render invalid results because in tiling mode, not the whole merged region may be captured. In that case, inner edges may appear as outer ones and their corners will receive rounding.

The following image shows the effect of the "rounded_corners" method. The upper ends of the vertical bars are rounded with a smaller radius automatically because their width does not allow a larger radius.

"scale" - Scales a layer (modifies the layer)

Usage:

Scales the input. After scaling, features have a f times bigger dimension. The layer that this method is called upon is modified and the modified version is returned for further processing.

"scaled" - Scales a layer

Usage:

Scales the input layer and returns a new layer whose features have a f times bigger dimension. The layer that this method is called upon is not modified.

The following images shows the effect of the "scaled" method:

"second_edges" - Returns the second edges of an edge pair collection

Usage:

Applies to edge pair collections only. Returns the second edges of the edge pairs in the collection.

"select" - Selects edges, edge pairs or polygons based on evaluation of a block

Usage:

This method evaluates the block and returns a new container with those objects for which the block evaluates to true. It is available for edge, polygon and edge pair layers. The corresponding objects are DPolygon, DEdge or DEdgePair.

Because this method executes inside the interpreter, it's inherently slow. Tiling does not apply to this method.

Here is a (slow) equivalent of the area selection method:

new_layer = layer.select { |polygon| polygon.area >= 10.0 }

"select_inside" - Selects shapes or regions of self which are inside the other region

Usage:

This method selects all shapes or regions from self which are inside the other region. completely (completely covered by polygons from the other region). If self is in raw mode, this method will select individual shapes. Otherwise, this method will select coherent regions and no part of these regions may be outside the other region. It modifies self to contain the selected shapes. A version which does not modify self is inside.

This method is available for polygon layers.

"select_interacting" - Selects shapes or regions of self which touch or overlap shapes from the other region

Usage:

This method selects all shapes or regions from self which touch or overlap shapes from the other region. Unless self is in raw mode (see raw), coherent regions are selected from self, otherwise individual shapes are selected. It modifies self to contain the selected shapes. A version which does not modify self is interacting.

This method is available for polygon and edge layers. Edges can be selected with respect to other edges or polygons.

"select_not_inside" - Selects shapes or regions of self which are not inside the other region

Usage:

This method selects all shapes or regions from self which are not inside the other region. completely (completely covered by polygons from the other region). If self is in raw mode, this method will select individual shapes. Otherwise, this method will select coherent regions and no part of these regions may be outside the other region. It modifies self to contain the selected shapes. A version which does not modify self is not_inside.

This method is available for polygon layers.

"select_not_interacting" - Selects shapes or regions of self which do not touch or overlap shapes from the other region

Usage:

This method selects all shapes or regions from self which do not touch or overlap shapes from the other region. Unless self is in raw mode (see raw), coherent regions are selected from self, otherwise individual shapes are selected. It modifies self to contain the selected shapes. A version which does not modify self is not_interacting.

This method is available for polygon and edge layers. Edges can be selected with respect to other edges or polygons.

"select_not_outside" - Selects shapes or regions of self which are not outside the other region

Usage:

This method selects all shapes or regions from self which are not completely outside the other region (part of these shapes or regions may be covered by shapes from the other region). If self is in raw mode, this method will select individual shapes. Otherwise, this method will select coherent regions and no part of these regions may overlap with shapes from the other region. It modifies self to contain the selected shapes. A version which does not modify self is not_outside.

This method is available for polygon layers.

"select_not_overlapping" - Selects shapes or regions of self which do not overlap shapes from the other region

Usage:

This method selects all shapes or regions from self which do not overlap shapes from the other region. Unless self is in raw mode (see raw), coherent regions are selected from self, otherwise individual shapes are selected. It modifies self to contain the selected shapes. A version which does not modify self is not_overlapping.

This method is available for polygon and edge layers. Edges can be selected with respect to other edges or polygons.

"select_outside" - Selects shapes or regions of self which are outside the other region

Usage:

This method selects all shapes or regions from self which are completely outside the other region (no part of these shapes or regions may be covered by shapes from the other region). If self is in raw mode, this method will select individual shapes. Otherwise, this method will select coherent regions and no part of these regions may overlap with shapes from the other region. It modifies self to contain the selected shapes. A version which does not modify self is outside.

This method is available for polygon layers.

"select_overlapping" - Selects shapes or regions of self which overlap shapes from the other region

Usage:

This method selects all shapes or regions from self which overlap shapes from the other region. Unless self is in raw mode (see raw), coherent regions are selected from self, otherwise individual shapes are selected. It modifies self to contain the selected shapes. A version which does not modify self is overlapping.

This method is available for polygon and edge layers. Edges can be selected with respect to other edges or polygons.

"sep" - An alias for "separation"

Usage:

See separation for a description of that method

"separation" - A two-layer spacing check

Usage:

This method performs a two-layer spacing check. Like space, this method can be applied to edge or polygon layers. Locations where edges of the layer are closer than the specified distance to the other layer are reported as edge pair error markers.

In contrast to the space and related methods, locations where both layers touch are also reported. More specifically, the case of zero spacing will also trigger an error while for space it will not.

As for the other DRC methods, merged semantics applies. The options available are the same than for width. Distance values can be given as floating-point values (in micron) or integer values (in database units). To explicitly specify the unit, use the unit denominators.

The following image shows the effect of the separation check (layer1: red, layer2: blue):

"size" - Polygon sizing (per-edge biasing, modifies the layer)

Usage:

See sized. The size method basically does the same but modifies the layer it is called on. The input layer is returned and available for further processing.

"sized" - Polygon sizing (per-edge biasing)

Usage:

This method requires a polygon layer. It will apply a bias per edge of the polygons and return the biased layer. The layer that this method is called on is not modified.

In the single-value form, that bias is applied both in horizontal or vertical direction. In the two-value form, the horizontal and vertical bias can be specified separately.

The mode defines how to handle corners. The following modes are available:

Merged semantics applies, i.e. polygons will be merged before the sizing is applied unless the layer was put into raw mode (see raw). On output, the polygons are not merged immediately, so it is possible to detect overlapping regions after a positive sizing using raw and merged with an overlap count, for example:

layer.sized(300.nm).raw.merged(2)

Bias values can be given as floating-point values (in micron) or integer values (in database units). To explicitly specify the unit, use the unit denominators.

size is working like sized but modifies the layer it is called on.

The following images show the effect of various forms of the "sized" method:

"smoothed" - Smoothes the polygons of the region

Usage:

"Smoothing" returns a simplified version of the polygons. Simplification is achieved by removing vertices unless the resulting polygon deviates by more than the given distance d from the original polygon.

This method return a layer wit the modified polygons. Merged semantics applies for this method (see raw and clean).

"snap" - Brings each vertex on the given grid (g or gx/gy for x or y direction)

Usage:

Shifts each off-grid vertex to the nearest on-grid location. If one grid is given, this grid is applied to x and y coordinates. If two grids are given, gx is applied to the x coordinates and gy is applied to the y coordinates. If 0 is given as a grid, no snapping is performed in that direction.

This method modifies the layer. A version that returns a snapped version of the layer without modifying the layer is snapped.

This method requires a polygon layer. Merged semantics applies (see raw and clean).

"snapped" - Returns a snapped version of the layer

Usage:

See snap for a description of the functionality. In contrast to snap, this method does not modify the layer but returns a snapped copy.

"space" - A space check

Usage:

This method performs a space check and returns a collection of edge pairs. A space check can be performed on polygon and edge layers. On edge layers, all edges are checked against all other edges. If two edges form a "face to face" relation (i.e. their outer sides face each other) and their distance is less than the specified value, an error shape is generated for that edge pair. On polygon layers, the polygons on each layer are checked for space against other polygons for locations where their space is less than the specified value. In that case, an edge pair error shape is generated. The space check will also check the polygons for space violations against themselves, i.e. notches violating the space condition are reported.

The notch method is similar, but will only report self-space violations. The isolated method will only report space violations to other polygons. separation is a two-layer space check where space is checked against polygons of another layer.

The options available are the same than for the width method. Like for the width method, merged semantics applies. Distance values can be given as floating-point values (in micron) or integer values (in database units). To explicitly specify the unit, use the unit denominators.

The following image shows the effect of the space check:

"start_segments" - Returns the part at the beginning of each edge

Usage:

This method will return a partial edge for each edge in the input, located and the end of the original edge. The new edges will share the start point with the original edges, but not necessarily their end points. For further details about the orientation of edges and the parameters of this method, see end_segments.

The following images show the effect of the method:

"strict" - Marks a layer for strict handling

Usage:

If a layer is marked for strict handling, some optimizations are disabled. Specifically for boolean operations, the results will also be merged if one input is empty. For boolean operations, strict handling should be enabled for both inputs. Strict handling is disabled by default.

See non_strict about how to reset this mode.

This feature has been introduced in version 0.23.2.

"strict?" - Returns true, if strict handling is enabled for this layer

Usage:

See strict for a discussion of strict handling.

This feature has been introduced in version 0.23.2.

"texts" - Selects texts from an original layer

Usage:

This method can be applied to original layers - i.e. ones that have been created with input. By default, a small box (2x2 DBU) will be produced on each selected text. By using the "as_dots" option, degenerated point-like edges will be produced.

Texts can be selected either by exact match string or a pattern match with a glob-style pattern. By default, glob-style pattern are used. The options available are:

Here are some examples:

# Selects all texts
t = input(1, 0).texts
# Selects all texts beginning with an "A"
t = input(1, 0).texts("A*")
t = input(1, 0).texts(pattern("A*"))
# Selects all texts whose string is "A*"
t = input(1, 0).texts(text("A*"))

"transform" - Transforms a layer (modifies the layer)

Usage:

Like transform, but modifies the input and returns a reference to it for further processing.

"transformed" - Transforms a layer

Usage:

Transforms the input layer by the given transformation and returns the moved layer. The layer that this method is called upon is not modified. This is the most generic method is transform a layer. The transformation is a DCplxTrans object which describes many different kinds of affine transformations except shear and anisotropic magnification.

The following image shows the effect of the "moved" method:

"width" - A width check

Usage:

This method performs a width check and returns a collection of edge pairs. A width check can be performed on polygon and edge layers. On edge layers, all edges are checked against all other edges. If two edges form a "back to back" relation (i.e. their inner sides face each other) and their distance is less than the specified value, an error shape is generated for that edge pair. On polygon layers, the polygons on each layer are checked for locations where their width is less than the specified value. In that case, an edge pair error shape is generated.

The options available are:

Note that without the angle_limit, acute corners will always be reported, since two connected edges always violate the width in the corner. By adjusting the angle_limit, an acute corner check can be implemented.

Merge semantics applies to this method, i.e. disconnected polygons are merged before the width is checked unless "raw" mode is chosen.

The resulting edge pairs can be converted to polygons using the polygons method.

Distance values can be given as floating-point values (in micron) or integer values (in database units). To explicitly specify the unit, use the unit denominators, i.e.

# width check for 1.5 micron:
markers = in.width(1.5)
# width check for 2 database units:
markers = in.width(2)
# width check for 2 micron:
markers = in.width(2.um)
# width check for 20 nanometers:
markers = in.width(20.nm)

The following images show the effect of various forms of the width check:

"with_angle" - Selects edges by their angle

Usage:

When called on an edge layer, the method selects edges by their angle, measured against the horizontal axis in the mathematical sense. The first version selects edges with a angle larger or equal to min and less than max (but not equal). The second version selects edges with exactly the given angle. The third version is identical to the first one.

When called on a polygon layer, this method selects corners which match the given angle or is within the given angle interval. The angle is measured between the edges forming the corner. For each corner, an edge pair containing the edges forming in the angle is returned.

A method delivering all objects not matching the angle criterion is without_angle.

The following images demonstrate some use cases of with_angle and without_angle:

"with_area" - Selects polygons by area

Usage:

The first form will select all polygons with an area larger or equal to min and less (but not equal to) max. The second form will select the polygons with exactly the given area. The third form basically is equivalent to the first form, but allows specification of nil for min or max indicating no lower or upper limit.

"with_bbox_height" - Selects polygons by the height of the bounding box

Usage:

The method selects polygons similar to with_area or with_perimeter. However, the measured dimension is the width of the bounding box.

This method is available for polygon layers only.

"with_bbox_max" - Selects polygons by the maximum dimension of the bounding box

Usage:

The method selects polygons similar to with_area or with_perimeter. However, the measured dimension is the maximum dimension of the bounding box. The maximum dimension is either the width or height of the bounding box, whichever is larger.

This method is available for polygon layers only.

"with_bbox_min" - Selects polygons by the minimum dimension of the bounding box

Usage:

The method selects polygons similar to with_area or with_perimeter. However, the measured dimension is the minimum dimension of the bounding box. The minimum dimension is either the width or height of the bounding box, whichever is smaller.

This method is available for polygon layers only.

"with_bbox_width" - Selects polygons by the width of the bounding box

Usage:

The method selects polygons similar to with_area or with_perimeter. However, the measured dimension is the width of the bounding box.

This method is available for polygon layers only.

"with_length" - Selects edges by their length

Usage:

The method selects edges by their length. The first version selected edges with a length larger or equal to min and less than max (but not equal). The second version selects edges with exactly the given length. The third version is similar to the first one, but allows specification of nil for min or max indicating that there is no lower or upper limit.

This method is available for edge layers only.

"with_perimeter" - Selects polygons by perimeter

Usage:

The first form will select all polygons with an perimeter larger or equal to min and less (but not equal to) max. The second form will select the polygons with exactly the given perimeter. The third form basically is equivalent to the first form, but allows specification of nil for min or max indicating no lower or upper limit.

This method is available for polygon layers only.

"without_angle" - Selects edges by the their angle

Usage:

The method basically is the inverse of with_angle. It selects all edges of the edge layer or corners of the polygons which do not have the given angle (second form) or whose angle is not inside the given interval (first and third form).

"without_area" - Selects polygons by area

Usage:

This method is the inverse of "with_area". It will select polygons without an area equal to the given one or outside the given interval.

This method is available for polygon layers only.

"without_bbox_height" - Selects polygons by the height of the bounding box

Usage:

The method selects polygons similar to without_area or without_perimeter. However, the measured dimension is the width of the bounding box.

This method is available for polygon layers only.

"without_bbox_max" - Selects polygons by the maximum dimension of the bounding box

Usage:

The method selects polygons similar to without_area or without_perimeter. However, the measured dimension is the maximum dimension of the bounding box. The minimum dimension is either the width or height of the bounding box, whichever is larger.

This method is available for polygon layers only.

"without_bbox_min" - Selects polygons by the minimum dimension of the bounding box

Usage:

The method selects polygons similar to without_area or without_perimeter. However, the measured dimension is the minimum dimension of the bounding box. The minimum dimension is either the width or height of the bounding box, whichever is smaller.

This method is available for polygon layers only.

"without_bbox_width" - Selects polygons by the width of the bounding box

Usage:

The method selects polygons similar to without_area or without_perimeter. However, the measured dimension is the width of the bounding box.

This method is available for polygon layers only.

"without_length" - Selects edges by the their length

Usage:

The method basically is the inverse of with_length. It selects all edges of the edge layer which do not have the given length (second form) or are not inside the given interval (first and third form).

This method is available for edge layers only.

"without_perimeter" - Selects polygons by perimeter

Usage:

This method is the inverse of "with_perimeter". It will select polygons without a perimeter equal to the given one or outside the given interval.

This method is available for polygon layers only.

"xor" - Boolean XOR operation

Usage:

The method computes a boolean XOR between self and other. It is an alias for the "^" operator.

This method is available for polygon and edge layers.

The following images show the effect of the "xor" method on polygons and edges (layer1: red, layer2: blue):

"|" - Boolean OR operation

Usage:

The method computes a boolean OR between self and other. A similar operation is join which will basically gives the same result but won't merge the shapes.

This method is available for polygon and edge layers. An alias is "or". See there for a description of the function.