ClassesClassesClassesClasses | | | | Operators

read_object_model_3d_dxfread_object_model_3d_dxfReadObjectModel3dDxfread_object_model_3d_dxfReadObjectModel3dDxfReadObjectModel3dDxf (Operator)


read_object_model_3d_dxfread_object_model_3d_dxfReadObjectModel3dDxfread_object_model_3d_dxfReadObjectModel3dDxfReadObjectModel3dDxf — Read a 3D object model from a DXF file.


read_object_model_3d_dxfread_object_model_3d_dxfReadObjectModel3dDxfread_object_model_3d_dxfReadObjectModel3dDxfReadObjectModel3dDxf is obsolete and is only provided for reasons of backward compatibility. New applications should use the operator read_object_model_3dread_object_model_3dReadObjectModel3dread_object_model_3dReadObjectModel3dReadObjectModel3d instead.


read_object_model_3d_dxf( : : FileName, Scale, GenParamNames, GenParamValues : ObjectModel3D, DxfStatus)

Herror read_object_model_3d_dxf(const char* FileName, const char* Scale, const char* GenParamNames, double GenParamValues, Hlong* ObjectModel3D, char* DxfStatus)

Herror T_read_object_model_3d_dxf(const Htuple FileName, const Htuple Scale, const Htuple GenParamNames, const Htuple GenParamValues, Htuple* ObjectModel3D, Htuple* DxfStatus)

Herror read_object_model_3d_dxf(const HTuple& FileName, const HTuple& Scale, const HTuple& GenParamNames, const HTuple& GenParamValues, Hlong* ObjectModel3D, char* DxfStatus)

Herror read_object_model_3d_dxf(const HTuple& FileName, const HTuple& Scale, const HTuple& GenParamNames, const HTuple& GenParamValues, HTuple* ObjectModel3D, HTuple* DxfStatus)

HTuple HObjectModel3D::ReadObjectModel3dDxf(const HTuple& FileName, const HTuple& Scale, const HTuple& GenParamNames, const HTuple& GenParamValues)

void ReadObjectModel3dDxf(const HTuple& FileName, const HTuple& Scale, const HTuple& GenParamNames, const HTuple& GenParamValues, HTuple* ObjectModel3D, HTuple* DxfStatus)

HTuple HObjectModel3D::ReadObjectModel3dDxf(const HString& FileName, const HTuple& Scale, const HTuple& GenParamNames, const HTuple& GenParamValues)

HString HObjectModel3D::ReadObjectModel3dDxf(const HString& FileName, const HString& Scale, const HString& GenParamNames, double GenParamValues)

HString HObjectModel3D::ReadObjectModel3dDxf(const char* FileName, const char* Scale, const char* GenParamNames, double GenParamValues)

void HOperatorSetX.ReadObjectModel3dDxf(
[in] VARIANT FileName, [in] VARIANT Scale, [in] VARIANT GenParamNames, [in] VARIANT GenParamValues, [out] VARIANT* ObjectModel3D, [out] VARIANT* DxfStatus)

VARIANT HObjectModel3DX.ReadObjectModel3dDxf(
[in] BSTR FileName, [in] VARIANT Scale, [in] VARIANT GenParamNames, [in] VARIANT GenParamValues)

static void HOperatorSet.ReadObjectModel3dDxf(HTuple fileName, HTuple scale, HTuple genParamNames, HTuple genParamValues, out HTuple objectModel3D, out HTuple dxfStatus)

HTuple HObjectModel3D.ReadObjectModel3dDxf(string fileName, HTuple scale, HTuple genParamNames, HTuple genParamValues)

string HObjectModel3D.ReadObjectModel3dDxf(string fileName, string scale, string genParamNames, double genParamValues)


The operator read_object_model_3d_dxfread_object_model_3d_dxfReadObjectModel3dDxfread_object_model_3d_dxfReadObjectModel3dDxfReadObjectModel3dDxf reads the contents of the DXF file FileNameFileNameFileNameFileNameFileNamefileName (DXF version AC1009, AutoCAD Release 12) and converts them to a 3D object model. The handle of the 3D object model is returned in ObjectModel3DObjectModel3DObjectModel3DObjectModel3DObjectModel3DobjectModel3D. If no absolute path is given in FileNameFileNameFileNameFileNameFileNamefileName, the DXF file is searched in the current directory of the HALCON process. The default HALCON file extension for the DXF file is 'dxf'.

The output parameter DxfStatusDxfStatusDxfStatusDxfStatusDxfStatusdxfStatus contains information about the number of 3D faces that were read and, if necessary, warnings that parts of the DXF file could not be interpreted.

The operator read_object_model_3d_dxfread_object_model_3d_dxfReadObjectModel3dDxfread_object_model_3d_dxfReadObjectModel3dDxfReadObjectModel3dDxf supports the following DXF entities:

The two-dimensional linear DXF entities LINE, CIRCLE and ARC are not interpreted as faces. Only if these elements are extruded, the resulting faces are inserted in the 3D object model.

The curved surface of extruded DXF entities of the type CIRCLE and ARC is approximated by planar faces. The accuracy of this approximation can be controlled with the two generic parameters 'min_num_points'"min_num_points""min_num_points""min_num_points""min_num_points""min_num_points" and 'max_approx_error'"max_approx_error""max_approx_error""max_approx_error""max_approx_error""max_approx_error". The parameter 'min_num_points'"min_num_points""min_num_points""min_num_points""min_num_points""min_num_points" defines the minimum number of sampling points that are used for the approximation of the DXF element CIRCLE or ARC. Note that the parameter 'min_num_points'"min_num_points""min_num_points""min_num_points""min_num_points""min_num_points" always refers to the full circle, even for ARCs, i.e., if 'min_num_points'"min_num_points""min_num_points""min_num_points""min_num_points""min_num_points" is set to 50 and a DXF entity of the type ARC is read that represents a semi-circle, this semi-circle is approximated by at least 25 sampling points. The parameter 'max_approx_error'"max_approx_error""max_approx_error""max_approx_error""max_approx_error""max_approx_error" defines the maximum deviation of the XLD contour from the ideal circle. The determination of this deviation is carried out in the units used in the DXF file. For the determination of the accuracy of the approximation both criteria are evaluated. Then, the criterion that leads to the more accurate approximation is used.

Internally, the following default values are used for the generic parameters:

To achieve a more accurate approximation, either the value for 'min_num_points'"min_num_points""min_num_points""min_num_points""min_num_points""min_num_points" must be increased or the value for 'max_approx_error'"max_approx_error""max_approx_error""max_approx_error""max_approx_error""max_approx_error" must be decreased.

One possible way to create a suitable DXF file is to create a 3D model of the object with the CAD program AutoCAD. Ensure that the surface of the object is modelled, not only its edges. Lines that, e.g., define object edges, will not be used by HALCON, because they do not define the surface of the object. Once the modelling is completed, you can store the model in DWG format. To convert the DWG file into a DXF file that is suitable for HALCON's 3D matching, carry out the following steps:

Users of other CAD programs should ensure that the surface of the 3D model is triangulated before it is exported into the DXF file. If the CAD program is not able to carry out the triangulation, it is often possible to save the 3D model in the proprietary format of the CAD program and to convert it into a suitable DXF file by using a CAD file format converter that is able to perform the triangulation.

Note that if a 3D object model is no longer needed or should be overwritten, the memory has to be freed first by calling the operator clear_object_model_3dclear_object_model_3dClearObjectModel3dclear_object_model_3dClearObjectModel3dClearObjectModel3d.



FileNameFileNameFileNameFileNameFileNamefileName (input_control) HTupleHTupleHTupleVARIANTHtuple (string) (string) (HString) (char*) (BSTR) (char*)

Name of the DXF file

File extension: .dxf

ScaleScaleScaleScaleScalescale (input_control)  number HTupleHTupleHTupleVARIANTHtuple (string / integer / real) (string / int / long / double) (HString / Hlong / double) (char* / Hlong / double) (BSTR / Hlong / double) (char* / Hlong / double)

Scale or unit.

Default value: 'm' "m" "m" "m" "m" "m"

Suggested values: 'm'"m""m""m""m""m", 'cm'"cm""cm""cm""cm""cm", 'mm'"mm""mm""mm""mm""mm", 'microns'"microns""microns""microns""microns""microns", 'µm'"µm""µm""µm""µm""µm", 1.0, 0.01, 0.001, 1.0e-6, 0.0254, 0.3048, 0.9144

GenParamNamesGenParamNamesGenParamNamesGenParamNamesGenParamNamesgenParamNames (input_control)  string(-array) HTupleHTupleHTupleVARIANTHtuple (string) (string) (HString) (char*) (BSTR) (char*)

Names of the generic parameters that can be adjusted for the DXF input.

Default value: []

List of values: 'max_approx_error'"max_approx_error""max_approx_error""max_approx_error""max_approx_error""max_approx_error", 'min_num_points'"min_num_points""min_num_points""min_num_points""min_num_points""min_num_points"

GenParamValuesGenParamValuesGenParamValuesGenParamValuesGenParamValuesgenParamValues (input_control)  number(-array) HTupleHTupleHTupleVARIANTHtuple (real / integer / string) (double / int / long / string) (double / Hlong / HString) (double / Hlong / char*) (double / Hlong / BSTR) (double / Hlong / char*)

Values of the generic parameters that can be adjusted for the DXF input.

Default value: []

Suggested values: 0.1, 0.25, 0.5, 1, 2, 5, 10, 20

ObjectModel3DObjectModel3DObjectModel3DObjectModel3DObjectModel3DobjectModel3D (output_control)  object_model_3d HObjectModel3D, HTupleHTupleHObjectModel3D, HTupleHObjectModel3DX, VARIANTHtuple (integer) (IntPtr) (Hlong) (Hlong) (Hlong) (Hlong)

Handle of the read 3D object model.

DxfStatusDxfStatusDxfStatusDxfStatusDxfStatusdxfStatus (output_control)  string(-array) HTupleHTupleHTupleVARIANTHtuple (string) (string) (HString) (char*) (BSTR) (char*)

Status information.


read_object_model_3d_dxfread_object_model_3d_dxfReadObjectModel3dDxfread_object_model_3d_dxfReadObjectModel3dDxfReadObjectModel3dDxf returns 2 (H_MSG_TRUE) if all parameters are correct. If necessary, an exception is raised.

Possible Successors

affine_trans_object_model_3daffine_trans_object_model_3dAffineTransObjectModel3daffine_trans_object_model_3dAffineTransObjectModel3dAffineTransObjectModel3d, project_object_model_3dproject_object_model_3dProjectObjectModel3dproject_object_model_3dProjectObjectModel3dProjectObjectModel3d, clear_object_model_3dclear_object_model_3dClearObjectModel3dclear_object_model_3dClearObjectModel3dClearObjectModel3d


3D Metrology

ClassesClassesClassesClasses | | | | Operators