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 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.
https://docs.python.org/2/tutorial/
http://www.ironpythoninaction.com/download.html
https://pythonprogramming.net/
http://wiki.theprovingground.org/system:page-tags/tag/python
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.
@Lknapton
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
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
clr.AddReference('RevitAPI')
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:
matching_sheets.append(sheet)
OUT = matching_sheets
Thanks for this