Hi All
I have some strange behavior when working with Civil 3D surfaces via the API
I have a surface and a variety of polygons drawn inside that surface.
In the screenshots below, the yellow lines are the surface boundary.
I create myself a new surface, and then "paste" this existing surface in to end up with a copy of it.
I then draw a large box around my new surface and set it as a hide boundary so everything disappears.
I then set each of the polygons as a show boundary.
If I do this manually within Civil3D, it works as expected and the results look like the first screenshot below (surf1):
However, when I try to do the same process via the API, I am ending up with what you see in the second screenshot (surf2). Its ending up showing the whole of the surface.
Below is the relevant section of code which takes my surface and adds the hide and show boundaries to my surface.
I have checked my code and its definitely selecting the same polygons as when I do this manually, so its not some extra polygon creeping in that's causing the issue. I cant figure out what the possible cause could be.
Can anyone figure out why its doing this?
' 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