Filter Revisions by Revision Name

I have used the dynamo routine by Andrew King found here. I am trying to then filter that list by using the revision selector in Dynamo to filter my list. Attache is what I have, but I cannot seem to get it right!

Hi @AndriaLynch

Please re-post your image. It is not clear. Thanks!

Thanks, and done!

@AndriaLynch

Connect and see what does it gives you. Come back with errors and images if any. You’re welcome!

@AndriaLynch Can you copy the Python code you are using and share it here (as preformatted text </>)

Also an image showing more of your graph would be helpful. I’m not sure what you are feeding into that Python node. Zoom in on your graph in Dynamo and use the screen capture button :slight_smile:

1 Like

@AndriaLynch select the text and set it to be Preformatted Text with this button:
image

1 Like
# Python Code for Dynamo
# Input: Revision Clouds, Sheets
# Output: Matching Sheets, Matching Revision Clouds, Referencing Views
# Version 0.6
# Coded by Andrew King
# http://andrewkingme.com
#
# 2016-02-06 Version 0.1
# Hello World
#
# 2016-02-08 Version 0.2
# Output matchingrevisionclouds from Python node to avoid hidden element mismatch.
#
# 2016-02-14 Version 0.4
# Expanded Python code to output every instance of a revision cloud in every instance of a legend.
#
# 2016-02-16 Version 0.5
# Restructured code to reduce number of cycles.
# Eliminated the need for a separate legend/dependency path.
# Boolean selector for Revisions on Sheets/Revisions in Views on Sheets.
# Revit 2014 compatibility.
#
# 2016-02-25 Version 0.6
# Added category filter to improve FilteredElementCollector performace.

import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *

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

# Import DocumentManager and TransactionManager
clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

# Assign input to the IN variables.
revisioncloudinput = UnwrapElement(IN[0])
sheetinput = UnwrapElement(IN[1])
revisionsonsheets = IN[2]
revisionsinviewsonsheets = IN[3]

matchingsheets = []
matchingrevisionclouds = []
referencingviews = []

# Look for revision clouds on sheets.
if revisionsonsheets == True:
  for sheet in sheetinput:
    for sheetelement in FilteredElementCollector(DocumentManager.Instance.CurrentDBDocument, sheet.Id).OfCategory(BuiltInCategory.OST_RevisionClouds):
      for revisioncloud in revisioncloudinput:
        if sheetelement.Id == revisioncloud.Id:
          matchingsheets.append(sheet)
          matchingrevisionclouds.append(revisioncloud)
          referencingviews.append(sheet)

# Look for revision clouds in views on sheets.
if revisionsinviewsonsheets == True:
  for sheet in sheetinput:
    if DocumentManager.Instance.CurrentUIApplication.Application.VersionName == "Autodesk Revit 2018":
      for viewport in sheet.GetAllViewports():
        for view in [DocumentManager.Instance.CurrentDBDocument.GetElement(viewport)]:
          for viewid in [DocumentManager.Instance.CurrentDBDocument.GetElement(view.ViewId)]:
            for viewelement in FilteredElementCollector(DocumentManager.Instance.CurrentDBDocument, viewid.Id).OfCategory(BuiltInCategory.OST_RevisionClouds):
              for revisioncloud in revisioncloudinput:
                if viewelement.Id == revisioncloud.Id:
                  matchingsheets.append(sheet)
                  matchingrevisionclouds.append(revisioncloud)
                  referencingviews.append(viewid)
    else:
      for viewport in sheet.GetAllPlacedViews():
        for view in [DocumentManager.Instance.CurrentDBDocument.GetElement(viewport)]:
          for viewelement in FilteredElementCollector(DocumentManager.Instance.CurrentDBDocument, view.Id).OfCategory(BuiltInCategory.OST_RevisionClouds):
            for revisioncloud in revisioncloudinput:
              if viewelement.Id == revisioncloud.Id:
                matchingsheets.append(sheet)
                matchingrevisionclouds.append(revisioncloud)
                referencingviews.append(view)

# Assign output to the OUT variable.
OUT = matchingsheets, matchingrevisionclouds, referencingviews

@AndriaLynch just had a look at your graph - you are feeding the list of revisions into the List.FilterByBoolMask node, instead feed it the list of revision clouds like so:

1 Like