MIL_ID ContextModId, | //in |
MIL_INT64 FileType, | //in |
MIL_CONST_TEXT_PTR FileName, | //in |
MIL_INT64 ControlFlag | //in |
This function defines a model from a file and adds it to a Model Finder context. Models defined from a file are CAD-type synthetic models; use MmodDefine() to add other types of models to the Model Finder context. This function does not support M_SHAPE_CIRCLE type of Model Finder contexts.
You must preprocess the Model Finder context after you add a model.
By default, synthetic models are defined to have a 10% margin around the bounding box of their active edges. When finding an occurrence, any extra edges found in this area will reduce the target score. You can change the size of the margins with the MmodControl() M_BOX_MARGIN_... control types.
When the model is added to the Model Finder context from a CAD DXF file, the model will retain the CAD-file's coordinate system (the origin and the axis). Specify the ratio between model units and pixel units using MmodControl() with M_PIXEL_SCALE.
Note that if the model is used to search in a calibrated target, you must also associate the calibration context of the target with the model, using M_ASSOCIATED_CALIBRATION. MIL needs the calibration context for internal purposes at preprocessing time. MIL will not use the calibration context to compensate for inconguencies between the model and the target, nor will MIL map the model's coordinate system to that of the target.
If the target is calibrated, the model units should be the same as the calibrated units. If the target is calibrated, M_PIXEL_SCALE will be used for draw operations, but not for the match nor the returned results.
Most CAD DXF files are oriented so that the Y-axis is positive going up, whereas the coordinate system MIL uses is oriented with the Y-axis positive going down. So if you take the edge coordinates of an object from a CAD DXF file and put them in an image, the imaged object will look flipped when compared to the original object. This is also the case for a model defined from a CAD DXF file. This means that, unless the object is symmetrical, the match will not be made. You can use M_CAD_Y_AXIS to set the Y-axis in the appropriate direction.
To delete a model from a Model Finder context, use MmodDefine() with M_DELETE.
Specifies the identifier of the Model Finder context. For this parameter, you can only specify M_GEOMETRIC or M_GEOMETRIC_CONTROLLED type of Model Finder contexts.
Specifies the type of file from which to define the model.
This parameter can be set to the following value:
For specifying the type of
file
|
|||||||||||||||||||||||||||||||||||||||
Value | Description
|
||||||||||||||||||||||||||||||||||||||
M_DXF_FILE |
Defines the model from the entities in the specified CAD DXF file. (more details...) |
Specifies the name and path of the file from which to define the model. The function handles (internally) the opening and closing of the file.
This parameter can be set to the following value:
For specifying the file name and
path
|
|||||||||||||||||||||||||||||||||||||||
Value | Description
|
||||||||||||||||||||||||||||||||||||||
MIL_TEXT("FileName") 1 |
Specifies the drive, directory, and name of the file (for example, "C:\mydirectory\myfile"). (more details...) |
1 If you are passing the value in a variable, don't enclose it in MIL_TEXT().
Header | Include mil.h. |
Library | Use mil.lib; milmod.lib. |
DLL | Requires mil.dll; milmod.dll. |