Primitive#

class pyedb.grpc.database.primitive.primitive.Primitive(pedb, edb_object)#

Bases: ansys.edb.core.primitive.primitive.Primitive

Manages EDB functionalities for a primitives. It inherits EDB Object properties.

Examples

>>> from pyedb import Edb
>>> edb = Edb(myedb, edbversion="2021.2")
>>> edb_prim = edb.modeler.primitives[0]
>>> edb_prim.is_void  # Class Property
>>> edb_prim.IsVoid()  # EDB Object Property

Overview#

get_connected_objects

Get connected objects.

area

Return the total area.

get_connected_object_id_set

Produce a list of all geometries physically connected to a given layout object.

convert_to_polygon

Convert path to polygon.

intersection_type

Get intersection type between actual primitive and another primitive or polygon data.

is_intersecting

Check if actual primitive and another primitive or polygon data intesects.

get_closest_point

Get the closest point of the primitive to the input data.

rotate

Rotate polygon around a center point by an angle.

move

Move polygon along a vector.

scale

Scales the polygon relative to a center point by a factor.

subtract

Subtract active primitive with one or more primitives.

intersect

Intersect active primitive with one or more primitives.

unite

Unite active primitive with one or more primitives.

get_closest_arc_midpoint

Get the closest arc midpoint of the primitive to the input data.

add_void

Add a void to current primitive.

points

Return the list of points with arcs converted to segments.

expand

Expand the polygon shape by an absolute value in all direction.

plot

Plot the current polygon on matplotlib.

type

Type of the primitive.

polygon_data

Polygon data.

object_instance

Layout object instance.

net_name

Net name.

layer_name

Layer name.

voids

Primitive voids.

aedt_name

Name to be visualized in AEDT.

center

Return the primitive bounding box center coordinate.

bbox

Return the primitive bounding box points. Lower left corner, upper right corner.

arcs

Get the Primitive Arc Data.

longest_arc

Longest arc.

shortest_arc

Longest arc.

points_raw

Return a list of Edb points.

Import detail#

from pyedb.grpc.database.primitive.primitive import Primitive

Property detail#

property Primitive.type: str#

Type of the primitive.

Expected output is among "Circle", "Rectangle",``”Polygon”,”Path”`` or "Bondwire".

Returns:
str
property Primitive.polygon_data#

Polygon data.

Returns:
PolygonData
property Primitive.object_instance#

Layout object instance.

Returns:
LayoutObjInstance
property Primitive.net_name: str#

Net name.

Returns:
str

Net name.

property Primitive.layer_name: str#

Layer name.

Returns:
str

Layer name.

property Primitive.voids: list[any]#

Primitive voids.

Returns:
List[Primitive
property Primitive.aedt_name: str#

Name to be visualized in AEDT.

Returns:
str

Name.

property Primitive.center: list[float]#

Return the primitive bounding box center coordinate.

Returns:
List[float, float]

[x, y]

property Primitive.bbox: list[float]#

Return the primitive bounding box points. Lower left corner, upper right corner.

Returns:
List[float, float, float, float]

[lower_left x, lower_left y, upper right x, upper right y]

property Primitive.arcs#

Get the Primitive Arc Data.

Returns:
ArcData
property Primitive.longest_arc: float#

Longest arc.

Returns:
float

Arc length.

property Primitive.shortest_arc: float#

Longest arc.

Returns:
float

Arc length.

property Primitive.points_raw#

Return a list of Edb points.

Returns:
List[PointData]

Method detail#

Primitive.get_connected_objects()#

Get connected objects.

Returns:
List[LayoutObjInstance]
Primitive.area(include_voids=True) float#

Return the total area.

Parameters:
include_voidsbool, optional

Either if the voids have to be included in computation. The default value is True.

Returns:
float
Primitive.get_connected_object_id_set() list[int]#

Produce a list of all geometries physically connected to a given layout object.

Returns:
List[int]

Found connected objects IDs with Layout object.

Primitive.convert_to_polygon()#

Convert path to polygon.

Returns:
Polygon

Polygon when successful, False when failed.

Primitive.intersection_type(primitive)#

Get intersection type between actual primitive and another primitive or polygon data.

Parameters:
primitivePolygon or PolygonData
Returns:
int

Intersection type: 0 - objects do not intersect, 1 - this object fully inside other (no common contour points), 2 - other object fully inside this, 3 - common contour points, 4 - undefined intersection.

Primitive.is_intersecting(primitive) bool#

Check if actual primitive and another primitive or polygon data intesects.

Parameters:
primitivePrimitive or PolygonData
Returns:
bool
Primitive.get_closest_point(point) list[float]#

Get the closest point of the primitive to the input data.

Parameters:
pointlist of float or PointData
Returns:
List[float, float]

[x, y].

Primitive.rotate(angle, center=None) bool#

Rotate polygon around a center point by an angle.

Parameters:
anglefloat

Value of the rotation angle in degree.

centerList of float or str [x,y], optional

If None rotation is done from polygon center.

Returns:
bool

True when successful, False when failed.

Primitive.move(vector) bool#

Move polygon along a vector.

Parameters:
vectorList of float or str [x,y].
Returns:
bool

True when successful, False when failed.

Examples

>>> edbapp = ansys.aedt.core.Edb("myproject.aedb")
>>> top_layer_polygon = [poly for poly in edbapp.modeler.polygons if poly.layer_name == "Top Layer"]
>>> for polygon in top_layer_polygon:
>>>     polygon.move(vector=["2mm", "100um"])
Primitive.scale(factor, center=None) bool#

Scales the polygon relative to a center point by a factor.

Parameters:
factorfloat

Scaling factor.

centerList of float or str [x,y], optional

If None scaling is done from polygon center.

Returns:
bool

True when successful, False when failed.

Primitive.subtract(primitives) list[any]#

Subtract active primitive with one or more primitives.

Parameters:
primitivesPrimitives

or: List[Primitives] or: class:PolygonData

Returns:
List[Primitive]

List of Primitive objects.

Primitive.intersect(primitives) list[any]#

Intersect active primitive with one or more primitives.

Parameters:
primitives :class:`Primitives `
or: List[:class:`Primitives `]
or: class:`PolygonData `
Returns:
List[Primitive]

List of Primitive objects.

Primitive.unite(primitives) list[any]#

Unite active primitive with one or more primitives.

Parameters:
primitivesPrimitives
or: List[:class:`Primitives `]
or: class:`PolygonData `
Returns:
List[Primitive]

List of Primitive objects.

Primitive.get_closest_arc_midpoint(point) list[float]#

Get the closest arc midpoint of the primitive to the input data.

Parameters:
pointList[float] or List[PointData]
Returns:
LIst[float, float]

[x, y].

Primitive.add_void(point_list) bool#

Add a void to current primitive.

Parameters:
point_listlist or Primitive or point list in the format of [[x1,y1], [x2,y2],..,[xn,yn]].
Returns:
bool

True if successful, either False.

Primitive.points(arc_segments=6) tuple[float, float]#

Return the list of points with arcs converted to segments.

Parameters:
arc_segmentsint

Number of facets to convert an arc. Default is 6.

Returns:
tuple(float, float)

(X, Y).

Primitive.expand(offset=0.001, tolerance=1e-12, round_corners=True, maximum_corner_extension=0.001) list[any]#

Expand the polygon shape by an absolute value in all direction. Offset can be negative for negative expansion.

Parameters:
offsetfloat, optional

Offset value in meters.

tolerancefloat, optional

Tolerance in meters.

round_cornersbool, optional

Whether to round corners or not. If True, use rounded corners in the expansion otherwise use straight edges (can be degenerate).

maximum_corner_extensionfloat, optional

The maximum corner extension (when round corners are not used) at which point the corner is clipped.

Primitive.plot(plot_net=False, show=True, save_plot=None)#

Plot the current polygon on matplotlib.

Parameters:
plot_netbool, optional

Whether if plot the entire net or only the selected polygon. Default is False.

showbool, optional

Whether if show the plot or not. Default is True.

save_plotstr, optional

Save the plot path.

Returns:
(ax, fig)

Matplotlib ax and figures.