add_sub_ecad_component#

MCADAssembly.add_sub_ecad_component(name: str, model: str) → ECADComponent#

Add a top-level ECAD (layout) subcomponent to the assembly.

Create and register an ECAD (layout/PCB) subcomponent instance at the top level of the assembly hierarchy. The component is ready for configuration including coordinate systems, transformations, and child components.

Parameters:
namestr

Instance name for this component in the assembly. Must be unique within the assembly.

modelstr

Reference name of a registered ECAD model (see add_ecad_component_model).

Returns:
ECADComponent

The created ECAD component instance, ready for configuration.

Examples

Add top-level PCB layout components to an assembly:

>>> assembly = MCADAssembly()
>>> assembly.add_ecad_component_model(name="MainBoard", path="pcb/main.aedb")
>>> assembly.add_ecad_component_model(name="DaughterBoard", path="pcb/daughter.aedb")
>>> main_pcb = assembly.add_sub_ecad_component(name="PCB_1", model="MainBoard")
>>> daughter_pcb = assembly.add_sub_ecad_component(name="PCB_2", model="DaughterBoard")

Configure the component with layout-specific settings:

>>> main_pcb.target_coordinate_system = "MainCS"
>>> main_pcb.layout_coordinate_systems = ["USB_Mount", "Antenna_Base"]
>>> main_pcb.reference_coordinate_system = "PCB_Origin"