add_sub_mcad_component#

MCADAssembly.add_sub_mcad_component(name: str, model: str) → MCADComponent#

Add a top-level MCAD (3D) subcomponent to the assembly.

Create and register an MCAD (3D model) subcomponent instance at the top level of the assembly hierarchy. The component is ready for configuration including placement, 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 MCAD model (see add_mcad_component_model).

Returns:
MCADComponent

The created MCAD component instance, ready for configuration.

Examples

Add top-level MCAD components to an assembly:

>>> assembly = MCADAssembly()
>>> assembly.add_mcad_component_model(name="Enclosure", path="models/chassis.a3dcomp")
>>> assembly.add_mcad_component_model(name="Antenna", path="models/antenna.step")
>>> enclosure = assembly.add_sub_mcad_component(name="Case", model="Enclosure")
>>> antenna = assembly.add_sub_mcad_component(name="ANT1", model="Antenna")

Configure the component after creation:

>>> enclosure.target_coordinate_system = "MainCS"
>>> enclosure.add_arrange_rotate(axis="Z", angle="45deg")