Rhino.SurfaceAreaCentroid is screwy

AreaCentroidIssue.3dm (119.1 KB)


Hi @Asterisk,

The Rhino.SurfaceAreaCentroid works on surfaces and polysurfaces. From our image, I can see your object is an instance object (e.g. block). Thus, for this to work in RhinoScript, you’ll need to explode the block, calculate the centroid, and then delete the results of explode.

Make sense?

– Dale

It does and it doesn’t, 'cause AreaCentroid gives the correct point without exploding anything.

The AreaCentroid command is designed to work with instances. The Rhino.SurfaceAreaCentroid is not…

– Dale

Last question. Clicking surface edge (in a block) when running Rhino.GetPoint (four commas True), ID of what object Rhino.GetPoint ()(1) would spit out? 'Cause I get some random ID name that’s not any object ID.

I see, every time I go into EditBlock mode R6 assigns new ID to the object in a block.

Is there a way to check if object belongs to a block? In other words is there a method similar to ObjectGroups like ObjectBlockID?

Hi @Asterisk,

In this case, the id is that of one of the instances underlying definition geometry. A way to check is to make a copy of the instance then run GetPoint picking in the same basic location. You’ll see the ids are the same.

As far as querying if an object is instance definition geometry, use IsBlockObject. However, I don’t know if this works when in block editing mode.

– Dale

So, Rhino.CopyObject will copy the geometry by block base point into 0,0,0 (not in place) when fed block object ID derived from Rhino.GetPoint()(1). Which renders this useless as desirable outcome needs to be a copy in-place - right over the block geometry. I’m using Rhino.PointPick to select the block itself and just run Rhino.Command “AreaCentroid” afterwards. Not optimal, but works for now.