Modeler#

class pyedb.dotnet.database.modeler.Modeler(p_edb)#

Bases: object

Manages EDB methods for primitives management accessible from Edb.modeler property.

Examples

>>> from pyedb import Edb
>>> edbapp = Edb("myaedbfolder", edbversion="2021.2")
>>> edb_layout = edbapp.modeler

Overview#

get_primitive

Retrieve primitive from give id.

get_polygons_by_layer

Retrieve polygons by a layer.

get_primitive_by_layer_and_point

Return primitive given coordinate point [x, y], layer name and nets.

get_polygon_bounding_box

Retrieve a polygon bounding box.

get_polygon_points

Retrieve polygon points.

parametrize_polygon

Parametrize pieces of a polygon based on another polygon.

create_trace

Create a trace based on a list of points.

create_polygon

Create a polygon based on a list of points and voids.

create_polygon_from_points

Create a new polygon from a point list.

create_rectangle

Create rectangle.

create_circle

Create a circle on a specified layer.

delete_primitives

Delete primitives by net names.

get_primitives

Get primitives by conditions.

fix_circle_void_for_clipping

Fix issues when circle void are clipped due to a bug in EDB.

add_void

Add a void into a shape.

shape_to_polygon_data

Convert a shape to polygon data.

parametrize_trace_width

Parametrize a Trace on specific layer or all stackup.

unite_polygons_on_layer

Try to unite all Polygons on specified layer.

defeature_polygon

Defeature the polygon based on the maximum surface deviation criteria.

get_layout_statistics

Return EDBStatistics object from a layout.

create_bondwire

Create a bondwire object.

create_pin_group

Create a PinGroup.

db

Db object.

layers

Dictionary of layers.

primitives

Primitives.

polygons_by_layer

Primitives with layer names as keys.

primitives_by_net

Primitives with net names as keys.

primitives_by_layer

Primitives with layer names as keys.

rectangles

Rectangles.

circles

Circles.

paths

Paths.

polygons

Polygons.

__getitem__

Get a layout instance from the Edb project.

Import detail#

from pyedb.dotnet.database.modeler import Modeler

Property detail#

property Modeler.db#

Db object.

property Modeler.layers#

Dictionary of layers.

Returns:
dict

Dictionary of layers.

property Modeler.primitives#

Primitives.

Returns:
list of pyedb.dotnet.database.edb_data.primitives_data.Primitive

List of primitives.

property Modeler.polygons_by_layer#

Primitives with layer names as keys.

Returns:
dict

Dictionary of primitives with layer names as keys.

property Modeler.primitives_by_net#

Primitives with net names as keys.

Returns:
dict

Dictionary of primitives with nat names as keys.

property Modeler.primitives_by_layer#

Primitives with layer names as keys.

Returns:
dict

Dictionary of primitives with layer names as keys.

property Modeler.rectangles#

Rectangles.

Returns:
list of pyedb.dotnet.database.edb_data.primitives_data.Primitive

List of rectangles.

property Modeler.circles#

Circles.

Returns:
list of pyedb.dotnet.database.edb_data.primitives_data.Primitive

List of circles.

property Modeler.paths#

Paths.

Returns:
list of pyedb.dotnet.database.edb_data.primitives_data.Primitive

List of paths.

property Modeler.polygons#

Polygons.

Returns:
list of pyedb.dotnet.database.edb_data.primitives_data.Primitive

List of polygons.

Method detail#

Modeler.__getitem__(name)#

Get a layout instance from the Edb project.

Parameters:
namestr, int
Returns:
pyedb.dotnet.database.cell.hierarchy.component.EDBComponent
Modeler.get_primitive(primitive_id)#

Retrieve primitive from give id.

Parameters:
primitive_idint

Primitive id.

Returns:
list of pyedb.dotnet.database.edb_data.primitives_data.Primitive

List of primitives.

Modeler.get_polygons_by_layer(layer_name, net_list=None)#

Retrieve polygons by a layer.

Parameters:
layer_namestr

Name of the layer.

net_listlist, optional

List of net names.

Returns:
list

List of primitive objects.

Modeler.get_primitive_by_layer_and_point(point=None, layer=None, nets=None)#

Return primitive given coordinate point [x, y], layer name and nets.

Parameters:
pointlist

Coordinate [x, y]

layerlist or str, optional

list of layer name or layer name applied on filter.

netslist or str, optional

list of net name or single net name applied on filter

Returns:
list of pyedb.dotnet.database.edb_data.primitives_data.Primitive

List of primitives, polygons, paths and rectangles.

Modeler.get_polygon_bounding_box(polygon)#

Retrieve a polygon bounding box.

Parameters:
polygon

Name of the polygon.

Returns:
list

List of bounding box coordinates in the format [-x, -y, +x, +y].

Examples

>>> poly = database.modeler.get_polygons_by_layer("GND")
>>> bounding = database.modeler.get_polygon_bounding_box(poly[0])
Modeler.get_polygon_points(polygon)#

Retrieve polygon points.

Note

For arcs, one point is returned.

Parameters:
polygon

class: dotnet.database.edb_data.primitives_data.Primitive

Returns:
list
List of tuples. Each tuple provides x, y point coordinate. If the length of two consecutives tuples

from the list equals 2, a segment is defined. The first tuple defines the starting point while the second tuple the ending one. If the length of one tuple equals one, that means a polyline is defined and the value is giving the arc height. Therefore to polyline is defined as starting point for the tuple before in the list, the current one the arc height and the tuple after the polyline ending point.

Examples

>>> poly = database.modeler.get_polygons_by_layer("GND")
>>> points = database.modeler.get_polygon_points(poly[0])
Modeler.parametrize_polygon(polygon, selection_polygon, offset_name='offsetx', origin=None)#

Parametrize pieces of a polygon based on another polygon.

Parameters:
polygon

Name of the polygon.

selection_polygon

Polygon to use as a filter.

offset_namestr, optional

Name of the offset to create. The default is "offsetx".

originlist, optional

List of the X and Y origins, which impacts the vector computation and is needed to determine expansion direction. The default is None, in which case the vector is computed from the polygon’s center.

Returns:
bool

True when successful, False when failed.

Modeler.create_trace(path_list, layer_name, width=1, net_name='', start_cap_style='Round', end_cap_style='Round', corner_style='Round')#

Create a trace based on a list of points.

Parameters:
path_listlist

List of points.

layer_namestr

Name of the layer on which to create the path.

widthfloat, optional

Width of the path. The default is 1.

net_namestr, optional

Name of the net. The default is "".

start_cap_stylestr, optional

Style of the cap at its start. Options are "Round", "Extended", and "Flat". The default is "Round".

end_cap_stylestr, optional

Style of the cap at its end. Options are "Round", "Extended", and "Flat". The default is "Round".

corner_stylestr, optional

Style of the corner. Options are "Round", "Sharp" and "Mitered". The default is "Round".

Returns:
pyedb.dotnet.database.edb_data.primitives_data.Primitive
Modeler.create_polygon(main_shape=None, layer_name='', voids=[], net_name='', points=None)#

Create a polygon based on a list of points and voids.

Parameters:
main_shapelist of points or PolygonData or modeler.Shape

Shape or point lists of the main object. Point list can be in the format of [[x1,y1], [x2,y2],..,[xn,yn]]. Each point can be: - [x, y] coordinate - [x, y, height] for an arc with specific height (between previous point and actual point) - [x, y, rotation, xc, yc] for an arc given a point, rotation and center.

layer_namestr

Name of the layer on which to create the polygon.

voidslist, optional

List of shape objects for voids or points that creates the shapes. The default is``[]``.

net_namestr, optional

Name of the net. The default is "".

pointslist, optional

Added for compatibility with grpc.

Returns:
bool, dotnet.database.edb_data.primitives.Primitive

Polygon when successful, False when failed.

Modeler.create_polygon_from_points(point_list, layer_name, net_name='')#

Create a new polygon from a point list.

Deprecated since version 0.6.73.

Use create_polygon() method instead. It now supports point lists as arguments.

Parameters:
point_listlist

Point list in the format of [[x1,y1], [x2,y2],..,[xn,yn]]. Each point can be: - [x,y] coordinate - [x,y, height] for an arc with specific height (between previous point and actual point) - [x,y, rotation, xc,yc] for an arc given a point, rotation and center.

layer_namestr

Name of layer on which create the polygon.

net_namestr, optional

Name of the net on which create the polygon.

Returns:
pyedb.dotnet.database.edb_data.primitives_data.Primitive
Modeler.create_rectangle(layer_name, net_name='', lower_left_point='', upper_right_point='', center_point='', width='', height='', representation_type='LowerLeftUpperRight', corner_radius='0mm', rotation='0deg')#

Create rectangle.

Parameters:
layer_namestr

Name of the layer on which to create the rectangle.

net_namestr

Name of the net. The default is "".

lower_left_pointlist

Lower left point when representation_type="LowerLeftUpperRight". The default is "".

upper_right_pointlist

Upper right point when representation_type="LowerLeftUpperRight". The default is "".

center_pointlist

Center point when representation_type="CenterWidthHeight". The default is "".

widthstr

Width of the rectangle when representation_type="CenterWidthHeight". The default is "".

heightstr

Height of the rectangle when representation_type="CenterWidthHeight". The default is "".

representation_typestr, optional

Type of the rectangle representation. The default is LowerLeftUpperRight. Options are "LowerLeftUpperRight" and "CenterWidthHeight".

corner_radiusstr, optional

Radius of the rectangle corner. The default is "0mm".

rotationstr, optional

Rotation of the rectangle. The default is "0deg".

Returns:
pyedb.dotnet.database.edb_data.primitives_data.Primitive

Rectangle when successful, False when failed.

Modeler.create_circle(layer_name, x, y, radius, net_name='')#

Create a circle on a specified layer.

Parameters:
layer_namestr

Name of the layer.

xfloat

Position on the X axis.

yfloat

Position on the Y axis.

radiusfloat

Radius of the circle.

net_namestr, optional

Name of the net. The default is None, in which case the default name is assigned.

Returns:
pyedb.dotnet.database.edb_data.primitives_data.Primitive

Objects of the circle created when successful.

Modeler.delete_primitives(net_names)#

Delete primitives by net names.

Parameters:
net_namesstr, list

Names of the nets to delete.

Returns:
bool

True when successful, False when failed.

References

>>> Edb.modeler.delete_primitives(net_names=["GND"])
Modeler.get_primitives(net_name=None, layer_name=None, prim_type=None, is_void=False)#

Get primitives by conditions.

Parameters:
net_namestr, optional

Set filter on net_name. Default is None.

layer_namestr, optional

Set filter on layer_name. Default is None.

prim_typestr, optional

Set filter on primitive type. Default is None.

is_voidbool

Set filter on is_void. Default is ‘False’

Returns
——-
list

List of filtered primitives

Modeler.fix_circle_void_for_clipping()#

Fix issues when circle void are clipped due to a bug in EDB.

Returns:
bool

True when successful, False when no changes were applied.

Modeler.add_void(shape, void_shape)#

Add a void into a shape.

Parameters:
shapePolygon

Shape of the main object.

void_shapelist, Path

Shape of the voids.

Modeler.shape_to_polygon_data(shape)#

Convert a shape to polygon data.

Parameters:
shapepyedb.dotnet.database.modeler.Modeler.Shape

Type of the shape to convert. Options are "rectangle" and "polygon".

Modeler.parametrize_trace_width(nets_name, layers_name=None, parameter_name='trace_width', variable_value=None)#

Parametrize a Trace on specific layer or all stackup.

Parameters:
nets_namestr, list

name of the net or list of nets to parametrize.

layers_namestr, optional

name of the layer or list of layers to which the net to parametrize has to be included.

parameter_namestr, optional

name of the parameter to create.

variable_valuestr, float, optional

value with units of parameter to create. If None, the first trace width of Net will be used as parameter value.

Returns:
bool
Modeler.unite_polygons_on_layer(layer_name=None, delete_padstack_gemometries=False, net_names_list=None)#

Try to unite all Polygons on specified layer.

Parameters:
layer_namestr, optional

Name of layer name to unite objects on. The default is None, in which case all layers are taken.

delete_padstack_gemometriesbool, optional

Whether to delete all padstack geometries. The default is False.

net_names_listlist[str]optional

Net names list filter. The default is [], in which case all nets are taken.

Returns:
bool

True is successful.

Modeler.defeature_polygon(poly, tolerance=0.001)#

Defeature the polygon based on the maximum surface deviation criteria.

Parameters:
maximum_surface_deviationfloat
polyEdb Polygon primitive

Polygon to defeature.

tolerancefloat, optional

Maximum tolerance criteria. The default is 0.001.

Returns:
bool

True when successful, False when failed.

Modeler.get_layout_statistics(evaluate_area=False, net_list=None)#

Return EDBStatistics object from a layout.

Parameters:
evaluate_areaoptional bool

When True evaluates the layout metal surface, can take time-consuming, avoid using this option on large design.

Returns:
EDBStatistics object.
Modeler.create_bondwire(definition_name, placement_layer, width, material, start_layer_name, start_x, start_y, end_layer_name, end_x, end_y, net, bondwire_type='jedec4', start_cell_instance_name=None)#

Create a bondwire object.

Parameters:
bondwire_typeBondwireType

Type of bondwire: kAPDBondWire or kJDECBondWire types.

definition_namestr

Bondwire definition name.

placement_layerstr

Layer name this bondwire will be on.

widthValue

Bondwire width.

materialstr

Bondwire material name.

start_layer_namestr

Name of start layer.

start_xValue

X value of start point.

start_yValue

Y value of start point.

end_layer_namestr

Name of end layer.

end_xValue

X value of end point.

end_yValue

Y value of end point.

netstr or Net or None

Net of the Bondwire.

start_cell_instance_nameNone

Added for grpc compatibility.

Returns:
pyedb.dotnet.database.dotnet.primitive.BondwireDotNet

Bondwire object created.

Modeler.create_pin_group(name: str, pins_by_id=None, pins_by_aedt_name=None, pins_by_name=None)#

Create a PinGroup.

Parameters:
namestr

Name of the PinGroup.

pins_by_idlist[int] or None

List of pins by ID.

pins_by_aedt_namelist[str] or None

List of pins by AEDT name.

pins_by_namelist[str] or None

List of pins by name.

Classes#

Shape

Shape class.