Get Assemblies without Views

A client of mine has asked me to help out with a Dynamo script for creating Assembly Views. It is going to be around 200 Assemblies with about 10 Views each.

So far not a problem with the Nodes from the SteamNodes package.
I get all the Assemblies, filter out the ones I need by name, create the Views and Sheets and rename some stuff. The location of the Views on the Sheets is not what it is supposed to be, but we agreed on them doing that manual for now.

The problem is that the client already did a lot of the Assembly Views by hand and we don’t wanna redo those and it will of course give all sorts of errors when creating VIews and Sheets with the same name.

Is there any way to filter out the Assemblies that already have Views?

Yes, you can use a Python script (not sure if there is a package out there that can do this). The idea is to cast the Assembly views, which are of type ViewSection:

https://www.revitapidocs.com/2019/fcc75682-bd99-a97d-5a4d-0f8eb9e92ab5.htm

into type View:

https://www.revitapidocs.com/2019/fb92a4e7-f3a7-ef14-e631-342179b18de9.htm

this type has the properties IsAssemblyView and AssociatedAssemblyInstanceId. So once you loop through the views you can check if it is an assembly view, and if positive, skip the view or retrieve the assembly to which it belongs to.

OK thanks, I will have to look into this and figure out some Python.