Hi all,
I was playing around again with the ngons and got stuck.
I want to divide an existin ngon mesh into meshborder and interior
Probably there are way more elegant/easy/fast solutions.
Now I am copying all vertices and all faces to the new mesh and then I create the ngons I want.
How can I avoid to copy those both lists completly?
Code:
private void RunScript(Mesh mesh, object y, ref object A)
{
Mesh m = new Mesh();
for (int i = 0; i < mesh.Vertices.Count; i++)
{
m.Vertices.Add(mesh.Vertices[i]);
}
for (int i = 0; i < mesh.Faces.Count; i++)
{
m.Faces.AddFace(mesh.Faces[i]);
}
var ngons = new List<int>();
for (int i = 0; i < mesh.Faces.Count; i++)
if(mesh.Faces.HasNakedEdges(i))//get all border triangles
if(!ngons.Contains(mesh.Ngons.NgonIndexFromFaceIndex(i)))
ngons.Add(mesh.Ngons.NgonIndexFromFaceIndex(i));//get the ngons they belong to
for (int i = 0; i < ngons.Count; i++)
{
m.Ngons.AddNgon(mesh.Ngons[ngons[i]]);
}
A = m;
Thanks everybody for taking the time and looking into it!
Have a nice start in the week everyone!
File:20201121_NgonCopy.gh (35.1 KB)