' Create a new surface
Dim PaveSurfaceId As ObjectId = TinSurface.Create(layerName, trianSurfaceStyleID)
' Add surface to the surfaceCollection so we can easily get to them at the end of the script when we want to delete them
surfacesCollection.Add(PaveSurfaceId)
' Open up the surface for editing
Dim PaveSurfaceObject As Autodesk.Civil.DatabaseServices.TinSurface = trans.GetObject(PaveSurfaceId, OpenMode.ForWrite)
' Paste in the original surface
PaveSurfaceObject.PasteSurface(GetSurfaceResult.ObjectId)
' The AddBoundaries function needs the boundaries passed in as an objectIDCollection, so add the boundaries to a collection, then
' add to the surface
Dim hideBoundaryCollection As ObjectIdCollection = New ObjectIdCollection
hideBoundaryCollection.Add(hideBoundary.ObjectId)
PaveSurfaceObject.BoundariesDefinition.AddBoundaries(hideBoundaryCollection, 0.1, Autodesk.Civil.SurfaceBoundaryType.Hide, True)
' Now add all the user selected polylines as "show" boundaries
For Each showBoundId As ObjectId In boundaryDict(layerName)
Dim showBoundIdColl As ObjectIdCollection = New ObjectIdCollection
showBoundIdColl.Add(showBoundId)
PaveSurfaceObject.BoundariesDefinition.AddBoundaries(showBoundIdColl, 0.1, Autodesk.Civil.SurfaceBoundaryType.Show, True)
Next