XmlStackup#

class pyedb.xml_parser.xml_stackup.XmlStackup(/, **data: Any)#

Bases: pydantic.BaseModel

Main stackup configuration for EDB XML files.

This class represents the complete stackup definition including materials and layers for a PCB design.

Parameters:
materialsXmlMaterials, optional

Container for material definitions. The default is None.

layersXmlLayers, optional

Container for layer definitions. The default is None.

schema_versionstr, optional

Version of the XML schema. The default is None.

Examples

>>> from pyedb.xml_parser.xml_stackup import XmlStackup
>>> stackup = XmlStackup()
>>> materials = stackup.add_materials()
>>> layers = stackup.add_layers()

Overview#

add_materials

Add a materials container to the stackup.

add_layers

Add a layers container to the stackup.

import_from_cfg_stackup

Import stackup configuration from a CFG stackup object.

to_dict

Convert the stackup configuration to a dictionary.

materials

layers

schema_version

model_config

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

Import detail#

from pyedb.xml_parser.xml_stackup import XmlStackup

Attribute detail#

XmlStackup.materials: XmlMaterials | None = None#
XmlStackup.layers: XmlLayers | None = None#
XmlStackup.schema_version: str | None = None#
XmlStackup.model_config#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

Method detail#

XmlStackup.add_materials() XmlMaterials#

Add a materials container to the stackup.

Returns:
XmlMaterials

The newly created materials container object.

Examples

>>> from pyedb.xml_parser.xml_stackup import XmlStackup
>>> stackup = XmlStackup()
>>> materials = stackup.add_materials()
>>> materials.add_material("copper", conductivity=5.8e7)
XmlStackup.add_layers() XmlLayers#

Add a layers container to the stackup.

Returns:
XmlLayers

The newly created layers container object with default length unit of “mm”.

Examples

>>> from pyedb.xml_parser.xml_stackup import XmlStackup
>>> stackup = XmlStackup()
>>> layers = stackup.add_layers()
>>> layers.add_layer(name="TOP", type="signal", thickness=0.035, material="copper")
XmlStackup.import_from_cfg_stackup(cfg_stackup: pyedb.configuration.cfg_data.CfgStackup) None#

Import stackup configuration from a CFG stackup object.

Parameters:
cfg_stackupCfgStackup

Configuration stackup object to import from. This should contain materials and layers attributes that can be converted to XML format.

Examples

>>> from pyedb.xml_parser.xml_stackup import XmlStackup
>>> from pyedb.configuration.cfg_data import CfgStackup
>>> stackup = XmlStackup()
>>> cfg_data = CfgStackup(materials=[...], layers=[...])
>>> stackup.import_from_cfg_stackup(cfg_data)
XmlStackup.to_dict() dict#

Convert the stackup configuration to a dictionary.

Returns:
dict

Dictionary containing ‘layers’ and ‘materials’ keys with their respective data as lists of dictionaries. Layer thicknesses are normalized to include units, and layer types are converted to lowercase format.

Examples

>>> from pyedb.xml_parser.xml_stackup import XmlStackup
>>> stackup = XmlStackup()
>>> stackup.add_materials()
>>> stackup.materials.add_material("copper", conductivity=5.8e7)
>>> stackup.add_layers()
>>> stackup.layers.add_layer(name="TOP", type="signal", thickness=0.035, material="copper")
>>> config = stackup.to_dict()
>>> print(config["materials"])
[{'name': 'copper', 'conductivity': 58000000.0}]