XmlStackup#
- class pyedb.xml_parser.xml_stackup.XmlStackup(/, **data: Any)#
Bases:
pydantic.BaseModelMain stackup configuration for EDB XML files.
This class represents the complete stackup definition including materials and layers for a PCB design.
- Parameters:
- materials
XmlMaterials,optional Container for material definitions. The default is
None.- layers
XmlLayers,optional Container for layer definitions. The default is
None.- schema_version
str,optional Version of the XML schema. The default is
None.
- materials
Examples
>>> from pyedb.xml_parser.xml_stackup import XmlStackup >>> stackup = XmlStackup() >>> materials = stackup.add_materials() >>> layers = stackup.add_layers()
Overview#
Add a materials container to the stackup. |
|
Add a layers container to the stackup. |
|
Add an extended layers container to the stackup. |
|
Import stackup configuration from a CFG stackup object. |
|
Convert the stackup configuration to a dictionary. |
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#
- XmlStackup.e_layers: XmlELayers | 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:
XmlMaterialsThe 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(length_unit='mm') XmlLayers#
Add a layers container to the stackup.
- Returns:
XmlLayersThe 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.add_e_layers(length_unit='mm') XmlELayers#
Add an extended layers container to the stackup.
- Parameters:
- length_unit
str,optional Unit for layer dimensions. The default is
"mm".
- length_unit
- Returns:
XmlELayersThe newly created extended layers object.
- XmlStackup.import_from_cfg_stackup(cfg_stackup: pyedb.configuration.cfg_data.CfgStackup) None#
Import stackup configuration from a CFG stackup object.
- Parameters:
- cfg_stackup
CfgStackup Configuration stackup object to import from. This should contain materials and layers attributes that can be converted to XML format.
- cfg_stackup
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:
dictDictionary 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.
For extended layer stacks, dielectric and conductor layers are combined under ‘layers’; via definitions remain available on ‘e_layers’.
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}]