Skip to content

read_contour_xld_dxfread_contour_xld_dxfReadContourXldDxfReadContourXldDxfread_contour_xld_dxfread_contour_xld_dxf🔗

Short description🔗

read_contour_xld_dxfread_contour_xld_dxfReadContourXldDxfReadContourXldDxfread_contour_xld_dxfread_contour_xld_dxf — Read XLD contours from a DXF file.

Signature🔗

read_contour_xld_dxf( out xld_cont Contours, filename.read FileName, attribute.name GenParamName, attribute.value GenParamValue, out string DxfStatus )read_contour_xld_dxf( : Contours : FileName, GenParamName, GenParamValue : DxfStatus )void ReadContourXldDxf( HObject* Contours, const HTuple& FileName, const HTuple& GenParamName, const HTuple& GenParamValue, HTuple* DxfStatus )static void HOperatorSet.ReadContourXldDxf( out HObject contours, HTuple fileName, HTuple genParamName, HTuple genParamValue, out HTuple dxfStatus )def read_contour_xld_dxf( file_name: str, gen_param_name: MaybeSequence[str], gen_param_value: MaybeSequence[Union[int, str, float]] ) -> Tuple[HObject, Sequence[str]]

def read_contour_xld_dxf_s( file_name: str, gen_param_name: MaybeSequence[str], gen_param_value: MaybeSequence[Union[int, str, float]] ) -> Tuple[HObject, str]Herror read_contour_xld_dxf( Hobject* Contours, const char* FileName, const char* GenParamName, double GenParamValue, char* DxfStatus )

Herror T_read_contour_xld_dxf( Hobject* Contours, const Htuple FileName, const Htuple GenParamName, const Htuple GenParamValue, Htuple* DxfStatus )

HTuple HXLDCont::ReadContourXldDxf( const HString& FileName, const HTuple& GenParamName, const HTuple& GenParamValue )

HString HXLDCont::ReadContourXldDxf( const HString& FileName, const HString& GenParamName, double GenParamValue )

HString HXLDCont::ReadContourXldDxf( const char* FileName, const char* GenParamName, double GenParamValue )

HString HXLDCont::ReadContourXldDxf( const wchar_t* FileName, const wchar_t* GenParamName, double GenParamValue ) (Windows only)

HTuple HXLDCont.ReadContourXldDxf( string fileName, HTuple genParamName, HTuple genParamValue )

string HXLDCont.ReadContourXldDxf( string fileName, string genParamName, double genParamValue )

Description🔗

read_contour_xld_dxfReadContourXldDxf reads the contents of the DXF file FileNamefileNamefile_name (DXF version AC1009, AutoCAD Release 12) and converts them to the XLD contours Contourscontourscontours. If no absolute path is given in FileNamefileNamefile_name the DXF file is searched in the current directory of the HALCON process.

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

The operator read_contour_xld_dxfReadContourXldDxf supports the following DXF entities:

  • POLYLINE

    • 2D curves made up of line segments

    • Closed 2D curves made up of line segments

  • LWPOLYLINE

  • LINE

  • POINT

  • CIRCLE

  • ARC

  • ELLIPSE

  • SPLINE

  • BLOCK

  • INSERT

The x and y coordinates of the DXF entities are stored in the column and row coordinates, respectively, of the XLD contours Contourscontourscontours. The z coordinates of the DXF entities are ignored.

If the file has been created with the operator write_contour_xld_dxfWriteContourXldDxf, all attributes and global attributes that were originally defined for the XLD contours are read. This means that read_contour_xld_dxfReadContourXldDxf supports all the extended data written by the operator write_contour_xld_dxfWriteContourXldDxf. The reading of these attributes can be switched off by setting the generic parameter 'read_attributes'"read_attributes" to 'false'"false". Generic parameters are set by specifying the parameter name(s) in GenParamNamegenParamNamegen_param_name and the corresponding value(s) in GenParamValuegenParamValuegen_param_value.

DXF entities of the type CIRCLE, ARC, ELLIPSE, and SPLINE are approximated by XLD contours. The accuracy of this approximation can be controlled with the two generic parameters 'min_num_points'"min_num_points" and 'max_approx_error'"max_approx_error". The parameter 'min_num_points'"min_num_points" defines the minimum number of sampling points that are used for the approximation. Note that the parameter 'min_num_points'"min_num_points" always refers to the full circle or ellipse, respectively, even for ARCs or elliptical arcs, i.e., if 'min_num_points'"min_num_points" is set to 5050 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" defines the maximum deviation of the XLD contour from the ideal circle or ellipse, respectively (unit: pixel). 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:

  • 'read_attributes'"read_attributes" = 'true'"true"

  • 'min_num_points'"min_num_points" = 2020

  • 'max_approx_error'"max_approx_error" = 0.250.25

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

Execution information🔗

Execution information
  • Multithreading type: reentrant (runs in parallel with non-exclusive operators).

  • Multithreading scope: global (may be called from any thread).

  • Processed without parallelization.

Parameters🔗

Contourscontourscontours (output_object) xld_cont(-array) → objectobjectHObjectHXLDContHObjectHobject *

Read XLD contours.

FileNamefileNamefile_name (input_control) filename.read → (string)(string)HTuple (HString)HTuple (string)strHtuple (char*)

Name of the DXF file.

File extension: .dxf

GenParamNamegenParamNamegen_param_name (input_control) attribute.name(-array) → (string)(string)HTuple (HString)HTuple (string)MaybeSequence[str]Htuple (char*)

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

Default: [][]
List of values: 'max_approx_error', 'min_num_points', 'read_attributes'"max_approx_error", "min_num_points", "read_attributes"

GenParamValuegenParamValuegen_param_value (input_control) attribute.value(-array) → (real / integer / string)(real / integer / string)HTuple (double / Hlong / HString)HTuple (double / int / long / string)MaybeSequence[Union[int, str, float]]Htuple (double / Hlong / char*)

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

Default: [][]
Suggested values: 'true', 'false', 0.1, 0.25, 0.5, 1, 2, 5, 10, 20"true", "false", 0.1, 0.25, 0.5, 1, 2, 5, 10, 20

DxfStatusdxfStatusdxf_status (output_control) string(-array) → (string)(string)HTuple (HString)HTuple (string)Sequence[str]Htuple (char*)

Status information.

Result🔗

If the parameters are correct and the file could be read the operator read_contour_xld_dxfReadContourXldDxf returns the value 2 (H_MSG_TRUE). Otherwise, an exception is raised.

Combinations with other operators🔗

Combinations

Possible predecessors

write_contour_xld_dxfWriteContourXldDxf

See also

write_contour_xld_dxfWriteContourXldDxf, read_polygon_xld_dxfReadPolygonXldDxf, query_contour_attribs_xldQueryContourAttribsXld, query_contour_global_attribs_xldQueryContourGlobalAttribsXld, get_contour_attrib_xldGetContourAttribXld, get_contour_global_attrib_xldGetContourGlobalAttribXld

Module🔗

Foundation