This course covers SystemWeaver Script Language with a focus on configurable graphs. A graph is made up of nodes (points) and edges (lines) according to the mathematical concept of graph theory. In the Graphs view, the nodes and edges are drawn into the view according to the style of the configuration and automatic layout and routing methods. Examples and exercises are provided.
They are created via the graph editor. To access it, select an item in the tree, click on the View drop-down list, select Graphs and then select Sandbox:
Below is a demonstration of how nodes are defined (A). By default, the caption of the node will be the object you have selected in the structure tree. This can be changed by using the attribute ”caption” (B).
Nodes can be placed inside other nodes to form a hierarchy:
<Graph> <Node> <ForEachPart type="XESX"> <DefObj> <Node/> </DefObj> </ForEachPart> </Node> </Graph>
Custom node styles are also available.
Tip: See Finding SystemWeaver Type Identifiers (SIDs) for how to find the SIDs you will need.
Edges have a direction and are established between two items or parts that have been added as nodes to the graph. The tag defines one or many edges to be included (drawn) as a line between each pair of nodes. The attribute “to” defines the node the edge is pointing to. The attribute “from” defines the node the edge is pointing from. Below is a demonstration of how edges are defined.
InPort and OutPort
InPorts and OutPorts are used to easily model the implicit connection concept used in SystemWeaver. In this case there is no need to define edges. The graph itself will identify the edges based on the InPort and OutPort elements. An InPort(A) is added to indicate incoming communication. An OutPort (B) is added to indicate outgoing communication.
Below is a configuration showing how to use OutPort and InPort. The attribute ”connection” indicates what item or part is used to identify the connection. In this example, an OutPort will generate an edge to an InPort that has the same item or part as the connection object.
<Graph> <ForEachPart type="XESX"> <Node> <DefObj> <ForEachPart type="EXAC"> <DefObj> <Node> <ForEachPart type="ITOS"> <DefObj> <OutPort connection="."/> </DefObj> </ForEachPart> <ForEachPart type="ITIS"> <DefObj> <InPort connection="."/> </DefObj> </ForEachPart> </Node> </DefObj> </ForEachPart> </DefObj> </Node> </ForEachPart> </Graph>
A NodeStyle is used to define templates for how nodes should look. When a node is created, it is possible to assign a style to it with the ”style” attribute. The available attributes are:
The below picture illustrates the attributes for the NodeStyle named "component" and their effects on the appearance of a node.
<Graph> <NodeStyles> <NodeStyle name="component" fillColor="Green" fillColor2="Yellow" borderThickness="5" borderColor="Red" borderType="dash"/> </NodeStyles> <Node style="component"/> </Graph>
For more information on defining colors, see the XML Tag Reference - Graph specific section of the Help.
An EdgeStyle is used to define templates for how edges should look. When an edge is created, it is possible to assign a style to it with the ”style” attribute. The available attributes are:
The below example illustrates the attributes and their effects on the appearance of an edge.
<Graph> <EdgeStyles> <EdgeStyle name="realization" color="Red" thickness="3" lineType="dashdotdot" fromArrowType="Circle" toArrowType="Triangle"/> </EdgeStyles> <Node/> <Variable name="vehicleSpecification" as="Item" select="."/> <ForEachPart type="XESX"> <DefObj> <Node/> <Edge style="realization" from="$vehicleSpecification" to="." /> </DefObj> </ForEachPart> </Graph>
If you want to display the icon used in the SystemWeaver metadata in the graph nodes, you can use ObjIcons to do that in the Options tag declared directly below the Graph tag.
We hope that you are pleased with this course and feel ready to configure graphs. You can extend your knowledge by practicing the numerous scripting options described in the SystemWeaver Script Language Reference section in the Help or by browsing our how-to articles on the Support Portal.