| MIL 10 Reference
| Customize Help
| Save Settings

MmetAlloc



See also
Availability
Not available in MIL-Lite
Available in MIL

Available on Windows
Available on Linux

Available on Non-Matrox computer
Available on Matrox 4Sight-X
Available on Matrox 4Sight GP
Available on Matrox Supersight
function map Function map
Examples
Synopsis
Allocate a metrology context or a derived metrology region object.
Syntax
MIL_ID MmetAlloc(
MIL_ID SysId, //in
MIL_INT64 Type, //in
MIL_ID *ContextOrRegionObjectIdPtr //out
)
Description

This function allocates a metrology context or a derived metrology region object on the specified system. A metrology context contains all the information necessary to perform an MmetCalculate() operation, including global processing settings and a metrology template; the metrology template defines the set of features and geometric tolerances against which MmetCalculate() validates and measures objects in an image. A derived metrology region object is an optional container for specialized information about metrology regions (ROIs).

When you allocate a metrology context, MIL automatically creates a global frame, assigns it an index of 0, and labels it M_GLOBAL_FRAME. The global frame is the first coordinate system used to define the features to add to the metrology template of a metrology context. The global frame always exists and you cannot delete it. If the target image is not calibrated, the global frame's default origin (0,0) 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.

To add features (either physically measured or constructed) or geometric tolerances to the metrology template of a metrology context, use MmetAddFeature() or MmetAddTolerance(), respectively. To adjust metrology context, feature, and geometric tolerance settings, use MmetControl().

For physically measured features, you must also use MmetSetRegion() to set the metrology region that delimits the area in the target image from which to establish the feature. You can set the metrology region using explicit values or a graphics list; you can also derive a metrology region using other features. If you are using an explicitly-defined or a graphics list metrology region, you just need to allocate a metrology context, and specify it when you call MmetSetRegion(). If you are deriving a metrology region using other features, you must also allocate a derived metrology region object and specify it, as well as the metrology context, when you call MmetSetRegion().

When the metrology context or the derived metrology region object is no longer required, you should free them using MmetFree().

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 if there is complementary information.
Parameters
This function is not supported on the selected boards.
Parameters
SysId INQ

Specifies the system on which to allocate the metrology context or the derived metrology region object.

This parameter should be set to one of the following values:

function map For specifying the system
CollapseValue Description
Collapse M_DEFAULT_HOST

Specifies the default Host system of the current MIL application.

Collapse MIL system identifier

Specifies a valid system identifier, previously allocated using MsysAlloc().

Type

Specifies whether to allocate a metrology context or a derived metrology region object. This parameter should be set to one of the following values:

function map For specifying whether to allocate a metrology context or a derived metrology region object
CollapseValue Description
Collapse M_DEFAULT

Same as M_CONTEXT.

Collapse M_CONTEXT

Specifies a metrology context.

Collapse M_DERIVED_GEOMETRY_REGION

Specifies a derived metrology region object. This object is only required when a geometry setting of a metrology region must be derived from one or more features. This type of metrology region is referred to as a derived metrology region. Use MmetSetRegion() with M_FROM_DERIVED_GEOMETRY_REGION to associate the derived metrology region with a measured feature.

(summarize)
ContextOrRegionObjectIdPtr

Specifies the address of the variable in which to write the identifier of the metrology context or the derived metrology region object. Since the MmetAlloc() function also returns the identifier, you can set this parameter to M_NULL.

Return value
The returned value is the identifier of the metrology context or the derived metrology region object if the allocation is successful. If allocation fails, M_NULL is returned.
Compilation information
Header Include mil.h.
Library Use mil.lib; milmetrol.lib.
DLL Requires mil.dll; milmetrol.dll.
DEFAULT HOST DEFAULT CONTEXT DERIVED GEOMETRY REGION