Hi,
I’m working to a C# Grasshopper component. I need to find the center of a series of circle: the center of each individual circle and the centroid of all circles. I have found something on the forum byt don’t work:
Brep FstBrep = new Brep();
VolumeMassProperties vmp;
for (int cv = 0; cv < m_Curves.Count; cv++)
{
Brep[] brep = Brep.CreatePlanarBreps(m_Curves[cv]);
for (int br = 0; br < brep.Length; br++)
{
if(brep[br].Faces.Count < 2)
{
for (int fc = 0; fc < brep[br].Faces.Count; fc++)
{
Fasteners.Faces.Add(brep[br].Faces[fc]);
VolumeMassProperties vmpFst = VolumeMassProperties.Compute(brep[br].Faces[fc]);
Fastener fstObjects = new Fastener(vmpFst.Centroid);
fastnersArray.Add(fstObjects);
}
}
else
{
this.AddRuntimeMessage(GH_RuntimeMessageLevel.Error, string.Concat(new object[] { "Error"}));
}
}
}
vmp = VolumeMassProperties.Compute(FstBrep);
Point3d FastenersCentroid = vmp.Centroid;
Where i’m wrong?
Thanks