Deleting Unplaced Section Views that are not placed on any sheets

Hi everyone,

I’m working on a Dynamo script in Revit that aims to Delete all Section views that are not placed on any sheets, but I also want to prompt the user for confirmation before deletion.

I’ve created a graph that:

  1. Collects all views from the “Views” category.
  2. Filters out only those with “Section” in the view name.
  3. Gets all views placed on sheets via the “Sheets” category and “Sheet.Views”.
  4. Uses List.SetDifference to identify unplaced Section views.
  5. Attempts to delete the unplaced views using Element.Delete.

Issues:

Some of the inputs contain null values, which cause warnings and break the graph.
I’m not sure the filtering and deletion logic is completely accurate.
Most importantly, I want to include a (user confirmation step) before deletion — is there a way to do this purely in Dynamo (without Python)?

I’ve used List.Clean to remove nulls where possible, but still getting inconsistent results.

Attached is an image of my current graph.
Any advice or corrections would be greatly appreciated!

Thanks in advance!

Hi Saurabh, welcome :wave:

Use Element Classes ViewSection and All Elements of Class nodes to quickly get all sections without other guff or nulls.

You will need to filter view templates and views on sheet which archilab and Dynamo kindly have nodes to assist.

A view which is a template cannot be on sheet, so using an OR node you can get the sections that are not on sheets or templates.

Edit: Some Views will not have a template (i.e. None) so the archilab node that gets the View Template will return a null which is not useful. You may also wish to filter by view name - the Element.Name node works with views.

Then use Data-Shapes nodes to get the user input and then delete the offending views. I’ll leave the delete bit for you to complete. I would suggest checking ‘Was Cancelled’ is false before deleting

Added section filtering with archilab node

Thank you, Mike, for your quick response. I’ll give this a try and get back to you.

You could probably do this with just a filtered view list (schedule). Then you’d just need to periodically delete all views that show up in the schedule.

3 Likes

I re-created the Dynamo script module by module. No errors after I run. I get the dialog box differentiating between elevation and section. I choose just the un-referenced section view, select Delete but the elements remain. Could you help me figure out why? Thanks in advance

There was some homework in my response… :wink:

1 Like

Wasnt sure how ‘Was Cancelled’ was a hint, but I have a ways to go in getting a strong handling of Dynamo. But good news, I was able to solve it.

1 Like