Primitive#

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

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

Examples

>>> from pyedb import Edb
>>> edb = Edb("myedb", version="2026.1", grpc=True)
>>> edb_prim = edb.layout.primitives[0]

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.

points_raw

Return a list of Edb points.

expand

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

plot

Plot the current polygon on matplotlib.

delete

Delete the primitive.

type

Type of the primitive.

layout

Layout object.

polygon_data

Polygon data.

object_instance

Layout object instance.

net_name

Net name.

layer_name

Layer name.

voids

Primitive voids.

has_voids

Check if primitive has voids.

is_negative

Check if primitive is negative.

is_parameterized

Check if any primitive is parameterized.

is_zone_primitive

Check if primitive is a zone primitive.

can_be_zone_primitive

Check if primitive can be a zone primitive.

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.

id

Primitive ID. This is the same as edb_uid, long Int.

edb_uid

Primitive EDB UID. This is the same as id, long Int.

primitive_type

Primitive type.

net

is_void

Check if the primitive is a void.

is_null

Check if the primitive is null.

layer

Get the layer object of the primitive.

Import detail#

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

Property detail#

property Primitive.type: str#

Type of the primitive.

Returns:
str

Primitive type. Options are "circle", "rectangle", "polygon", "path", or "bondwire".

property Primitive.layout#

Layout object.

Returns:
Layout
property Primitive.polygon_data#

Polygon data.

Returns:
PolygonData
property Primitive.object_instance#

Layout object instance.

Returns:
LayoutObjInstance
property Primitive.net_name: str | None#

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.has_voids: bool#

Check if primitive has voids.

Returns:
bool
property Primitive.is_negative: bool#

Check if primitive is negative.

Returns:
bool
property Primitive.is_parameterized: bool#

Check if any primitive is parameterized.

Returns:
bool

True if any primitive is parameterized, False otherwise.

property Primitive.is_zone_primitive: bool#

Check if primitive is a zone primitive.

Returns:
bool

True if primitive is a zone primitive, False otherwise.

property Primitive.can_be_zone_primitive: bool#

Check if primitive can be a zone primitive.

Returns:
bool

True if primitive can be a zone primitive, False otherwise.

property Primitive.aedt_name: str#

Name to be visualized in AEDT.

Returns:
str

Name.

property Primitive.center: tuple[float, float]#

Return the primitive bounding box center coordinate.

Returns:
List[float]

[x, y]

property Primitive.bbox: list[float]#

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

Returns:
List[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.id: int#

Primitive ID. This is the same as edb_uid, long Int.

Returns:
int

Primitive ID.

property Primitive.edb_uid: int#

Primitive EDB UID. This is the same as id, long Int.

Returns:
int

Primitive EDB UID.

property Primitive.primitive_type: str#

Primitive type.

Returns:
str

Primitive type, such as “circle”, “rectangle”, “polygon”, “path” or “bondwire”.

property Primitive.net: pyedb.grpc.database.net.net.Net#
property Primitive.is_void#

Check if the primitive is a void.

Returns:
bool

True if the primitive is a void, False otherwise.

property Primitive.is_null#

Check if the primitive is null.

Returns:
bool

True if the primitive is null, False otherwise.

property Primitive.layer#

Get the layer object of the primitive.

Returns:
Layer

Layer object.

Attribute detail#

Primitive.core#

Method detail#

Primitive.get_connected_objects() list[Any]#

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

Area value.

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() pyedb.grpc.database.primitive.polygon.Polygon | bool#

Convert path to polygon.

Returns:
Polygon

Polygon when successful, False when failed.

Primitive.intersection_type(primitive) int#

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[float] or PointData

Point coordinates as [x, y] or a PointData object.

Returns:
list[float]

Closest point coordinates as [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 degrees.

centerlist[float or str], optional

Center point as [x, y]. If None, rotation is done from the polygon center.

Returns:
bool

True when successful, False when failed.

Primitive.move(vector) bool#

Move polygon along a vector.

Parameters:
vectorlist[float or str]

Translation vector as [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[float or str], optional

Center point as [x, y]. If None, scaling is done from the 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 PointData

Point coordinates as [x, y] or a PointData object.

Returns:
list[float]

Closest arc midpoint coordinates as [x, y].

Primitive.add_void(point_list) bool#

Add a void to current primitive.

Parameters:
point_listlist[Primitive] or list[list[float]]

Primitive object or list of points in the format [[x1, y1], [x2, y2], ..., [xn, yn]].

Returns:
bool

True if successful, False otherwise.

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

Return the list of points with arcs converted to segments.

Parameters:
arc_segmentsint, optional

Number of facets to convert an arc. The default is 6.

Returns:
tuple[list[float], list[float]] or None

Tuple of (x, y) coordinate lists, or None if no points are found.

Primitive.points_raw()#

Return a list of Edb points.

Returns:
List[PointData]
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.

Primitive.delete()#

Delete the primitive.