I run he script below and pick the points in the order mentioned in the rhino file attached.
The rectangle gets printed, but when i try to run something on it like areacentroid i get “Parameter must be a Guid or string representing a Guid”. And this is because points 2 and 3 are too close to each other.
what rs.GetRectangle returns is a .Net array of points and not a reference to a Curve object in the document. Yet that is what rs.CurveAreaCentroidis expecting.
What you can do is create a polyline from the points and get he AreaCentroid from that:
import rhinoscriptsyntax as rs
import Rhino
rectangle = rs.GetRectangle (mode=2, base_point=None, prompt1=None, prompt2=None, prompt3=None)
#make the Array a list
rect_points = list(rectangle)
#add first point as last point to get a cloded polyline
rect_points.append(rect_points[0])
#add polyine to document
polyline_id = rs.AddPolyline(rect_points)
#compute
c_point, c_vec = rs.CurveAreaCentroid(polyline_id)
#add point
rs.AddPoint(c_point)
#dispode of polyline
rs.DeleteObject(polyline_id)
#Note that you can also use geometry for calculations without adding it to the document:
polyline = Rhino.Geometry.PolylineCurve(rect_points)
c_point, c_vec = rs.CurveAreaCentroid(polyline)
#add a circle to differentiate between the point above
rs.AddCircle(c_point, 1)
#no need to delete the polyline as it is not added to the document