0% found this document useful (0 votes)
52 views

Visual Scripting Guide

Uploaded by

blevblayne92
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
52 views

Visual Scripting Guide

Uploaded by

blevblayne92
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 145

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

AUTOMATED INSPECTION USING


GEOMAGIC CONTROL X VISUAL SCRIPTING

Script it. Automate it


Geomagic Control X Visual Scripting provides a user-friendly solution for the design of automated inspection workflows, eliminating
the need for complex coding. The intuitive drag-and-drop interface enables you to quickly connect and integrate operations, such
as interactions, events, and sequences, to create highly efficient workflows. This solution requires no prior programming knowledge,
making it accessible to a wider range of users.

With Visual Scripting, you can:


y Effectively address complex inspection challenges through a simplified visual interface
y Assemble comprehensive automated workflows by connecting operations within the scripting environment
y Facilitate collaboration and improve operational efficiency through the creation of accessible, logical workflows
y Minimize the possibility of human error and optimize productivity by automating crucial quality assurance checks

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.

Visual Scripting Toolbar in Geomagic Control X Visual Scripting Editor

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.

Visual Scripting Toolbar in Geomagic Control X


The Visual Scripting Toolbar offers a convenient way to run scripts within the Geomagic Control X application or access the Visual
Scripting Editor to create new scripts or edit existing ones.

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.

Scripting Editor Menu Bar/Toolbar


The Scripting Editor Menu Bar / Toolbar provide a standard set of commands for working with a script.

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.

Visual Script Editor Menu


The following tools are available in the Visual Script Editor Menu.
y File
New
Opens a new scripting window.

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.

Description in Properties Description popped up on a script

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.

Visual Script Editor Toolbar


The frequently used tools available in the Visual Scripting Editor can also be accessed via the Visual Scripting Toolbar.

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.

Geomagic Control X Operations


Provides Geomagic Control X operations that work based on Geomagic
Control X functions.

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.

General Operations Geomagic Control X Operations

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).

Copy - Copies the selected action(s).

Paste - Pastes the selected action(s).

Delete - Deletes the selected action(s).

Group - Groups the selected action(s).

Detach - Detaches the selected action from a group.

Rename - Renames the selected action.

Delete - Deletes the selected action(s).

Add Breakpoint - Adds a Breakpoint to the selected action(s).

Customize Parameters - Configures the action dialog to include images, icons,


separators and headers, the properties of parameters and more.

Note: This option is available only for the Setup Parameters action.
For more information, see "6. Appendix B. Customizing Parameters" on page
128.

Save As Template - Allows you to save a selected action as a template.

Help - Displays the Scripting Help.

Oqton, Inc. 9
Connectors
The Connectors serve as the connections between actions in a script.

Input Output Description


Flow
Each action has a Flow connector in and out. There are one Input Flow (In-Flow) connector and two Output
Flow (Out-Flow) connectors. One of the Out-Flow connectors is used if the execution of the action was successful
(green-dot arrow ); another Out-Flow connector is used when the execution fails (red-dot arrow ).

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.

Choose from the following exercises to get started.


y Measuring the Volume of Meshes
y Measuring Overall Deviation using an Inspection Template
y Measuring Holes
y Measuring GD&T using an Inspection Template
y Measuring Deviations at Predefined Positions

Measuring the Volume of Meshes


In this exercise, you will learn how to use the Visual Scripting environment to create a visual script that can import multiple meshes
and calculate their volume automatically.

Completed Visual Script Inspection Results

What does this exercise cover?


Step Introduction Results in Each Step
Data Preparation
This step shows the procedure 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.

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.

The following actions will be used in this step:


y Utility (Environmental Variables) - To define the starting point for navigating data.
y Expression - To specify the location of input and output folder.
y Search (File Search) - To search for the files for which measurement needs to be calculated and define the type of data to be
imported from those files.
y Converter (Parameter to Data) - To convert imported data into a format that can be used by subsequent actions.

1. On the AUTOMATION tab, in the Visual Scripting group, click Visual Script Editor to open the Visual Script Editor.

2. The Visual Scripting Editor is initiated.

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 following is an example of en expression.


y Expression: Data="D:\VisualScripting\Test\"

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)

values, or selecting a desired color from the Color Palettes.

b. Double-click on the title of the box to rename the group.


c. Edit the name as you desired and click on any empty space in the main editing window to complete.

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.

The following actions will be used in this step:


y For Each - To use loop functionality to run actions specified inside the For Each action.
y Converter (ForEach Iterator) - To indicate the value (data) and index (iteration order) during the iteration process within the For
Each action.
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. 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.

5. 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. 26
Step 4: Outputs
Finally, you can specify the path of outputs and create results of the automated volume measurement performed on multiple meshes.

The following actions will be used in this step:


y Expression - To specify the path of outputs.
y Tools (Export Tabular View) - To export measurement results.

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.

7. In the Visual Scripting Toolbar, click Start to run the script.

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.

Completed Visual Script Inspection Results

What does this exercise cover?


Step Introduction Results in Each Step
Data Preparation
This step shows the procedure to set up a workflow for
importing data files required for deviation measurement.

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.

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.

The following actions will be used in this step:


y File (New Document) - To create a new document and set up measurement for a new data.
y Utility (Environmental Variables) - To define the starting point for navigating data.
y Expression - To specify the location of input and output folder.
y Search (File Search) - To search for the files for which deviation measurement needs to be calculated.
y File (Import File) - To import data files into this new document.

1. On the AUTOMATION tab, in the Visual Scripting group, click Visual Script Editor to open the Visual Script Editor.

2. The Visual Scripting Editor is initiated.

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 following is an example of en expression.


y Expression: Data="D:\VisualScripting\Test\"

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.

Š Expressions 1: inputFolder=VSFolder + "\Sample\Example_02\Input"


ƒ Specifies the location of the provided sample files used for the template inspection project.
Š Expressions 2: outputFolder=VSFolder + "\TestOutput\Example_02\"
ƒ Defines the output file path.
Š Expressions 3: sampleFolder=VSFolder + "\Sample\Example_02\TargetMeasuredData"
ƒ Specifies the location of the provided target files for deviation measurements.

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.

Š Expressions: ResultName="Result Data - 1"


ƒ Specifies the location of the Result Data in Geomagic Control X that will be referenced by the measurement report.

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.

14. 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)

values, or selecting a desired color from the Color Palettes.

b. Double-click on the title of the box to rename the group.


c. Edit the name as you desired and click on any empty space in the main editing window to complete.

Oqton, Inc. 44
Step 3: Iteration Framework
This step shows how to establish a framework to perform iterative operations on multiple meshes.

The following actions will be used in this step:


y Search (File Search) - To search for the files for which measurement needs to be calculated and define the type of data to be
imported from those files.
y Converter (Parameter to Data) - To convert imported data into a format that can be used by subsequent actions.
y For Each - To use loop functionality to run actions specified inside the For Each action.
y Converter (ForEach Iterator) - To indicate the value (data) and index (iteration order) during the iteration process within the For
Each action.
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 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.

The following actions will be used in this step:


y File (Replace Measured Data) - To replace the original mesh with a new one in the template project.
y Edit (Regenerate All) - To update the deviations with a new mesh 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.

3. 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. 51
Step 5: Outputs
Finally, you can specify the path of outputs and create results of the automated deviation measurement performed on multiple
meshes.

The following actions will be used in this step:


y Expression - To specify the name and path of the outputs.
y Report (Report Manager) - To update the inspection report with new deviation results.
y File (Save Document) - To save the project file and report in the desired format.

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.

Š Expressions: ReportName="Report 1"


ƒ Specifies the report stored in the template inspection project for the purpose of rebuilding or exporting the results.

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.

Š Expressions 1: cxprojFile=dir + meshName + ".cxproj"


ƒ Specifies the name of output file using the value extracted in the second Expression action from the previous step.
Š Expressions 2: pdfFile=dir + meshName + ".pdf"
ƒ Specifies the name of report file using the value extracted in the second Expression action from the previous step.

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.

7. Change the Method to Rebuild.

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.

9. Change the Method to Report (Export PDF).

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.

12. 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.

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.

Completed Visual Script Inspection Results

What does this exercise cover?


Step Introduction Results in Each Step
Data Preparation
This step shows the procedure to set up a workflow for
importing data files required for geometry creation.

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.

The following actions will be used in this step:


y Utility (Environmental Variables) - To define the starting point for navigating data.
y Expression - To specify the location of input folder.
y File (New Document) - To create a new document and set up measurement for a new data.
y Search (File Search) - To search for the files for which measurement needs to be calculated.
y File (Import File) - To import data files into this new document.
y 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.

1. On the AUTOMATION tab, in the Visual Scripting group, click Visual Script Editor to open the Visual Script Editor.

2. The Visual Scripting Editor is initiated.

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.

Š Expressions: SampleFolder=VSFolder + "\Sample\Example_03"


ƒ Specifies the location of the provided sample files for this exercise.

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.

The following actions will be used in this step:


y Search (Entity Seach By Tupes) - To search for the entities for which measurement needs to be calculated.
y Converter (Parameter to Data) - To convert imported data into a format that can be used by subsequent actions.
y For Each - To use loop functionality to run actions specified inside the For Each action.
y Converter (ForEach Iterator) - To indicate the value (data) and index (iteration order) during the iteration process within the For
Each action.
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 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.

10. 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)

values, or selecting a desired color from the Color Palettes.

b. Double-click on the title of the box to rename the group.

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.

The following actions will be used in this step:


y Constructed Geometry (Cylinder) - To create Constructed Cylinders on the entities that are searched from 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.

5. 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.

6. In the Visual Scripting Toolbar, click Start to run the script.

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.

Completed Visual Script Inspection Results

What does this exercise cover?


Step Introduction Results in Each Step
Data Preparation
This step shows the procedure to set up a workflow for
importing data files required for GD&T measurement.

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.

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.

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.

The following actions will be used in this step:


y File (New Document) - To create a new document and set up measurement for a new data.
y Utility (Environmental Variables) - To define the starting point for navigating data.
y Expression - To specify the location of input and output folder.
y Search (File Search) - To search for the files for which GD&T measurement needs to be calculated.
y File (Import File) - To import data files into this new document.

1. On the AUTOMATION tab, in the Visual Script group, click Visual Script Editor to open the Visual Script Editor.

2. The Visual Scripting Editor is initiated.

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.

Š Expressions 1: InputCAD=VSFolder + "\Sample\Example_04\Input"


ƒ Specifies the location of the provided sample files that can be used as Reference Data for this exercise.
Š Expressions 2: InputScan=VSFolder + "\Sample\Example_04\TargetMeasuredData"
ƒ Specifies the location of the provided target files for GD&T measurements.
Š Expressions 3: outputFolder=VSFolder + "\TestOutput\Example_04\"
ƒ Defines the path for the output files.

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)

values, or selecting a desired color from the Color Palettes.

b. Double-click on the title of the box to rename the group.


c. Edit the name as you desired and click on any empty space in the main editing window to complete.

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.

Š Datum Pair 1: Face<271>@Sample_CAD


Š Datum Pair 2: Face<249>@Sample_CAD
Š Datum Pair 3: Face<276>@Sample_CAD

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.

GD&T - Linear Dimension 1 GD&T - Linear Dimension 2


y Target 1: Face<281>@Sample_CAD y Target 1: Face<282>@Sample_CAD
y Target 2: Face<276>@Sample_CAD y Target 2: Face<249>@Sample_CAD
y Tolerance: ±0.3 y Tolerance: ±0.1

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.

The following actions will be used in this step:


y File (Import File) - To import new mesh files into the Geomagic Control X application.
y Edit (Regenerate All) - To update the GD&T measurement results with a new mesh in the template project.
y Properties (GD&T - Dimensions) - To obtain the properties of measured Dimensions features.

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.

Properties (GD&T - Dimensions) 1 Properties (GD&T - Dimensions) 2


y Entity Name: Linear Dim.1 y Entity Name: Linear Dim.2

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.

The following actions will be used in this step:


y Viewpoint (Front View) - To set the view direction to the desired model view for capturing a screenshot.
y Zoom (Zoom Fit) - To fit the model to the screen in the desired view for capturing a screenshot.
y Condition - To judge whether the condition of input data is true or false. The output flow depends on the results of the conditions.
y Visibility (Show Fail & Warning Only) - To create a report with the Fail and Warning result tags only.
y Expression - To specify the name and path of the outputs.
y File (Save Document) - To save the project file and report in the desired format.
y Tools (Capture Screen) - To capture screenshots for the report.

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.

Š IF: Result1 == "Pass" && Result2 == "Pass"

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.

9. In the Visual Scripting Toolbar, click Start to run the script.

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.

Completed Visual Script Inspection Results

What does this exercise cover?


Step Introduction Results in Each Step
Data Preparation
This step shows the procedure to set up a workflow for
importing data files required for deviation measurement.

Importing Simulated CMM Points


This step sets up a workflow for importing Simulated
CMM points for measurement. These imported CMM
points will be used to align Measured Data to the
Reference Data and measure the deviations between
them later on.

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.

Step 1: Data Preparation


This step shows the procedure to set up a workflow for importing data files required for deviation measurement.

The following actions will be used in this step:


y Utility (Environmental Variables) - To define the starting point for navigating data.
y Expression - To specify the location of input and output folder.
y File (New Document) - To create a new document and set up measurement for a new data.
y Search (File Search) - To search for the files for which deviation measurement needs to be calculated.
y File (Import File) - To import data files into this new document.
y Align (Initial Alignment) - To automatically align the imported Measured Data to the Reference Data using geometric feature
information in a part and apply the best-fitting algorithm for a finer alignment.

1. On the AUTOMATION tab, in the Visual Scripting group, click Visual Script Editor to open the Visual Script Editor.

Oqton, Inc. 100


2. The Visual Scripting Editor is initiated.

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.

Oqton, Inc. 101


6. In the Expression input box, type the following four expressions and click Enter. Click Plus icon to add more expressions.

Š 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.

Oqton, Inc. 102


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.

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.

Š Expressions: *.X_T; *.stl

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.

Oqton, Inc. 103


11. 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 Measured Data.

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.

Oqton, Inc. 104


14. 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.

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.

16. 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)

values, or selecting a desired color from the Color Palettes.

b. Double-click on the title of the box to rename the group.


c. Edit the name as you desired and click on any empty space in the main editing window to complete.

Oqton, Inc. 105


Step 2: Importing Simulated CMM Points
This step sets up a workflow for importing Simulated CMM points for measurement. These imported CMM points will be used to align
Measured Data to the Reference Data and measure the deviations between them later on.

The following actions will be used in this step:


y Constructed Geometry (Sim CMM) - To create Constructed Simulated CMM Points from a CMM position data file and project
them onto the Reference Data.
y Converter (Parameter to Data) - To convert imported data into a format that can be used by subsequent actions.

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.

Oqton, Inc. 106


2. Change the Method to Probe Contact From File to create simulated CMM points from a CMM position data file.

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.

Oqton, Inc. 107


5. To set the execution order, connect the Align (Initial Alignment) and Constructed Geometry (Sim CMM) actions using flow
connectors. Click on the Out-Flow of the Align (Initial Alignment) action and drag it to the In-Flow of the Constructed
Geometry (Sim CMM) action to connect the two actions.

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.

Oqton, Inc. 108


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.

9. 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)

values, or selecting a desired color from the Color Palettes.

b. Double-click on the title of the box to rename the group.


c. Edit the name as you desired and click on any empty space in the main editing window to complete.

Oqton, Inc. 109


Step 3: Iteration Framework
This step shows how to establish a framework to perform iterative operations for RPS alignment between the imported data.

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.

Oqton, Inc. 110


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 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.

Oqton, Inc. 111


4. In the Action List, under the Geomagic Control X > Align menu, either double click Align (RPS Alignment), or click and drag it
to the main editing window, and then drag it into the group added in the "Step 2: Importing Simulated CMM Points" on page
106 to add a RPS alignment operation for the imported Measured Data.

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.

Oqton, Inc. 112


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.

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.

Oqton, Inc. 113


Step 4: Measuring Deviations at predefined positions
This is a step for setting up a workflow to measure deviations at predefined positions.

The following actions will be used in this step:


y Compare (3D Compare) - To analyze the overall deviation between the imported Measured Data and Reference Data by
projecting all paired points onto the Reference Data.
y Compare (Comparison Point) - To measure the deviation between the imported Measured Data and Reference Data at specific
points.

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.

Oqton, Inc. 114


2. In the Action List, under the Geomagic Control X > Compare menu, either double-click Compare (Comparison Point), or click-
and-drag it onto the main editing window to add a deviation measurement operation for specific positions of the imported
Measured Data.

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.

Oqton, Inc. 115


4. Connect them as shown in the image below.

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.

Oqton, Inc. 116


Step 5: Outputs
Finally, you can specify the path of outputs and create results of the automated deviation measurement operations performed on the
imported data.

The following actions will be used in this step:


y Expression - To specify the name and path of the outputs.
y Report (Generate Report) - To generate an inspection report from deviation results.
y Report (Report Manager) - To update the inspection report with new deviation results.

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.

Š Expressions: TargetResultData="Result Data - 1"


ƒ Specifies the location of the Result Data in Geomagic Control X that will be referenced by the measurement report.

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. 117


3. 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 measurements.

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.

Oqton, Inc. 118


6. In the Expression input box, type the following two expressions and click Enter. Click Plus icon to add more expressions.

Š Expressions 1: TargetReport="Report 1"


ƒ Specifies the report stored in the project for exporting the results.
Š Expressions 2: TargetFilenFilePath=OutputFolder+"Result.pdf"
ƒ Specifies the name of 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.

8. Change the Method to Report (Export PDF).

Oqton, Inc. 119


9. Place them on the For Each action and connect them as shown in the image below.

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.

10. 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.

11. In the Visual Scripting Toolbar, click Start to run the script.

Oqton, Inc. 120


4 RUNNING A VISUAL SCRIPT
The Visual Scripting environment offers a variety of convenient ways to run scripts within the Geomagic Control X application or
externally.
The following are the available methods for running a script:
y Running a Visual Script in the Visual Scripting Toolbar
y Running a Visual Script in the Visual Scripting Editor
y Debugging a Visual Script for Scripting Analysis

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.

How to run a Visual Script in the Visual Scripting


Toolbar
1. In Geomagic Control X application, go to the Automation tab.

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.

Upon completion, a notification of completion will be displayed.

Oqton, Inc. 121


How to run a Visual Script in the Visual Scripting Editor
1. In Geomagic Control X application, go to the Automation tab.

2. On the Visual Scripting Toolbar, click Visual Script Editor to open the Visual Scripting Editor.
3. The Visual Scripting Editor is initiated.

4. Click Open or go to File > Open.


5. Browse Example_01.scrpt file from 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
6. The script will be loaded in the Visual Scripting Editor.
7. On the Visual Scripting Editor Toolbar, click Start or go to Debug > Start to run the script.

8. Check if the script runs without any failures and the results are created.

Oqton, Inc. 122


Debugging a Visual Script for Scripting Analysis
Debugging a Visual Script allows for comprehensive analysis and troubleshooting of the script's execution. By strategically placing
breakpoints at specific actions within the script, you can control the flow of the script and analyze its behavior.

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.

Oqton, Inc. 123


2. Click Start to run the script. It will pause at the breakpoint, and additional controls such as Continue, Pause, Stop,
and Next Step will appear in the Visual Script Editor Toolbar. The specific breakpoint symbol will be marked with a
Yellow arrow symbol .

3. Click Continue to proceed with the script.


4. If there is an issue, the Notification Window will display an error message indicating the cause of the problem, and the script will
exit.

5. Identify the cause of the failure and resolve it accordingly.

Oqton, Inc. 124


5 APPENDIX A. ADDITIONAL USER INTERFACE
This chapter explains supplementary user interfaces that are not introduced in the "Visual Scripting Editor User Interface Overview"
on page 3. It provides an overview of additional interfaces that can enhance your experience and productivity.

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.

How to move the Overview Window


1. Move the mouse cursor to any corner of the Overview Window until an arrow cross appears.
2. When this arrow appears, click-and-drag to move the Overview Window.

How to resize the Overview Window


1. Move the mouse cursor to any edge of the Overview Window until a double-headed arrow appears.
2. When this arrow appears, click-and-drag to make the Overview Window larger or smaller.

Oqton, Inc. 125


Canvas
The main workspace, referred to as the Canvas, includes multiple document tabs, main editing window, Overview Windows, and
Zoom Slider.

Multiple Document Tab


The multiple document interface allows you to edit multiple scripts concurrently. You can copy and paste actions across
multiple open scripts. The working document tab is highlighted in blue and marked with an asterisk (*) when a change
occurs.

Main Editing Window


Displays actions and allows to manipulate added actions.
The Canvas offers the ability to do the following:
y Adding / Deleting actions
y Manipulating actions
y Adding connectors between actions
For more information on working with actions in the main editing window, see "3. Building A Script" on page 12.

Oqton, Inc. 126


Overview Window
Shows an entire script you created. This is useful as an aid to find the required action while navigating large scripting
operations.
In the Overview Window, your the focusing area is displayed with a blue box indicating where you are working on in
the main editing window. While manipulate actions or a script, all operations are shown in the Overview Window in
conjunction. For more information, See "Overview Window" on page 125.

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.

Understanding Mouse Behavior


The mouse is used to manipulate the main editing window.
Action Mouse Button Usage
Pan To pan up, down, left and right on the main editing window, click the middle button and drag
the main editing window.

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.

Oqton, Inc. 127


6 APPENDIX B. CUSTOMIZING PARAMETERS
The Setup Parameters action dialog can be configured to include images, icons, separators and headers, the properties of
parameters, and more.
The customization is done by right-clicking the Setup Parameters action and clicking Customize Parameters from the Right-Click
Menu, to display the Customize Parameters dialog.
dfdd Customize Parameters dialog.

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.

The structure of the Customize Parameters dialog is as follows:

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.

The properties of the parameter currently selected in section (B).

Oqton, Inc. 128


Dropdown Menus
Multiple dropdown menus are available in the Customize Parameters dialog to enable options in the selected action dialog.
Some of these dropdowns are shown below.
Set the property’s Alignment when displayed in the action dialog:
Left - Aligns the property on the left of the dialog.

Center - Aligns the property in the center of the dialog.

Right - Aligns the property on the right of the dialog.

Stretch - Stretches the property across the width of the dialog.

Set the Icon Size when defining an icon to be displayed in the action dialog.

Set the property’s Type when displayed in the action dialog:


Bool - Boolean parameter will be presented as a checkbox.

Integer - Displays a spin box to hold integer values.

Double - Displays a spin box to hold double values.

String - Displays a text box.

Image - Displays a selected image.

FilePath - Displays a text box with an adjacent folder browse button.

Separator - Displays a separator line to improve data representation. The


separator line can also be defined with a Default Value string to be displayed
as a section header, for example “Options" as shown below.

Oqton, Inc. 129


Set the property’s Visibility level when displayed in the action dialog:
Always - The property is always displayed.

By Condition - The property is displayed by setting a conditional visibility


formula. If the criteria for the formula are met, the property is displayed in the
action dialog; if they are not met, the property is not displayed.

When the By Condition option is selected, a Visibility Formula property is


displayed beneath it. The Visibility Formula property consists of a text box
(for the formula) and the ƒ Edit Visibility Formula button.

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.

How to Customize Setup Parameters


To customize the Setup Parameters, follow the steps below:
1. In the Action List, under the General Operations menu, either double-click Setup Parameters, or click-and-drag it onto the
main editing window.

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.

Oqton, Inc. 130


3. Right-click on the Setup Parameter action and click Customize Setup Parameters from the menu.

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.

6. Click OK to exit the Customize Setup Parameters dialog.

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.

The Operators include:


Param - Inserts the ID of the selected field to
the formula.

Equal - Inserts an EQUAL operation to the


formula.

Not Equal - Inserts a NOT EQUAL operation


to the formula.

And - Inserts an AND operation to the


formula.

Or - Inserts an OR operation to the formula.

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.

Oqton, Inc. 132


7 APPENDIX C. USING EXPRESSION
This chapter provides comprehensive details on the usage of the Expression action that are not covered in the in the "Visual Scripting
Editor User Interface Overview" on page 3.

The Expression action is used for calculation and constants.

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.

List of Constants and Functions supported by the Expression action


y Constants:
Š e - is a mathematical constant approximately equal to 2.71828.
Š pi - is a mathematical constant approximately equal to 3.14159.
y Functions:
The following expression will be highlighted in blue when it is used in the Expression action.
Š abs - Returns the non-negative value of its argument. If a number is negative, Abs returns the positive equivalent.
Š acos - Returns the arc cosine (in degrees), or inverse cosine, of its argument. The arc cosine is the angle whose cosine is the
argument. The returned angle is given in degrees in the range 0 (zero) to 180˚. See Example Usage section for more infor-
mation.
Š append - Combines folder and filenames into a path. This function has 2 parameters.
Š asin - Returns the arcsine (in degrees), or inverse sine, of its argument. The arcsine is the angle whose sine is the argument.
The returned angle is given in degrees in the range -90˚ to 90˚.
Š atan - Returns the arctangent(in degrees), or inverse tangent, of its argument. The arctangent is the angle whose tangent is
the argument. The returned angle is given in degrees in the range -90˚ to 90˚.
Š atan2 - This function has 2 parameters(y,x), returns the angle in degrees between the positive x-axis and the ray from (0,0)
to the point (x,y).
Š cos - Returns the cosine(in degrees) of its argument, an angle specified in degrees.
Š exp - This exponential function returns ‘e’ raised to the power of its argument. “exp(x)"is the same as “ex". The number e
begins~2.71828...
Š extension - Returns the extension from the specified full path.
Š filename – Returns the file name and extension from the specified full path.
Š filenamewithoutextension – Returns the file name without the extension from a specified full path.
Š folder – Returns the folder name from the specified full path.
Š ln - Returns the natural logarithm(base of e) of its argument.
Oqton, Inc. 133
Š log - Returns the natural logarithm of its argument. This function has 2 parameters.
Š max - Returns the largest of the numbers given as input parameters. This function has 2 parameters.
Š min - Returns the lowest of the numbers given as input parameters. This function has 2 parameters. See Example Usage
section for more information.
Š pow - Returns a number raised to a power. It is equivalent to using the ^ operator.
Š pow2 - Returns the base to the exponent power, as in base ^ exponent. This function supports either1 or 2 parameters. See
Example Usage section for more information.
Š replace_ext (replace_extension) - Changes the extension of the specified path. This function has 2parameters.
Š round - Rounds a number to the specified number of decimal places. The Round rounds up if the next digit is 5 or higher.
Otherwise, this function rounds down. The roundfunction gets only one number as input. See Example Usage section for
more information.
Š select - This function has 3 parameters: condition, true_result, and false_result. See Example Usage section for more
information.
Š sin - Returns the sine of its argument, an angle specified in degrees. See Example Usage section for more information.
Š sqrt - Returns the number that,when multiplied by itself, equals its argument.
Š tan - Returns the tangent of its argument, an angle specified in degrees.
Š tonumber - Converts a string into a number.
Š tostring – Converts a number into a string.
Š foreachiter – Sets the number of iterations to count from 1 if it is used inside the ForEach action. However, if it is used outside
the ForEach action, the number of iterations is set to 0.

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).

Oqton, Inc. 134


8 APPENDIX D. EXTENDING VISUAL SCRIPTING
Although Visual Scripting provides extensive automation capabilities, it may not cover all operations required for custom workflows
that are not standard in Geomagic Control X. In these cases, associating the Visual Scripting workflow with a separate Python script
or external process can provide a solution.

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

How to run a Visual Script from Command Line


Some users want to trigger a Visual Script without having to go through the Visual Script Editor interface. This is possible with
Command Prompt (CMD).

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.

Oqton, Inc. 135


y Go to Start menu > Windows System > Command Prompt.
y Go to Start menu > All Programs > Accessories > Command Prompt.
y Go to the Start screen, hover your mouse in the lower-left corner of the screen, and click the down arrow that appears. The Apps
page should open. Click Command Prompt in the Windows System section.
y Hold the Windows key and press the “R" key to get a “Run" window. Type “cmd" in the box, and press the Enter key on the keyboard.

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 path of the script file should be in double-quotations.

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.

Š Open the Scripting Editor and load a Visual Script


ƒ 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>"

ƒ 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"

Oqton, Inc. 136


Š Open the Scripting Editor, load a Visual Script and then run it.
ƒ 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

ƒ 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 ----

Oqton, Inc. 137


ƒ Syntax
“C:\Program Files\Oqton\<Product Version Number>\GeomagicControlX.exe" /RunScript
“<Script File with Full Path>"

ƒ 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"

Note: The command option is case-insensitive. Either /RunScript or /runscript works.

3. Check if the script runs.

Oqton, Inc. 138


How to run an external Python script from Visual
Scripting Editor
The following example shows how to use the Run External Command action to execute custom Python scripts in conjunction with the
Visual Script tool in Geomagic Control X.

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

3. In Geomagic Control X application, go to the Automation tab.

4. On the Visual Scripting Toolbar, click Visual Script Editor to create a new Visual Script in the Visual Scripting Editor.

Oqton, Inc. 139


5. The Visual Scripting Editor is initiated.

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.

y Command Name: C:\Test\TestCmd.cmd


y Parameter 1: “C:\Test\Output.log"
y Parameter 2: 15

Note: Parameters added to the action block will be passed as command arguments.

Oqton, Inc. 140


8. On the Visual Scripting Editor Toolbar, click Start or go to Debug > Start to run the script.

9. Check if the script runs without any failures and the results are created.

How to Run a Visual Script from Python


If you may want to trigger a Visual Script from an external Python script. This is possible using the os module to replicate the
command line call described here: How to run a Visual Script from Command Line.

The general format for this is:


os.chdir(‘path to Control X install directory’ )
os.system(‘cmd /c “CMD Command to launch CX with script path"’)

The following is a smaple example:


import os
os.chdir(r’C:\Program Files\Oqton\Geomagic Control X 2022.1’ )
os.system(r’cmd /c “GeomagicControlX.exe /RunScript “C:\temp\SampleScript.
scrpt""’)

Oqton, Inc. 141


Oqton, Inc.
345 California St, Suite 600 San Francisco, CA 94104
www.oqton.com

Copyright © 2022 Oqton, Inc. All rights reserved.

You might also like