Element Iteration

Element Iteration

npetulla
Participant Participant
235 Views
1 Reply
Message 1 of 2

Element Iteration

npetulla
Participant
Participant

The company I work for uses Revit for pipework primarily. I have been trying to find a way to iterate through each element in the pipeline to automatically place hangers. When adding elements to a list it seems the RevitAPI likes to order the list by ascending element Id. If the user decides to add a element in between two other previously placed elements then this list is technically out of order for my purpose. 

 

I havent found a super solid way to iterate from part to part, but the way I am iterating from part to part now is by ordering a list of tuples(FabPart and XYZ(origin)) by its X then by its Y and creating a new list from this. 

I can then iterate through this new list in the correct-ish(Emphasis on the "-ish") order.

 

The iteration aspect of this project has proven to be more difficult than expected, how do you guys accomplish similar results to situations like this?

 

P.S. In the snippet I supplied I am aware this will only work for pipe. I am still very early on in this project, trying to mitigate confusion!

0 Likes
236 Views
1 Reply
Reply (1)
Message 2 of 2

jeremy_tammik
Alumni
Alumni

Please take a look at the official Revit SDK samples, especially TraverseSystem, and The Building Coder articles:

   

   

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
0 Likes