Grasshopper

algorithmic modeling for Rhino

Hi Everyone,

Quick question.

I can't find the method for getting a centroid from a Brep in C#?

Any help is appreciated.

-Andrei

Views: 3389

Replies to This Discussion

I think you need to create a VolumeMassProperies Class from the Brep.

You should be able to get the centroid from that.

http://4.rhino3d.com/5/rhinocommon/html/T_Rhino_Geometry_VolumeMass...

Hi Mat,

Thanks for quick reply!

Took me a while to figure this out- I kept on referencing a null overload for Centroid. Is it because it's a property and not a method?

P.S.

Here's a reference for rookies like me:

private void RunScript(Brep brep, ref object A)
{

VolumeMassProperties vmp = VolumeMassProperties.Compute(brep);
Point3d pt = vmp.Centroid;
A = pt;

}

Correct. As 'Centroid' is a property of the VolumeMassProperties Object and doesn't require any parameters it is accessed using the dot notation you've shown above.

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service