Stackup#

class pyedb.grpc.database.stackup.Stackup(pedb, edb_object=None)#

Bases: LayerCollection

Manages EDB methods for stackup operations.

Parameters:
pedbpyedb.Edb

EDB object.

edb_objectansys.edb.core.layer.LayerCollection, optional

EDB layer collection object. The default is None.

Overview#

create_symmetric_stackup

Create a symmetric stackup.

add_outline_layer

Add an outline layer named “Outline” if it is not present.

add_layer

Insert a layer into stackup.

remove_layer

Remove a layer from stackup.

export

Export stackup definition to a file.

export_stackup

Export stackup definition to a file.

limits

Retrieve stackup limits.

flip_design

Flip the current design of a layout.

get_layout_thickness

Return the layout thickness.

adjust_solder_dielectrics

Adjust the stack-up by adding or modifying dielectric layers that contain solder balls.

place_in_layout

Place current cell into another cell using layer placement method.

place_in_layout_3d_placement

Place current cell into another cell using 3D placement method.

place_instance

Place a component instance in the layout using 3D placement.

place_a3dcomp_3d_placement

Place a 3D component into the current layout.

residual_copper_area_per_layer

Report residual copper area per layer in percentage.

load

Import stackup from a file.

plot

Plot the current stackup and optionally overlap padstack definitions.

thickness

Retrieve the stackup thickness.

num_layers

Retrieve the number of layers in the stackup.

mode

Stackup mode.

Import detail#

from pyedb.grpc.database.stackup import Stackup

Property detail#

property Stackup.thickness: float#

Retrieve the stackup thickness.

Returns:
float

Stackup thickness.

Examples

>>> from pyedb import Edb
>>> edb = Edb()
>>> thickness = edb.stackup.thickness
property Stackup.num_layers: int#

Retrieve the number of layers in the stackup.

Returns:
int

Number of layers.

Examples

>>> from pyedb import Edb
>>> edb = Edb()
>>> num_layers = edb.stackup.num_layers
property Stackup.mode: str#

Stackup mode.

Returns:
str

Type of the stackup mode. Options are: - "laminate" - "overlapping" - "multizone"

Examples

>>> from pyedb import Edb
>>> edb = Edb()
>>> mode = edb.stackup.mode

Method detail#

Stackup.__getitem__(item)#
Stackup.create_symmetric_stackup(layer_count: int, inner_layer_thickness: str = '17um', outer_layer_thickness: str = '50um', dielectric_thickness: str = '100um', dielectric_material: str = 'FR4_epoxy', soldermask: bool = True, soldermask_thickness: str = '20um') bool#

Create a symmetric stackup.

Parameters:
layer_countint

Number of layers. Must be even.

inner_layer_thicknessstr, float, optional

Thickness of inner conductor layer.

outer_layer_thicknessstr, float, optional

Thickness of outer conductor layer.

dielectric_thicknessstr, float, optional

Thickness of dielectric layer.

dielectric_materialstr, optional

Material of dielectric layer.

soldermaskbool, optional

Whether to create soldermask layers. The default is True.

soldermask_thicknessstr, optional

Thickness of soldermask layer.

Returns:
bool

True when successful, False when failed.

Examples

>>> from pyedb import Edb
>>> edb = Edb()
>>> edb.stackup.create_symmetric_stackup(layer_count=4)
Stackup.add_outline_layer(name: str = 'Outline') bool#

Add an outline layer named “Outline” if it is not present.

Returns:
bool

True when successful.

Examples

>>> from pyedb import Edb
>>> edb = Edb()
>>> edb.stackup.add_outline_layer()
Stackup.add_layer(layer_name: str, base_layer: str | None = None, method: str = 'add_on_top', layer_type: str = 'signal', material: str = 'copper', fillMaterial: str = 'FR4_epoxy', thickness: str | float = '35um', etch_factor: float | None = None, is_negative: bool = False, enable_roughness: bool = False, elevation: float | None = None) bool#

Insert a layer into stackup.

Parameters:
layer_namestr

Name of the layer.

base_layerstr, optional

Name of the base layer.

methodstr, optional

Where to insert the new layer. The default is "add_on_top". Options are: - "add_on_top" - "add_on_bottom" - "insert_above" - "insert_below" - "add_at_elevation"

layer_typestr, optional

Type of layer. The default is "signal". Options are: - "signal" - "dielectric" - "conducting" - "air_lines" - "error" - "symbol" - "measure" - "assembly" - "silkscreen" - "solder_mask" - "solder_paste" - "glue" - "wirebond" - "hfss_region" - "user"

materialstr, optional

Material of the layer.

fillMaterialstr, optional

Fill material of the layer.

thicknessstr, float, optional

Thickness of the layer.

etch_factorint, float, optional

Etch factor of the layer.

is_negativebool, optional

Whether the layer is negative.

enable_roughnessbool, optional

Whether roughness is enabled.

elevationfloat, optional

Elevation of new layer. Only valid for Overlapping Stackup.

Returns:
pyedb.grpc.database.layers.stackup_layer.StackupLayer

Layer object created.

Stackup.remove_layer(name: str) bool#

Remove a layer from stackup.

Parameters:
namestr

Name of the layer to remove.

Returns:
bool

True when successful.

Stackup.export(fpath: str, file_format: str = 'xml', include_material_with_layer: bool = False) bool#

Export stackup definition to a file.

Parameters:
fpathstr

File path to export to.

file_formatstr, optional

Format of the file to export. The default is "xml". Options are: - "csv" - "xlsx" - "json" - "xml"

include_material_with_layerbool, optional

Whether to include the material definition inside layer objects. This parameter is only used when a JSON file is exported. The default is False.

Returns:
bool

True when successful.

Examples

>>> from pyedb import Edb
>>> edb = Edb()
>>> edb.stackup.export("stackup.xml")
Stackup.export_stackup(fpath, file_format='xml', include_material_with_layer=False)#

Export stackup definition to a file.

Deprecated since version 0.6.61: Use export() instead.

Parameters:
fpathstr

File path to export to.

file_formatstr, optional

Format of the file to export. The default is "xml". Options are: - "csv" - "xlsx" - "json"

include_material_with_layerbool, optional

Whether to include the material definition inside layer objects. This parameter is only used when a JSON file is exported. The default is False.

Examples

>>> from pyedb import Edb
>>> edb = Edb()
>>> edb.stackup.export_stackup("stackup.xml")
Stackup.limits(only_metals: bool = False) Tuple[str, str]#

Retrieve stackup limits.

Parameters:
only_metalsbool, optional

Whether to retrieve only metals. The default is False.

Returns:
tuple

Tuple containing: - Upper layer name - Upper layer top elevation - Lower layer name - Lower layer bottom elevation

Stackup.flip_design() bool#

Flip the current design of a layout.

Returns:
bool

True when successful.

Examples

>>> edb = Edb(edbpath=targetfile, edbversion="2021.2")
>>> edb.stackup.flip_design()
>>> edb.save()
>>> edb.close_edb()
Stackup.get_layout_thickness() float#

Return the layout thickness.

Returns:
float

Thickness value.

Stackup.adjust_solder_dielectrics() bool#

Adjust the stack-up by adding or modifying dielectric layers that contain solder balls.

This method identifies the solder-ball height and adjusts the dielectric thickness on top (or bottom) to fit the thickness in order to merge another layout.

Returns:
bool

True when successful.

Stackup.place_in_layout(edb: Edb, angle: float = 0.0, offset_x: float = 0.0, offset_y: float = 0.0, flipped_stackup: bool = True, place_on_top: bool = True) bool#

Place current cell into another cell using layer placement method.

Flip the current layer stackup of a layout if requested.

Parameters:
edbpyedb.Edb

Target Edb object.

anglefloat, optional

Rotation angle in degrees. The default is 0.0.

offset_xfloat, optional

X offset value. The default is 0.0.

offset_yfloat, optional

Y offset value. The default is 0.0.

flipped_stackupbool, optional

Whether to flip the current layout. The default is True.

place_on_topbool, optional

Whether to place the current layout on top of the destination layout. The default is True.

Returns:
bool

True when successful.

Examples

>>> edb1 = Edb(edbpath=targetfile1, edbversion="2021.2")
>>> edb2 = Edb(edbpath=targetfile2, edbversion="2021.2")
>>> hosting_cmp = edb1.components.get_component_by_name("U100")
>>> mounted_cmp = edb2.components.get_component_by_name("BGA")
>>> vector, rotation, solder_ball_height = edb1.components.get_component_placement_vector(
...     mounted_component=mounted_cmp,
...     hosting_component=hosting_cmp,
...     mounted_component_pin1="A12",
...     mounted_component_pin2="A14",
...     hosting_component_pin1="A12",
...     hosting_component_pin2="A14",
... )
>>> edb2.stackup.place_in_layout(
...     edb1.active_cell,
...     angle=0.0,
...     offset_x=vector[0],
...     offset_y=vector[1],
...     flipped_stackup=False,
...     place_on_top=True,
... )
Stackup.place_in_layout_3d_placement(edb: Edb, angle: float = 0.0, offset_x: float = 0.0, offset_y: float = 0.0, flipped_stackup: bool = True, place_on_top: bool = True, solder_height: float = 0) bool#

Place current cell into another cell using 3D placement method.

Flip the current layer stackup of a layout if requested.

Parameters:
edbpyedb.Edb

Target Edb object.

anglefloat, optional

Rotation angle in degrees. The default is 0.0.

offset_xfloat, optional

X offset value. The default is 0.0.

offset_yfloat, optional

Y offset value. The default is 0.0.

flipped_stackupbool, optional

Whether to flip the current layout. The default is True.

place_on_topbool, optional

Whether to place the current layout on top of the destination layout. The default is True.

solder_heightfloat, optional

Solder ball or bumps height. This value will be added to the elevation to align the two layouts.

Returns:
bool

True when successful.

Examples

>>> edb1 = Edb(edbpath=targetfile1, edbversion="2021.2")
>>> edb2 = Edb(edbpath=targetfile2, edbversion="2021.2")
>>> hosting_cmp = edb1.components.get_component_by_name("U100")
>>> mounted_cmp = edb2.components.get_component_by_name("BGA")
>>> edb2.stackup.place_in_layout(
...     edb1.active_cell,
...     angle=0.0,
...     offset_x="1mm",
...     offset_y="2mm",
...     flipped_stackup=False,
...     place_on_top=True,
... )
Stackup.place_instance(component_edb: Edb, angle: float = 0.0, offset_x: float = 0.0, offset_y: float = 0.0, offset_z: float = 0.0, flipped_stackup: bool = True, place_on_top: bool = True, solder_height: float = 0) ansys.edb.core.hierarchy.cell_instance.CellInstance#

Place a component instance in the layout using 3D placement.

Parameters:
component_edbpyedb.Edb

Component Edb object to place.

anglefloat, optional

Rotation angle in degrees. The default is 0.0.

offset_xfloat, optional

X offset value. The default is 0.0.

offset_yfloat, optional

Y offset value. The default is 0.0.

offset_zfloat, optional

Z offset value (elevation offset). The default is 0.0.

flipped_stackupbool, optional

Whether to flip the component stackup. The default is True.

place_on_topbool, optional

Whether to place the component on top of the target layout. The default is True.

solder_heightfloat, optional

Solder ball or bumps height. The default is 0.

Returns:
ansys.edb.core.hierarchy.CellInstance

Cell instance created.

Stackup.place_a3dcomp_3d_placement(a3dcomp_path: str, angle: float = 0.0, offset_x: float = 0.0, offset_y: float = 0.0, offset_z: float = 0.0, place_on_top: bool = True) bool#

Place a 3D component into the current layout.

3D Component ports are not visible via EDB. They will be visible after the EDB has been opened in Ansys Electronics Desktop as a project.

Parameters:
a3dcomp_pathstr

Path to the 3D Component file (*.a3dcomp) to place.

anglefloat, optional

Clockwise rotation angle applied to the a3dcomp.

offset_xfloat, optional

X offset value. The default is 0.0.

offset_yfloat, optional

Y offset value. The default is 0.0.

offset_zfloat, optional

Z offset value (elevation). The default is 0.0.

place_on_topbool, optional

Whether to place the 3D component on the top or the bottom of this layout. If False, the 3D component will be flipped over around its X axis.

Returns:
bool

True if successful, False if not.

Examples

>>> edb1 = Edb(edbpath=targetfile1, edbversion="2021.2")
>>> a3dcomp_path = "connector.a3dcomp"
>>> edb1.stackup.place_a3dcomp_3d_placement(
...     a3dcomp_path,
...     angle=0.0,
...     offset_x="1mm",
...     offset_y="2mm",
...     flipped_stackup=False,
...     place_on_top=True,
... )
Stackup.residual_copper_area_per_layer() Dict[str, float]#

Report residual copper area per layer in percentage.

Returns:
dict

Dictionary of copper area per layer.

Examples

>>> edb = Edb(edbpath=targetfile1, edbversion="2021.2")
>>> edb.stackup.residual_copper_area_per_layer()
Stackup.load(file_path: str | Dict, rename: bool = False) bool#

Import stackup from a file.

Supported formats: XML, CSV, JSON.

Parameters:
file_pathstr or dict

Path to stackup file or dictionary with stackup details.

renamebool, optional

If False, layers in layout not found in the stackup file are deleted. If True and the number of layers in the stackup file equals the number of stackup layers in the layout, layers are renamed according to the file.

Returns:
bool

True when successful.

Examples

>>> from pyedb import Edb
>>> edb = Edb()
>>> edb.stackup.load("stackup.xml")
Stackup.plot(save_plot: str | None = None, size: Tuple[int, int] = (2000, 1500), plot_definitions: str | List[str] | None = None, first_layer: str | pyedb.grpc.database.layers.layer.Layer | None = None, last_layer: str | pyedb.grpc.database.layers.layer.Layer | None = None, scale_elevation: bool = True, show: bool = True) Any#

Plot the current stackup and optionally overlap padstack definitions.

Only supports ‘Laminate’ and ‘Overlapping’ stackup types.

Parameters:
save_plotstr, optional

Path to save the plot image. If provided, show is ignored.

sizetuple, optional

Image size in pixels (width, height). Default is (2000, 1500).

plot_definitionsstr or list, optional

List of padstack definitions to plot on the stackup. Only supported for Laminate mode.

first_layerstr or pyedb.grpc.database.layers.layer.Layer, optional

First layer to plot from the bottom. Default is None (start from bottom).

last_layerstr or pyedb.grpc.database.layers.layer.Layer, optional

Last layer to plot from the bottom. Default is None (plot up to top layer).

scale_elevationbool, optional

Scale real layer thickness so that max_thickness = 3 * min_thickness. Default is True.

showbool, optional

Whether to show the plot. Default is True.

Returns:
matplotlib.pyplot

Matplotlib plot object.