Name
write_object_model_3dwrite_object_model_3dWriteObjectModel3dwrite_object_model_3dWriteObjectModel3dWriteObjectModel3d — Writes a 3D object model to a file.
void WriteObjectModel3d(const HTuple& ObjectModel3D, const HTuple& FileType, const HTuple& FileName, const HTuple& GenParamName, const HTuple& GenParamValue)
void HObjectModel3D::WriteObjectModel3d(const HString& FileType, const HString& FileName, const HTuple& GenParamName, const HTuple& GenParamValue) const
void HObjectModel3D::WriteObjectModel3d(const HString& FileType, const HString& FileName, const HString& GenParamName, const HString& GenParamValue) const
void HObjectModel3D::WriteObjectModel3d(const char* FileType, const char* FileName, const char* GenParamName, const char* GenParamValue) const
static void HOperatorSet.WriteObjectModel3d(HTuple objectModel3D, HTuple fileType, HTuple fileName, HTuple genParamName, HTuple genParamValue)
void HObjectModel3D.WriteObjectModel3d(string fileType, string fileName, HTuple genParamName, HTuple genParamValue)
void HObjectModel3D.WriteObjectModel3d(string fileType, string fileName, string genParamName, string genParamValue)
The operator write_object_model_3dwrite_object_model_3dWriteObjectModel3dwrite_object_model_3dWriteObjectModel3dWriteObjectModel3d writes the 3D object model
ObjectModel3DObjectModel3DObjectModel3DObjectModel3DObjectModel3DobjectModel3D to the file FileNameFileNameFileNameFileNameFileNamefileName. The object model
can be read again with read_object_model_3dread_object_model_3dReadObjectModel3dread_object_model_3dReadObjectModel3dReadObjectModel3d, or can be
imported into an appropriate CAD program. Please note that primitives
may only be stored in the HALCON format 'om3'"om3""om3""om3""om3""om3". Should it be
necessary to store the primitives in another format, the operator
sample_object_model_3dsample_object_model_3dSampleObjectModel3dsample_object_model_3dSampleObjectModel3dSampleObjectModel3d has to be called beforehand. However,
this results in a transformation of the primitives into 3D points and
therefore only corresponds to an approximation of the primitives.
All coordinates are written in meters. If the file is read later using
read_object_model_3dread_object_model_3dReadObjectModel3dread_object_model_3dReadObjectModel3dReadObjectModel3d, the parameter Scale must be set to
'm'"m""m""m""m""m" to avoid scaling the data.
The parameter FileTypeFileTypeFileTypeFileTypeFileTypefileType determines the type of the file. The
following types are supported by this operator:
- 'om3'"om3""om3""om3""om3""om3":
-
HALCON format for object model 3d. Files with this format can be
read by read_object_model_3dread_object_model_3dReadObjectModel3dread_object_model_3dReadObjectModel3dReadObjectModel3d.
The default file extension for this format is 'om3'.
- 'dxf'"dxf""dxf""dxf""dxf""dxf":
-
AUTOCAD format. See read_object_model_3dread_object_model_3dReadObjectModel3dread_object_model_3dReadObjectModel3dReadObjectModel3d for details
about reading this file format.
The default file extension for this format is 'dxf'.
- 'off'"off""off""off""off""off":
-
Object File Format. This is an ASCII-based format that can hold
3D points and polygons.
The default file extension for this format is 'off'.
- 'ply'"ply""ply""ply""ply""ply":
-
Polygon File Format (also Stanford Triangle Format).
This is an ASCII-based format that can hold 3D points, point
normals, and polygons.
The default file extension for this format is 'ply'.
- 'obj'"obj""obj""obj""obj""obj":
-
OBJ file format, also Wavefront OBJ-Format. This is an
ASCII-based format that can hold 3D points, polygons, normals,
texture coordinates, materials, and other information.
The default file extension for this format is 'obj'.
- 'stl'"stl""stl""stl""stl""stl",
- 'stl_binary'"stl_binary""stl_binary""stl_binary""stl_binary""stl_binary",
- 'stl_ascii'"stl_ascii""stl_ascii""stl_ascii""stl_ascii""stl_ascii":
-
STL file format, also 'Stereolithography format',
'SurfaceTesselationLanguage ', 'StandardTriangulationLanguage', and
'StandardTesselationLanguage'.
This format stores triangles and triangle normals. However, as
triangle normals are not supported by HALCON 3D object models and
point normals (which are, for example, calculated by
surface_normals_object_model_3dsurface_normals_object_model_3dSurfaceNormalsObjectModel3dsurface_normals_object_model_3dSurfaceNormalsObjectModel3dSurfaceNormalsObjectModel3d) are not supported by the STL
format, no normals are written to file. If the 3D object model contains
polygons, they are converted to triangles before before writing them to
disc. If the file type is set to 'stl'"stl""stl""stl""stl""stl" or 'stl_binary'"stl_binary""stl_binary""stl_binary""stl_binary""stl_binary",
the binary version of STL is written while 'stl_ascii'"stl_ascii""stl_ascii""stl_ascii""stl_ascii""stl_ascii" selects
the ASCII version. The default file extension for this format is 'stl'.
A set of additional optional parameters can be set. The names and values
of the parameters are passed in GenParamNameGenParamNameGenParamNameGenParamNameGenParamNamegenParamName and
GenParamValueGenParamValueGenParamValueGenParamValueGenParamValuegenParamValue, respectively. Some of the optional parameters
can only be set for a certain file type. The following values for
GenParamNameGenParamNameGenParamNameGenParamNameGenParamNamegenParamName are possible:
- 'invert_normals'"invert_normals""invert_normals""invert_normals""invert_normals""invert_normals":
-
Invert normals and face orientation before saving the 3D object model.
If this value is set to 'true'"true""true""true""true""true", for the formats 'off'"off""off""off""off""off",
'ply'"ply""ply""ply""ply""ply", 'obj'"obj""obj""obj""obj""obj", and 'stl'"stl""stl""stl""stl""stl" the orientation of
faces (triangles and polygons) is inverted . For formats that support
point normals ('ply'"ply""ply""ply""ply""ply",'obj'"obj""obj""obj""obj""obj"), all normals are inverted
before writing them to disc. Note that for the types 'om3'"om3""om3""om3""om3""om3" and
'dxf'"dxf""dxf""dxf""dxf""dxf" the parameter has no effect.
Value list: 'true'"true""true""true""true""true", 'false'"false""false""false""false""false"
Default value: 'false'"false""false""false""false""false"
Valid for formats: 'off'"off""off""off""off""off", 'ply'"ply""ply""ply""ply""ply",
'obj'"obj""obj""obj""obj""obj", 'stl'"stl""stl""stl""stl""stl"
- Multithreading type: reentrant (runs in parallel with non-exclusive operators).
- Multithreading scope: global (may be called from any thread).
- Processed without parallelization.
Handle of the 3D object model.
Type of the file that is written.
Default value:
'om3'
"om3"
"om3"
"om3"
"om3"
"om3"
List of values: 'dxf'"dxf""dxf""dxf""dxf""dxf", 'obj'"obj""obj""obj""obj""obj", 'off'"off""off""off""off""off", 'om3'"om3""om3""om3""om3""om3", 'ply'"ply""ply""ply""ply""ply", 'stl'"stl""stl""stl""stl""stl", 'stl_ascii'"stl_ascii""stl_ascii""stl_ascii""stl_ascii""stl_ascii", 'stl_binary'"stl_binary""stl_binary""stl_binary""stl_binary""stl_binary"
Name of the file that is written.
File extension: .off, .ply, .dxf, .om3, .obj, .stl
Names of the generic parameters.
Default value: []
List of values: 'invert_normals'"invert_normals""invert_normals""invert_normals""invert_normals""invert_normals"
Values of the generic parameters.
Default value: []
Suggested values: 'true'"true""true""true""true""true", 'false'"false""false""false""false""false"
The operator write_object_model_3dwrite_object_model_3dWriteObjectModel3dwrite_object_model_3dWriteObjectModel3dWriteObjectModel3d returns the value
2 (H_MSG_TRUE) if the given parameters are correct and the file can be written.
If necessary, an exception will be raised.
read_object_model_3dread_object_model_3dReadObjectModel3dread_object_model_3dReadObjectModel3dReadObjectModel3d,
xyz_to_object_model_3dxyz_to_object_model_3dXyzToObjectModel3dxyz_to_object_model_3dXyzToObjectModel3dXyzToObjectModel3d
read_object_model_3dread_object_model_3dReadObjectModel3dread_object_model_3dReadObjectModel3dReadObjectModel3d
read_object_model_3dread_object_model_3dReadObjectModel3dread_object_model_3dReadObjectModel3dReadObjectModel3d
3D Metrology