Contenuto principale

setPortQuery

Set port query on view

Since R2026a

    Description

    setPortQuery(view,select) sets or removes a port query on a view.

    example

    Examples

    collapse all

    Set a port query on a new view in the keyless entry system architecture model.

    Open the keyless entry system example and create a view. Specify the color as light blue and the query as all components.

    import systemcomposer.query.*
    
    openProject("scKeylessEntrySystem");
    model = systemcomposer.loadModel("KeylessEntryArchitecture");
    view = createView(model,"All Components",...
       Color="lightblue",Select=AnyComponent);

    Set the port query to filter by ports named "keyLocation".

    setPortQuery(view,Property("Name") == "keyLocation");

    Open the Architecture Views Gallery to see the view All Components with the port query.

    openViews(model)

    Remove a port query on a new view in the keyless entry system architecture model.

    Open the keyless entry system example and create a view. Specify the color as light blue and the query as all components.

    import systemcomposer.query.*
    
    openProject("scKeylessEntrySystem");
    model = systemcomposer.loadModel("KeylessEntryArchitecture");
    view = createView(model,"All Components",...
       Color="lightblue",Select=AnyComponent);

    Set the port query to filter by ports named "keyLocation".

    setPortQuery(view,Property("Name") == "keyLocation");

    Open the Architecture Views Gallery to see the view All Components with the port query.

    openViews(model)

    Remove the port query.

    setPortQuery(view,"");

    Open the Architecture Views Gallery to see the view All Components without the port query.

    openViews(model)

    Input Arguments

    collapse all

    Architecture view, specified as a systemcomposer.view.View object.

    Query to use to populate view, specified as a systemcomposer.query.Constraint object.

    A constraint can contain a subconstraint that can be joined with another constraint using AND or OR. A constraint can be negated using NOT.

    Example: HasStereotype(IsStereotypeDerivedFrom("AutoProfile.HardwareComponent"))

    Query Objects and Conditions for Constraints

    Query ObjectCondition
    PropertyA non-evaluated value for the given property or stereotype property.
    PropertyValueAn evaluated property value from a System Composer™ object or a stereotype property.
    HasConnectorA component has a connector that satisfies the given subconstraint.
    HasPortA component has a port that satisfies the given subconstraint.
    HasInterfaceA port has an interface that satisfies the given subconstraint.
    HasInterfaceElementAn interface has an interface element that satisfies the given subconstraint.
    HasStereotypeAn architecture element has a stereotype that satisfies the given subconstraint.
    IsInRangeA property value is within the given range.
    AnyComponentAn element is a component and not a port or connector.
    IsStereotypeDerivedFrom A stereotype is derived from the given stereotype.

    More About

    collapse all

    Version History

    Introduced in R2026a