read_polygon_xld_dxfread_polygon_xld_dxfReadPolygonXldDxfReadPolygonXldDxfread_polygon_xld_dxf (算子)
名称
read_polygon_xld_dxfread_polygon_xld_dxfReadPolygonXldDxfReadPolygonXldDxfread_polygon_xld_dxf — 从 DXF 文件读取 XLD 多边形。
签名
void ReadPolygonXldDxf(HObject* Polygons, const HTuple& FileName, const HTuple& GenParamName, const HTuple& GenParamValue, HTuple* DxfStatus)
HTuple HXLDPoly::ReadPolygonXldDxf(const HString& FileName, const HTuple& GenParamName, const HTuple& GenParamValue)
HString HXLDPoly::ReadPolygonXldDxf(const HString& FileName, const HString& GenParamName, double GenParamValue)
HString HXLDPoly::ReadPolygonXldDxf(const char* FileName, const char* GenParamName, double GenParamValue)
HString HXLDPoly::ReadPolygonXldDxf(const wchar_t* FileName, const wchar_t* GenParamName, double GenParamValue)
(
Windows only)
def read_polygon_xld_dxf(file_name: str, gen_param_name: MaybeSequence[str], gen_param_value: MaybeSequence[Union[int, str, float]]) -> Tuple[HObject, Sequence[str]]
def read_polygon_xld_dxf_s(file_name: str, gen_param_name: MaybeSequence[str], gen_param_value: MaybeSequence[Union[int, str, float]]) -> Tuple[HObject, str]
描述
read_polygon_xld_dxfread_polygon_xld_dxfReadPolygonXldDxfReadPolygonXldDxfReadPolygonXldDxfread_polygon_xld_dxf reads the contents of the DXF file
FileNameFileNameFileNameFileNamefileNamefile_name (DXF version AC1009, AutoCAD Release 12) and
converts them to the XLD polygons PolygonsPolygonsPolygonsPolygonspolygonspolygons.
If no absolute path is given in FileNameFileNameFileNameFileNamefileNamefile_name the DXF file
is searched in the current directory of the HALCON process.
The output parameter DxfStatusDxfStatusDxfStatusDxfStatusdxfStatusdxf_status contains information about
the number of polygons that were read and, if necessary,
warnings that parts of the DXF file could not be interpreted.
算子 read_polygon_xld_dxfread_polygon_xld_dxfReadPolygonXldDxfReadPolygonXldDxfReadPolygonXldDxfread_polygon_xld_dxf supports the following
DXF entities:
-
POLYLINE
-
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 polygons
PolygonsPolygonsPolygonsPolygonspolygonspolygons. The z coordinates of the DXF entities are
ignored.
DXF entities of the type CIRCLE, ARC, ELLIPSE, and SPLINE
are approximated by XLD polygons. 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"
(for SPLINE only 'max_approx_error'"max_approx_error""max_approx_error""max_approx_error""max_approx_error""max_approx_error").
Generic parameters are set by specifying the parameter name(s) in
GenParamNameGenParamNameGenParamNameGenParamNamegenParamNamegen_param_name and the corresponding value(s) in
GenParamValueGenParamValueGenParamValueGenParamValuegenParamValuegen_param_value.
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.
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 or ellipse, respectively, even for ARCs or elliptical
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 polygon 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:
-
'min_num_points'"min_num_points""min_num_points""min_num_points""min_num_points""min_num_points" = 20
-
'max_approx_error'"max_approx_error""max_approx_error""max_approx_error""max_approx_error""max_approx_error" = 0.25
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.
Note that reading a DXF file with read_polygon_xld_dxfread_polygon_xld_dxfReadPolygonXldDxfReadPolygonXldDxfReadPolygonXldDxfread_polygon_xld_dxf results
in exactly the same geometric information as reading the file with
read_contour_xld_dxfread_contour_xld_dxfReadContourXldDxfReadContourXldDxfReadContourXldDxfread_contour_xld_dxf。However, the resulting data structure is
different.
执行信息
- 多线程类型:可重入(与非独占算子并行运行)。
- 多线程作用域:全局(可从任何线程调用)。
- 未采用并行化处理。
参数
PolygonsPolygonsPolygonsPolygonspolygonspolygons (输出对象) xld_poly(-array) → objectHXLDPolyHObjectHXLDPolyHobject *
Read XLD polygons.
FileNameFileNameFileNameFileNamefileNamefile_name (输入控制) filename.read → HTuplestrHTupleHtuple (string) (string) (HString) (char*)
Name of the DXF file.
File extension:
.dxf
GenParamNameGenParamNameGenParamNameGenParamNamegenParamNamegen_param_name (输入控制) attribute.name(-array) → HTupleMaybeSequence[str]HTupleHtuple (string) (string) (HString) (char*)
Names of the generic parameters that can be
adjusted for the DXF input.
默认值:
[]
值列表:
'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"
GenParamValueGenParamValueGenParamValueGenParamValuegenParamValuegen_param_value (输入控制) attribute.value(-array) → HTupleMaybeSequence[Union[int, str, float]]HTupleHtuple (real / integer / string) (double / int / long / string) (double / Hlong / HString) (double / Hlong / char*)
Values of the generic parameters that can be
adjusted for the DXF input.
默认值:
[]
建议值:
0.1, 0.25, 0.5, 1, 2, 5, 10, 20
DxfStatusDxfStatusDxfStatusDxfStatusdxfStatusdxf_status (输出控制) string(-array) → HTupleSequence[str]HTupleHtuple (string) (string) (HString) (char*)
Status information.
结果
If the parameters are correct and the file could be read the
operator read_polygon_xld_dxfread_polygon_xld_dxfReadPolygonXldDxfReadPolygonXldDxfReadPolygonXldDxfread_polygon_xld_dxf 返回值 2 ( H_MSG_TRUE )。否则,将抛出异常。
可能的前趋
write_polygon_xld_dxfwrite_polygon_xld_dxfWritePolygonXldDxfWritePolygonXldDxfWritePolygonXldDxfwrite_polygon_xld_dxf
另见
write_polygon_xld_dxfwrite_polygon_xld_dxfWritePolygonXldDxfWritePolygonXldDxfWritePolygonXldDxfwrite_polygon_xld_dxf,
read_contour_xld_dxfread_contour_xld_dxfReadContourXldDxfReadContourXldDxfReadContourXldDxfread_contour_xld_dxf
模块
基础