how can I delete an ngon in a mesh?
The command DeleteMeshFaces allows to select a ngon, but don’t delete it.
The command DeleteMeshNgons removes all the ngons from the mesh datastructure.
can you post an example mesh ?
I`ve tried to import two testmeshes containing only ngons but Rhino6 cannot handle them. Rhino5 imports them fine but converts the ngons to triangles.
Eamples_Ngon.zip (980 Bytes)
Thanks for the answer.
Attached you can find a mesh with ngons, quads and triangles.
If I try to delete triangles by the command _DeleteMeshFaces, Rhino answers: “Unable to delete any mesh faces”.
The same happens with a lot of quad, while if I try to delete an ngon by _DeleteMeshFaces, I can select the ngon, but the ngon is not deleted.
The mesh is build with a python script similar to the attached file and I’m using Rhino WIP (6.0.15341.15281, 07/12/2015).
gNgonSample.3dm (3.4 MB)AddmeshNgon.py (1.3 KB)
i do get the same problems using
_DeleteMeshFaces as soon as ngons are involved. Even tried to delete the faces which made up an ngon using python but this creates an invalid mesh for some reason. Getting the face or ngon index seems to be tricky, i get an index but do not know how to determine if it comes from an ngon or face. If i use
go = Rhino.Input.Custom.GetObject() go.GeometryFilter = Rhino.DocObjects.ObjectType.MeshFace
I get the ngon in the selection as during
_DeleteMeshFaces command. From this i get
GeometryComponentIndex of the picked ngon or face. Either i´m missing something or there is no way yet to prevent the picker from picking the ngon if there is one. So i do not know how to determine if the returned ComponentIndexType points to the correct selection, it always gives 15 which is
Below is one python example which deletes an ngon once. If i try to delete another ngon after the first one got deleted, i get strange things happen. eg. it deletes faces unexpected. I´ve found that if i run the command
_NgonulateMesh right after running the script, this error does not happen. This only was tested on the example soccerball below. So i asume meshes with ngons may not be properly handled yet.
The Rhino file has a mesh with (only) 32 ngons. Could you try to run the script on it to repeat it ?
In my opinion, the faces indices of each ngon is not updated, when you delete a ngon and the relevant faces.
Probably. I´ve tried to remove the ngon after or before removing the faces. But the mesh is invalid. I was expecting that
mesh.Compact() takes care of updating the face indices of the ngons automatically. but it obviously does not…