Modeler#
- class pyedb.grpc.database.modeler.Modeler(p_edb)#
Bases:
objectManages EDB methods for primitives management accessible from Edb.modeler.
Examples
>>> from pyedb import Edb >>> edbapp = Edb("myaedbfolder", edbversion="2021.2") >>> edb_layout = edbapp.modeler
Overview#
Force reload of all primitives and reset indexes. |
|
Retrieve primitive from give id. |
|
Retrieve polygons by layer. |
|
Get primitive at specified point on layer. |
|
Get bounding box of polygon. |
|
Get points defining a polygon. |
|
Parametrize polygon points based on another polygon. |
|
Create trace path. |
|
Create polygon primitive. |
|
Create rectangle primitive. |
|
Create circle primitive. |
|
Create text primitive. |
|
Delete primitives by net name(s). |
|
Get primitives with filtering. |
|
Fix circle void clipping issues. |
|
Parametrize trace width. |
|
Unite polygons on layer. |
|
Defeature polygon. |
|
Get layout statistics. |
|
Create bondwire. |
|
Create pin group. |
|
Insert a layout instance into the active layout. |
|
Insert a 3D component placement into the active layout. |
|
Insert a 3D component placement into the active layout. |
|
Insert a layout instance into the active layout. |
|
Create an RF trace taper polygon between two points. |
|
Create solder mask openings for components, voids, and traces. |
Primitives. |
|
Primitives organized by layer names. |
|
Primitives with layer names as keys. |
|
All rectangle primitives. |
|
All circle primitives. |
|
All path primitives. |
|
All text primitives. |
|
All polygon primitives. |
|
Primitives with net names as keys. |
Add void to shape. |
Get a primitive by name or ID. |
Import detail#
from pyedb.grpc.database.modeler import Modeler
Property detail#
- property Modeler.primitives#
Primitives.
Deprecated since version 0.70.0: Use
edb.layout.primitivesinstead.- Returns:
listofpyedb.grpc.database.primitives.PrimitiveList of primitives.
- property Modeler.primitives_by_layer#
Primitives organized by layer names.
Deprecated since version 0.70.0.
use layout.primitives_by_layer property instead.
- property Modeler.polygons_by_layer: dict[str, List[pyedb.grpc.database.primitive.polygon.Polygon]]#
Primitives with layer names as keys.
Deprecated since version 0.70.0.
use layout.polygons_by_layer property instead.
- Returns:
dictDictionary of polygons with layer names as keys.
- property Modeler.rectangles: List[pyedb.grpc.database.primitive.rectangle.Rectangle | pyedb.grpc.database.primitive.primitive.Primitive]#
All rectangle primitives.
- Returns:
listList of
pyedb.grpc.database.edb_data.primitives_data.Rectangleobjects.
- property Modeler.circles: List[pyedb.grpc.database.primitive.circle.Circle | pyedb.grpc.database.primitive.primitive.Primitive]#
All circle primitives.
Deprecated since version 0.70.0.
use layout.circles instead.
- Returns:
listList of
pyedb.grpc.database.edb_data.primitives_data.Circleobjects.
- property Modeler.paths: List[pyedb.grpc.database.primitive.path.Path | pyedb.grpc.database.primitive.primitive.Primitive]#
All path primitives.
Deprecated since version 0.70.0.
use layout.paths instead.
- Returns:
listList of
pyedb.grpc.database.edb_data.primitives_data.Pathobjects.
- property Modeler.texts: List[pyedb.grpc.database.primitive.text.Text | pyedb.grpc.database.primitive.primitive.Primitive]#
All text primitives.
- Returns:
listList of
pyedb.grpc.database.edb_data.primitives_data.Textobjects.
- property Modeler.polygons: List[pyedb.grpc.database.primitive.polygon.Polygon | pyedb.grpc.database.primitive.primitive.Primitive]#
All polygon primitives.
Deprecated since version 0.70.0.
use layout.polygons instead.
- Returns:
listList of
pyedb.grpc.database.primitive.polygon.Polygonobjects.
- property Modeler.primitives_by_net: dict[str, List[pyedb.grpc.database.primitive.primitive.Primitive]]#
Primitives with net names as keys.
Deprecated since version 0.70.0.
use layout.primitives_by_net instead.
- Returns:
dictDictionary of primitives with net names as keys.
Method detail#
- Modeler.__getitem__(name: str | int) pyedb.grpc.database.primitive.primitive.Primitive#
Get a primitive by name or ID.
- Parameters:
- Returns:
pyedb.grpc.database.primitive.primitive.PrimitivePrimitive instance if found, None otherwise.
- Raises:
TypeErrorIf name is not str or int.
- Modeler.clear_cache()#
Force reload of all primitives and reset indexes.
- Modeler.get_primitive(primitive_id: int) list[pyedb.grpc.database.primitive.primitive.Primitive]#
Retrieve primitive from give id.
Deprecated since version 0.70.0.
use layout.find_object_by_id method instead.
- Parameters:
- primitive_id
int Primitive id.
- primitive_id
- Returns:
listofpyedb.grpc.database.primitive.primitive.PrimitiveList of primitives.
- Modeler.get_polygons_by_layer(layer_name: str, net_list: List[str] | None = None) List[pyedb.grpc.database.primitive.primitive.Primitive]#
Retrieve polygons by layer.
Deprecated since version 0.70.0.
use layout.get_polygons_by_layer method instead.
- Modeler.get_primitive_by_layer_and_point(point: List[float] | None = None, layer: str | List[str] | None = None, nets: str | List[str] | None = None) List[pyedb.grpc.database.primitive.primitive.Primitive]#
Get primitive at specified point on layer.
- Modeler.get_polygon_bounding_box(polygon: pyedb.grpc.database.primitive.primitive.Primitive) List[float]#
Get bounding box of polygon.
Deprecated since version 0.70.0.
use layout.get_polygon_bounding_box method instead.
- Parameters:
- polygon
pyedb.grpc.database.edb_data.primitives_data.Primitive Polygon primitive.
- polygon
- Returns:
listBounding box coordinates [min_x, min_y, max_x, max_y].
- Modeler.get_polygon_points(polygon) List[List[float]]#
Get points defining a polygon.
Deprecated since version 0.70.0.
use layout.get_polygon_points method instead.
- Parameters:
- polygon
pyedb.grpc.database.edb_data.primitives_data.Primitive Polygon primitive.
- polygon
- Returns:
listList of point coordinates.
- Modeler.parametrize_polygon(polygon, selection_polygon, offset_name='offsetx', origin=None) bool#
Parametrize polygon points based on another polygon.
- Parameters:
- Returns:
- bool
True if successful, False otherwise.
- Modeler.create_trace(path_list: Iterable[float] | ansys.edb.core.geometry.polygon_data.PolygonData, layer_name: str, width: float = 1, net_name: str = '', start_cap_style: str = 'Round', end_cap_style: str = 'Round', corner_style: str = 'Round') pyedb.grpc.database.primitive.primitive.Primitive | None#
Create trace path.
- Parameters:
- path_list
Iterable List of points [x,y] or [[x, y], …] or [(x, y)…].
- layer_name
str Layer name.
- width
float,optional Trace width.
- net_name
str,optional Associated net name.
- start_cap_style
str,optional Start cap style (“Round”, “Extended”, “Flat”).
- end_cap_style
str,optional End cap style (“Round”, “Extended”, “Flat”).
- corner_style
str,optional Corner style (“Round”, “Sharp”, “Mitered”).
- path_list
- Returns:
pyedb.grpc.database.edb_data.primitives_data.Pathor boolPath object if created, False otherwise.
- Modeler.create_polygon(points: List[List[float]] | ansys.edb.core.geometry.polygon_data.PolygonData, layer_name: str, voids: List[Any] | None = [], net_name: str = '') pyedb.grpc.database.primitive.primitive.Primitive | None | bool#
Create polygon primitive.
- Parameters:
- Returns:
pyedb.grpc.database.edb_data.primitives_data.Polygonor boolPolygon object if created, False otherwise.
- Modeler.create_rectangle(layer_name: str, net_name: str = '', lower_left_point: str = '', upper_right_point: str = '', center_point: str = '', width: str | float = '', height: str | float = '', representation_type: str = 'lower_left_upper_right', corner_radius: str = '0mm', rotation: str = '0deg') pyedb.grpc.database.primitive.primitive.Primitive | None#
Create rectangle primitive.
- Parameters:
- layer_name
str Layer name.
- net_name
str,optional Associated net name.
- lower_left_point
list Required for representation type: “lower_left_upper_right” [x,y] lower left point.
- upper_right_point
list Required for representation type: “lower_left_upper_right” [x,y] upper right point.
- center_point
list Required for representation type: “center_width_height” [x,y] center point.
- width
strorfloat,optional Required for representation type: “center_width_height” Rectangle width.
- height
strorfloat,optional Required for representation type: “center_width_height”
Rectangle height.
- representation_type
str,optional “lower_left_upper_right” or “center_width_height”. Default value is “lower_left_upper_right”.
- corner_radius
str,optional Corner radius with units.
- rotation
str,optional Rotation angle with units.
- layer_name
- Returns:
pyedb.grpc.database.edb_data.primitives_data.Rectangleor boolRectangle object if created, False otherwise.
- Modeler.create_circle(layer_name: str, x: float | str, y: float | str, radius: float | str, net_name: str = '') pyedb.grpc.database.primitive.primitive.Primitive | None#
Create circle primitive.
- Modeler.create_text(layer_name: str, x: float | str, y: float | str, text: str) pyedb.grpc.database.primitive.primitive.Primitive | None#
Create text primitive.
- Modeler.get_primitives(net_name: str | None = None, layer_name: str | None = None, prim_type: str | None = None, is_void: bool | None = None) List[pyedb.grpc.database.primitive.primitive.Primitive]#
Get primitives with filtering.
- Modeler.fix_circle_void_for_clipping() bool#
Fix circle void clipping issues.
- Returns:
- bool
True if changes made, False otherwise.
- Modeler.parametrize_trace_width(nets_name: str | List[str], layers_name: str | List[str] | None = None, parameter_name: str = 'trace_width', variable_value: float | str | None = None) bool#
Parametrize trace width.
- Modeler.unite_polygons_on_layer(layer_name: str | List[str] | None = None, delete_padstack_gemometries: bool = False, net_names_list: List[str] | None = None) bool#
Unite polygons on layer.
- Modeler.defeature_polygon(poly: pyedb.grpc.database.primitive.polygon.Polygon, tolerance: float = 0.001) bool#
Defeature polygon.
- Modeler.get_layout_statistics(evaluate_area: bool = False, net_list: List[str] | None = None) pyedb.grpc.database.utility.layout_statistics.LayoutStatistics#
Get layout statistics.
- Modeler.create_bondwire(definition_name: str, placement_layer: str, width: float | str, material: str, start_layer_name: str, start_x: float | str, start_y: float | str, end_layer_name: str, end_x: float | str, end_y: float | str, net: str, start_cell_instance_name: str | None = None, end_cell_instance_name: str | None = None, bondwire_type: str = 'jedec4') pyedb.grpc.database.primitive.bondwire.Bondwire#
Create bondwire.
- Parameters:
- definition_name
str Bondwire definition name.
- placement_layer
str Placement layer name.
- width
floatorstr Bondwire width.
- material
str Material name.
- start_layer_name
str Start layer name.
- start_x
floatorstr Start x-coordinate.
- start_y
floatorstr Start y-coordinate.
- end_layer_name
str End layer name.
- end_x
floatorstr End x-coordinate.
- end_y
floatorstr End y-coordinate.
- net
str Associated net name.
- start_cell_instance_name
str,optional Start cell instance name.
- end_cell_instance_name
str,optional End cell instance name.
- bondwire_type
str,optional Bondwire type (“jedec4”, “jedec5”, “apd”).
- definition_name
- Returns:
pyedb.grpc.database.edb_data.primitives_data.Bondwireor boolBondwire object if created, False otherwise.
- Modeler.create_pin_group(name: str, pins_by_id: List[int] | None = None, pins_by_aedt_name: List[str] | None = None, pins_by_name: List[str] | None = None) bool#
Create pin group.
- static Modeler.add_void(shape: pyedb.grpc.database.primitive.primitive.Primitive, void_shape: pyedb.grpc.database.primitive.primitive.Primitive | List[pyedb.grpc.database.primitive.primitive.Primitive]) bool#
Add void to shape.
- Modeler.insert_layout_instance_on_layer(cell_name: str, placement_layer: str, rotation: float | str = 0.0, rotation_x: float | str = 0, rotation_y: float | str = 0, x: float | str = 0, y: float | str = 0, place_on_bottom: bool = False, local_origin_x: float | str | None = 0, local_origin_y: float | str | None = 0) Any#
Insert a layout instance into the active layout.
- Parameters:
- cell_name: str
Name of the layout to insert.
- placement_layer: str
Placement Layer.
- rotation
floatorstr Rotation angle around Z-axis, specified counter-clockwise in radians.
- rotation_x
floatorstr Rotation angle around X-axis, specified counter-clockwise in radians.
- rotation_y
floatorstr Rotation angle around Y-axis, specified counter-clockwise in radians.
- x
floatorstr X offset.
- y
floatorstr Y offset.
- place_on_bottombool
Whether to place the layout instance on the bottom of the layer.
- local_origin_x: float or str
Local origin X coordinate.
- local_origin_y: float or str
Local origin Y coordinate.
- Modeler.insert_layout_instance_placement_3d(cell_name: str | pyedb.grpc.database.primitive.path.Path, x: float | str = 0.0, y: float | str = 0.0, z: float | str = 0.0, rotation_x: float | str = 0.0, rotation_y: float | str = 0.0, rotation_z: float | str = 0.0, local_origin_x: float | str = 0.0, local_origin_y: float | str = 0.0, local_origin_z: float | str = 0.0) Any#
Insert a 3D component placement into the active layout.
- Parameters:
- cell_name: str
Name of the layout to insert.
- x: float or str
X coordinate.
- y: float or str
Y coordinate.
- z: float or str
Z coordinate.
- rotation_x: float or str
Rotation angle around X-axis, specified counter-clockwise in radians.
- rotation_y: float or str
Rotation angle around Y-axis, specified counter-clockwise in radians.
- rotation_z: float or str
Rotation angle around Z-axis, specified counter-clockwise in radians.
- local_origin_x: float or str
Local origin X coordinate.
- local_origin_y: float or str
Local origin Y coordinate.
- local_origin_z: float or str
Local origin Z coordinate.
- Modeler.insert_3d_component_placement_3d(a3dcomp_path: str | pyedb.grpc.database.primitive.path.Path, x: float | str = 0.0, y: float | str = 0.0, z: float | str = 0.0, rotation_x: float | str = 0.0, rotation_y: float | str = 0.0, rotation_z: float | str = 0.0, local_origin_x: float | str = 0.0, local_origin_y: float | str = 0.0, local_origin_z: float | str = 0.0) Any#
Insert a 3D component placement into the active layout.
- Parameters:
- a3dcomp_path: str or Path
File path to the 3D component.
- x: float or str
X coordinate.
- y: float or str
Y coordinate.
- z: float or str
Z coordinate.
- rotation_x: float or str
Rotation angle around X-axis, specified counter-clockwise in radians.
- rotation_y: float or str
Rotation angle around Y-axis, specified counter-clockwise in radians.
- rotation_z: float or str
Rotation angle around Z-axis, specified counter-clockwise in radians.
- local_origin_x: float or str
Local origin X coordinate.
- local_origin_y: float or str
Local origin Y coordinate.
- local_origin_z: float or str
Local origin Z coordinate.
- Modeler.insert_3d_component_on_layer(a3dcomp_path: str | pyedb.grpc.database.primitive.path.Path, placement_layer: str, rotation: float | str = 0, rotation_x: float | str = 0, rotation_y: float | str = 0, x: float | str = 0, y: float | str = 0, place_on_bottom: bool = False, local_origin_x: float | str | None = 0, local_origin_y: float | str | None = 0, local_origin_z: float | str | None = 0) Any#
Insert a layout instance into the active layout.
- Parameters:
- a3dcomp_path: str or Path
File path to the 3D component.
- placement_layer: str
Placement Layer.
- rotation
floatorstr Rotation angle, specified counter-clockwise in radians.
- rotation_x
floatorstr Rotation angle, specified counter-clockwise in radians.
- rotation_y
floatorstr Rotation angle, specified counter-clockwise in radians.
- x
floatorstr X offset.
- y
floatorstr Y offset.
- place_on_bottombool
Whether to place the layout instance on the bottom of the layer.
- local_origin_x: float or str
Local origin X coordinate.
- local_origin_y: float or str
Local origin Y coordinate.
- local_origin_z: float or str
Local origin Z coordinate.
- Modeler.create_taper(start_point: tuple[str | float, str | float, str | float, str | float], end_point: tuple[str | float, str | float, str | float, str | float], start_width: str | float, end_width: str | float, layer_name: str = '', voids: list | None = None, net_name: str = '') pyedb.grpc.database.primitive.polygon.Polygon#
Create an RF trace taper polygon between two points.
The taper is a trapezoidal polygon with
start_widthatstart_pointandend_widthatend_point, rotated to match the direction between the two points.(y) ↑ | <─ End Width ─> | ─────── End Point ─────── | / | | / | | / | | ────────── Start Point ───────── | <─ Start Width ─> +──────────────────────────────────────→ (x)
- Parameters:
- start_point
tuple[strorfloat,strorfloat] Start point coordinates as
(x, y).- end_point
tuple[strorfloat,strorfloat] End point coordinates as
(x, y).- start_width
strorfloat Width of the taper at the start point.
- end_width
strorfloat Width of the taper at the end point.
- layer_name
str,optional Name of the layer on which to create the taper. The default is
"".- voids
list,optional List of void polygons to subtract from the taper. The default is
None.- net_name
str,optional Net name to assign to the taper polygon. The default is
"".
- start_point
- Returns:
PolygonCreated taper polygon object.
- Modeler.open_solder_mask(open_components: bool = True, component_filter: list[str] | None = None, components_opening_offset: float | str = 0.0, open_voids: bool = True, voids_opening_offset: float | str = 0.0, open_traces: bool = True, traces_offset: float | str = 0.0, open_traces_net_filter: list[str] | None = None, solder_mask_layer_name: str = 'Solder', solder_mask_thickness: float | str = '30um', solder_mask_material: str = '', reference_signal_layer: str = '', open_top: bool = True) bool#
Create solder mask openings for components, voids, and traces.
This method creates a solder mask dielectric layer with openings (negative geometries) for:
Component pads and bodies
Polygon voids (cutouts) in power/ground planes
PCB traces (transmission lines)
The solder mask is created as a negative layer (inverted copper representation) in EDB, and openings are implemented as rectangular or polygonal shapes placed on this layer. A default solder mask material (εᵣ = 4) is created automatically if no material is specified.
- Parameters:
- open_componentsbool,
optional Enable creation of solder mask openings for component pads and bodies. If
Trueandcomponent_filterisNone, openings are created for all components on the reference signal layer. The default isTrue.- component_filter
list[str],optional Reference designators (RefDes) of specific components to open (e.g.,
["C1", "R2"]). If specified, only these components receive solder mask openings. IfNone, all components on the reference layer are opened. The default isNone.- components_opening_offset
floatorstr,optional Offset distance (in layout units or string with units) to expand component opening rectangles beyond the component bounding box. Use positive values to expand the opening, negative values to shrink it. The default is
0.0. Example:"0.1mm"or0.0001(in default unit).- open_voidsbool,
optional Enable creation of solder mask openings for polygon voids (cutouts in planes). When enabled, iterates all polygons on the reference layer and extracts nested voids to create corresponding mask openings. The default is
True.- voids_opening_offset
floatorstr,optional Scaling factor for void opening polygons. Positive values expand the void, negative values shrink it (relative scaling, not absolute offset). The default is
0.0.- open_tracesbool,
optional Enable creation of solder mask openings for traces (paths) on the reference layer. When enabled, all path primitives are converted to polygonal mask openings. The default is
True.- traces_offset
floatorstr,optional Scaling factor for trace opening polygons. The default is
0.0.- open_traces_net_filter
list[str],optional Net name filter to select only specific traces for mask openings (e.g.,
["GND", "SIG1"]). IfNone, all traces on the reference layer are opened. The default isNone.- solder_mask_layer_name
str,optional Name of the solder mask layer to create or reuse. If a layer with this name already exists in the stackup, it is reused; otherwise, a new layer is created. The default is
"Solder".- solder_mask_thickness
floatorstr,optional Thickness of the solder mask layer (in layout units or string with units). The default is
"30um".- solder_mask_material
str,optional Name of the dielectric material for the solder mask layer. If the material does not exist in the database, a default solder mask material with εᵣ = 4 is created and a warning is logged. The default is
""(empty string triggers default creation).- reference_signal_layer
str,optional Name of the signal layer to reference for component placement and primitive filtering. If not specified, the topmost signal layer is used when
open_top=True, or the bottommost signal layer whenopen_top=False. The default is"".- open_topbool,
optional If
True, the solder mask layer is placed on top of the board and references the topmost signal layer. IfFalse, the mask is placed on the bottom and references the bottommost signal layer. The default isTrue.
- open_componentsbool,
- Returns:
- bool
Trueif the solder mask layer and all openings were created successfully. RaisesValueErrorifcomponent_filterspecifies RefDes values that do not exist in the design.
- Raises:
ValueErrorIf any reference designator in
component_filteris not found in the design.
See also
stackup.add_layer()Add a dielectric layer to the stackup
create_rectangle()Create a rectangular primitive
create_polygon()Create a polygonal primitive
Notes
Solder mask layers are created as negative layers in EDB (inverted copper model).
All opening geometries inherit the solder mask layer name and are assigned to the default net (empty net name
"").Component openings are rectangular bounding-box-based; for non-rectangular pads, consider using padstack opening geometries instead.
Void and trace openings are polygon-based and inherit the exact geometry of the original plane cutout or trace path.
Offset/scaling parameters use EDB unit system (typically millimeters).
Examples
Create a standard solder mask with all openings on the top side:
>>> edb = Edb("design.aedb") >>> edb.modeler.open_solder_mask()
Create openings only for specific components with a 0.1 mm margin:
>>> edb.modeler.open_solder_mask( ... component_filter=["U1", "U2"], ... components_opening_offset="0.1mm", ... open_voids=False, ... open_traces=False, ... )
Create a bottom-side solder mask with custom material and thickness:
>>> edb.modeler.open_solder_mask( ... solder_mask_layer_name="BottomSolder", ... solder_mask_material="CustomMask", ... solder_mask_thickness="50um", ... open_top=False, ... )