Visual Scripting Guide
Visual Scripting Guide
TABLE OF CONTENTS
1.1 INTRODUCTION 1
2.2 VISUAL SCRIPTING ENVIRONMENT INTRODUCTION 2
Visual Scripting Toolbar in Geomagic Control X 2
Visual Scripting Editor User Interface Overview 3
Visual Scripting Editor Menu Bar / Toolbar 4
Actions List 6
What Are Actions and Their Purpose? 7
Understanding the Basic Structure of An Action 8
Using Right-Click Menus on The Action 9
Connectors 10
Notifications Window 11
3.3 BUILDING A SCRIPT 12
Measuring the Volume of Meshes 12
Step 1: Data Preparation 14
Step 2: Iteration Framework 22
Step 3: Measurements 24
Step 4: Outputs 27
Measuring Overall Deviation by Using an Inspection Template 31
Step 1: Data Preparation 33
Step 2: Measurement Setup for Template Project 39
Step 3: Iteration Framework 45
Step 4: Measuring Deviations with Multiple Meshes 50
Step 5: Outputs 52
Measuring Holes 58
Step 1: Data Preparation 59
Step 2: Iteration Framework 64
Step 3: Measurements 69
Measuring GD&T by using an Inspection Template 72
Step 1: Data Preparation 74
Step 2: Measurement Setup for Template Project 81
Step 3: Measuring GD&Ts with Multiple Meshes 88
Step 4: Outputs 91
Measuring Deviations at Predefined Positions 99
Step 1: Data Preparation 100
Step 2: Importing Simulated CMM Points 106
Step 3: Iteration Framework 110
Step 4: Measuring Deviations at predefined positions 114
Step 5: Outputs 117
4.4RUNNING A VISUAL SCRIPT 121
How to run a Visual Script in the Visual Scripting Toolbar 121
How to run a Visual Script in the Visual Scripting Editor 122
Debugging a Visual Script for Scripting Analysis 123
5.5 APPENDIX A. ADDITIONAL USER INTERFACE 125
Overview Window 125
Canvas 126
6.6 APPENDIX B. CUSTOMIZING PARAMETERS 128
7.7 APPENDIX C. USING EXPRESSION 133
8.8 APPENDIX D. EXTENDING VISUAL SCRIPTING 135
How to run a Visual Script from Command Line 135
How to run an external Python script from Visual Scripting Editor 139
How to Run a Visual Script from Python 141
1 INTRODUCTION
Oqton, Inc. 1
2 VISUAL SCRIPTING ENVIRONMENT INTRODUCTION
The Geomagic Control X Visual Scripting environment consists of two main components: the Visual Scripting Toolbar and the Visual
Scripting Editor. To access the Visual Scripting Editor, you can simply launch it through the Toolbar.
Note: Geomagic Control X Visual Scripting environment is only available in Geomagic Control X Professional and is not in
Geomagic Control X Essentials or Geomagic Control X Essentials Connect.
The following image shows the various tools available in the Visual Scripting Toolbar.
Visual Script Editor
Opens the Script Editor.
Open
Opens a predefined script.
Script List
A dropdown list of all available scripts that were
previously opened using the Open Script.
Start Script
Runs a script.
Stop Script
Stops the currently running script.
Oqton, Inc. 2
Visual Scripting Editor User Interface Overview
The following image shows the various elements available in the Visual Scripting Editor.
Actions List
The Actions list is composed of two main types of operations: General Operations and Geomagic Control X Operations.
Connectors
Connectors connect one action to another.
Breakpoints
Allows viewing and control of all breakpoints within the script, either globally or individually. When the script is run, it
will pause at these designated breakpoints, allowing for scripting analysis. Breakpoints can be deleted, disabled, or re-
enabled as required.
Overview Window
Displays an overview of all the action boxes in the scripts.
Notifications
Shows system message regarding the scripting operation.
Canvas
The main workspace (or canvas) where script editing occurs.
Oqton, Inc. 3
Visual Scripting Editor Menu Bar / Toolbar
The Visual Script Editor Menu Bar / Toolbar provide a standard set of commands for working with a script.
Open
Opens a saved script file (.scrpt).
Save
Saves the current script (.scrpt), overwriting the same location
and file name as the original.
Save As
Saves the current script under a another name and in a different
location as a script file (.scrpt).
Properties
Allows adding a description to a script so that you can better
represent the script when sharing it with co-workers.
y Edit
Undo
Undoes a scripting operation.
Redo
Redoes a scripting operation.
Zoom All
Zooms in or out so all actions can be viewed in the main editing
window.
Zoom To 100%
Displays the actions at 100% zoom to enable you to read the
action text.
Zoom By Box
Zooms in the actions by drawing a box on the screen so you can
read the action text.
Oqton, Inc. 4
Select All
Selects all actions in the main editing window.
Unselect All
Clears the selection.
Auto Arrange
Automatically arranges all actions in the main editing window.
y Debug
Start
Click to run the script. Once the script is running, the
Start button will be replaced with the 'Continue',
'Pause', 'Stop', and 'Go To Next Step' buttons.
Continue
Click to continue the script execution, either until the
end or until the next breakpoint.
Pause
Click to pause the script execution.
Stop
Click to stop the script execution.
Go To Next Step
Click to go to the next step (action) in the script
execution. The script moves to the next action and
displays a Yellow arrow symbol above the action to
signify the stopped location, as shown below.
y Help
Help
Opens the Scripting Help.
The Help is a resource of general information on Geomagic
Control X as well as providing context-specific assistance (help for
the current state of the application).
For context-sensitive Help, press the F1 key. This opens the Help
at the specific page reflecting the current state of the Geomagic
Control X active window, enabling you to receive assistance
without leaving the current context of your work.
About Scripting Editor
Shows general information about the Virtual Script Editor and the
current Virtual Script Editor version number.
Oqton, Inc. 5
Actions List
The List of Actions pane is a repository of actions that may be used in creating a script.
Search Bar
Allows you to search a desired action from the list of the actions.
General Operation
Provides general operations that control the global options and
parameters used in actions.
Refresh
Allows you to collapse all actions within each operation.
Explore the topics below to learn about using actions in the Visual Scripting Editor:
y What are actions and their purpose?
y Understanding the basic structure of an action
y Using right-click menus on the Action
Oqton, Inc. 6
What Are Actions and Their Purpose?
The Action List comprises two types of operations: General Operations and Geomagic Control X operations.
The Actions in the General Operations allows you to control global options and parameters used in actions. The Actions in the
Geomagic Control X Operations allows you to perform similarly to their respective Geomagic Control X functions.
Oqton, Inc. 7
Understanding the Basic Structure of An Action
The structure of the action dialog is composed of the following elements.
Name of Action
Shows the name of action.
Action Template
Shows the method to be used to carry out the action.
Parameters
Shows parameters available for the action.
The parameters displayed in the Action dialog are the same as the corresponding options for the Geomagic Control X command.
For example, the parameters that are displayed in the expanded Constructed Geometry (Plane) action dialog are the same options
in the Add Plane tool of Geomagic Control X as shown in the table below.
Comparison between Constructed Geometry (Plane) Action and Add Plane command
Oqton, Inc. 8
Using Right-Click Menus on The Action
Right-click menus are context-sensitive menus that contain frequently used commands, some of which are also found on the Toolbar.
Cut - Cuts the selected action(s).
Note: This option is available only for the Setup Parameters action.
For more information, see "6. Appendix B. Customizing Parameters" on page
128.
Oqton, Inc. 9
Connectors
The Connectors serve as the connections between actions in a script.
Note: If an error occurs during the execution of an action item and the Output Error Flow is not connected, the
script will stop at the point of the error and any errors will be displayed in the Notification pane.
Flow connectors are represented in the main editing window as dot lines.
Parameter Data Sockets
Input Parameter Data Sockets are used to receive parameters from other actions. Output Parameter Data
Sockets are used to pass parameters to the next actions. Parameter Data connectors are represented in the
main editing window as solid lines.
Note: More information on the connection between actions will be covered in the "3. Building A Script" on page 12.
Oqton, Inc. 10
Notifications Window
The Notification window displays system messages regarding the current script and appears on the right of the Visual Scripting
Editor.
The Notification windows can be displayed or hidden using the Notification icon located in the upper right corner of the Visual
Scripting Editor.
To zoom in on the action that has a script failure mentioned in the message, simply click on the message in the Notification Window.
Oqton, Inc. 11
3 BUILDING A SCRIPT
The following tutorials will guide you through using Visual Scripting in Geomagic Control X to automate various inspection tasks. You
will learn how to create scripts and run them in Geomagic Control X Visual Scripting Editor by following the step-by-step instructions.
Oqton, Inc. 12
Step Introduction Results in Each Step
Iteration Framework
This step shows how to establish a framework to perform
iterative operations on multiple meshes.
Measurements
This is a step for setting up a workflow to import a mesh
and apply volume measurement to it.
Outputs
Finally, you can specify the path of outputs and
create results of the automated volume measurement
performed on multiple meshes.
Oqton, Inc. 13
Step 1: Data Preparation
This step shows the process to set up a workflow for specifying the location of the files required for measurement and defining the
type of data to be imported from those files.
1. On the AUTOMATION tab, in the Visual Scripting group, click Visual Script Editor to open the Visual Script Editor.
3. Check if there is any unsaved document open in the Visual Script Editor. If yes, click Save or Save As to save your
document and click New or go to File > New to create a new document.
Oqton, Inc. 14
4. In the Action List, under the Geomagic Control X > Utility menu, either double-click Environmental Variables, or click-and-drag
it onto the main editing window to define the initial file search location.
This action allows you to select the installation location of Geomagic Control X or the Visual Scripting data folder using two
parameters.
Control X Folder: C:\Program Files\3D Systems\<Geomagic Control X Version> or C:\Program Files\Oqton\<Geomagic Con-
trol X Version>
Visual Script Editor Folder: C:\3D Systems\Geomagic Control X\<Version Number>\VisualScripting or C:\Oqton\Geomagic
Control X\<Version Number>\VisualScripting
Tip: To specify the initial file search location to another location, use the Setup Parameter action and enter an expression
to specify the file path.
The Parameter named "Data" functions as an identifier that stores the associated value, representing the desired file
location. The parameter will be passed to the next action through parameter connectors.
5. In the Action List, under the General Operations menu, either double-click Expression, or click-and-drag it onto the main
editing window to specify the location of data from the starting point.
Oqton, Inc. 15
6. In the Expression input box, type the following two expressions and click Enter. Click Plus icon to add more expressions.
Expressions 1: SampleFolder=VSFolder+"\Sample\Example_01"
Specifies the location of the provided sample files for this exercise.
Expressions 2: OutputFolder=VSFolder+"\TestOutput\Example_01"
Defines the path for the output files.
Note: You can define the names of input and output variables as per your preference. Ensure that the input file path points
to the location of the target files.
The default location of the provided sample files for this exercise is as follows:
C:\Oqton\Geomagic Control X\<Version Number>\VisualScripting\Sample\Example_01
7. In the Action List, under the Geomagic Control X > Search menu, either double-click Search (File Search), or click-and-drag it
onto the main editing window to search desired data from the location specified in the step 6.
Oqton, Inc. 16
8. In the Search (File Search) action, change the File Type to Scan Files to search scan files from the specified data folder.
9. In the Action List, under the Geomagic Control X > Converter menu, either double-click Converter (Parameter to Data), or
click-and-drag it onto the main editing window. The Converter (Parameter to Data) action is utilized to convert data that is
received as parameters from files into a format that can be utilized by subsequent actions in the script.
10. To set the execution order, connect the Utility (Environmental Variables) and Expression actions using flow connectors. Click on
the Out-Flow of the Utility (Environmental Variables) action and drag it to the In-Flow of the Expression action to connect the
two actions.
Oqton, Inc. 17
11. Connect on the Visual Script Editor Folder parameter of the Utility (Environmental Variables) action to the Input Data Socket
of the Expression action defined as “VSFolder" to set the data flow.
12. Connect the actions in the same way as in the previous step, as shown in the image below. If all connections are successfully
established, they will be indicated in black.
Note: All the fields or parameters marked with an asterisk (*) are mandatory and must be filled in or connected before
running the script. Ensure their presence before proceeding.
Oqton, Inc. 18
Note: In the case that a connector is mistakenly connected to the wrong location, it will appear in RED as a warning. The
Notification window displays system messages regarding the current script and appears on the right of the Scripting Editor
window.
In order to delete a connection, right click on the connector and select Delete.
13. If necessary, the actions in the main editing window can be organized into functional groups for a more efficient workflow. The
groups can be renamed, recolored, and ungrouped as needed. To organize actions into functional groups, select the actions
by either holding down the Ctrl key on the keyboard while clicking them or by clicking and dragging a box around them.
14. Right-click on the selection and click Group to organize the actions into a functional group. The actions will be grouped in a box
with a default name and a random color.
Oqton, Inc. 19
15. To customize the group, you can do the following steps.
a. Change the color by clicking the Color Chooser icon and adjusting the R (Red), G (Green), B (Blue), and A (Alpha)
Note: The Output Data (OutputFolder) Socket of the Expression will later be connected to the Input Data
(OutputFolder) Socket of the next Expression.
16. If necessary, actions can be detached from the group. Select the action and click Detach from the Right-Click menu.
Oqton, Inc. 20
17. To ungroup, select the group and click Ungroup from the Right-Click menu.
Oqton, Inc. 21
Step 2: Iteration Framework
This step shows how to establish a framework to perform iterative operations on multiple meshes.
1. In the Action List, under the General Operations menu, either double-click For Each, or click-and-drag it onto the main editing
window to set up a framework for iterative operations.
Oqton, Inc. 22
2. In the Action List, under the Geomagic Control X > Converter menu, either double-click Converter (ForEach Iterator), or click-
and-drag it onto the main editing window, and then drag it into the For Each action to indicate the value (data) and index
(iteration order) during the iteration process within the For Each action.
3. Connect the Converter (Parameter to Data) and the For Each actions as shown in the image below.
IMPORTANT: When performing iterative operations within the ForEach action, it is essential to convert the action results
into data format using the Parameter to Data action and then pass them to the Data socket.
Oqton, Inc. 23
Step 3: Measurements
This is a step for setting up a workflow to import a mesh and apply volume measurement to it.
This step is composed of two procedures and the following actions are used in each procedure:
y Creating a new Geomagic Control X file and importing a mesh in it
File (New Document) - To create a new document and set up measurement for a new data.
File (Import File) - To import a data file into the Geomagic Control X application.
y Measuring Volume of imported mesh
Search (Entity Search By Context) - To search target mesh for measurement from the imported file.
Measure (Measure Volume) - To perform volume measurement on the target mesh.
1. In the Action List, under the Geomagic Control X > File menu, either double-click File (New Document), or click-and-drag it
onto the main editing window, and then drag it into the For Each action to create a new document and set up measurement for
a new data.
Oqton, Inc. 24
2. Add File (Import File), Search (Entity Search By Context), and Measure (Measure Volume) actions and place them into the For
Each as done in the previous step and arrange them as shown in the image below to prepare for volume measurement.
Tip: You can easily search desired actions by using the Search Box in the Action List.
Tip: The File (Import File) action allows you to customize user settings for the imported data format. To customize the
settings, select the Use Custom Setting option, which expands the available options for customization. You can customize
the settings according to your preferences, similar to the options available in the "Import" dialog in Geomagic Control X.
Oqton, Inc. 25
3. In the File (Entity Search By Context) action, change the Context Type to Measured Data to import data as Measured Data.
4. In the Measure (Measure Volume) action, clear the Use Projection Plane option to disable mesh projection.
Note: All the fields or parameters marked with an asterisk (*) are mandatory and must be filled in or connected before
running the script. Ensure their presence before proceeding.
Oqton, Inc. 26
Step 4: Outputs
Finally, you can specify the path of outputs and create results of the automated volume measurement performed on multiple meshes.
1. In the Action List, under the General Operations menu, either double-click Expression, or click-and-drag it onto the main
editing window, and then drag it into the For Each action to specify the path of outputs.
2. Add Tools (Export Tabular View) action and place it into the For Each in the same way as in the previous step, as shown in the
image below.
Oqton, Inc. 27
3. In the Expression, in the Expression input box, type the following two expressions and click Enter. Click Plus icon to add more
expressions. This Expression action is used to specify the names of measurements and output files.
Expressions 1: measureName=filenamewithoutextension(valueIn)
Extracts the name of the target file from the provided value, which can then be used to determine the name of the
output file.
Expressions 2: outFile=outputFolder+"\"+measureName+"_Measure.csv"
Specifies the name of output file using the extracted value.
Note: The name of input or output variables can be defined as you desired. The output parameter (outputFolder) socket
in the Expression added in the "Step 1: Data Preparation" on page 14 will later be connected to the input parameter
(outputFolder) socket.
4. In the Tools (Export Tabular View) action, change the Feature Type to Measurement.
Oqton, Inc. 28
5. Connect the added actions as shown in the image below.
Note: To ensure proper flow processing, ensure that the output parameter (outputFolder) socket in the first Expression
added in the "Step 1: Data Preparation" on page 14 is connected to the input parameter (outputFolder) socket in the
second Expression.
Oqton, Inc. 29
6. Finally, the script is completed.
Note: All the fields or parameters marked with an asterisk (*) are mandatory and must be filled in or connected before
running the script. Ensure their presence before proceeding.
Oqton, Inc. 30
Measuring Overall Deviation by Using an Inspection
Template
In this exercise, you will learn how to use the Visual Scripting environment to create a visual script that can automatically import
multiple meshes and measure the overall deviation in comparison to the Reference Data.
Iteration Framework
This step shows how to establish a framework to perform
iterative operations on multiple meshes.
Oqton, Inc. 31
Step Introduction Results in Each Step
Measuring Deviations with Multiple Meshes
This is a step for setting up a workflow to measure
deviations by iteratively replacing the original mesh with
new ones in the template project.
Outputs
Finally, you can specify the path of outputs and create
results of the automated deviation measurement
performed on multiple meshes.
Oqton, Inc. 32
Step 1: Data Preparation
This step shows the procedure to set up a workflow for importing data files required for deviation measurement.
1. On the AUTOMATION tab, in the Visual Scripting group, click Visual Script Editor to open the Visual Script Editor.
3. Check if there is any unsaved document open in the Visual Script Editor. If yes, click Save or Save As to save your
document and click New or go to File > New to create a new document.
Oqton, Inc. 33
4. In the Action List, under the Geomagic Control X > File menu, either double-click File (New Document), or click-and-drag it
onto the main editing window. The File (New Document) is used to clean up any existing document open in the application and
create a new document.
5. In the Action List, under the Geomagic Control X > Utility menu, either double-click Environmental Variables, or click-and-drag
it onto the main editing window to define the initial file search location.
This action allows you to select the installation location of Geomagic Control X or the Visual Scripting data folder using two
parameters.
Control X Folder: C:\Program Files\3D Systems\<Geomagic Control X Version> or C:\Program Files\Oqton\<Geomagic Con-
trol X Version>
Visual Script Editor Folder: C:\3D Systems\Geomagic Control X\<Version Number>\VisualScripting or C:\Oqton\Geomagic
Control X\<Version Number>\VisualScripting
Tip: o specify the initial file search location to another location, use the Setup Parameter action and enter an expression to
specify the file path.
The Parameter named "Data" functions as an identifier that stores the associated value, representing the desired file
location. The parameter will be passed to the next action through parameter connectors.
Oqton, Inc. 34
6. In the Action List, under the General Operations menu, either double-click Expression, or click-and-drag it onto the main
editing window to specify the location of data from the starting point.
7. In the Expression input box, type the following three expressions and click Enter. Click Plus icon to add more expressions.
Note: You can define the names of input and output variables as per your preference. Ensure that the input file path points
to the location of the target files.
The default location of the provided sample files for this exercise is as follows:
C:\Oqton\Geomagic Control X\<Version Number>\VisualScripting\Sample\Example_02
Oqton, Inc. 35
8. In the Action List, under the Geomagic Control X > Search menu, either double-click Search (File Search), or click-and-drag it
onto the main editing window to search desired data from the location specified in the step 7.
9. In the Action List, under the Geomagic Control X > File menu, either double-click File (Import File), or click-and-drag it onto the
main editing window. The File (Import File) is used to import files for the measurements and pass them to next actions.
Oqton, Inc. 36
Tip: The File (Import File) action allows you to customize user settings for the imported data format. To customize the
settings, select the Use Custom Setting option, which expands the available options for customization. You can customize
the settings according to your preferences, similar to the options available in the "Import" dialog in Geomagic Control X.
10. To set the execution order, connect the Utility (Environmental Variables) and Expression actions using flow connectors. Click on
the Out-Flow of the Utility (Environmental Variables) action and drag it to the In-Flow of the Expression action to connect the
two actions.
11. Connect on the Visual Script Editor Folder parameter of the Utility (Environmental Variables) action to the Input Data Socket
of the Expression action defined as “VSFolder" to set the data flow.
Oqton, Inc. 37
12. Connect the actions in the same way as in the previous step, as shown in the image below.
Note: The output parameters (outputFolder, sampleFolder) socket in the Expression will later be connected to the input
parameter socket in the next Expression.
Oqton, Inc. 38
Step 2: Measurement Setup for Template Project
This is a step for setting up a workflow to apply deviation measurement operations to an imported mesh and creating a template
project that can be utilized for multiple meshes.
This step is composed of two procedures and the following actions are used in each procedure:
y Measuring deviation of imported mesh in compare to the Reference Data
Align (Initial Alignment) - To automatically align the imported mesh to the Reference Data using geometric feature
information in a part and apply the best-fitting algorithm for a finer alignment.
Compare (3D Compare) - To analyze the overall deviation between the imported mesh and Reference Data by projecting
all paired points onto the Reference Data.
y Generating an inspection report and saving the file
Expression - To specify the name and path of the outputs.
Report (Generate Report) - To generate an inspection report from deviation results.
File (Save Document) - To save a file to be used as a template.
1. In the Action List, under the Geomagic Control X > Align menu, either double-click Align (Initial Alignment), or click-and-drag
it onto the main editing window to add an alignment operation to the script for the imported mesh.
Oqton, Inc. 39
2. In the Action List, under the Geomagic Control X > Compare menu, either double-click Compare (3D Compare), or click-and-
drag it onto the main editing window to add deviation measurement to the script for the imported mesh.
3. In the Action List, under the General Operations menu, either double-click Expression, or click-and-drag it onto the main
editing window to specify the name of result data.
4. In the Expression input box, type the following expression and click Enter.
Note: You can define the names of output variables as per your preference. However, in order to create a result report
that refers to the Result Data location, the value of the output variable must match the default name of the Result Data in
Geomagic Control X. The default name for the Result Data is "Result Data - 1" (including the spaces).
Oqton, Inc. 40
5. In the Action List, under the Geomagic Control X > Report menu, either double-click Report (Generate Report), or click-and-
drag it onto the main editing window to generate an inspection report for the deviation measurement.
6. Under the Parameters, type “A4_Portrait” to the Template input box and click Enter to specify the size and orientation of the
report.
7. In the Action List, under the General Operations menu, either double-click Expression, or click-and-drag it onto the main
editing window to specify the path of an inspection project file to be used as a template project.
Oqton, Inc. 41
8. In the Expression input box, type the following expression and click Enter.
Expressions 1: TemplateFileName=outputFolder+"Template.CXProj"
Specifies the name of the template inspection project. The template inspection project will then be utilized to inspect
the target Measured Data in the subsequent steps.
Note: The output parameter (outputFolder) socket in the Expression added in the "Step 1: Data Preparation" on page
33 will later be connected to the input parameter (outputFolder) socket in this Expression.
9. In the Action List, under the Geomagic Control X > File menu, either double-click File (Save Document), or click-and-drag it
onto the main editing window to save the current inspection project as a template project for next measurements.
10. To set the execution order, connect the File (Import File) and Align (Initial Alignment) actions using flow connectors. Click on
the Out-Flow of the File (Import File) action and drag it to the In-Flow of the Align (Initial Alignment) action to connect the two
actions.
Oqton, Inc. 42
11. Connect the actions in the same way as in the previous step, as shown in the image below.
Note: To ensure proper flow processing, ensure that the output parameter (outputFolder) socket in the Expression is
connected to the input parameter (outputFolder) socket in the second Expression.
Note: All the fields or parameters marked with an asterisk (*) are mandatory and must be filled in or connected before
running the script. Ensure their presence before proceeding.
12. If necessary, the actions in the main editing window can be organized into functional groups for a more efficient workflow. The
groups can be renamed, recolored, and ungrouped as needed. To organize actions into functional groups, select the actions
by either holding down the Ctrl key on the keyboard while clicking them or by clicking and dragging a box around them.
Oqton, Inc. 43
13. Right-click on the selection and click Group to organize the actions into a functional group. The actions will be grouped in a box
with a default name and a random color.
a. Change the color by clicking the Color Chooser icon and adjusting the R (Red), G (Green), B (Blue), and A (Alpha)
Oqton, Inc. 44
Step 3: Iteration Framework
This step shows how to establish a framework to perform iterative operations on multiple meshes.
1. In the Action List, under the Geomagic Control X > Search menu, either double-click Search (File Search), or click-and-drag it
onto the main editing window to search desired data from the location specified in the Expression within the step 7 of "Step 1:
Data Preparation" on page 33.
Oqton, Inc. 45
2. In the Search (File Search) action, change the File Type to Scan Files to search scan files from the specified data folder.
3. In the Action List, under the Geomagic Control X > Converter menu, either double-click Converter (Parameter to Data), or
click-and-drag it onto the main editing window. The Converter (Parameter to Data) action is utilized to convert data that is
received as parameters from files into a format that can be utilized by subsequent actions in the script.
4. In the Action List, under the General Operations menu, either double-click For Each, or click-and-drag it onto the main editing
window to set up a framework for iterative operations.
Oqton, Inc. 46
5. In the Action List, under the Geomagic Control X > Converter menu, either double-click Converter (ForEach Iterator), or click-
and-drag it onto the main editing window, and then drag it into the For Each action to indicate the value (data) and index
(iteration order) during the iteration process within the For Each action.
6. To set the execution order, connect the Search (File Search) and Converter (Parameter to Data) actions using flow connectors.
Click on the Out-Flow of the Search (File Search) action and drag it to the In-Flow of the Converter (Parameter to Data) action
to connect the two actions.
7. To organize actions into functional groups, select the Search (File Search), Converter (Parameter to Data), and For Each
actions by either holding down the Ctrl key on the keyboard while clicking them or by clicking and dragging a box around them.
8. Right-click on the selection and click Group to organize the actions into a functional group. The actions will be grouped in a box
with a default name and a random color.
Oqton, Inc. 47
9. The selected actions are grouped. Double click the name of the group and change it as you desired. Connect the actions in the
same way as in the previous step, as shown in the image below.
IMPORTANT: When performing iterative operations within the ForEach action, it is essential to convert the action results
into data format using the Parameter to Data action and then pass them to the Data socket.
10. To set the execution order, connect the File (Save Document) and Search (File Search) actions using flow connectors. Click on
the Out-Flow of the File (Save Document) action and drag it to the In-Flow of the Search (File Search) action to connect the
two actions.
Oqton, Inc. 48
11. To connect the Parameter Data sockets between actions, add data connectors. Click the SampleFolder socket of the Expression
added in "Step 1: Data Preparation" on page 33 and drag it to the Target Folder socket of the Search (File Search) action to
connect the Parameter Data sockets between the two actions.
Oqton, Inc. 49
Step 4: Measuring Deviations with Multiple Meshes
This is a step for setting up a workflow to measure deviations by iteratively replacing the original mesh with new ones in the template
project.
1. In the Action List, under the Geomagic Control X > File menu, either double-click File (Replace Measured Data), or click-and-
drag it onto the main editing window, and then drag it into the For Each action to iteratively replace the original mesh with a
new one for new deviation measurement.
Oqton, Inc. 50
2. Add Edit (Regenerate All) action and place it into the For Each action in the same way as in the previous step, as shown in the
image below.
Tip: You can easily search desired actions by using the Search Box in the Action List.
Note: All the fields or parameters marked with an asterisk (*) are mandatory and must be filled in or connected before
running the script. Ensure their presence before proceeding.
Oqton, Inc. 51
Step 5: Outputs
Finally, you can specify the path of outputs and create results of the automated deviation measurement performed on multiple
meshes.
1. In the Action List, under the General Operations menu, either double-click Expression, or click-and-drag it onto the main
editing window, and then drag it into the For Each action to specify the name and path of the outputs.
Oqton, Inc. 52
2. Add two more Expressions into the For Each action in the same way as in the previous step, as shown in the image below.
3. In the Expression input box, type the following expression and click Enter.
Note: You can define the names of output variables as per your preference. However, in order to rebuild or export a result
report, the value of the output variable must match the default name of the report in Geomagic Control X. The default
report name is "Report 1" (including the space).
Oqton, Inc. 53
4. In the second Expression, in the Expression input box, type the following expression and click Enter. The second Expression
action is used to define the name of target Measured data.
Expressions: meshName=filenamewithoutextension(valueIn)
Extracts the name of the target file from the provided value, which can then be used to determine the name of the
output files.
Note: The name of input or output variables can be defined as you desired.
5. In the third Expression, in the Expression input box, type the following two expressions and click Enter. Click Plus icon to add
more expressions. The third Expression is used to specify the path and file name of outputs.
Note: The name of input or output variables can be defined as you desired. The output parameter (outputFolder) socket
in the Expression added in the "Step 1: Data Preparation" on page 33 will later be connected to the input parameter
(dir) socket.
Oqton, Inc. 54
6. In the Action List, under the Geomagic Control X > Report menu, either double click Report (Report Manager), or click and
drag it to the main editing window, and then drag it into the For Each action.
Note: The first Report (Report Manager) is used to run rebuilding a report for new Measured Data.
8. Add one more Report (Report Manager) into the For Each action in the same way as in the previous step.
Note: The second Report (Report Manager) is used to output the report as a PDF file.
Oqton, Inc. 55
10. In the Action List, under the Geomagic Control X > File menu, either double click File (Save Document), or click and drag it to
the main editing window, and then drag it into the For Each action to save a Geomagic Control X file once the measurements is
done for the new mesh.
11. Place them on the For Each action and connect them as shown in the image below.
Oqton, Inc. 56
Note: To ensure proper flow processing, ensure that the output parameter (outputFolder) socket in the Expression action
added in the "Step 1: Data Preparation" on page 33 is connected to the input parameter (dir) socket in the third
Expression.
Note: All the fields or parameters marked with an asterisk (*) are mandatory and must be filled in or connected before
running the script. Ensure their presence before proceeding.
13. In the Visual Scripting Toolbar, click Start to run the script.
Oqton, Inc. 57
Measuring Holes
In this exercise, you will learn how to use the Visual Scripting environment to create a visual script that can automatically import a
mesh and Reference Data, and measure holes by creating cylinders on both data.
Iteration Framework
This step shows how to establish a framework to perform
iterative operations on the imported data.
Measurements
This is a step for setting up a workflow to create cylinders
on the imported data.
Oqton, Inc. 58
Step 1: Data Preparation
This step shows the procedure to set up a workflow for importing data files required for geometry creation.
1. On the AUTOMATION tab, in the Visual Scripting group, click Visual Script Editor to open the Visual Script Editor.
3. Check if there is any unsaved document open in the Visual Script Editor. If yes, click Save or Save As to save your
document and click New or go to File > New to create a new document.
Oqton, Inc. 59
4. In the Action List, under the Geomagic Control X > Utility menu, either double-click Environmental Variables, or click-and-drag
it onto the main editing window to define the initial file search location.
This action allows you to select the installation location of Geomagic Control X or the Visual Scripting data folder using two
parameters.
Control X Folder: C:\Program Files\3D Systems\<Geomagic Control X Version> or C:\Program Files\Oqton\<Geomagic Con-
trol X Version>
Visual Script Editor Folder: C:\3D Systems\Geomagic Control X\<Version Number>\VisualScripting or C:\Oqton\Geomagic
Control X\<Version Number>\VisualScripting
5. In the Action List, under the General Operations menu, either double-click Expression, or click-and-drag it onto the main
editing window to specify the location of data from the starting point.
6. In the Expression input box, type the following three expressions and click Enter.
Oqton, Inc. 60
Note: You can define the names of input variable as per your preference. Ensure that the input file path points to the
location of the target files.
The default location of the provided sample files for this exercise is as follows:
C:\Oqton\Geomagic Control X\<Version Number>\VisualScripting\Sample\Example_03
7. In the Action List, under the Geomagic Control X > File menu, either double-click File (New Document), or click-and-drag it
onto the main editing window. The File (New Document) is used to clean up any existing document open in the application and
create a new document.
8. In the Action List, under the Geomagic Control X > Search menu, either double-click Search (File Search), or click-and-drag it
onto the main editing window to search desired data from the location specified in the step 6.
Oqton, Inc. 61
9. In the Action List, under the Geomagic Control X > File menu, either double-click File (Import File), or click-and-drag it onto the
main editing window. The File (Import File) is used to import files for the measurements and pass them to next actions.
Tip: The File (Import File) action allows you to customize user settings for the imported data format. To customize the
settings, select the Use Custom Setting option, which expands the available options for customization. You can customize
the settings according to your preferences, similar to the options available in the "Import" dialog in Geomagic Control X.
Oqton, Inc. 62
10. In the Action List, under the Geomagic Control X > Align menu, either double-click Align (Initial Alignment), or click-and-drag
it onto the main editing window to add an alignment operation to the script for the imported mesh.
11. To set the execution order, connect the Utility (Environmental Variables) and Expression actions using flow connectors. Click on
the Out-Flow of the Utility (Environmental Variables) action and drag it to the In-Flow of the Expression action to connect the
two actions.
12. Connect on the Visual Script Editor Folder parameter of the Utility (Environmental Variables) action to the Input Data Socket
of the Expression action defined as “VSFolder" to set the data flow.
13. Connect the actions in the same way as in the previous step, as shown in the image below.
Note: All the fields or parameters marked with an asterisk (*) are mandatory and must be filled in or connected before
running the script. Ensure their presence before proceeding.
Oqton, Inc. 63
Step 2: Iteration Framework
This step shows how to establish a framework to perform iterative operations on the imported data.
1. In the Action List, under the Geomagic Control X > Search menu, either double-click Search (Entity Search By Type), or click-
and-drag it onto the main editing window to search desired entities from the imported data.
Oqton, Inc. 64
2. Change the Entity Type to Face and select the Search Filter option to add a filter for selecting desired geometries only from the
imported data.
3. Select the Geometry Type option and change the Geometry Type to Cylinder to search cylindrical features from the input
Reference and Measured Data.
4. In the Action List, under the Geomagic Control X > Converter menu, either double-click Converter (Parameter to Data), or
click-and-drag it onto the main editing window. The Converter (Parameter to Data) action is utilized to convert data that is
received as parameters from files into a format that can be utilized by subsequent actions in the script.
Oqton, Inc. 65
5. In the Action List, under the General Operations menu, either double-click For Each, or click-and-drag it onto the main editing
window to set up a framework for iterative operations.
6. In the Action List, under the Geomagic Control X > Converter menu, either double-click Converter (ForEach Iterator), or click-
and-drag it onto the main editing window, and then drag it into the For Each action to indicate the value (data) and index
(iteration order) during the iteration process within the For Each action.
7. Connect the Converter (Parameter to Data) and the For Each actions as shown in the image below.
Oqton, Inc. 66
IMPORTANT: When performing iterative operations within the ForEach action, it is essential to convert the action results
into data format using the Parameter to Data action and then pass them to the Data socket.
8. Select the actions by either holding down the Ctrl key on the keyboard while clicking them or by clicking and dragging a box
around them.
9. Right-click on the selection and click Group to organize the actions into a functional group. The actions will be grouped in a box
with a default name and a random color.
a. Change the color by clicking the Color Chooser icon and adjusting the R (Red), G (Green), B (Blue), and A (Alpha)
Oqton, Inc. 67
c. Edit the name as you desired and click on any empty space in the main editing window to complete.
Oqton, Inc. 68
Step 3: Measurements
This is a step for setting up a workflow to create cylinders on the imported data.
1. In the Action List, under the Geomagic Control X > Constructed Geometry menu, either double click Constructed Geometry
(Cylinder), or click and drag it to the main editing window, and then drag it into the For Each action to add Constructed
Geometry (Cylinder) action that creates Constructed Cylinders on the entities that are searched from the imported data.
Tip: You can easily search desired actions by using the Search Box in the Action List.
Oqton, Inc. 69
2. Change the Template to Cylinder.
3. Change the Method to Extract to create cylinders by extracting cylindric features from the Reference and Measured Data.
Oqton, Inc. 70
4. Connect them as shown in the image below.
Note: All the fields or parameters marked with an asterisk (*) are mandatory and must be filled in or connected before
running the script. Ensure their presence before proceeding.
Oqton, Inc. 71
Measuring GD&T by using an Inspection Template
In this exercise, you will learn how to use the Visual Scripting environment to create a visual script that imports multiple meshes and
measures GD&Ts by using inspection template automatically.
Oqton, Inc. 72
Step Introduction Results in Each Step
Outputs
Finally, you can specify the path of outputs and create
results of the automated GD&T measurement performed
on multiple meshes.
Oqton, Inc. 73
Step 1: Data Preparation
This step shows the procedure to set up a workflow for importing data files required for GD&T measurement.
1. On the AUTOMATION tab, in the Visual Script group, click Visual Script Editor to open the Visual Script Editor.
3. Check if there is any unsaved document open in the Visual Script Editor. If yes, click Save or Save As to save your
document and click New or go to File > New to create a new document.
4. In the Action List, under the Geomagic Control X > File menu, either double-click File (New Document), or click-and-drag it
onto the main editing window. The File (New Document) is used to clean up any existing document open in the application and
create a new document.
Oqton, Inc. 74
5. In the Action List, under the Geomagic Control X > Utility menu, either double-click Environmental Variables, or click-and-drag
it onto the main editing window to define the initial file search location.
This action allows you to select the installation location of Geomagic Control X or the Visual Scripting data folder using two
parameters.
Control X Folder: C:\Program Files\3D Systems\<Geomagic Control X Version> or C:\Program Files\Oqton\<Geomagic Con-
trol X Version>
Visual Script Editor Folder: C:\3D Systems\Geomagic Control X\<Version Number>\VisualScripting or C:\Oqton\Geomagic
Control X\<Version Number>\VisualScripting
6. In the Action List, under the General Operations menu, either double-click Expression, or click-and-drag it onto the main
editing window to specify the location of data from the starting point.
7. In the Expression input box, type the following three expressions and click Enter. Click Plus icon to add more expressions.
Oqton, Inc. 75
Note: You can define the names of input and output variables as per your preference. Ensure that the input file path points
to the location of the target files.
The default location of the provided sample files for this exercise is as follows:
C:\Oqton\Geomagic Control X\<Version Number>\VisualScripting\Sample\Example_04
8. In the Action List, under the Geomagic Control X > Search menu, either double-click Search (File Search), or click-and-drag it
onto the main editing window to search desired data from the location specified in the step 7.
9. In the Search (File Search), change the File Type to CAD Files to search CAD files from input data.
Oqton, Inc. 76
10. In the Action List, under the Geomagic Control X > File menu, either double-click File (Import File), or click-and-drag it onto the
main editing window. The File (Import File) is used to import files for the measurements and pass them to next actions.
Tip: The File (Import File) action allows you to customize user settings for the imported data format. To customize the
settings, select the Use Custom Setting option, which expands the available options for customization. You can customize
the settings according to your preferences, similar to the options available in the "Import" dialog in Geomagic Control X.
Oqton, Inc. 77
11. In the Action List, under the Geomagic Control X > Search menu, either double-click Search (File Search), or click-and-drag it
onto the main editing window to search target scan data from the location specified in the step 7.
12. In the Action List, under the Geomagic Control X > Converter menu, either double-click Converter (Parameter to Data), or
click-and-drag it onto the main editing window. The Converter (Parameter to Data) action is utilized to convert data that is
received as parameters from files into a format that can be utilized by subsequent actions in the script.
13. To set the execution order, connect the File (New Document) and Utility (Environmental Variables) actions using flow
connectors. Click on the Out-Flow of the File (New Document) action and drag it to the In-Flow of the Utility (Environmental
Variables) action to connect the two actions.
14. Connect the actions in the same way as in the previous step, as shown in the image below.
Oqton, Inc. 78
Note: To ensure proper flow processing, ensure that the output parameter (inputCAD) socket in the Expression is connected
to the Target Folder parameter in the first Search (File Search) action and that the output parameter (inputScan) socket in
the Expression is connected to the Target Folder parameter in the second Search (File Search) action.
Note: The output parameter (outputFolder) socket in the Expression will later be connected to the input parameter
(outputFolder) socket in the next Expressions.
Note: All the fields or parameters marked with an asterisk (*) are mandatory and must be filled in or connected before
running the script. Ensure their presence before proceeding.
15. If necessary, the actions in the main editing window can be organized into functional groups for a more efficient workflow. The
groups can be renamed, recolored, and ungrouped as needed. To organize actions into functional groups, select the actions
by either holding down the Ctrl key on the keyboard while clicking them or by clicking and dragging a box around them.
16. Right-click on the selection and click Group to organize the actions into a functional group. The actions will be grouped in a box
with a default name and a random color.
Oqton, Inc. 79
17. To customize the group, you can do the following steps.
a. Change the color by clicking the Color Chooser icon and adjusting the R (Red), G (Green), B (Blue), and A (Alpha)
Oqton, Inc. 80
Step 2: Measurement Setup for Template Project
This is a step for setting up a workflow to apply GD&T measurement operations to an imported mesh and creating a template project
that can be utilized for multiple meshes.
This step is composed of two procedures and the following actions are used in each procedure:
y Establishing a framework to perform iterative operations on multiple meshes
For Each - To use loop functionality to run actions specified inside the For Each action.
Converter (ForEach Iterator) - To indicate the value (data) and index (iteration order) during the iteration process within the
For Each action.
Condition - To judge whether the condition of input data is true or false. The output flow depends on the results of the
conditions.
File (Import File) - To import new mesh files into the Geomagic Control X application.
y Measuring GD&Ts of imported mesh in compare to the Reference Data
Align (Initial Alignment) - To automatically align the imported mesh to the Reference Data using geometric feature
information in a part and apply the best-fitting algorithm for a finer alignment.
Align (Datum Alignment) - To automatically align the imported mesh to the Reference Data by matching geometric fea-
tures defined as datums.
GD&T (Linear Dimension) - To measure a distance between selected target entities.
All the actions within the “For Each" action will be executed repeatedly until there is no more data to be processed.
1. In the Action List, under the General Operations menu, either double-click For Each, or click-and-drag it onto the main editing
window to set up a framework for iterative operations.
Oqton, Inc. 81
2. In the Action List, under the Geomagic Control X > Converter menu, either double-click Converter (ForEach Iterator), or click-
and-drag it onto the main editing window, and then drag it into the For Each action to indicate the value (data) and index
(iteration order) during the iteration process within the For Each action.
3. In the Action List, under the General Operations menu, either double click Condition, or click and drag it to the main editing
window to add the Condition action, which judges whether the condition of input data is true or false. The output flow depends
on the results of the conditions.
4. Click-and-drag the Condition action into the For Each action to indicate the value (data) and index (iteration order) during the
iteration process within the For Each action.
Oqton, Inc. 82
5. Under the Condition, in the IF input box, type the following condition and click Enter. This Condition action is used To indicate
the value (data) and index (iteration order) during the iteration process within the For Each action.
IF: Index == 0
The iteration number is recorded as an index and starts at 0. When the index is 0, the data will be processed for config-
uring the template project. For an index of 1 or higher, the data will be processed for applying to the template project.
Note: The following signs may be used in the expressions and conditions.
Sign Condition
== Is equal?
> Is larger?
< Is smaller?
|| Or
&& And
6. Add File (Import File), Align (Initial Alignment), Align (Datum Alignment), and two GD&T (Linear Dimension) actions and place
them into the For Each in the same way as in the previous step, as shown in the image below.
Tip: You can easily search desired actions by using the Search Box in the Action List.
Oqton, Inc. 83
7. In the Align (Initial Alignment) action, change the Method to Quick in order to quickly analyzes features on Measured Data
and match them to the Reference data in a rough manner.
8. In the Align (Datum Alignment) action, type the following parameters in the Datum Pair1, Pair2, and Pair 3, and click Enter.
Note: The face ID number may differ based on the version of Geomagic Control X you use or the selection you make. To
find the unique face ID, open the Reference Data in Geomagic Control X and locate their face name in the properties of the
target faces.
Oqton, Inc. 84
9. In the GD&T (Linear Dimension) actions, type the following parameters in the Target 1 and Target 2, and click Enter as done in
the previous step, as shown in the image below. Adjust the Max. and Min. Tolerances as follows.
10. To set the execution order, connect the Converter (ForEach Iterator) and Condition actions using flow connectors. Click on
the Out-Flow of the Converter (ForEach Iterator) action and drag it to the In-Flow of the Condition action to connect the two
actions.
Oqton, Inc. 85
11. Connect the actions in the same way as in the previous step, as shown in the image below.
IMPORTANT: When performing iterative operations within the ForEach action, it is essential to convert the action results
into data format using the Parameter to Data action and then pass them to the Data socket.
Oqton, Inc. 86
Note: To ensure proper flow processing, ensure that the output parameter (Index) socket in the Converter (ForEach Iterator)
is connected to the input parameter (Index) socket in the Condition action, and that the output parameter (Value out)
socket in the Converter (ForEach Iterator) is connected to the input parameter (Files) in the File (Import File) action.
Moreover, connect the output parameter (IF) socket in the Condition to the In-Flow of the File (Import File) action to process
the measurement with the first input Measured Data.
Note: All the fields or parameters marked with an asterisk (*) are mandatory and must be filled in or connected before
running the script. Ensure their presence before proceeding.
Oqton, Inc. 87
Step 3: Measuring GD&Ts with Multiple Meshes
This is a step for setting up a workflow to measure GD&Ts by iteratively replacing the original mesh with new ones in the template
project.
1. In the Action List, under the Geomagic Control X > Converter menu, either double-click File (Import File), or click-and-drag it
onto the main editing window, and then drag it into the For Each action to import a new Measured Data file into the framework
for iterative operations.
Oqton, Inc. 88
2. Add Edit (Regenerate All) and two Properties (GD&T - Dimensions) actions and place them into the For Each in the same way
as in the previous step, as shown in the image below.
3. In the Properties (GD&T - Dimensions) actions, type the following parameters in the Entity Name, and click Enter.
4. To set the execution order, connect the File (Import File) and Edit (Regenerate All) actions using flow connectors. Click on
the Out-Flow of the File (Import File) action and drag it to the In-Flow of the Edit (Regenerate All) action to connect the two
actions.
Oqton, Inc. 89
5. Connect the actions in the same way as in the previous step, as shown in the image below.
Note: To ensure proper flow processing, ensure that the output parameter (Value out) socket in the Converter (ForEach
Iterator) is connected to both the input parameter (Files) socket in the two File (Import File), and that the output parameter
(IF) socket in the Condition is connected to the In-Flow of the second File (Import File).
The Connector (marked in Green) will make a flow processing the measurement with the input Measured Data that is
imported sequentially from the second time.
Note: All the fields or parameters marked with an asterisk (*) are mandatory and must be filled in or connected before
running the script. Ensure their presence before proceeding.
Oqton, Inc. 90
Step 4: Outputs
Finally, you can specify the path of outputs and create results of the automated GD&T measurement performed on multiple meshes.
1. In the Action List, under the Geomagic Control X > Viewpoint menu, either double-click Viewpoint (Front View), or click-and-
drag it onto the main editing window, and then drag it into the For Each action to add Viewpoint (Front View) action, which
sets the view direction to the desired model view.
Oqton, Inc. 91
2. Add Zoom (Zoom Fit), two Condition, Visibility (Show Fail & Warning Only), four Expression, and two File (Save Document),
and two Tools (Capture Screen) actions and place them into the For Each in the same way as in the previous step, as shown in
the image below.
3. In both the Expression input box, in the Condition (IF) input box, type the following condition and click Enter. These Condition
actions will be utilized to determine the pass or fail results.
Note: The following signs may be used in the expressions and conditions.
Sign Condition
== Is equal?
> Is larger?
< Is smaller?
|| Or
&& And
Oqton, Inc. 92
4. There are a total of four Expression actions. For the first two Expression actions, enter the following expressions in the
Expression input box and click Enter to specify the names of the pass or fail output files.
y Expression: LocalValueOut=outputFolder+"Pass\PassFail_Result_" +
filenamewithoutextension(ValueIn) + ".CXProj"
y Expression: LocalValueOut=outputFolder+"Fail\PassFail_Result_" +
filenamewithoutextension(ValueIn) + ".CXProj"
5. Similarly, for the remaining two Expression actions, enter the following expressions in the Expression input box and click Enter to
specify the names of the screenshots for the pass or fail output.
y Expression: LocalValueOut=outputFolder+"Pass\PassFail_Result_" +
filenamewithoutextension(ValueIn) + ".jpg"
y Expression: LocalValueOut=outputFolder+"Fail\PassFail_Result_" +
filenamewithoutextension(ValueIn) + ".jpg"
Note: The name of input or output variables can be defined as you desired. The output parameter (outputFolder) socket
in the Expression added in the "Step 1: Data Preparation" on page 72 will later be connected to the input parameter
(outputFolder) socket of each Expression action. The output parameter (Value out) socket in the Converter (ForEach
Iterator) will later be connected to the input parameter (ValueIn) socket of each Expression action.
Oqton, Inc. 93
6. In both the Tools (Capture Screen) actions, change the Method to Current View and select the Export Image option to capture
the results of the measurement and export it as an image file.
7. Place the actions on the For Each action and connect them as shown in the image below.
Oqton, Inc. 94
Note: There are a total of two Condition and four Expression actions. Please refer to the table below for information on how
to connect these actions among the Geomagic Control X Operations actions. Ensure that all actions are connected and the
flows are correctly defined.
1st Condition
y Input
1st GD&T (Linear Dimension): Output parameter (Result Status) socket → Condition: Input parameter
(Result1) socket
2nd GD&T (Linear Dimension): Output parameter (Result Status) socket → Condition: Input parameter
(Result2) socket
y Output
Condition: Output parameter (IF) socket → Visibility (Show Fail & Warning Only): In-Flow socket
Condition : Output parameter (ELSE) socket → Visibility (Show Fail & Warning Only): In-Flow socket
2nd Condition
y Input
Properties (GD&T - Dimensions): Output parameter (Result Status) socket → Condition: Input pa-
rameter (Result1) socket
Properties (GD&T - Dimensions): Output parameter (Result Status) socket → Condition: Input pa-
rameter (Result2) socket
y Output
Condition: Output parameter (IF) socket → Visibility (Show Fail & Warning Only): In-Flow socket
Condition : Output parameter (ELSE) socket → Visibility (Show Fail & Warning Only): In-Flow socket
Oqton, Inc. 95
1st Expression
y Input
Expression: Output parameter (outputFolder) socket → Expression: Input parameter (outputFolder)
socket
Converter (ForEach Iterator): Output parameter (Value out) socket → Expression: Input parameter
(ValueIn) socket
y Output
Expression: Output parameter (LocalValueOut) socket → File (Save Document): Input parameter
(Geomagic Control X File) socket
2nd Expression
y Input
Expression: Output parameter (outputFolder) socket → Expression: Input parameter (outputFolder)
socket
Converter (ForEach Iterator): Output parameter (Value out) socket → Expression: Input parameter
(ValueIn) socket
y Output
Expression: Output parameter (LocalValueOut) socket → File (Save Document): Input parameter
(Geomagic Control X File) socket
Oqton, Inc. 96
3rd Expression
y Input
Expression: Output parameter (outputFolder) socket → Expression: Input parameter (outputFolder)
socket
Converter (ForEach Iterator): Output parameter (Value out) socket → Expression: Input parameter
(ValueIn) socket
y Output
Expression: Output parameter (LocalValueOut) socket → Tools (Capture Screen): Input parameter
(Image File) socket
4th Expression
y Input
Expression: Output parameter (outputFolder) socket → Expression: Input parameter (outputFolder)
socket
Converter (ForEach Iterator): Output parameter (Value out) socket → Expression: Input parameter
(ValueIn) socket
y Output
Expression: Output parameter (LocalValueOut) socket → Tools (Capture Screen): Input parameter
(Image File) socket
Oqton, Inc. 97
8. Finally, the script is completed.
Note: All the fields or parameters marked with an asterisk (*) are mandatory and must be filled in or connected before
running the script. Ensure their presence before proceeding.
Oqton, Inc. 98
Measuring Deviations at Predefined Positions
In this exercise, you will learn how to use the Visual Scripting environment to create a visual script that can automatically import
multiple meshes and measure the deviations between Reference and Measured data at the predefined positions.
Iteration Framework
This step shows how to establish a framework to perform
iterative operations for RPS alignment between the
imported data.
Oqton, Inc. 99
Step Introduction Results in Each Step
Measuring Deviations at predefined positions
This is a step for setting up a workflow to measure
deviations at predefined positions.
Outputs
Finally, you can specify the path of outputs and create
results of the automated deviation measurement
performed on the imported data.
1. On the AUTOMATION tab, in the Visual Scripting group, click Visual Script Editor to open the Visual Script Editor.
3. Check if there is any unsaved document open in the Visual Script Editor. If yes, click Save or Save As to save your
document and click New or go to File > New to create a new document.
4. In the Action List, under the Geomagic Control X > Utility menu, either double-click Environmental Variables, or click-and-drag
it onto the main editing window to define the initial file search location.
This action allows you to select the installation location of Geomagic Control X or the Visual Scripting data folder using two
parameters.
Control X Folder: C:\Program Files\3D Systems\<Geomagic Control X Version> or C:\Program Files\Oqton\<Geomagic Con-
trol X Version>
Visual Script Editor Folder: C:\3D Systems\Geomagic Control X\<Version Number>\VisualScripting or C:\Oqton\Geomagic
Control X\<Version Number>\VisualScripting
5. In the Action List, under the General Operations menu, either double-click Expression, or click-and-drag it onto the main
editing window to specify the location of data from the starting point.
Expressions 1: InputData=VSFolder+"\Sample\Example_05\Input\"
Specifies the location of the provided sample files that can be used as Reference Data for this exercise.
Expressions 2: InputCMP=InputData+"CMP_Points_RM.txt"
Specifies the location of the provided comparison point file used for deviation measurements.
Expressions 3: InputCMM=InputData+"SimCMM_Points_RMXYZ.txt"
Specifies the location of the provided simulated CMM point file for aligning Measured Data to the Reference Data.
Expressions 4: OutputFolder=VSFolder+"\TestOutput\Example_05\"
Defines the path for the output files.
Note: You can define the names of input and output variables as per your preference. Ensure that the input file path points
to the location of the target files.
The default location of the provided sample files for this exercise is as follows:
C:\Oqton\Geomagic Control X\<Version Number>\VisualScripting\Sample\Example_05
7. In the Action List, under the Geomagic Control X > File menu, either double-click File (New Document), or click-and-drag it
onto the main editing window. The File (New Document) is used to clean up any existing document open in the application and
create a new document.
9. In the Search (File Search), change the File Type to User Defined and type the following expression in the User Defined
Extension, and click Enter to search files with user-defined file formats in the target folder.
10. In the Action List, under the Geomagic Control X > File menu, either double-click File (Import File), or click-and-drag it onto the
main editing window. The File (Import File) is used to import files for the measurements and pass them to next actions.
12. To set the execution order, connect the Expression and File (New Document) actions using flow connectors. Click on the Out-
Flow of the Expression action and drag it to the In-Flow of the File (New Document) action to connect the two actions.
13. Connect the actions in the same way as in the previous step, as shown in the image below.
Note: To ensure proper flow processing, ensure that the output parameters (InputData) socket in the Expression is
connected to the input parameter (Target Folder) socket in the Search (File Search) action.
Note: The output parameter (InputCMP, InputCMM) sockets in the Expression will later be connected to the input
parameter socket in the next actions. The output parameter (OutputFolder) socket in the Expression will later be
connected to the input parameter socket in the next Expression.
15. Right-click on the selection and click Group to organize the actions into a functional group. The actions will be grouped in a box
with a default name and a random color.
a. Change the color by clicking the Color Chooser icon and adjusting the R (Red), G (Green), B (Blue), and A (Alpha)
1. In the Action List, under the Geomagic Control X > Constructed Geometry menu, either double click Constructed Geometry
(Sim CMM), or click and drag it to the main editing window to add Constructed Geometry (Sim CMM) action that creates
Constructed Simulated CMM Points on the Reference Data.
Tip: You can easily search desired actions by using the Search Box in the Action List.
3. Type "XYZ" in the Template Name input box to define data for X, Y, and Z locations as listed in the first (X), second (Y), and third
(Z) data columns in the CMM position data file that is imported from the folder specified in the Expression action added in
"Step 1: Data Preparation" on page 99.
4. In the Action List, under the Geomagic Control X > Converter menu, either double-click Converter (Parameter to Data), or
click-and-drag it onto the main editing window. The Converter (Parameter to Data) action is utilized to convert data that is
received as parameters from files into a format that can be utilized by subsequent actions in the script.
6. Connect the actions in the same way as in the previous step, as shown in the image below.
Note: To ensure proper flow processing, ensure that the output parameter (InputCMM) socket in the Expression is
connected to the input parameter (Select File) socket in the Constructed Geometry (Sim CMM) action and that the output
parameter (Result Name) socket in the Constructed Geometry (Sim CMM) is connected to the input parameter (Parameter)
socket in the Converter (Parameter to Data) action.
7. To organize actions into functional groups, select the actions by either holding down the Ctrl key on the keyboard while clicking
them or by clicking and dragging a box around them.
a. Change the color by clicking the Color Chooser icon and adjusting the R (Red), G (Green), B (Blue), and A (Alpha)
This step is composed of two procedures and the following actions are used in each procedure:
y Establishing a framework for iterative operations to define RPS pairs for RPS alignment
For Each - To use loop functionality to run actions specified inside the For Each action.
Converter (ForEach Iterator) - To indicate the value (data) and index (iteration order) during the iteration process within the
For Each action.
Data Type (RPS Pair) - To define RPS pairs for RPS alignment.
y Applying RPS alignment to the Measured Data
Align (RPS Alignment) - To automatically align the imported Measured Data to the Reference Data by matching RPS pairs.
All the actions within the “For Each" action will be executed repeatedly until there is no more data to be processed.
1. In the Action List, under the General Operations menu, either double-click For Each, or click-and-drag it onto the main editing
window to set up a framework for iterative operations.
3. In the Action List, under the Geomagic Control X > Data Type menu, either double click Data Type (RPS Pair), or click and drag
it to the main editing window, and then drag it into the For Each action to add Data Type (RPS Pair) action.
Tip: You can easily search desired actions by using the Search Box in the Action List.
6. Connect the actions by adding data connectors. Click the Input socket of the For Each action and drag to the Input socket of the
Converter (ForEach Iterator) action.
7. Connect the actions in the same way as in the previous step, as shown in the image below.
Note: To ensure proper flow processing, ensure that the Input socket in the For Each is connected to the Input socket
in Converter (ForEach Iterator) action, and that the output parameter (RPS Pair) socket in the Data Type (RPS Pair)
is connected to the Output socket in the For Each. The simulated CMM points that are passed through the iterative
operations in the For Each action will be redefined as RPS pair points, and rearranged in a data array. The RPS pairs will be
used as input parameters for the RPS alignment.
1. In the Action List, under the Geomagic Control X > Compare menu, either double-click Compare (3D Compare), or click-and-
drag it onto the main editing window to add an overall deviation measurement operation for the imported Measured Data.
Tip: You can easily search desired actions by using the Search Box in the Action List.
3. Type "XYZ" in the Template Name input box to define data for X, Y, and Z locations as listed in the first (X), second (Y), and third
(Z) data columns in the Comparison Point file that is imported from the folder specified in the Expression action added in "Step
1: Data Preparation" on page 99.
Note: The input parameter (InputCMP) sockets in the Expression action added in the "Step 1: Data Preparation" on page
99 will later be connected to the Comparison Point File parameter socket in the Compare (Comparison Point) action.
Note: To ensure proper flow processing, ensure that the output parameter (InputCMP) sockets in the Expression is
connected to the Comparison Point File parameter socket in the Compare (Comparison Point) action.
1. In the Action List, under the General Operations menu, either double-click Expression, or click-and-drag it onto the main
editing window, and then drag it into the For Each action to specify the name and path of the outputs.
2. In the Expression input box, type the following expression and click Enter to specify the target measurement results that need to
be reported.
Note: You can define the names of output variables as per your preference. However, in order to create a result report
that refers to the Result Data location, the value of the output variable must match the default name of the Result Data in
Geomagic Control X. The default name for the Result Data is "Result Data - 1" (including the spaces).
4. Under the Parameters, type “Letter_Landscape” to the Template input box and click Enter to specify the size and orientation of
the report.
5. In the Action List, under the General Operations menu, either double-click Expression, or click-and-drag it onto the main
editing window to specify the target measurement report and the output path for the report.
Note: You can define the names of output variables as per your preference. However, in order to export a result report, the
value of the output variable must match the default name of the report in Geomagic Control X. The default report name is
"Report 1" (including the space).
Note: The output parameter (OutputData) socket in the Expression added in the "Step 1: Data Preparation" on page
99 will later be connected to the input parameter (dir) socket in the second Expression.
7. In the Action List, under the Geomagic Control X > Report menu, either double click Report (Report Manager), or click and
drag it to the main editing window, and then drag it into the For Each action.
Note: To ensure proper flow processing, ensure that the output parameter (OutputFolder) socket in the Expression action
added in the "Step 1: Data Preparation" on page 99 is connected to the input parameter (OutputFolder) socket in the
second Expression.
Note: All the fields or parameters marked with an asterisk (*) are mandatory and must be filled in or connected before
running the script. Ensure their presence before proceeding.
11. In the Visual Scripting Toolbar, click Start to run the script.
The standalone examples with files can be found at one of the following locations:
y C:\3D Systems\Geomagic Control X\<Version Number>\VisualScripting\Sample
y C:\Oqton\Geomagic Control X\<Version Number>\VisualScripting\Sample
CAUTION: THE SAMPLE FILES ARE PROVIDED BY OQTON. THEY ARE THE PROPERTY OF OQTON AND 3D SYSTEMS, INC.
AND ARE USED FOR INFORMATIONAL PURPOSES ONLY. OTHER THAN TO IDENTIFY THIS SOFTWARE AND PUBLICATION,
INDIVIDUALS OR ORGANIZATIONS PURCHASING THE SOFTWARE ARE NOT ENTITLED TO USE THE SAMPLE DATA WITHOUT
OQTON’S PRIOR WRITTEN CONSENT.
2. To run a script in Geomagic Control X application, either open a predefined script by clicking Open Script or choose the desired
script from the dropdown list on the Visual Scripting Toolbar.
3. Browse Example_01.scrpt file at the following location and open the file by clicking Open.
Default file location is: C:\3D Systems\Geomagic Control X\<Version Number>\VisualScripting\Sample\Example_01 or C:\
Oqton\Geomagic Control X\<Version Number>\VisualScripting\Sample\Example_01
4. Click Start Script.
5. The script will then run without interruption and a progress bar will be displayed to monitor the script’s progress.
2. On the Visual Scripting Toolbar, click Visual Script Editor to open the Visual Scripting Editor.
3. The Visual Scripting Editor is initiated.
8. Check if the script runs without any failures and the results are created.
To debug a script, breakpoints can be added at specific actions within the script. When the script is run, it will pause at these
designated breakpoints, allowing for scripting analysis. When a breakpoint is reached, the Toolbar displays additional controls, such
as Continue (to the end of the script or next breakpoint), Pause, Stop, or Next Step (jump to the next action in the script).
Breakpoints can be Deleted, Disabled, or Enabled. The Breakpoints pane provides an overview of all the breakpoints within the
script, allowing you to control them globally or individually.
The following scripting example shows how to add a breakpoint and use it for scripting analysis.
1. To add a breakpoint for analysis, right-click on the desired action and select Add Breakpoint from the menu..
Once added, a RED breakpoint symbol will appear above the selected action. When running the script, it will pause at
this breakpoint before executing the selected action.
Overview Window
The Overview window displays all the action boxes in the script. The Overview window can be displayed or hidden using the
Overview Window icon located in the upper right corner of the Visual Scripting Editor.
The action boxes currently displayed in the main editing window are highlighted by a blue ‘bounding box’ in the Overview window.
Drag this bounding box to display the required action boxes in the main editing window. For large scripting operations, this greatly
eases navigation between action boxes, enabling you to find the required action boxes in the visual interface environment.
The Overview window itself can be dragged to a suitable location within the main editing window or resized for a better view.
Zoom Slider
Allows you to zoom in or out of the main editing window to see your script better. Use the Scroll wheel or click the Minus
or Plus button to zoom in or out of the main editing window. The slider can also be used to zoom in or out of the
main editing window to the specific zoom level.
Zoom To zoom in or out of the main editing window, the following actions are available:
y Use the mouse scroll to zoom in or out.
y Use the slider at the bottom right corner of the window.
Note: To revert to 100% zoom, click Zoom to 100% on the Context Menu.
On the Customize Parameters dialog, you may define the order of the parameters and the properties of each parameter.
The properties of an operation can be used to change the type of the parameter; for example, a Boolean (Bool) parameter will be
presented as a checkbox and a File Path (FilePath) parameter will have a browse button next to it. It is also possible to add an icon to
a parameter, set minimum and maximum values, define the width and alignment, and more.
Parameters may also be used as separators or comments to improve data representation. Another ability is to use formulas to show
or hide a parameter depending on the values of other parameters.
Toolbar buttons are used to add a new parameter, copy and paste parameters, or change the order of the parameters
(listed in section (B)) to be performed.
The parameters listed in the selected action.
Set the Icon Size when defining an icon to be displayed in the action dialog.
Clicking the ƒ button displays the Formula Editor dialog where the visibility
formula for the current property can be defined.
Never - The property is never displayed.
2. In the Expression input box of the Setup Parameters action, type the following expression and click Enter.
Expressions: Data="D:\VisualScripting\Test"
Specifies the location of the data used for measurements.
4. The Customize Setup Parameters dialog will open. Look for the parameter named "Data" and select it.
5. In the list of Parameter's Properties, change the Type to FilePath. This customization allows you to open the File Explorer to
search for data files easily.
7. Save the current script and then click Start to run the script.
Note: To apply the changes made in the Customize Setup Parameter dialog, it is necessary to save the current script.
Once the script is executed, the changes will take effect in the Setup Parameter dialog.
8. The Setup Parameters dialog will appear with the applied changes. You can now click the Browse icon to open the File Explorer,
and easily find and specify the location of the files that you want to use in the script. Click Run to run the script.
Note: To save the customized parameters for future use, click Save parameters to file .
Oqton, Inc. 131
Formula Editor
The Formula Editor dialog consists of a Formula pane containing the formula defined for the currently selected row in the table
below.
The Fields table includes all the formula fields defined in the action dialog and, for each formula row, shows the parameter Type,
Name and ID.
Saving As Template
Customized parameters in an action can be saved as a template for future use.
To create a template action with changed parameters, simply change the action's parameters as needed, and then right-click on it.
From the right-click menu, click Save As Template.
This will open the Save as Template dialog, which will initially suggest a default template name based on the selected action's name.
You can rename the template as desired. After saving, the template action will be added to the same location as the original action,
and can be used in the future.
Input and output sockets are added automatically as the expression is entered in the Expression field. See the list of Constants and
Functions supported by the Expression action, below.
For example, in the Expression action on the left, when the ‘A =’ is entered, an output
socket is automatically created. When ‘B’ and ‘C’ are entered, two input sockets are
created.
Example Usage
y Y = acos (X): Y is the value in degrees of the inverse cosine of X.
y Z = min (X, Y): Z is the minimum value of X and Y, where X and Y are numbers.
y Y = sin (X): Y is the sinus value of X, where X is a number in degrees.
y pow2 (x): With one input argument, computes 2^x for each element of x.
y pow2 (f, e): With two input arguments, returns f*(2^e).
The following are the possible methods for custom workflow with Command Line and Python:
y Running a Visual Script from Command Line
y Running an external Python script from Visual Scripting Editor
y Running a Visual Script from Python
The following example shows how to run the Visual Script from Command Prompt.
1. Depending on your version of Windows, proceed to one of the following to open the Command Prompt in Windows:
y Go to the Start menu or screen, and type “Command Prompt" in the search field.
2. After launching the Command Prompt, you can run a saved script by entering one of the following example commands. To
execute the command, press the 'Enter' key on the keyboard after typing it on the command line.
Note: The following Geomagic Control X Scripting command line arguments are available:
Argument Description
-f <FilePath> Opens the Scripting Editor and loads the given specific script file.
-r Runs a script.
-outxml <LogFilePath> Creates an output file.
Runs the script in hidden mode (the Scripting Editor is hidden).
-h Only shows the progress bar and the Setup Parameters dialog. The
Geomagic Control X GUI will still be shown.
Runs the script in silent mode. The Scripting Editor and the Setup
-silent Parameters dialog are hidden. The Geomagic Control X GUI will still be
shown.
For example
“C:\Oqton\Geomagic Control X\2023. 2. 0\VisualScripting\3DScripting.exe" -f “C:\Oqton\
Geomagic Control X\2023. 2. 0\VisualScripting\Sample\Example_01\Example_01.scrpt"
For example
“C:\Oqton\Geomagic Control X\2023. 1. 0\VisualScripting\3DScripting.exe" -f “C:\Oqton\
Geomagic Control X\2023. 1. 0\VisualScripting\Sample\Example_01\Example_01.scrpt" -r
Open the Scripting Editor, loads a Visual Script and runs it in hidden mode (where only the progress bar and the Setup
Parameters dialog are shown)
Syntax
“C:\3D Systems\Geomagic Control X\<Version Number>\VisualScripting or C:\Oqton\Geomagic
Control X\<Version Number>\VisualScripting\3DScripting.exe" -f “<Script File with Full
Path>" -r -h
For example
“C:\Oqton\Geomagic Control X\2023. 1. 0\VisualScripting\3DScripting.exe" -f “C:\Oqton\
Geomagic Control X\2023. 1. 0\VisualScripting\Sample\Example_01\Example_01.scrpt" -r -h
Open the Scripting Editor, load a Visual Script and run it in silent mode (where the Scripting Editor and the Setup
Parameters dialog are hidden)
Syntax
“C:\3D Systems\Geomagic Control X\<Version Number>\VisualScripting or C:\Oqton\Geomagic
Control X\<Version Number>\VisualScripting\3DScripting.exe" -f “<Script File with Full
Path>" -r -silent
For example
“C:\Oqton\Geomagic Control X\2023. 1. 0\VisualScripting\3DScripting.exe" -f “C:\Oqton\
Geomagic Control X\2023. 1. 0\VisualScripting\Sample\Example_01\Example_01.scrpt" -r
-silent
---- OR ----
For example
“C:\Program Files\Oqton\Geomagic Control X 2023.0\GeomagicControlX.exe" /RunScript “C:\O-
qton\Geomagic Control X\2023. 2. 0\VisualScripting\Sample\Example_01\
Example_01.scrpt"
1. Create a Python (.py) file which contains the desired Python code under the following location at: C:\Test\
import sys
Note: This Python script creates a new file with the
def main(): specified name, then writes a number of lines to
# assign arguments the file equal to the value specified in the second
filename = sys.argv[1] # output filename argument passed to the script. Each line contains
count = int(sys.argv[2]) # count the string "Count : " followed by the number of the
current iteration of the loop.
# open an output file
outFile = open(filename, “w+") This script needs to be run using the command line
and expects two arguments to be passed through
# write counts to the output file the Run External Command action in the Visual
for i in range (count): Script Editor:
outFile.write(“Count : %d\n" % i) y The name of the file you want to create for the
output
# close the output file
y The number of lines you want to write to that
outFile.close()
file.
if __name__=="__main__":
main()
TestScript.py
2. Create a Batch (.cmd or .bat) file under the following location at: C:\Test\ to run the .py file from Step 1.
echo off
set FileName=%1
set Count=%2
“C:\Program Files\Oqton\Geomagic Control
X 2023.2\bin\python\python.exe" “C:\Test\
TestScript.py" %FileName% %Count%
TestCmd.cmd
4. On the Visual Scripting Toolbar, click Visual Script Editor to create a new Visual Script in the Visual Scripting Editor.
6. In the Actions List, under the General Operations menu, double-click Run External Command, or click-and-drag it to the main
editing window to the Visual Script to trigger the batch file from Step 2.
7. Type the following parameters into the Command Name and Parameter 1 and 2 fields.
Note: Parameters added to the action block will be passed as command arguments.
9. Check if the script runs without any failures and the results are created.