LoadStockFromDXF
LoadStockFromDXFOnlyOnce
Name
LoadStockFromDXF
LoadStockFromDXFOnlyOnce
When to use it
After setting the NumberOfStockPieces property and anytime before the OnFinish event ends.
Prototype
LoadStockFromDXF(
LoadStockFromDXFOnlyOnce(
Index: long/*[in]*/,
FileName: BSTR/*[in]*/,
TrimMargin: double/*[in]*/,
TrimHolesMargin: double/*[in]*/,
HandleOpenCurves: long /*[in]*/,
ExternalID: long/*[in]*/,
Priority: long/*[in]*/,
LoadedOk: long /*[out]*/
);
Explanation
With this method you may set the information about of each piece from Stock.
The number of stock pieces to be cut is given by the NumberOfStockPieces property.
The dimensions of each piece can be get using the GetStock method.
LoadStockFromDXF will parse each DXF file. LoadStockFromDXFOnlyOnce tries to reduce the number of parsed files. Thus, if there are multiple pieces loaded from the same file, the LoadStockFromDXFOnlyOnce 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...NumberOfStockPieces - 1].
FileName: DXF file from where the shapes are loaded.
TrimMargin: margin of sheet that must be avoided due to faults - not implemented yet.
TrimHolesMargin: margin of holes that must be avoided due to faults - 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.
ExternalID - an user defined value which can help you to track down the piece during the OnFinish event. This value will be returned by the GetStock and GetUtilizedStock methods.
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.
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
NumberOfStockPieces, DXFLinkingDistance, SetStock, GetStock, SetStockHole.