public void AddStandardBoundary(ObjectId polyId, string surfacename, Autodesk.Civil.DatabaseServices.TinSurface surface) { using (Transaction tr = CivilApplicationManager.StartTransaction()) { //1. Create new surface if no existing surface passed in // if (surface == null) // surface = m_TheSurfaceId.GetObject(OpenMode.ForRead) as Autodesk.Civil.DatabaseServices.TinSurface; //2. Store boundary ObjectIdCollection boundaryEntities = new ObjectIdCollection(); boundaryEntities = GetObjectIdCollectionFromEntity(polyId); //3. Access the BoundariesDefinition object from the surface object Autodesk.Civil.DatabaseServices.SurfaceDefinitionBoundaries surfaceBoundaries = surface.BoundariesDefinition; //4. now add the boundary to the surface surfaceBoundaries.AddBoundaries(boundaryEntities, 1.0, SurfaceBoundaryType.Hide, true); tr.Commit(); //surface = trans.GetObject(surfaceId, OpenMode.ForWrite) as C3DLandDb.TinSurface; //// Add the selected polyline's ObjectId to a collection //ObjectIdCollection boundaryEntities = new ObjectIdCollection(); //boundaryEntities.Add(plineId); } }
public void AddStandardInnerBoundary(ObjectId polyId, string layername) { try { using (Transaction tr = CivilApplicationManager.StartTransaction()) { //1. Create new surface if no existing surface passed in C3DLandDb.TinSurface surface = m_TheSurfaceId.GetObject(OpenMode.ForRead) as C3DLandDb.TinSurface; if (surface == null) { surface = m_TheSurfaceId.GetObject(OpenMode.ForRead) as C3DLandDb.TinSurface; } //2. Store boundary ObjectIdCollection boundaryEntities = new ObjectIdCollection(); boundaryEntities = GetObjectIdCollectionFromEntity(polyId); //3. Access the BoundariesDefinition object from the surface object C3DLandDb.SurfaceDefinitionBoundaries surfaceBoundaries = surface.BoundariesDefinition; //4. now add the boundary to the surface var sbo = surfaceBoundaries.AddBoundaries(boundaryEntities, 1.0, SurfaceBoundaryType.Hide, true); sbo.Name = layername + "-" + DateTime.Now.Millisecond; tr.Commit(); } } catch (System.Exception e) { PGA.MessengerManager.MessengerManager.LogException(e); } }
public void AddStandardInnerBoundary(ObjectId polyId, string surfacename) { try { using (Transaction tr = CivilApplicationManager.StartTransaction()) { try { //1. Create new surface if no existing surface passed in C3DLandDb.TinSurface surface = m_TheSurfaceId.GetObject(OpenMode.ForRead) as C3DLandDb.TinSurface; if (surface == null) { surface = m_TheSurfaceId.GetObject(OpenMode.ForRead) as C3DLandDb.TinSurface; } //2. Store boundary ObjectIdCollection boundaryEntities = new ObjectIdCollection(); boundaryEntities = GetObjectIdCollectionFromEntity(polyId); //3. Access the BoundariesDefinition object from the surface object C3DLandDb.SurfaceDefinitionBoundaries surfaceBoundaries = surface.BoundariesDefinition; //4. now add the boundary to the surface try { surfaceBoundaries.AddBoundaries(boundaryEntities, 1.0, SurfaceBoundaryType.Hide, true); } catch (Exception ex) { PGA.Civil.Logging.ACADLogging.LogMyExceptions(string.Format ("AddStandardInnerBoundary: {0}:{1}", polyId, ex.Message)); } } catch (Exception ex) { PGA.Civil.Logging.ACADLogging.LogMyExceptions(string.Format("AddStandardInnerBoundary: {0}:{1}", surfacename, ex.Message)); } tr.Commit(); } } catch (System.Exception e) { PGA.Civil.Logging.ACADLogging.LogMyExceptions("AddStandardInnerBoundary: " + e.Message); } }
public void AddStandardBoundary(ObjectId polyId, string surfacename) { try { using (Transaction tr = CivilApplicationManager.StartTransaction()) { //1. Create new surface if no existing surface passed in C3DLandDb.TinSurface surface = m_TheSurfaceId.GetObject(OpenMode.ForRead) as C3DLandDb.TinSurface; if (surface == null) { surface = m_TheSurfaceId.GetObject(OpenMode.ForRead) as C3DLandDb.TinSurface; } //2. Store boundary ObjectIdCollection boundaryEntities = new ObjectIdCollection(); boundaryEntities = GetObjectIdCollectionFromEntity(polyId); //3. Access the BoundariesDefinition object from the surface object C3DLandDb.SurfaceDefinitionBoundaries surfaceBoundaries = surface.BoundariesDefinition; //4. now add the boundary to the surface surfaceBoundaries.AddBoundaries(boundaryEntities, 1.0, SurfaceBoundaryType.Outer, true); tr.Commit(); //surface = trans.GetObject(surfaceId, OpenMode.ForWrite) as C3DLandDb.TinSurface; //// Add the selected polyline's ObjectId to a collection //ObjectIdCollection boundaryEntities = new ObjectIdCollection(); //boundaryEntities.Add(plineId); } } catch (System.Exception e) { PGA.MessengerManager.MessengerManager.LogException(e); } }