Unable to calculate area

Hi,

I found again a polyline for which grasshopper cannot calculate area. While Rhino solves it without problems.

How can I avoid this?
Thanks!

190719 unable to calculate area.3dm (49.6 KB)

190719%20unable%20to%20calculate%20area

If I had to guess it probably has something to do with whether it’s a planar curve or not.

APF (Always Post Files) - gh

@Bogdan_Chipara - the curve is not planar within Rhino’s internal zero tolerance. So, try calculating the area using a larger tolerance. This seems to work:

import Rhino
import rhinoscriptsyntax as rs
from scriptcontext import doc

id = rs.GetObject("Select curve", rs.filter.curve)
curve = rs.coercecurve(id)
if curve.IsClosed and curve.IsPlanar(doc.ModelAbsoluteTolerance):
    area_mp = Rhino.Geometry.AreaMassProperties.Compute(curve, doc.ModelAbsoluteTolerance)
    if area_mp:
        print area_mp.Area

You can do the same from within a Python or C# component in GH.

– Dale

1 Like

Thank you @dale , it works. I also placed it in a Python component.
I’m thinking that some components such as Area or Join could use a tolerance input.

1 Like

Also, this planarity issue, i noticed it creates problems with offset crv,creating self-intersecting curves.