Hello
I wish to remove a triangle from a Mesh. The mesh is part of a TopographySurface. How do you remove a triangle from a Mesh? There isn't a function to do this?
The following code can successfully retrieve a TopographySurface's Mesh and finds the triangle I wish to remove, but there isn't any function AFAIK that can remove a triangle from a mesh. I hope there is:
public static int removeTriangle(Document doc, ref TopographySurface surface, uint triangleIndex) { Mesh mesh = null; Options op = new Options(); op.ComputeReferences = true; IEnumerator<GeometryObject> geoObjects = surface.get_Geometry(op).GetEnumerator(); while (geoObjects.MoveNext()) { GeometryObject geoObj = geoObjects.Current as GeometryObject; if (geoObj is Mesh) { mesh = geoObj as Mesh; break; } } if (mesh == null) return -1; MeshTriangle p1 = mesh.get_Triangle(triangleIndex); //mesh.removeTriangle(triangleIndex); return 1; }
As far as I know, a mesh is a read-only geometrical object in the Revit API.
You can, however, edit the topography surface and remove individual points from it.
That ought to enable you to eliminate the unwanted mesh triangle.
Cheers,
Jeremy
Hi Jeremy,
removing points from an existing TopoSurface wouldn't mean to cut holes into it.
Since TopoSurface uses some sort of convex hull, it would also affect neighboring triangles when removing shared vertices.
Best regards,
Revitalizer
P.S.: see you this Saturday 😉
Dear Revitalizer,
Yes, absolutely. And no, not at all. If you wanted to fiddle with the mesh, you would have to redefine the triangles, of course. The topography surface just manages a bunch of points, though, and triangulates them itself, doesn't it? Looking frward to seeing you Saturday!
Cheers,
Jeremy