Retrieves Analytical Model Loops with respect to the loopType.
Namespace: Autodesk.Revit.DB.Structure
Assembly: RevitAPI (in RevitAPI.dll) Version: 18.0.0.0 (18.2.0.0)
Since:
2013
Syntax
Return Value
Loops that satisfy loopType criteria are returned.
Remarks
Examples
CopyC#
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)
{
AnalyticalModelSurface modelWall = aWall.GetAnalyticalModel() as AnalyticalModelSurface;
if (null == modelWall)
{
continue;
}
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());
}
}
CopyVB.NET
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
Dim modelWall As AnalyticalModelSurface = TryCast(aWall.GetAnalyticalModel(), AnalyticalModelSurface)
If modelWall Is Nothing Then
Continue For
End If
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
See Also