| Customize Help
| Save Settings

MmetSetPosition



Function Map
Synopsis
Set the position of a feature.
Syntax
void MmetSetPosition(
MIL_ID ContextId, //in
MIL_INT FeatureLabelOrIndex, //in
MIL_INT64 TransformationType, //in
MIL_DOUBLE Param1, //in
MIL_DOUBLE Param2, //in
MIL_DOUBLE Param3, //in
MIL_DOUBLE Param4, //in
MIL_INT64 ControlFlag //in
)
Description

This function moves the specified feature's position in the metrology template of a metrology context.

This function is valid for all measured (MmetAddFeature() with M_MEASURED) and parametrically constructed (MmetAddFeature() with M_CONSTRUCTED and M_PARAMETRIC) features, unless otherwise specified. Typically this function is used to move the position of the global frame or a parametrically constructed local frame (each of which is considered a feature). When specifying a frame, all features and metrology regions that use that frame as their reference frame are moved accordingly. Note that you can also position features using MmetControl() with M_POSITION_X and M_POSITION_Y. However, in this case you must enter exact values; you cannot, for example, position features based on the results of another module, as you can using MmetSetPosition() with M_RESULT.

MIL moves the specified feature relative to its reference frame, except for the global frame, which MIL moves relative to its default origin (0,0). If the target image is not calibrated, the global frame's default origin is aligned with the center of the top-left corner pixel of the target image. If the target image is calibrated, the global frame's default origin is aligned with the origin of the relative (world) coordinate system.

If a camera calibration context is associated with the target image, set positional and dimensional values in real-world units. Otherwise, use pixel units.

Note that when using a C compiler (not a C++ or other compiler) in 64-bit mode, MmetSetPosition() internally calls the MIL_DOUBLE version of this function (MmetSetPositionDouble()). If you need to pass integer values, call the MIL_INT64 version of this function (MmetSetPositionInt64()).
Note that this function reference has not been updated for a MIL system added during a MIL update. Refer to the MIL system's release note to see which MIL system’s documentation you should use in its place and any possible differences.
Parameters
This function is not supported on the selected boards.
This function reference has not been updated for the selected MIL system. To show the content of this page, choose a second MIL system; refer to the MIL system's release note to see which MIL system’s documentation to choose and any possible differences.
Parameters
ContextId

Specifies the identifier of the metrology context. The metrology context must have been previously allocated on the required system using MmetAlloc().

FeatureLabelOrIndex

Specifies the label or index of the feature you want to position. Set this parameter to one of the following values.

function map For specifying a feature
Click to summarizeValue Description
Click to summarize M_DEFAULT

Specifies the global frame.

Click to summarize

Specifies the index value of an existing individual feature.

(summarize)
Parameters

This parameter specifies the index of the feature to position. You can set this parameter to the following:

Value >= 0

Specifies the index. Note that the index of the global frame is 0.

Click to summarize

Specifies the label value of an existing individual feature.

(summarize)
Parameters

This parameter specifies the label of the feature to position. You can set this parameter to the following:

Value > 0

Specifies the label.

TransformationType

Specifies the type of transformation that will be used to set the new position of the feature.

See the Parameter associations section for possible values that can be specified.

Param1

Specifies an attribute of the position to set. Its definition is dependent on the type of position chosen.

See the Parameter associations section for possible values that can be specified.

Param2

Specifies an attribute of the position to set. Its definition is dependent on the type of position chosen.

See the Parameter associations section for possible values that can be specified.

Param3

Specifies an attribute of the position to set. Its definition is dependent on the type of position chosen.

Set this parameter to M_DEFAULT if not used.

See the Parameter associations section for possible values that can be specified.

Param4

Specifies an attribute of the position to set. Its definition is dependent on the type of position chosen.

Set this parameter to M_DEFAULT if not used.

See the Parameter associations section for possible values that can be specified.

ControlFlag

Reserved for future expansion and must be set to M_DEFAULT.

The table below lists possible values for the TransformationType, Param1, Param2, Param3, and Param4 parameters.

Note that any unused parameters should be set to M_DEFAULT.

function map For selecting the operation that will be used to position the feature
Click to summarizeTransformationType Description
Param1
Param2
Param3
Param4
Click to summarize M_FORWARD_COEFFICIENTS

Specifies to position the feature using an operation based on forward transformation coefficients, using the equations that follow.

x d = A x s + B y s + C .

y d = -B x s + A y s + D .

(summarize)
Click to summarize Param1

Sets the forward transformation coefficient A.

(summarize)
Click to summarize M_DEFAULT

Specifies the default value; the default value is 1.0.

Click to summarize Value

Specifies the coefficient.

Click to summarize Param2

Sets the forward transformation coefficient B.

(summarize)
Click to summarize M_DEFAULT

Specifies the default value; the default value is 1.0.

Click to summarize Value

Specifies the coefficient.

Click to summarize Param3

Sets the forward transformation coefficient C.

(summarize)
Click to summarize M_DEFAULT

Specifies the default value; the default value is 1.0.

Click to summarize Value

Specifies the coefficient.

Click to summarize Param4

Sets the forward transformation coefficient D.

(summarize)
Click to summarize M_DEFAULT

Specifies the default value; the default value is 1.0.

Click to summarize Value

Specifies the coefficient.

Click to summarize M_GEOMETRIC

Specifies to position the feature using an operation based on a translation and rotation.

(summarize)
Click to summarize Param1

Sets the translation value for the feature, in the X-direction.

(summarize)
Click to summarize M_DEFAULT

Specifies the default value; the default value is 0.0.

Click to summarize Value

Specifies the distance to move the feature, in pixel or world units.

Click to summarize Param2

Sets the translation value for the feature, in the Y-direction.

(summarize)
Click to summarize M_DEFAULT

Specifies the default value; the default value is 0.0.

Click to summarize Value

Specifies the distance to move the feature, in pixel or world units.

Click to summarize Param3

Sets the angle of rotation for the feature.

(summarize)
Click to summarize M_DEFAULT

Specifies the default value; the default value is 0.0°.

Click to summarize 0.0 <= Value <= 360.0

Specifies the angle, in degrees.

Click to summarize M_POSITION

Specifies to position the feature at a specific position and angle. This should be used only for a parametrically constructed local frame.

(summarize)
Click to summarize Param1

Sets the X-coordinate of the origin of the local frame.

(summarize)
Click to summarize M_DEFAULT

Specifies the default value. The default value is 0.0 pixels.

(summarize)
Click to summarize Value

Specifies the X-coordinate, in pixel or world units.

Click to summarize Param2

Sets the Y-coordinate of the origin of the local frame.

(summarize)
Click to summarize M_DEFAULT

Specifies the default value. The default value is 0.0 pixels.

(summarize)
Click to summarize Value

Specifies the Y-coordinate, in pixel or world units.

Click to summarize Param3

Sets the angle of the local frame.

(summarize)
Click to summarize M_DEFAULT

Specifies the default value; the default value is 0.0°.

Click to summarize 0.0 <= Value <= 360.0

Specifies the angle, in degrees.

Click to summarize M_RESULT

Specifies to position the feature at the position calculated by another MIL module. Supported modules are Code, Geometric Model Finder, Pattern Matching, and String Reader. If you are using a Model Finder result, you can combine M_RESULT with M_FORWARD_COEFFICIENTS. In this case, the transformation uses the forward coefficients of Model Finder's result occurrence.

(summarize)
Click to summarize Param1

Sets a MIL result buffer identifier from the MIL module to use to specify the feature's position.

(summarize)
Click to summarize Param2

Sets the index value of the result occurrence to use to set the feature's position. This value must be a valid index that is contained within the result buffer you provided with Param1.

(summarize)
Type-specific versions of the function when using a C compiler under 64-bit
void MmetSetPositionInt64 (MIL_ID ContextId, MIL_INT FeatureLabelOrIndex, MIL_INT64 TransformationType, MIL_INT64 Param1, MIL_DOUBLE Param2, MIL_DOUBLE Param3, MIL_DOUBLE Param4, MIL_INT64 ControlFlag)
Parameters

ContextId

See ContextId of the main function for a description.

FeatureLabelOrIndex

See FeatureLabelOrIndex of the main function for a description.

TransformationType

See TransformationType of the main function for a description.

Param1

See Param1 of the main function for a description.

Param2

See Param2 of the main function for a description.

Param3

See Param3 of the main function for a description.

Param4

See Param4 of the main function for a description.

ControlFlag

See ControlFlag of the main function for a description.

void MmetSetPositionDouble (MIL_ID ContextId, MIL_INT FeatureLabelOrIndex, MIL_INT64 TransformationType, MIL_DOUBLE Param1, MIL_DOUBLE Param2, MIL_DOUBLE Param3, MIL_DOUBLE Param4, MIL_INT64 ControlFlag)
Parameters

ContextId

See ContextId of the main function for a description.

FeatureLabelOrIndex

See FeatureLabelOrIndex of the main function for a description.

TransformationType

See TransformationType of the main function for a description.

Param1

See Param1 of the main function for a description.

Param2

See Param2 of the main function for a description.

Param3

See Param3 of the main function for a description.

Param4

See Param4 of the main function for a description.

ControlFlag

See ControlFlag of the main function for a description.

Compilation information
Header Include mil.h.
Library Use mil.lib; milmetrol.lib.
DLL Requires mil.dll; milmetrol.dll.
DEFAULT FORWARD COEFFICIENTS DEFAULT DEFAULT DEFAULT DEFAULT GEOMETRIC DEFAULT DEFAULT DEFAULT POSITION DEFAULT DEFAULT DEFAULT RESULT