EndPointType屬性

套用至
視覺物件:Contour, Edge, Line, LineInspector

說明
指定Line物件使用的結束點類型。

大多數情況下,結束點類型為點位(通常代表EndPointObject的PixelX及PixelY位置)。但若目前線條的EndPointObject為第2個Line物件,EndPointType屬性會用於定義第2條線上的交點,如線條中點、結束點、起始點或垂直位置。

用途

VGet  Sequence.Object.EndPointType, var
VSet  Sequence.Object.EndPointType, value
Sequence
序列名稱或表示序列名稱的字串變數
Object
物件名稱或表示物件名稱的字串變數。物件必須存在於指定序列中。
var
表示屬性值的整數變數
value
表示新屬性值的整數或運算式

數值

EndPointObject = Line、LineFinder EndPointObject = Screen, Geometric, Correlation, Blob, Edge, Polar, BoxFinder, CornerFinder, LineInspector, ArcFinder, DefectFinder, Point, Contour物件

請參閱詳細說明。

預設:2 - MidPoint

0 - Point

搭配上述物件以外的物件一起使用時,EndPointType僅可為Point類型。

預設:0 - Point

詳細說明
如上方的數值表所示,許多EndPointObject屬性僅支援EndPointType屬性的「0 - Point」。這是因為大多數EndPointObject屬性通常使用PixelX及PixelY位置作為定義線條起始或結束點的參考位置。因此當EndPointObject設為Screen、Blob、Correlation、Edge或Point時,EndPointType將永遠設為0 - Point。

EndPointType的有效數值範圍因EndPointObject而定。

當EndPointObject是另一個Line物件時,使用者需決定第2條線要與第1條線相交的位置。選項如下所示:

  • 1 - EndPoint
    • 視覺常數:VISION_ENDPNTTYPE_ENDPOINT
    • 使用其他線條的結束點作為此線條的結束點。
  • 2 - MidPoint
    • 視覺常數:VISION_ENDPNTTYPE_MIDPOINT
    • 將其他線條切成兩半,並使用其他線條的中心(或中點)作為此線條的結束點。
  • 3 - PerpToLine
    • 視覺常數:VISION_ENDPNTTYPE_PERPTOLINE
    • 計算2條線垂直相交時第2條線上的位置,並將此位置作為起結束點。
  • 4 - StartPoint
    • 視覺常數:VISION_ENDPNTTYPE_STARTPOINT
    • 使用其他線條的起始點作為此線條的結束點。
  • 5 - PerpToStartPoint
    • 視覺常數:VISION_ENDPNTTYPE_PERPTOSTARTPOINT
    • 計算第2條線上與第1條線起始點垂直相交的位置,並將此位置作為結束點。
  • 6 - PerpToMidPoint
    • 視覺常數:VISION_ENDPNTTYPE_PERPTOMIDPOINT
    • 計算第2條線上與第1條線中點垂直相交的位置,並將此位置作為結束點。
  • 7 - PerpToEndPoint
    • 視覺常數:VISION_ENDPNTTYPE_PERPTOENDPOINT
    • 計算第2條線上與第1條線結束點垂直相交的位置,並將此位置作為結束點。

若EndPointObject變更為Line物件,EndPointType會自動變更為MidPoint。

若EndPointObject變更為Screen, Geometric, Correlation, Blob, Edge, Polar, BoxFinder, CornerFinder, LineInspector, ArcFinder, DefectFinder, Point, Contour物件,EndPointType會自動變更為0 - Point。

參考
Contour物件、Edge物件、EndPointObject屬性、Line物件、LineInspector物件、StartPointType屬性