after two days of trial and error, and exploring wast, undocumented namespaces, this may by almost finished!
here is the code that will check if .NET area is correct. If it is - use curve.area to read, if not, use COM. However, do not use COM in overrules! In that case you can't tell area.
The way to go would be to try to see if GECURVE can bring some area.
Here is the code to check if .NET API is good for read. I HAVE NOT TESTED THIS ALL TROUGH!
Public Shared Function isAreaOK(testcurve As Curve) As Boolean
'if curve intersect with itself, including imaginary start to end line, then its reporterd area is wrong
If testcurve.GetRXClass.IsDerivedFrom(xlineType) Then Return False
Dim selfintersection As Integer = 0
Dim cge As Curve3d = testcurve.GetGeCurve
Dim ci As New CurveCurveIntersector3d(cge, cge, testcurve.GetPlane.Normal)
selfintersection = ci.NumberOfIntersectionPoints
Dim overlapcnt As Integer = ci.OverlapCount
Dim startendintersections As Integer = 2
If testcurve.StartPoint <> testcurve.EndPoint Then
Dim cconect As New Line(testcurve.StartPoint, testcurve.EndPoint)
Dim cgconnect As Curve3d = cconect.GetGeCurve
Dim cstartend As New CurveCurveIntersector3d(cge, cgconnect, testcurve.GetPlane.Normal)
startendintersections = cstartend.NumberOfIntersectionPoints
cconect.Dispose()
cgconnect.Dispose()
cstartend.Dispose()
End If
cge.Dispose()
ci.Dispose()
'sits on itself partialy
If overlapcnt > 0 Then Return False
If startendintersections = 2 Or startendintersections = 0 Then
'0 = single line, single vertice
'2 = non self-intersecting polyline with 2 or more vertices, and imaginary line connects startpoint and endpoint
If selfintersection = 0 Then Return True
End If
Return False
End Function
concerns:
-disposing?
-is startpoint=endpoint comparing doubles? if so, this may also be unpredictable test
-3d?
EDIT: sorry, I had declared xline somewhere else Public Shared xlineType = RXClass.GetClass(GetType(Xline))