Retrieves Analytical Model Loops with respect to the loopType.
Namespace: Autodesk.Revit.DB.Structure
Assembly: RevitAPI (in RevitAPI.dll) Version: 2015.0.0.0 (2015.0.0.0)
Since: 2013
Syntax
C# |
---|
|
Visual Basic |
---|
|
Visual C++ |
---|
|
Parameters
- loopType
- Type: Autodesk.Revit.DB.Structure AnalyticalLoopType
Return Value
Loops that satisfy loopType criteria are returned.Remarks
For multiple concentric loops, only the outermost loop will be considered External. All other loops will be considered Internal.
Examples

// retrieve and iterate current selected element
UIDocument uidoc = commandData.Application.ActiveUIDocument;
ICollection<ElementId> selectedIds = uidoc.Selection.GetElementIds();
Document document = uidoc.Document;
foreach (ElementId id in selectedIds)
{
Element e = document.GetElement(id);
Wall aWall = e as Wall;
if (null != aWall)
{
// get AnalyticalModelSurface from Structural Wall
AnalyticalModelSurface modelWall = aWall.GetAnalyticalModel() as AnalyticalModelSurface;
if (null == modelWall)
{
// Architecture wall doesn't have analytical model
continue;
}
// get wall curves
StringBuilder wallString = new StringBuilder();
wallString.AppendLine("Wall curves:");
IList<CurveLoop> wallCurveLoops = modelWall.GetLoops(AnalyticalLoopType.External);
foreach (CurveLoop curveloop in wallCurveLoops)
{
CurveLoopIterator itr = curveloop.GetCurveLoopIterator();
itr.Reset();
while (itr.MoveNext())
{
Curve wallCurve = itr.Current;
wallString.AppendLine(String.Format("{0}, {1}", wallCurve.GetEndPoint(0).ToString(), wallCurve.GetEndPoint(1).ToString()));
}
}
TaskDialog.Show("Wall Analytical Model", wallString.ToString());
}
}

' retrieve and iterate current selected element
Dim uidoc As UIDocument = commandData.Application.ActiveUIDocument
Dim selectedIds As ICollection(Of ElementId) = uidoc.Selection.GetElementIds()
Dim document As Document = uidoc.Document
For Each id As ElementId In selectedIds
Dim e As Element = document.GetElement(id)
Dim aWall As Wall = TryCast(e, Wall)
If aWall IsNot Nothing Then
' get AnalyticalModelSurface from Structural Wall
Dim modelWall As AnalyticalModelSurface = TryCast(aWall.GetAnalyticalModel(), AnalyticalModelSurface)
If modelWall Is Nothing Then
' Architecture wall doesn't have analytical model
Continue For
End If
' get wall curves
Dim wallString As New StringBuilder()
wallString.AppendLine("Wall curves:")
Dim wallCurveLoops As IList(Of CurveLoop) = modelWall.GetLoops(AnalyticalLoopType.External)
For Each curveloop As CurveLoop In wallCurveLoops
Dim itr As CurveLoopIterator = curveloop.GetCurveLoopIterator()
itr.Reset()
While itr.MoveNext()
Dim wallCurve As Curve = itr.Current
wallString.AppendLine([String].Format("{0}, {1}", wallCurve.GetEndPoint(0).ToString(), wallCurve.GetEndPoint(1).ToString()))
End While
Next
TaskDialog.Show("Wall Analytical Model", wallString.ToString())
End If
Exceptions
Exception | Condition |
---|---|
Autodesk.Revit.Exceptions ArgumentOutOfRangeException | A value passed for an enumeration argument is not a member of that enumeration |