CurveAreaCentroid error

rhinoscript

#1

In the attached file which has one closed planar curve, if I use the Rhino command _AreaCentroid, it gives a correct result, but if in RhinoScript I use the CurveAreaCentroid function, it returns 0,0,0 which is wrong.

areacentroid_error.3dm (34.7 KB)

Rhino version (6.3.18064.23201, 5/03/2018)


#2

In Python/RhinoCommon/rhinoscriptsyntax this does appear to be returning the correct value:

import rhinoscriptsyntax as rs
objID=rs.GetObject("Select curve",4,preselect=True)
if objID:
    cent=rs.CurveAreaCentroid(objID)
    #returns (centroid, error)
    if cent: rs.AddPoint(cent[0])

Which returns the same point as the Rhino command CurvAreaCentroid.

In VB Rhinoscript, it does look like it’s buggy - returning 0,0,0… @dale ?


(Dale Fugier) #3

Hi @gavinmetzler, @Helvetosaur:

Yes, I see this - thanks for reporting.

https://mcneel.myjetbrains.com/youtrack/issue/RH-44692

– Dale