If you add a subflowchart, it is essentially used as a step.
This make it easier to reuse a flowchart structure across multiple
projects. For example, you can have a subflowchart that handles
communications with a PLC, which is often developed by someone
other than the vision specialist. You can then add this
subflowchart as a separate step to your main flowchart or to
another subflowchart.
By adding subflowcharts, you can also simplify and organize more
complex projects. Such projects should typically have one main,
simple flowchart, that includes a series of subflowchart steps.
To add a subflowchart, access the
Flowcharts page of the
Add Step dialog.
For a new subflowchart, enter a unique name, click the
New Flowchart
button, add a description, and click Add. Your project can now
access the new subflowchart. By default, the subflowchart is added
to the current (calling) flowchart. The subflowchart appears as a
step, with double sidelines.
To configure a subflowchart, you must access it by
double-clicking on the subflowchart step, or by selecting the
subflowchart name with either the Flowchart menu item or by
right-clicking inside the Flowchart view. A newly
created subflowchart includes only the Start and End circle elements.
You can configure a subflowchart as you would a regular
flowchart. For example, you can add new steps or copy steps from
other flowcharts. To return to the calling flowchart, or to access
any other flowchart in your project, use the Flowchart menu or
right-click inside the Flowchart view.
A subflowchart can have as many inputs (also referred to as
parameters) and outputs as you require. At design-time, the
Quick Evaluate pane displays the value of all inputs,
outputs, and variables of all the flowcharts and subflowcharts in a
project.
If you add a variable inside a subflowchart, set its
Reset Point
property to specify when the variable should be reset to its
initial value. For more information, see the Lifetime section
in Chapter
25: Variables and the Store step.
![](../../images/z_script_arrow_open.png)
Inputs
Inputs are the values the subflowchart receives from the calling
flowchart. Click on the Start circle element to
define the inputs to receive. Use a meaningful name and description
for each input, particularly if you plan to add the flowchart to
the library for future use. For more information, see the
Managing subflowcharts
section later in this chapter.
Input expressions must have a unique name and be of type
number, boolean (True or False), string, or
image. When you add an input expression, a default is set:
0 for
Numeric, False for Boolean,
null for
Image, or an empty String. Once added, you cannot
change the type.
In the calling flowchart, set appropriate values for all the
subflowchart's inputs if the default input expressions are not
suitable. Often, the input expressions are links to the results of
other steps.
![](../../images/z_script_arrow_open.png)
Outputs
Outputs are the values the subflowchart sends to the calling
flowchart. Click on the End circle element to define
the outputs to send. Like a subflowchart's inputs, outputs must be
of type Numeric, Boolean, String, or
Image.
![](../../images/z_script_arrow_open.png)
Linking to
other flowcharts
When configuring steps inside a subflowchart, a dropdown list
giving access to images and fixtures will only show images and
fixtures of the current subflowchart. To link to anything in
another flowchart, use the
Link editor.