ClassesClassesClassesClasses | | | | Operators

write_object_model_3dwrite_object_model_3dWriteObjectModel3dwrite_object_model_3dWriteObjectModel3dWriteObjectModel3d (Operator)

Name

write_object_model_3dwrite_object_model_3dWriteObjectModel3dwrite_object_model_3dWriteObjectModel3dWriteObjectModel3d — Writes a 3D object model to a file.

Signature

write_object_model_3d( : : ObjectModel3D, FileType, FileName, GenParamName, GenParamValue : )

Herror write_object_model_3d(const Hlong ObjectModel3D, const char* FileType, const char* FileName, const char* GenParamName, const char* GenParamValue)

Herror T_write_object_model_3d(const Htuple ObjectModel3D, const Htuple FileType, const Htuple FileName, const Htuple GenParamName, const Htuple GenParamValue)

Herror write_object_model_3d(const HTuple& ObjectModel3D, const HTuple& FileType, const HTuple& FileName, const HTuple& GenParamName, const HTuple& GenParamValue)

void HObjectModel3D::WriteObjectModel3d(const HTuple& FileType, const HTuple& FileName, const HTuple& GenParamName, const HTuple& GenParamValue) const

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

void HOperatorSetX.WriteObjectModel3d(
[in] VARIANT ObjectModel3D, [in] VARIANT FileType, [in] VARIANT FileName, [in] VARIANT GenParamName, [in] VARIANT GenParamValue)

void HObjectModel3DX.WriteObjectModel3d(
[in] BSTR FileType, [in] BSTR FileName, [in] VARIANT GenParamName, [in] VARIANT GenParamValue)

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)

Description

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"

Parallelization

Parameters

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

Handle of the 3D object model.

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

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"

FileNameFileNameFileNameFileNameFileNamefileName (input_control)  filename.write HTupleHTupleHTupleVARIANTHtuple (string) (string) (HString) (char*) (BSTR) (char*)

Name of the file that is written.

File extension: .off, .ply, .dxf, .om3, .obj, .stl

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

Names of the generic parameters.

Default value: []

List of values: 'invert_normals'"invert_normals""invert_normals""invert_normals""invert_normals""invert_normals"

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

Values of the generic parameters.

Default value: []

Suggested values: 'true'"true""true""true""true""true", 'false'"false""false""false""false""false"

Result

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.

Possible Predecessors

read_object_model_3dread_object_model_3dReadObjectModel3dread_object_model_3dReadObjectModel3dReadObjectModel3d, xyz_to_object_model_3dxyz_to_object_model_3dXyzToObjectModel3dxyz_to_object_model_3dXyzToObjectModel3dXyzToObjectModel3d

Possible Successors

read_object_model_3dread_object_model_3dReadObjectModel3dread_object_model_3dReadObjectModel3dReadObjectModel3d

See also

read_object_model_3dread_object_model_3dReadObjectModel3dread_object_model_3dReadObjectModel3dReadObjectModel3d

Module

3D Metrology


ClassesClassesClassesClasses | | | | Operators