SuperNode properties
Properties that are specific to SuperNodes are described in the following tables. Note that common node properties also apply to SuperNodes.
| Property name | Property type/List of values | Property description |
|---|---|---|
execute_method
|
Script
Normal
|
|
script
|
string |
SuperNode Parameters
You can use scripts to create or set SuperNode parameters using the general format:
mySuperNode.setParameterValue("minvalue", 30)
You can retrieve the parameter value with:
value mySuperNode.getParameterValue("minvalue")
Finding Existing SuperNodes
You can find SuperNodes in streams using the findByType() function:
source_supernode = modeler.script.stream().findByType("source_super", None)
process_supernode = modeler.script.stream().findByType("process_super", None)
terminal_supernode = modeler.script.stream().findByType("terminal_super", None)
Setting Properties for Encapsulated Nodes
You can set properties for specific nodes encapsulated within a SuperNode by
accessing the child diagram within the SuperNode. For example, suppose you have a source SuperNode
with an encapsulated Variable File node to read in the data. You can pass the name of the file to
read (specified using the full_filename property) by accessing the child diagram
and finding the relevant node as follows:
childDiagram = source_supernode.getChildDiagram()
varfilenode = childDiagram.findByType("variablefile", None)
varfilenode.setPropertyValue("full_filename", "c:/mydata.txt")
Creating SuperNodes
If you want to create a SuperNode and its content from scratch, you can do that in a similar way by creating the SuperNode, accessing the child diagram, and creating the nodes you want. You must also ensure that the nodes within the SuperNode diagram are also linked to the input- and/or output connector nodes. For example, if you want to create a process SuperNode:
process_supernode = modeler.script.stream().createAt("process_super", "My SuperNode", 200, 200)
childDiagram = process_supernode.getChildDiagram()
filternode = childDiagram.createAt("filter", "My Filter", 100, 100)
childDiagram.linkFromInputConnector(filternode)
childDiagram.linkToOutputConnector(filternode)