Main Content

systemcomposer.view.View

Architecture view

Since R2021a

    Description

    A View object is used to manage architecture views for a System Composer™ model.

    Creation

    Create a view using the createView function.

    objView = createView(objModel)

    Properties

    expand all

    Name of view, specified as a string.

    Example: "NewView"

    Data Types: string

    Root element group that defines view, specified as a systemcomposer.view.ElementGroup object.

    Architecture model where view belongs, specified as a systemcomposer.arch.Model object.

    Selection query associated with view, specified as a systemcomposer.query.Constraint object.

    Grouping criteria, specified as a string array of properties in the form "<profile>.<stereotype>.<property>".

    Example: ["AutoProfile.MechanicalComponent.mass","AutoProfile.MechanicalComponent.cost"]

    Color of view, specified as a string. The color can be the name "blue", "black", or "green", or it can be an RGB value encoded in a hexadecimal string: "#FF00FF" or "#DDDDDD". An invalid color results in an error.

    Description of view, specified as a string.

    Data Types: string

    Whether to include referenced models, specified as a logical.

    Example: included = get(objView,'IncludeReferenceModels')

    Data Types: logical

    Universal unique identifier, specified as a character vector.

    Example: '91d5de2c-b14c-4c76-a5d6-5dd0037c52df'

    Data Types: char

    Object Functions

    modifyQueryModify architecture view query and property groupings
    runQueryRe-run architecture view query on model
    removeQueryRemove architecture view query
    destroyRemove model element

    Examples

    collapse all

    Use a keyless entry system architecture model to programmatically create views.

    Import the namespace with queries.

    import systemcomposer.query.*

    Open the Simulink® project file for the keyless entry system.

    openProject("scKeylessEntrySystem");

    Load the example model into System Composer™.

    model = systemcomposer.loadModel("KeylessEntryArchitecture");

    Hardware Component Review Status View

    Create a view that selects all hardware components in the architecture model and groups them using the ReviewStatus property.

    1. Construct a query to select all hardware components.

    hwCompQuery = HasStereotype(IsStereotypeDerivedFrom("AutoProfile.HardwareComponent"));

    2. Use the query to create a view.

    model.createView("Hardware Component Review Status",...
     Select=hwCompQuery,...
     GroupBy={'AutoProfile.BaseComponent.ReviewStatus'},...
     IncludeReferenceModels=true,...
     Color="purple");

    3. To open the Architecture Views Gallery the Modeling section, click Architecture Views.

    model.openViews
    

    Hardware component review status component diagram view.

    FOB Locater System Supplier View

    Create a view with components from the FOB Locater System and group them using existing and new view components for the suppliers. In this example, you will use element groups, groupings of components in a view, to programmatically populate a view.

    1. Create a view architecture.

    fobSupplierView = model.createView("FOB Locater System Supplier Breakdown",...
        Color="lightblue");

    2. Add a subgroup called Supplier D. Add the FOB Locater Module to the view element subgroup.

    supplierD = fobSupplierView.Root.createSubGroup("Supplier D");
    supplierD.addElement("KeylessEntryArchitecture/FOB Locater System/FOB Locater Module");

    3. Create a new subgroup for Supplier A.

    supplierA = fobSupplierView.Root.createSubGroup("Supplier A");

    4. Add each of the FOB Receivers to the view element subgroup.

    FOBLocaterSystem = model.lookup("Path","KeylessEntryArchitecture/FOB Locater System");

    Find all the components which contain the name Receiver.

    receiverCompPaths = model.find(...
        contains(Property("Name"),"Receiver"),...
        FOBLocaterSystem.Architecture);
    
    supplierA.addElement(receiverCompPaths)

    FOB locater system supplier view component diagram.

    More About

    expand all

    Version History

    Introduced in R2021a