主要内容

本页采用了机器翻译。点击此处可查看最新英文版本。

addElement

在视图元素组中添加组件

自 R2021a 起

    说明

    addElement(elementGroup,component) 将组件 component 添加到架构视图的元素组 elementGroup 中。

    注意

    如果在视图上定义了选择查询或分组,则不能使用此函数。要删除查询,请运行 removeQuery

    示例

    示例

    全部折叠

    打开无钥匙进入系统示例并创建视图 newView

    openProject("scKeylessEntrySystem");
    model = systemcomposer.loadModel("KeylessEntryArchitecture");
    view = model.createView("newView");

    打开架构视图库以查看 newView

    model.openViews
    

    通过路径在视图中添加元素。

    view.Root.addElement("KeylessEntryArchitecture/Lighting System/Headlights")

    通过对象向视图添加元素。

    component = model.lookup(Path="KeylessEntryArchitecture/Lighting System/Cabin Lights");
    view.Root.addElement(component)

    输入参数

    全部折叠

    视图的元素组,指定为 systemcomposer.view.ElementGroup 对象。

    组件,指定为 systemcomposer.arch.Component 对象、systemcomposer.arch.VariantComponent 对象、systemcomposer.arch.Component 对象数组、systemcomposer.arch.VariantComponent 对象数组、组件路径或组件路径元胞数组。

    示例: "KeylessEntryArchitecture/Lighting System/Headlights"

    数据类型: char | string

    详细信息

    全部折叠

    版本历史记录

    在 R2021a 中推出