Get Worksets of Raster Images

Hi,

I have over 200 raster images in my model. I want to remove the ones that are no longer needed. In order to do this, I would like to be able to see each link in the view on which it is placed, so that I can determine if it is really needed any more (the previews in manage links dialog are quite small). The manage links dialogue does not offer this functionality (something like ‘find in project browser’, but for raster images.)

So, I thought I would try it with dynamo. I noticed that raster images don’t have a ‘view’ parameter, but the ‘workset’ parameter includaes the name of the view.

So, I created a dynamo graph that gets the workset of each raster image, using the ‘Element.Workset’ node from Clockwork. However, it returns a list of values that are all the same: ‘Autodesk.Revit.DB.Workset’.

Is there a way to get the names of each workset as shown in the properties in revit (e.g. ‘View “Floor Plan: … etc”’)?

Or, is there another way to get the names of the views on which raster images are placed?

Thanks

Dynamo Core 2.18.1.5096
Dynamo Revit 2.18.1.8943
Revit 24.1.10.25
20230830_0315(x64)
2024.1.1

Hi @Peter-Christensen,

You can use the Element Workset node from Genius Loci package.

The ImageInstance class inherits this property from the Element class, which tells you the Id of the view which contains it:

Hi,

working with ImageType and OwnerViewId property like @GavinNicholls as mentioned

code Python (all engines)

import clr
import sys
import System

#import Revit API
clr.AddReference('RevitAPI')
import Autodesk
from Autodesk.Revit.DB import *
import Autodesk.Revit.DB as DB

#import net library
from System import Array
from System.Collections.Generic import List, IList, Dictionary

clr.AddReference('RevitNodes')
import Revit
clr.ImportExtensions(Revit.Elements)

#import transactionManager and DocumentManager (RevitServices is specific to Dynamo)
clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument


lst_ImageType = FilteredElementCollector(doc).OfClass(ImageType).ToElements()
lst_ImageTypeIntance = List[DB.Element](FilteredElementCollector(doc).OfClass(ImageInstance).ToElements())
result = []

for imgType in lst_ImageType:
    imgTypeName = imgType.ToDSType(False).Name
    filterElem = System.Predicate[System.Object](lambda x: x.GetTypeId() == imgType.Id)
    lst_instanceImg = lst_ImageTypeIntance.FindAll(filterElem)
    set_onwer_viewIds = set([x.OwnerViewId for x in lst_instanceImg])
    result.append({"image_Name": imgTypeName, "list_views" : [doc.GetElement(xId) for xId in set_onwer_viewIds] , "rvt_ElementType" : imgType})

OUT = result

Thank you all so much. I used the Genius Loci node and was able to export the info to excel: