add_model_library#
- MCADAssembly.add_model_library(library_path: str | Path)#
Register a model library for component resolution.
Add a library path that contains a
model_library.tomlfile. This file defines mappings from component reference designators to 3D component models, enabling automatic population of MCAD components from ECAD layouts. Libraries provide a centralized way to manage component-to-model relationships.- Parameters:
- library_path
str|Path Path to the library folder containing
model_library.toml. Can be an absolute path or relative to the configuration file location. Themodel_library.tomlfile should map component part numbers/ designators to 3D model files and pin location information.
- library_path
Notes
Libraries registered at the assembly level are available to all components. Individual components can also register their own libraries if needed. The component reference designators must match those in the
model_library.tomlmapping.Examples
Register model libraries at the assembly level:
>>> assembly = MCADAssembly() >>> assembly.add_model_library(library_path="/project/component_libraries/standard") >>> assembly.add_model_library(library_path="/project/component_libraries/custom")
Use with ECAD components for automatic population:
>>> pcb = assembly.add_sub_ecad_component(name="PCB_1", model="MainBoard") >>> pcb.add_sub_mcad_component_from_library( ... reference_designators=["U1", "U2", "J1", "J2"] ... )