# TrainPatMax3D

The TrainPatMax3D function Functions are tools that are available in Spreadsheet for processing and analyzing acquisitions or other results. You can add functions to your Spreadsheet job to create tool chains and produce results for specific applications. is used to extract and train a 3D pattern in the point cloud A point cloud is a 3D structure that consists of the data points collected by a 3D vision system during acquisition.. This pattern is then used with the FindPatMax3D function. The function returns a Model3D structure.

## TrainPatMax3D Overview

The TrainPatMax3D function is used to extract and train a 3D pattern in the point cloud. This pattern is then used with the FindPatMax3D function.

Inputs

The TrainPatMax3D function has the following syntax:

TrainPatMax3D(PointCloud A point cloud is a 3D structure that consists of the data points collected by a 3D vision system during acquisition., Fixture3D, ExternalFixture, Box3D, ExternalRegion, ExcludeBasePlane, Plane3D, ExternalPlane, PatternOrigin, PatMax3DVersion, FeatureSize, TrainEvent, Timeout, Show)

See the table for a description of the available parameters.

Parameter | Description
PointCloud | Reference to a cell containing a point cloud. The default value is $A$0.
Fixture3D | Specifies the point cloud coordinate system in which the 3D fixture A fixture is a coordinate location on the image that keeps the tool in the place determined by the fixture. is defined. It is offset from the PointCloud origin in the following format with the following arguments: {X, Y, Z, Rotation, Tilt, TiltDirection}
X | Offset on the X-axis from the PointCloud origin.
Y | Offset on the Y-axis from the PointCloud origin.
Z | Offset on the Z-axis from the PointCloud origin.
Rotation | Specifies the in-plane rotation in degrees around the PointCloud Z-axis. The value range is -180 to 180. The tool normalizes external references with values outside the allowed range to the allowed range.
Tilt | Specifies the tilt angle in degrees from the PointCloud Z-axis after rotation. The value range is 0-180. External references with values outside the allowed range result in an error.
Tilt Direction | Specifies the direction of tilt in degrees from the rotated PointCloud X-axis of the tool, around the PointCloud Z-axis of the tool. The value range is -180 to 180. The tool normalizes external references with values outside the allowed range to the allowed range.
Note: The Fixture3D parameter is only available if you set External Fixture to 0. Note: You can use the Fixture3D parameter to set the ROI fixture.
External Fixture | Specifies a reference to a Fixture3D structure defined in another cell. The function uses the referenced cell as the fixture of the function. Set to 0 (OFF) to use the internal fixture of the function instead.
Box3D | Specifies the dimensions, offset and angle for 3D region of interest (ROI) of the function. It is offset from the Fixture3D origin in the following format with the following arguments: {SizeX, SizeY, SizeZ, X, Y, Z, Rotation, Tilt, TiltDirection}
SizeX | The size of the ROI along the Fixture3D X-axis.
SizeY | The size of the ROI along the Fixture3D Y-axis.
SizeZ | The size of the ROI along the Fixture3D Z-axis.
X | Offset on the X-axis from the Fixture3D origin.
Y | Offset on the Y-axis from the Fixture3D origin.
Z | Offset on the Z-axis from the Fixture3D origin.
Rotation | Specifies the in-plane rotation in degrees around the Fixture3D Z-axis of the tool. The value range is -360 to 360. The tool normalizes external references with values outside the allowed range to the allowed range.
Tilt | Specifies the tilt angle in degrees from the Fixture3D Z-axis of the tool after rotation. The value range is 0-180. External references with values outside the allowed range result in an error.
Tilt Direction | Specifies the direction of tilt in degrees from the rotated Fixture3D X-axis of the tool, around the Fixture3D Z-axis of the tool . The value range is -360 to 360. The tool normalizes external references with values outside the allowed range to the allowed range.
Note: This setting is only available if you set External Region to 0.
External Region | Specifies a reference to a 3D region defined in another cell. The function uses the referenced cell as the Region of Interest of the function. Set to 0 (OFF) to use the internal Box3D structure of the function as the ROI.
Exclude Base Plane | When enabled, the function adds a separate planar region of interest (ROI), so that the surface plane can be excluded when training or finding a 3D pattern, improving the performance of the tool. This setting is disabled by default, as undesired areas can also be excluded with appropriate placement of the Box3D structure.
Plane3D | Specifies the offset and the angle of the plane to use. It is offset from the PointCloud origin in the following format with the following arguments: {X, Y, Z, Tilt, TiltDirection}
X | Offset on the X-axis from the PointCloud origin.
Y | Offset on the Y-axis from the PointCloud origin.
Z | Offset on the Z-axis from the PointCloud origin.
Tilt | Specifies the tilt angle (in degrees) from the PointCloud Z-axis. The value range is 0-180. External references with values outside the allowed range will result in an error.
Tilt Direction | Specifies the direction of tilt (in degrees) from the plane's rotated PointCloud X-axis, about the tool's PointCloud Z-axis. The value range is -360 - 360. External references with values outside the allowed range will be normalized to the allowed range.
Note: This parameter is available only if External Plane is set to 0. Note: You can use Plane3D to mask data for training. The Plane3D function prevents the tool from taking any points that belong to that plane and are within the ROI. Note: This parameter is available only if Exclude Base Plane is True and External Plane is 0.
External Plane | Specifies a reference to a Rectangle3D or Circle3D structure defined in another cell to be used by the function. Set to 0 (OFF) to use the function's internal Plane3D structure instead. Note: This parameter is available only if Exclude Base Plane is True.
Pattern Origin | Specifies the X, Y and Z-axis location of the training pattern's origin, as offsets from the center of the training region.
Offset X | Specifies the X-axis offset from the center of the trained pattern.
Offset Y | Specifies the Y-axis offset from the center of the trained pattern.
Offset Z | Specifies the Z-axis offset from the center of the trained pattern.
Rotation | Specifies the training pattern's in-plane rotation (in degrees) about the Fixture3D Z-axis. The value range is -360 to 360. External references with values outside the allowed range will be normalized to the allowed range.
Tilt | Specifies the training pattern's tilt angle (in degrees) from the Fixture3D Z-axis. The value range is 0-180. External references with values outside the allowed range will result in an error.
Tilt Direction | Specifies the training pattern's direction of tilt (in degrees) from the tool's rotated Fixture3D X-axis, about the tool's Fixture3D Z-axis. The value range is -360 to 360. External references with values outside the allowed range will be normalized to the allowed range.
PatMax3D Version | 1.0 (1) - use for existing jobs to ensure that results remain consistent. 2.0 (2) - returns pose results twice as fast on average. Recommended for new jobs. Note: The accuracy of the two versions is generally equal. However, there can be cases where one PatMax3D version produces a result, but the other does not.
Feature Size | Specifies the sampling quality of the point cloud points and patches that PatMax3D will use for alignment. The available values are the following: 0 = Large: Calculate alignment using large features. 1 = Medium: Calculate alignment using medium features. This is the default setting. 2 = Small: Calculate alignment using small features. Tip: Lower values (Large and Medium) increase alignment performance, but are less accurate. The Small value results in more accurate alignment and better noise data sensitivity, at the cost of performance.
Train Event | Trains the configured pattern upon clicking the button.
Timeout | Specifies a length of time (in milliseconds) to allow the training to run. The function execution stops if the time out exceeds the configured value.
Show | Selects the type of graphics to overlay on the image.
0 = hide all (default) | All graphics are hidden, except when the cell containing the function is highlighted in the spreadsheet.
1 = result graphics only | The result graphics of the function are displayed at all times.
2 = input and result graphics | The region of interest, the input data and the results are displayed at all times.

Outputs

Returns | A Model3D data structure containing the trained pattern, or #ERR if any of the input parameters are invalid.
Results | When initially inserted into a cell, the following functions are automatically inserted into the spreadsheet to create a result table.
| Trained | Origin | X | Y | Z
❒Model3D | GetTrained(Model3D) | GetOrigin(Model3D) | GetX(Point3D) | GetY(Point3D) | GetZ(Point3D)

Vision Data Access functions

The following TrainPatMax3D Vision Data Access functions are automatically inserted into the spreadsheet to create the result table:

Function | Description
GetOrigin(Model3D) | Returns the origin point of the model as a Point3D structure.
GetTrained(Model3D) | Checks if the referenced cell contains a successfully trained pattern or not. The function returns 1 if it does, and 0 if it does not.
GetX(Point3D) | Returns the X-axis coordinate of the model's origin point.
GetY(Point3D) | Returns the Y-axis coordinate of the model's origin point.
GetZ(Point3D) | Returns the Z-axis coordinate of the model's origin point.