Confusion on chaining "." operator to access methods/properties of objects

Confusion on chaining "." operator to access methods/properties of objects

Ethibaudeau
Advocate Advocate
168 Views
0 Replies
Message 1 of 1

Confusion on chaining "." operator to access methods/properties of objects

Ethibaudeau
Advocate
Advocate

In the below code, I am trying to create a Vector2D object representing the vector between two Point2D objects.

 

In this example, I get an error about "Member not found".

Function IsChamferMatchedToSymbol(oChamferNote As ChamferNote,
                                  oSketchedSymbol As SketchedSymbol) As Boolean

Dim oVector2D As Vector2D
oVector2D = oChamferNote.Position.VectorTo(oSketchedSymbol.Position)

In trying to figure out the above error, I tried splitting up the operations, which works properly:

Function IsChamferMatchedToSymbol(oChamferNote As ChamferNote,
                                  oSketchedSymbol As SketchedSymbol) As Boolean

Dim oChamferPoint2D As Point2D
Dim oSymbolPoint2D As Point2D
Dim oVector2D As Vector2D

oChamferPoint2D = oChamferNote.Position
oSymbolPoint2D = oSketchedSymbol.Position
oVector2D = oChamferPoint2D.VectorTo(oSymbolPoint2D)​

 

In my mind, I should be able to chain the results together from the "." operator, into a single line (line 5, 1st example). Can someone help explain why this results in an error?
@bbrownellLS4J4 

169 Views
0 Replies
Replies (0)