public static void ExportSurfaceObjects() { PasteSurfaces surfaceManager = new PasteSurfaces(); global::Autodesk.AutoCAD.DatabaseServices.Database db = Application.DocumentManager.MdiActiveDocument.Database; Editor ed = Application.DocumentManager.MdiActiveDocument.Editor; try { ObjectIdCollection surfaces = surfaceManager.GetAllSurfaces(); foreach (ObjectId surfaceId in surfaces) { using (Transaction trans = db.TransactionManager.StartTransaction()) { TinSurface surface = trans.GetObject(surfaceId, OpenMode.ForWrite) as TinSurface; surface.GetTriangles(true); trans.Commit(); } } } catch (Exception e) { PGA.MessengerManager.MessengerManager.LogException(e); } }
public static DBObjectCollection ExtractFaces(TinSurface surf) { var faces = new DBObjectCollection(); foreach (var triangle in surf.GetTriangles(false)) { var face = new Face(triangle.Vertex1.Location, triangle.Vertex2.Location, triangle.Vertex3.Location, true, true, true, true); faces.Add(face); } return(faces); }