Revit API Forum
Welcome to Autodesk’s Revit API Forums. Share your knowledge, ask questions, and explore popular Revit API topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Retrieve Area Boundary

3 REPLIES 3
SOLVED
Reply
Message 1 of 4
Moshe-A
575 Views, 3 Replies

Retrieve Area Boundary

Hi Guys,

 

i want to retrieve the Lines contour of an Area Boundary Element and i'm stuck

actually i do not know how to iterate the result coming from Area.GetBoundarySegments()

 

thanks in advance

Moshe

 

 

namespace MyNameSpace
{
    [Autodesk.Revit.Attributes.Transaction(Autodesk.Revit.Attributes.TransactionMode.ReadOnly)]
    public class Class1 : IExternalCommand
    {
        public Autodesk.Revit.UI.Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
        {
            try
            {
                Document document = commandData.Application.ActiveUIDocument.Document;

                AreaFilter filter = new AreaFilter();
                FilteredElementCollector collector = new FilteredElementCollector(document, document.ActiveView.Id);

                IList<Element> elementAreas = collector.WherePasses(filter).WhereElementIsNotElementType().ToElements();
                IList<IList<BoundarySegment>> boundarySegments;

                foreach (Element elem in elementAreas)
                {
                    Area ba = elem as Area;
                    boundarySegments = ba.GetBoundarySegments(new SpatialElementBoundaryOptions());
                    // stuck here ???
                }
            }
            catch (Exception e)
            {
                message = "Unexpected Exception thrown.";
                return Autodesk.Revit.UI.Result.Failed;
            }

           return Autodesk.Revit.UI.Result.Succeeded;
        }
    }
}

 

 

3 REPLIES 3
Message 2 of 4
jeremytammik
in reply to: Moshe-A

Dear Moshe-A,

 

Try this:

 

http://lmgtfy.com/?q=revit+api+GetBoundarySegments

 

Cheers,

 

Jeremy



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

Message 3 of 4
Moshe-A
in reply to: jeremytammik

thank you
Message 4 of 4
jeremytammik
in reply to: Moshe-A

my pleasure entirely  🙂



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Rail Community