Assembly: Cognex.VisionPro.Core (in Cognex.VisionPro.Core.dll) Version: 75.0.0.0
Parameters
- replaceSegment
- Type: Cognex.VisionPro CogGeneralContourSegmentIterator
The segment to be replaced.
- startFlags
- Type: Cognex.VisionPro CogGeneralContourVertexConstants
Flags that specify how the start point is treated with respect to the other segments in the contour shape.
- startX
- Type: System Double
X-coordinate of the start point of the segment. Ignored if startFlags includes Connected.
- startY
- Type: System Double
Y-coordinate of the start point of the segment. Ignored if startFlags includes Connected.
- endFlags
- Type: Cognex.VisionPro CogGeneralContourVertexConstants
Flags that specify how the end point is treated with respect to the other segments in the contour shape.
- endX
- Type: System Double
X-coordinate of the end point of the segment. Ignored if endFlags includes Connected.
- endY
- Type: System Double
Y-coordinate of the end point of the segment. Ignored if endFlags includes Connected.
Return Value
Type: CogGeneralContourSegmentIteratorA new iterator positioned at the new segment.
| Event Type | Reason |
|---|---|
| CogGeneralContour Changed | Fires when the segment is replaced. The following state flags may be affected: |
| Exception | Condition |
|---|---|
| CogShapeBadContourSegConnException | replaceSegment is the first segment and startFlags includes Connected or replaceSegment is the end segment and endFlags includes Connected. |
| ArgumentException | startFlags or endFlags include bits that are not defined in CogGeneralContourVertexConstants. |
| CogShapeCoordinatesMustDifferException | Points in the new segment are coincident. |
| CogIteratorInvalidIteratorException | replaceSegment is invalid and not the end iterator. |
| CogShapeBadContourChainClosureException | endFlags include Closed but startFlags do not include Connected ; or startFlags include Closed but endFlags do not include Connected. This error may also occur if the startFlags and endFlags are set properly but closing the chain would create a contour with only two segments. |
Replaces replaceSegment with a new line segment and returns a new iterator positioned at the new segment.
If replaceSegment is Nothing or if replaceSegment.IsEnd is True, ReplaceSegmentWithLineSegment(CogGeneralContourSegmentIterator, CogGeneralContourVertexConstants, Double, Double, CogGeneralContourVertexConstants, Double, Double) behaves exactly as if AddLineSegment(CogGeneralContourSegmentIterator, CogGeneralContourVertexConstants, Double, Double, CogGeneralContourVertexConstants, Double, Double) were called with NextSegment set to Nothing.
If startFlags includes Connected, then startX and startY are ignored. Similarly, if endFlags includes Connected, then endX and endY are ignored.
Note: ReplaceSegmentWithLineSegment(CogGeneralContourSegmentIterator, CogGeneralContourVertexConstants, Double, Double, CogGeneralContourVertexConstants, Double, Double) can break connections and undo closed contour chains. Any CogGeneralContourSegmentIterator positioned at the replaced segment (including replaceSegment) become invalid. Other iterators are unchanged.