Filtering Sheets by Sheet Name

Hi All,

I’m trying to filter sheets with python but I don’t know how to get elementid from sheetname. Any help would be great, thanks.

Script on left is not mine (still learning)

Hi @Lknapton,

Sorry to say the thing which you have done is not correct and not even close. I suggest you start first basic of Python. Below are some links for Python learning resources.

Hi @Kulkul,

Your response is very crude and to be honest not helpful at all. I was given the script on left from work, as an example to learn from…

An example script or solution would have been a tremendous help.

I don’t know how to get elementid from sheetname
You can’t. Sheet name is a string.
You could search all sheets and try to find one with matching names, but since Sheet names are not unique, that’s probably not a good idea.

Check this example, see if it helps:

import clr
from Autodesk.DesignScript.Geometry import *

import RevitServices
from RevitServices.Persistence import DocumentManager

from Autodesk.Revit.DB import *

doc = DocumentManager.Instance.CurrentDBDocument
search_string = IN[0]

sheet_collector = FilteredElementCollector(doc).OfClass(ViewSheet)

matching_sheets = []
for sheet in sheet_collector:
	sheet_name = sheet.Name
	if search_string in sheet_name:

OUT = matching_sheets
1 Like

Thanks for this