Distance Segment Line Edit ControlCognex VisionPro

This topic contains the following sections.

The Distance Segment Line edit control provides a graphical user interface to the DistanceSegmentLine method, which returns the shortest distance from the line segment Segment to the line Line. The edit control allows you to configure the line segment and the line, dictate which graphics appear as the tool executes, and view tool results. The following figure shows the Distance Segment Line edit control:

Cognex Dimensioning Distance Segment Line Control Distance Segment Line Whole Control

The edit control offers the following features:

  • A row of control buttons at the top left
  • A set of function tabs to configure the line segment and the line, choose what graphics the tool will use, and view results
  • An image display window for displaying tool images and graphics

You can experiment with the edit control by using QuickBuild to create a CogDistanceSegmentLine tool. A new CogDistanceSegmentLine tool appears as shown in the following figure:

Cognex Dimensioning Distance Segment Line Control Distance Segment Line Terminals

The Segment and Line parameters can either be specified directly from within the edit control or accepted as the result of other shape-generating vision tools. For example, the following figure shows how a Distance Segment Line tool accepts the line segment and line generated as output from other tools:

Cognex Dimensioning Distance Segment Line Control Distance Segment Line Accept Shapes

To include the edit control in your custom vision application, you must first add it to your Visual Studio.NET development environment. See Using Edit Controls in Your Custom Vision Applications for more information.

Control Buttons

Cognex Dimensioning Distance Segment Line Control MTWButton Bar

The following table describes the function of each button:

Table 1. Control buttons
ButtonDescriptionFunction
Run Button
RunMeasures the distance from the line segment to the line
Electric Button
Electric modeToggles electric mode, where the Distance Segment Line tool executes automatically when particular configuration parameters change. In electric mode, a lightning bolt appears next to every electric property

Local Display Button

Local image display

Opens or closes the local image display window. A Distance Segment Line tool supports the following image buffers:

  • The Current.InputImage buffer contains the current image and the input line segment and input line
  • The LastRun.InputImage buffer contains the results of the tool after it measures the distance between the line segment and the line
Floating Display Button
Floating image displayOpens one or more floating image windows, which support the same image buffers as the local image display window
Open Button
OpenOpens a VisionPro persistence (.vpp) file that contains a set of saved properties for this vision tool object type. VisionPro reports an error if you try to open a .vpp file for another object type.
Save Button
SaveSaves the current properties of the vision tool to a VisionPro persistence (.vpp) file. The edit control allows you to choose between saving the vision tool with or without its image buffers and tool results.
Save As Button
Save AsSaves the current properties of the vision tool to a new VisionPro persistence (.vpp) file
Reset Button
ResetResets the vision tool to its default state.
Tool Tips Button
Show ToolTipsEnables or disables the display of tooltips for individual items in the edit control
Help Button
HelpOpens this VisionPro online help file
Settings Tab

Use the Settings tab to define the input line segment and input line, or use the tab to confirm that the existing shapes correspond to the correct input parameters generated by other tools. The following figure shows the Settings tab:

Cognex Dimensioning Distance Segment Line Control Distance Segment Line Settings Tab

The Settings tab offers the following features to define the Segment parameter:

Table 2. Settings tab
FeatureDescription
SelectedSpaceNameNames the coordinate space for the segment shape
Select ModeDetermines whether the line segment is determined by the 2 Points option (two [x, y] coordinates) or by the Point/Length option (a starting [x, y] coordinate followed by a line length and a measure of rotation).
StartX and StartYNames the starting (x, y) coordinate of the line segment
EndX and EndYNames the ending (x, y) coordinate of the line segment when using the 2 Points option.
Length and RotationControls the length and angle of rotation of the line segment when using the Point/Length option.
FitToImageCenters the line segment within the Current.InputImage

The Settings tab offers the following features to define the Line parameter:

Table 3. Settings tab
FeatureDescription
SelectedSpaceNameNames the coordinate space for the line shape
XThe x-coordinate of a reference point on the line
YThe y-coordinate of a reference point on the line
RotationThe angle of the line
FitToImageCenters the line within the Current.InputImage
Graphics Tab

Use the Graphics tab to control which graphics the Distance Segment Line tool generates and displays. The following figure shows the Graphics tab:

Cognex Dimensioning Distance Segment Line Control Distance Segment Line Graphics Tab

The Graphics tab offers the following features:

Table 4. Graphics tab
FeatureDescription
Show Input ImageDetermines whether or not the input image is recorded as part of the diagnostic record, and whether the image is copied to the record or saved in the record as a reference
Show SegmentShow Segment in the LastRun.InputImage buffer
Show LineShow Line in the LastRun.InputImage buffer
Show ArrowShow the line segment representing the shortest distance between Segment and Line
Results Tab

Use the Results tab to view the relationship between Segment and Line as determined by the Distance Segment Line tool. The following figure shows the Results tab:

Cognex Dimensioning Distance Segment Line Control Distance Segment Line Results Tab

The Results tab offers the following features:

Table 5. Results tab
FeatureDescription
DistanceThe shortest distance between Segment and Line
SegmentX and SegmentYThe (x, y) coordinate on Segment that is closest to Line
LineX and LineYThe (x, y) coordinate on Line that is closest to Segment