LoadPartFromDXF
LoadPartFromDXFOnlyOnce
Name
LoadPartFromDXF
LoadPartFromDXFOnlyOnce
When to use it
After setting the NumberOfParts property and anytime before the starting the optimization.
Prototype
LoadPartFromDXF(
LoadPartFromDXFOnlyOnce(
IndexPart: long /*[in]*/,
FileName: BSTR/*[in]*/,
RotationStep: double/*[in]*/,
RotationCenterX: double/*[in]*/,
RotationCenterY: double/*[in]*/,
AllowMirror: long/*[in]*/,
HandleOpenCurves: long /*[in]*/,
AllowFillHoles: long /*[in]*/,
Priority: long /*[in]*/,
LoadedOk: long /*[out]*/,
UserDefinedData: long /*[in]*/
);
Explanation
Load a part from a DXF file.
The number of pieces to be cut is given by the NumberOfParts property.
LoadPartFromDXF will parse each DXF file. LoadPartFromDXFOnlyOnce tries to reduce the number of parsed files. Thus, if there are multiple parts loaded from the same file, the LoadPartFromDXFOnlyOnce method will parse a DXF file once and then, for each additional piece will check if the previously loaded file has the same name. If it has the same name, the component will simply copy the shape from there instead of parsing the DXF again.
Parameters
Index - the index of the piece whose information are set. This number is in range [0...NumberOfParts - 1].
FileName - the name of the file where DXF shape is stored.
RotationStep - The step with which the piece may be rotated for a better fit. Smaller steps are better but it can take a longer time. Rotation is given in degrees (between 0 and 360).
RotationCenterX, RotationCenterY - the rotation point around which the rotation is made. This parameter is ignored if RotationType is greater than 0.
AllowFaceRotation - specify if the piece can be rotated on a different face (1 if yes, 0 if not). Not implemented yet.
HandleOpenCurves - DXF files can contain a sequence of entities which do not form a closed shape. For instance it can contain several lines which do not form a closed polygon. This parameter will tell you how to handle these cases. Possible values are:
0 - ignores open shapes,
1- close (first node is connected to the last node in the shape),
2 - returns an error in the LoadedOk parameter.
AllowFillHoles - 1 if the holes are allowed to be filled by other parts. 0 otherwise. This parameter is applied to all holes of parts loaded with this method call.
Priority - The priority for cutting a piece. 0 is the highest priority. Pieces with a higher priority are nested before pieces with a lower priority.
LoadedOk - specify if the shape was correctly loaded from file. The following values are returned (they can be combine by OR operator):
0 - ok.
1 - IndexPart out of range.
2 - Could not open file or invalid file.
4 - Not supported shape.
8 - Curve not closed ! Please check your data or DXFLinkingDistance.
16 - Components of the dxf are overlapping! No main part was found.
32 - Invalid polyshape.
UserDefinedData - an user defined data.
Warning !
Only the following entities are read from a DXF file: CIRCLE, ARC, LINE, POLYLINE and VERTEX. All other entities are ignored.
The DXF file may contain only one shape (optional with holes), otherwise the results are unpredictable. For instance if the file contains 2 distinct shapes (2 circles) it is considered as incorrect.
See also
NumberOfParts, DXFLinkingDistance, LoadMultiplePartsFromDXF, SetPart, GetPart, RotationType, SetPartVertex, SetPartArc, SetPartHole, SetPartHoleVertex.