BoundarySegment Class

BoundarySegment Class

An object that represents a segment of an area boundary.
Inheritance Hierarchy
SystemObject
  Autodesk.Revit.DBBoundarySegment

Namespace: Autodesk.Revit.DB
Assembly: RevitAPI (in RevitAPI.dll) Version: 25.0.0.0 (25.0.0.0)
Syntax
public class BoundarySegment : IDisposable
Public Class BoundarySegment
	Implements IDisposable
public ref class BoundarySegment : IDisposable
type BoundarySegment = 
    class
        interface IDisposable
    end

The BoundarySegment type exposes the following members.

Properties
 NameDescription
Public propertyElementId 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.
Public propertyIsValidObject Specifies whether the .NET object represents a valid Revit entity.
Public propertyLinkElementId Retrieve the element id of the element in a link instance that forms this boundary.
Top
Methods
 NameDescription
Public methodDisposeReleases all resources used by the BoundarySegment
Public methodEqualsDetermines whether the specified object is equal to the current object.
(Inherited from Object)
Public methodGetCurve Get a copy of the curve that is formed along this boundary.
Public methodGetHashCodeServes as the default hash function.
(Inherited from Object)
Public methodGetTypeGets the Type of the current instance.
(Inherited from Object)
Public methodToStringReturns a string that represents the current object.
(Inherited from Object)
Top
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.
Example
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);
   }
}
Public Sub GetInfo_BoundarySegment(room As Room)
    Dim segments As IList(Of IList(Of Autodesk.Revit.DB.BoundarySegment)) = room.GetBoundarySegments(New SpatialElementBoundaryOptions())

    If segments IsNot Nothing Then
        'the room may not be bound
        Dim message As String = "BoundarySegment"
        For Each segmentList As IList(Of Autodesk.Revit.DB.BoundarySegment) In segments
            For Each boundarySegment As Autodesk.Revit.DB.BoundarySegment In segmentList

          ' Get curve start point
          message += ((vbLf & "Curve start point: (" + boundarySegment.GetCurve().GetEndPoint(0).X & ",") + boundarySegment.GetCurve().GetEndPoint(0).Y & ",") + boundarySegment.GetCurve().GetEndPoint(0).Z & ")"
          ' Get curve end point
          message += ((";" & vbLf & "Curve end point: (" + boundarySegment.GetCurve().GetEndPoint(1).X & ",") + boundarySegment.GetCurve().GetEndPoint(1).Y & ",") + boundarySegment.GetCurve().GetEndPoint(1).Z & ")"
          ' Get document path name
          message += ";" & vbLf & "Document path name: " + room.Document.PathName
          ' Get boundary segment element name
          If boundarySegment.ElementId IsNot ElementId.InvalidElementId Then
             message += ";" & vbLf & "Element name: " + room.Document.GetElement(boundarySegment.ElementId).Name
          End If

            Next
        Next
        TaskDialog.Show("Revit", message)
    End If
End Sub

No code example is currently available or this language may not be supported.

No code example is currently available or this language may not be supported.

See Also