An iterator for polylines. The iterator allows access to polyline attributes as well as access to attributes and coordinates of individual polyline points.
Option “closed” for polyline mode. E.g. an outer or inner polygon of a part layer-section. The polygon can contain an arbitrary number of points where each point is the start of an edge vector. The last point defines an edge vector with the first point so that the polygon is always closed.
Option “open” for polyline mode. The polyline can contain an arbitrary number of points where each point (except the last point) is the start of an edge vector. The last point is the end point of the last edge vector. The polyline can be geometrically closed if the last point is equal to the first point. But nevertheless the polyline is ‘logically’ open.
Option “hatch” for polyline mode. A list of independent edge vectors where each edge has its own start and end point. Therefore the number of points is always a multiple of 2. E.g. p1Start, p1End, p2Start, p2End
Option “invalid” for polyline mode.
Iterate over the border polygons of an island.
Iterate over open polylines of a layer.
Iterate over a layer’s exposure polylines.
Iterate over a layer’s exposure polylines. The iterator will follow the intended processing order of the exposure toolpaths. This order can be controlled by setting the attribute ‘_processing_order’ in a bsPolyline or bsHatch to an ascending integer sort key.
Creates a new instance which is a copy of this iterator.
A new bsPolylineIterator object
Creating an array of all attributes which are stored in the current polyline. Each attribute has the member ‘uid’ which is the unique identifier of the attribute. The second member contains the attribute value. Its name depends on the type of the attribute (int, real). The value member name is ‘intValue’ for an integer attribute and ‘fltValue’ for a real attribute.
Array of Attributes
Queries the value of an integer attribute with the unique identifier sId. Attributes must have been declared within declareBuildAttributes. If the attribute is not available then the return value is 0.
Attribute value. If the attribute is not available then the return value is 0.
Queries the value of an integer attribute with the unique identifier sId. Attributes must have been declared within declareBuildAttributes. If the attribute is not available then the undefined value is returned.
Attribute value. If the attribute is not available then the undefined value is returned.
Queries the value of an integer attribute with the unique identifier sId. Attributes must have been declared within declareBuildAttributes. If the attribute is not available then the return value is 0.0.
Attribute value. If the attribute is not available then the return value is 0.0.
Queries the value of an integer attribute with the unique identifier sId. Attributes must have been declared within declareBuildAttributes. If the attribute is not available then the undefined value is returned.
Attribute value. If the attribute is not available then the undefined value is returned.
Get bounding box of all polylines.
Bounding box (bsBounds2D).
Queries the part index of the part where the polyline belongs to.
Part index (0 for the first part)
Queries the part sub-type of the polyline.
Sub-type of the polyline. E.g. nSubtypePart, nSubtypeSupport (see bsModel).
Links: bsModel
Queries the value of an integer point attribute with the unique identifier sId. Attributes must have been declared within declareBuildAttributes. If the attribute is not available then the return value is 0.
nPointIndex : Polyline point index
sId : Attribute unique identifier
Attribute value. If the attribute is not available then the return value is 0.
Queries the value of an integer point attribute with the unique identifier sId. Attributes must have been declared within declareBuildAttributes. If the attribute is not available then the undefined value is returned.
nPointIndex : Polyline point index
sId : Attribute unique identifier
Attribute value. If the attribute is not available then the undefined value is returned.
Queries the value of a floating point point attribute with the unique identifier sId. Attributes must have been declared within declareBuildAttributes. If the attribute is not available then the return value is 0.0.
nPointIndex : Polyline point index
sId : Attribute unique identifier
Attribute value. If the attribute is not available then the return value is 0.0.
Queries the value of a floating point point attribute with the unique identifier sId. Attributes must have been declared within declareBuildAttributes. If the attribute is not available then the undefined value is returned.
nPointIndex : Polyline point index
sId : Attribute unique identifier
Attribute value. If the attribute is not available then the undefined value is returned.
Queries the number of points of the current polyline. Points are accessed by their point index (0..n).
Number of points
Queries the mode of the current polyline (e.g.: bsPolylineIterator.nPolyClosed , bsPolylineIterator.nPolyOpen , bsPolylineIterator.nPolyHatch , bsPolylineIterator.nPolyModeInvalid).
The polyline mode (bsPolylineIterator.nPolyClosed , bsPolylineIterator.nPolyOpen , bsPolylineIterator.nPolyHatch , bsPolylineIterator.nPolyModeInvalid).
Queries x and y-coordinate of the polyline point at the given index.
Vec2 object.
Checks if current polyline is an inner loop of a layer section of the part.
true if it’s an inner loop. false if it is not an inner loop.
Checks if current polyline is the outer loop of a layer section of the part.
true if it’s an outer loop. false if it is not an outer loop.
Checks if the iterator is valid.
true if the iterator is valid. false if the iterator is invalid.
Make the iterator invalid.
Sets the iterator to the next polyline.
true if successful and iterator is still valid. false if the iterator has become invalid.
Converts the current polyline to exposure vectors.
Sets the value of an integer attribute with the unique identifier sId. Attributes must have been declared within declareBuildAttributes.
sId : Attribute unique identifier
nValue : Attribute value to set
Sets the value of a Real attribute with the unique identifier sId. Attributes must have been declared within declareBuildAttributes.
sId : Attribute unique identifier
fValue : Attribute value to set
Remove attributes with given ids
True if any attributes have been removed
Remove attributes with given ids
nPointIndex : Index of point where to remove the attributes (-1 for all points)
sId : Attribute unique identifier(s). Can be a single string (e.g. “bsid”) or an array (e.g. [“bsid1”,”bsid2”])
True if any attributes have been removed
Returns the total number of skip vectors. These are the vectors from a segment end to the start of the next segment. If the polyline is not in hatch mode then the result is always zero (see getPolylineMode()).
Total number of skip vectors.
Calculates the whole length of all skip vectors in mm. If the polyline is not in hatch mode then the result is always zero (see getPolylineMode()).
Whole length of all skip vectors.
Get the length of the polyline. Or In hatch mode the sum of the lengths of all individual segments.
Length
Sorting polylines so that the sum of all traveling distances between the polylines are reduced.
var args = {
"startPos" : {x: 0.0, y: 0.0},
"bFlip" : true
};polylines : Array of bsPolylineIterator.
args.startPos : A start block will be selected near to the given position.
args.bFlip : Allow to flip a polyline (revert the segment order) to reduce jump length (optional, default = false).