Surface smoothing adds points at system-determined elevations using Natural Neighbor Interpolation (NNI) or Kriging methods, which results in smoothed contours with no overlapping. See the AutoCAD Civil 3D User’s Guide for more information about the two supported smoothing methods.
TinSurface objects expose these two smoothing operations with the SmoothSurfaceByNNI() and SmoothSurfaceByKriging() methods.
Setting up a smoothing operation takes a couple of steps:
This example illustrates setting up and using the SmoothSurfaceByNNI() method, using the Centroids output location:
[CommandMethod("SmoothTinSurface")] public void SmoothTinSurface() { using (Transaction ts = Application.DocumentManager.MdiActiveDocument.Database.TransactionManager.StartTransaction()) { try { // Select a TIN Surface: ObjectId surfaceId = promptForEntity("Select a TIN surface to smooth\n", typeof(TinSurface)); TinSurface oSurface = surfaceId.GetObject(OpenMode.ForWrite) as TinSurface; // Select a polyline to define the output region: ObjectId polylineId = promptForEntity("Select a polyline to define the output region\n", typeof(Polyline)); Point3dCollection points = new Point3dCollection(); Polyline polyline = polylineId.GetObject(OpenMode.ForRead) as Polyline; // Convert the polyline into a collection of points: int count = polyline.NumberOfVertices; for (int i = 0; i < count; i++) { points.Add(polyline.GetPoint3dAt(i)); } // Set the options: SurfacePointOutputOptions output = new SurfacePointOutputOptions(); output.OutputLocations = SurfacePointOutputLocationsType.Centroids; output.OutputRegions = new Point3dCollection[] { points }; SurfaceOperationSmooth op = oSurface.SmoothSurfaceByNNI(output); editor.WriteMessage("Output Points: {0}\n", op.OutPutPoints.Count); // Commit the transaction ts.Commit(); } catch (System.Exception e) { editor.WriteMessage(e.Message); } } }