How to find all views/sheets in which a model in place element is placed?

I am in the process of converting all model in place elements to Revit families in a project. However I need to know the list of sheets or viewports in which a particular model in place element is placed in so that when i delete it, i can recreate all the associated annotations (like tags and dimensions) of that model in place element. Is there any dynamo script that can achieve this?

I would go about this in a different way. Rather than worrying about where an element is visible, you should look for annotation elements that are hosted by the elements that you want to delete/recreate.

Ideally, there would be a node that would get you all the elements that reference an object. There may be one out there, but I do not know of it. Since you mentioned dimensions and tags, I would use the following logic:

Get all tags in project → Get hosts of tags (via Tag.TaggedElement) → Compare and filter list of hosts by list of elements to delete.
From that list of tags, extract the host view and insertion point of each tag so you can recreate them hosted on the new element.

You can follow a similar workflow for dimensions, but that will be harder. As the dimensions are not usually hosted directly to an element, you will need to:

  • first get the references the dimension uses (face, point, etc)
  • then get the parent element of that reference
  • then filter the list of all dimension reference parent elements vs. the elements to be deleted.

I don’t know of an out of the box node that does this, but according to this thread, The GeniusLoci package has something that should work.

Of course, the recreation of dimensions will be harder as well because you will have to map the references of the new vs deleted element rather than just the element itself.

Hope this helps, and as usual, I look forward to learning a better way to do this!

There’s probably a lot more help already in the forums. I turned up some posts with Python and other suggestions by searching for “recreate Dimension”.

Good plan. Solid logic and a good outline process… but…

You can likely get stuff a bit easier using an old Revit API trick - pre-delete. I don’t know of a node which does this already, but I do know of some Python which does the trick: https://github.com/Amoursol/dynamoPython/blob/master/revitAPI/elementPreDelete.py

From there you’ll have a list of GUIDs/IDs which will change. As a result, if you did a ‘save as’ you can try and transition from an archive to the active model too. Filter by workset, get the active view’s workset, select, and manually copy/paste to the new model. If that works, try transitioning to an automated transference.

The other way to get elements which have been impacted by the delete is to use the DocumentDifference class, which is new in 2023. GetDeletedElementIds Method

1 Like

Sneaky!
Also, I did not know about Sol’s Github with Python samples, so I will be looking through that for goodies and inspiration. Thanks!

1 Like