public static void AddStandardBoundary(ObjectId polyId, string surfacename, Autodesk.Civil.DatabaseServices.TinSurface surface) { Polyline poly = null; try { using (Transaction tr = CivilApplicationManager.StartTransaction()) { poly = polyId.GetObject(OpenMode.ForRead) as Polyline; var points = AcadUtilities.GetPointsFromPolyline(poly); Autodesk.Civil.DatabaseServices.SurfaceDefinitionBoundaries surfaceBoundaries = surface.BoundariesDefinition; if (points.Count == 0) { //throw new ArgumentException( // String.Format("Len={0} Nodes={1} Layer={2} Oid={3}", // poly.Length.ToString(), // poly.NumberOfVertices.ToString(), // poly.Layer.ToString(), // poly.ObjectId.ToString()), "AddStandardBoundary"); } else { surfaceBoundaries.AddBoundaries(points, 1.0, SurfaceBoundaryType.Hide, true); } tr.Commit(); } } catch { } }
public static ObjectIdCollection GetAllInternalPolyLines(ObjectId oid, ObjectIdCollection oids) { var objectIdCollection = new ObjectIdCollection(); var num = 0.1; try { using (var workingDatabase = WorkingDatabase) { foreach (ObjectId oid1 in oids) { Polyline polyFromObjId1; Polyline polyFromObjId2; try { if ( !(GetPolyFromObjId(oid1) == null)) { polyFromObjId1 = GetPolyFromObjId(oid, workingDatabase); polyFromObjId2 = GetPolyFromObjId(oid1, workingDatabase); if (polyFromObjId1 == null || polyFromObjId2 == null) { continue; } } else { continue; } } catch (NullReferenceException ex) { PGA.MessengerManager.MessengerManager.LogException(ex); continue; } if (Math.Abs(polyFromObjId1.Area - polyFromObjId2.Area) >= num) { var pointsFromPolyline = AcadUtilities.GetPointsFromPolyline(polyFromObjId2); if ( PointInPolyline(AcadUtilities.GetPointsFromPolyline(polyFromObjId1), pointsFromPolyline) && oid1.IsValid) { objectIdCollection.Add(oid1); } } } if ((uint)objectIdCollection.Count > 0U) { return(objectIdCollection); } } } catch (NullReferenceException ex) { PGA.MessengerManager.MessengerManager.LogException(ex); } catch (Exception ex) { PGA.MessengerManager.MessengerManager.LogException(ex); } return(null); }