/// <summary> /// Gets boundary curve list of the room. /// </summary> /// <param name="room"></param> /// <param name="opt"></param> /// <returns></returns> public static CurveLoop GetRoomProfile(this SpatialElement room, Option opt = null) { if (room is null) { throw new ArgumentNullException(nameof(room)); } if (opt == null) { opt = new Option { SpatialElementBoundaryLocation = Finish } } ; var segs = room.GetBoundarySegments(opt).SelectMany(s => s); var result = segs.Select(s => s.GetCurve()).ToCurveLoop(); if (result.IsOpen()) { throw new InvalidDataException("The profile isn't closed!"); } return(result); }
private List <DB.BoundarySegment> GetBoundarySegment() { List <DB.BoundarySegment> output = new List <DB.BoundarySegment>(); DB.SpatialElementBoundaryOptions opt = new DB.SpatialElementBoundaryOptions(); foreach (List <DB.BoundarySegment> segments in InternalSpace.GetBoundarySegments(opt)) { foreach (DB.BoundarySegment segment in segments) { output.Add(segment); } } return(output.Distinct().ToList()); }
/// <summary> /// Gets boundary wall list of the room. /// </summary> /// <param name="room"></param> /// <param name="doc"></param> /// <param name="opt"></param> /// <returns></returns> public static List <Wall> GetBoundaryWallList(this SpatialElement room, Document doc, Option opt = null) { if (room is null) { throw new ArgumentNullException(nameof(room)); } if (doc is null) { throw new ArgumentNullException(nameof(doc)); } var results = new List <Wall>(); if (opt == null) { opt = new Option { SpatialElementBoundaryLocation = Finish } } ; var segments = room.GetBoundarySegments(opt).SelectMany(s => s); foreach (var segment in segments) { // It's invalid! if (segment.ElementId.IntegerValue == -1) { continue; } // Because base room boundary to do, so one wall maybe be picked up some times. if (results.FirstOrDefault(f => f.Id == segment.ElementId) != null) { continue; } if (doc.GetElement(segment.ElementId) is Wall wall) { results.Add(wall); } } return(results); } }
private IEnumerable <IEnumerable <Autodesk.DesignScript.Geometry.Curve> > GetBoundaries(Autodesk.Revit.DB.SpatialElementBoundaryLocation position) { var options = new Autodesk.Revit.DB.SpatialElementBoundaryOptions() { SpatialElementBoundaryLocation = position, StoreFreeBoundaryFaces = true }; var boundaries = new List <List <Autodesk.DesignScript.Geometry.Curve> >(); foreach (var segments in this.InternalRevitElement.GetBoundarySegments(options)) { var boundary = new List <Autodesk.DesignScript.Geometry.Curve>(); foreach (Autodesk.Revit.DB.BoundarySegment segment in segments) { boundary.Add(segment.GetCurve().ToProtoType()); } boundaries.Add(boundary); } return(boundaries); }
private List<DB.BoundarySegment> GetBoundarySegment() { List<DB.BoundarySegment> output = new List<DB.BoundarySegment>(); DB.SpatialElementBoundaryOptions opt = new DB.SpatialElementBoundaryOptions(); foreach (List<DB.BoundarySegment> segments in InternalRoom.GetBoundarySegments(opt)) { foreach (DB.BoundarySegment segment in segments) { output.Add(segment); } } return output.Distinct().ToList(); }