2021 Class
Changes 0
C

BoundarySegment

Description:
An object that represents a segment of an area boundary.
Remarks:
These objects define the exterior boundary of an area. The geometry of the segment can be retrieved along with the id of the element that is responsible for producing that boundary.
Inheritance Hierarchy:
System.Object
  Autodesk.Revit.DB.BoundarySegment
public class BoundarySegment : IDisposable
public void GetInfo_BoundarySegment(Room room)
{
   IList<IList<Autodesk.Revit.DB.BoundarySegment>> segments = room.GetBoundarySegments(new SpatialElementBoundaryOptions());

   if (null != segments)  //the room may not be bound
   {
      string message = "BoundarySegment";
      foreach (IList<Autodesk.Revit.DB.BoundarySegment> segmentList in segments)
      {
         foreach (Autodesk.Revit.DB.BoundarySegment boundarySegment in segmentList)
         {

            // Get curve start point
            message += "\nCurve start point: (" + boundarySegment.GetCurve().GetEndPoint(0).X + ","
                           + boundarySegment.GetCurve().GetEndPoint(0).Y + "," +
                          boundarySegment.GetCurve().GetEndPoint(0).Z + ")";
            // Get curve end point
            message += ";\nCurve end point: (" + boundarySegment.GetCurve().GetEndPoint(1).X + ","
                 + boundarySegment.GetCurve().GetEndPoint(1).Y + "," +
                 boundarySegment.GetCurve().GetEndPoint(1).Z + ")";
            // Get document path name
            message += ";\nDocument path name: " + room.Document.PathName;
            // Get boundary segment element name
            if (boundarySegment.ElementId != ElementId.InvalidElementId)
            {
               message += ";\nElement name: " + room.Document.GetElement(boundarySegment.ElementId).Name;
            }
         }
      }
      TaskDialog.Show("Revit",message);
   }
}
Name Return Type Description
M Dispose() None Releases all resources used by the
M GetCurve() Curve Get a copy of the curve that is formed along this boundary.
Name Return Type Description
P ElementId ElementId Retrieve the id of the element that produces this boundary segment. If the segment is created from an element in a link, this is the id of the RevitLinkInstance.
P IsValidObject bool Specifies whether the .NET object represents a valid Revit entity.
P LinkElementId ElementId Retrieve the element id of the element in a link instance that forms this boundary.