Hello! I am working with a mesh on grasshopper that was imported from rhino. I was wondering if I can extrude the center of the mesh faces to creating pyramids without using the weaverbird extension. Thanks!
In case that you are familiar with coding (shown C#) is rather elementary:
public List<Mesh> pyramids;
public Mesh pyramid;
public void GetFacePyramids(List<Mesh> meshList, double d){
pyramids = new List<Mesh>();
for(int m = 0; m < meshList.Count;m++){
pyramid = new Mesh();
Mesh M = meshList[m];
M.Vertices.CombineIdentical(true, true);
M.UnifyNormals();
M.FaceNormals.ComputeFaceNormals();
var MTV = M.TopologyVertices;
var MF = M.Faces;
var MFN = M.FaceNormals;
for(int i = 0; i < MF.Count;i++){
Vector3d faceNormal = (Vector3d) MFN[i] * d;
Point3d center = MF.GetFaceCenter(i) + faceNormal;
int[] adjV = MF.GetTopologicalVertices(i);
for(int j = 0; j < adjV.Length;j++){
Point3d p1 = MTV[adjV[j]];
Point3d p2 = MTV[adjV[(j + 1) % adjV.Length]];
UpdatePyramidMesh(new Point3d[3]{p1,p2,center});
}
}
pyramid.Vertices.CombineIdentical(true, true);
pyramids.Add(pyramid);
}
}
public void UpdatePyramidMesh(Point3d[] v){
Mesh m = new Mesh();
m.Vertices.AddVertices(v);
m.Faces.AddFace(0, 1, 2);
pyramid.Append(m);
}
I assume that it can been done via components as well (not my game)
Thank you, but I’m not sure this is what I was looking for. I am working with components.
It is … but without components. I’m sure that some other good Samaritan who … blah, blah.
On the other hand - general case - one should check “self Ccx events”. That’s another animal.
“extrude to point” component