Configure diagram views
SysML v2 diagram views let you define which elements to include in a diagram and how to render them, with additional diagram customization through configurable attributes.
Views work in both Modeler and Modeler CLI.
package MyViews {
private import Views::asTreeDiagram;
part def SystemViews {
view customDroneView {
expose DroneMission::Structure::Quadcopter;
filter @ SysML::PartUsage;
attribute depth = 2;
render asTreeDiagram;
}
}
}
This view exposes the Quadcopter element and filters its contents to show only
elements which have metadata of type SysML::PartUsage. The view also contains
attribute depth, which tells Syside how deep to traverse each subtree, and render asTreeDiagram which tells Syside which rendering style to use. This page covers the
view kind and the configurable attributes in detail. For expose and filter, which decide
which elements reach the diagram at all, see Select diagram elements.
Choosing the view kind
Modeler CLI
View kind selection applies only to Modeler CLI.
The SysML v2 specification defines eight standard view definitions, available through
the standard library package StandardViewDefinitions. Typing a view by one of them
selects the kind of diagram it produces:
package MyDiagrams {
private import StandardViewDefinitions::*;
view partWiring : InterconnectionView {
expose MySystem::powertrain::**;
}
view chargingStates : StateTransitionView {
expose MySystem::modes::**;
}
}
Syside supports the following kinds as diagrams (see SysML v2 diagram coverage for examples):
View definition |
View kind |
|---|---|
|
General (structure, containment, and relationships) |
|
Interconnection (parts wired through ports) |
|
Action flow (actions and control flow) |
|
State transition (states and transitions) |
|
Sequence (lifelines and messages) |
Note
An untyped or unrecognized view renders as a General view. As an alternative to
typing, a render asInterconnectionDiagram; statement selects the interconnection
kind.
Configurable attributes
The following attributes control how each view renders.
Attribute |
Default |
Since |
Description |
|---|---|---|---|
|
|
0.10.0 |
How many levels of descendants to show. |
|
Nested Diagram |
0.10.0 |
Layout style. Use |
|
|
0.10.0 |
Output format: |
|
|
0.10.0 |
Output file name. |
|
|
0.10.0 |
Zoom level for rendering. Applicable only to PNG and JPEG output. |
|
|
0.10.0 |
How the view’s filters interact with exposed elements: |
|
|
0.10.3 |
Per-compartment row cap: |
|
|
0.10.3 |
Hides inherited ( |
|
|
0.10.0 |
Hides annotation (documentation and metadata) compartment rows when set to
|
|
|
0.11.0 |
Draws all connections as edges when set to |
Modeler CLI
The fileType, fileName and zoomLevel attributes name the output file, so they
apply to the Modeler CLI only.
Additionally, attributes exposeMode, maxCompartmentEntries, showInheritedRows, and
showConnectionElaborations only apply to CLI.
Note
Except for render, which comes from the standard Views library, these
attributes are Syside-specific and have no effect in other tools.
Command-line options and [viz] settings interact with these attributes in a fixed
order of precedence.
depth explained
depth controls how many levels of each exposed element’s subtree to traverse.
Traversal happens after filtering, so the diagram may include element types that
were filtered out. To avoid this, set depth to 0 or 1 when using filters.
0 shows only the filtered elements. Because filtering applies to elements rather
than relationships, no relationships between them appear at this depth.
1 shows the filtered elements and the relationships between them: ownership, state
transitions, connections, and similar. Use this depth when relationships need to be
visible.
-1 (the default) means infinite depth, which is useful for exploratory diagrams but
typically too detailed for documentation and may contain elements that should be
filtered out.
render explained
render controls the layout style used to display the diagram. The default Nested
style shows child elements inside their parents; Tree arranges them as a branching
tree instead.
To switch to Tree layout, add a render Views::asTreeDiagram; statement to the view.
exposeMode explained
exposeMode applies to the Modeler CLI only, and
Expose modes in Diagram generation explains how each mode maps a
view’s filtered elements onto the diagram.
Common pitfalls
The following behaviors are correct but regularly surprise view authors.
View name becomes diagram frame title
The view name is not an internal identifier: it renders verbatim as the diagram title in
the frame, so a view named 05_power_distribution shows that 05_ to every reader,
in a diagram panel as much as in an exported file. On the command line the fileName
attribute sets the output file name independently, so ordering prefixes can live there
while the title stays presentable.
depth demotes elements instead of hiding them
Elements beyond the depth limit collapse into compartment rows of their parent. Relationship edges that target a demoted element (verify, satisfy, allocate, and similar) cannot render as arrows and surface as textual compartment entries instead.
To keep relationship arrows, keep both endpoints within the depth limit, or leave the depth unlimited.
Relationship edges need both endpoints as nodes
If one end of a keyword relationship is absent or demoted to a compartment row, the edge disappears or degrades to text.