So with help from @JhoelForshav's code, I got it working the way I wanted.
Posting my code here in case others have use for it. (I found many people asking similar questions)
' Select a SketchLine in the window and run this rule to get the RefKey
Class GetSketchLineRefKey
Sub Main
Dim oDoc As PartDocument = ThisDoc.Document
Dim oSketchLine As SketchLine = oDoc.SelectSet(1)
Dim refKey() As Byte
refKey = New Byte() {}
Call oSketchLine.GetReferenceKey(refKey)
Dim strKey As String
strKey = oDoc.ReferenceKeyManager.KeyToString(refKey)
Logger.Info("Line Refkey: " & strKey)
End Sub
End Class
Then replace the RefKey Strings in rule below with the ones you receive from previous code:
Class ReconstrainSketch
Dim oDoc As PartDocument
Sub Main
oDoc = ThisDoc.Document
Dim oSketch As PlanarSketch = oDoc.ComponentDefinition.Sketches.Item("Sketch2")
'[ Enter RefKey for lines from SketchLineRefKey rule strings manually
Dim oMovingLine As SketchLine = RefKeyStringToObject("EAIAABAAAABSAAAAAAAAAIAAAAAAAAAA")
Dim oRefLine1 As SketchLine = RefKeyStringToObject("EAIAABAAAAAXAQAAAAAAAIAAAAAAAAAA")
Dim oRefLine2 As SketchLine = RefKeyStringToObject("EAIAABAAAAAwAQAAAAAAAIAAAAAAAAAA")
']
For Each oConstraint In oMovingLine.Constraints
If (oConstraint.Type = ObjectTypeEnum.kCollinearConstraintObject)
Dim oLine1 As SketchLine = oConstraint.EntityOne
Dim oLine2 As SketchLine = oConstraint.EntityTwo
If (KnuckleDistance < PlateDistance) And ((oLine1 Is oMovingLine And oLine2 Is oRefLine1) Or (oLine1 Is oRefLine1 And oLine2 Is oMovingLine)) Then
Logger.Info("Reconstraining 1")
oConstraint.Delete
oSketch.GeometricConstraints.AddCollinear(oMovingLine, oRefLine2)
Exit For
Else If (KnuckleDistance > PlateDistance) And ((oLine1 Is oMovingLine And oLine2 Is oRefLine2) Or (oLine1 Is oRefLine2 And oLine2 Is oMovingLine)) Then
Logger.Info("Reconstraining 2")
oConstraint.Delete
oSketch.GeometricConstraints.AddCollinear(oMovingLine, oRefLine1)
Exit For
End If
End If
Next
iLogicVb.UpdateWhenDone = True
End Sub
Function RefKeyStringToObject(strKey As String) As Object
Dim refKey() As Byte
refKey = New Byte() {}
Call oDoc.ReferenceKeyManager.StringToKey(strKey, refKey)
Dim obj As Object = oDoc.ReferenceKeyManager.BindKeyToObject(refKey)
Return obj
End Function
End Class
I'm not fond if the following code:
If (KnuckleDistance < PlateDistance) And ((oLine1 Is oMovingLine And oLine2 Is oRefLine1) Or (oLine1 Is oRefLine1 And oLine2 Is oMovingLine))
but I found no better way at the moment.