Author Topic: Strange Civil 3D API behaviour working with surfaces  (Read 1450 times)

0 Members and 1 Guest are viewing this topic.

jh_dempsey

  • Mosquito
  • Posts: 11
Strange Civil 3D API behaviour working with surfaces
« on: December 20, 2017, 01:40:05 PM »
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?

Code - vb.net: [Select]
  1. ' Create a new surface
  2.                 Dim PaveSurfaceId As ObjectId = TinSurface.Create(layerName, trianSurfaceStyleID)
  3.  
  4.                 ' Add surface to the surfaceCollection so we can easily get to them at the end of the script when we want to delete them
  5.                 surfacesCollection.Add(PaveSurfaceId)
  6.  
  7.                 ' Open up the surface for editing
  8.                 Dim PaveSurfaceObject As Autodesk.Civil.DatabaseServices.TinSurface = trans.GetObject(PaveSurfaceId, OpenMode.ForWrite)
  9.  
  10.                 ' Paste in the original surface
  11.                 PaveSurfaceObject.PasteSurface(GetSurfaceResult.ObjectId)
  12.  
  13.                 ' The AddBoundaries function needs the boundaries passed in as an objectIDCollection, so add the boundaries to a collection, then
  14.                 ' add to the surface
  15.                 Dim hideBoundaryCollection As ObjectIdCollection = New ObjectIdCollection
  16.                 hideBoundaryCollection.Add(hideBoundary.ObjectId)
  17.                 PaveSurfaceObject.BoundariesDefinition.AddBoundaries(hideBoundaryCollection, 0.1, Autodesk.Civil.SurfaceBoundaryType.Hide, True)
  18.  
  19.                 ' Now add all the user selected polylines as "show" boundaries
  20.                
  21.                 For Each showBoundId As ObjectId In boundaryDict(layerName)
  22.  
  23.                     Dim showBoundIdColl As ObjectIdCollection = New ObjectIdCollection
  24.                     showBoundIdColl.Add(showBoundId)
  25.                     PaveSurfaceObject.BoundariesDefinition.AddBoundaries(showBoundIdColl, 0.1, Autodesk.Civil.SurfaceBoundaryType.Show, True)
  26.  
  27.                 Next
  28.                
  29.                
« Last Edit: December 20, 2017, 01:43:39 PM by jh_dempsey »

huiz

  • Swamp Rat
  • Posts: 913
  • Certified Prof C3D
Re: Strange Civil 3D API behaviour working with surfaces
« Reply #1 on: December 20, 2017, 02:45:35 PM »
If you check the build properties of the Surface, is there a difference with the manual created Surface?
The conclusion is justified that the initialization of the development of critical subsystem optimizes the probability of success to the development of the technical behavior over a given period.