Not sure if this is pyRevit API error, but I can’t modify the revision clouds via the API.
"""
Change all revision clouds on the sheet from one revision to another.
"""
from pyrevit import DB, forms, HOST_APP,revit
from uiUtils import selectRevision, selectCloudedRevisions
if __name__ == "__main__":
doc = HOST_APP.doc
current_sheet = HOST_APP.active_view
selected_revisions = selectCloudedRevisions(doc, current_sheet)
target_revision = selectRevision(doc)
all_clouds = DB.FilteredElementCollector(doc, current_sheet.Id).OfCategory(DB.BuiltInCategory.OST_RevisionClouds).WhereElementIsNotElementType().ToElements()
with DB.Transaction(doc, "Change Revision Clouds") as t:
t.Start()
for cloud in all_clouds:
if cloud.RevisionId in selected_revisions:
cloud.LookupParameter("Revision").Set(target_revision)
cloud.LookupParameter("Mark").Set("New Mark")
print("changed cloud {} to revision {}".format(cloud.Id, target_revision.Id))
t.Commit()
Here’s the result even after it “supposedly” changed the revision cloud, it’s supposed to say “Issue for CDC” or I even try changing the “Mark” to see if that parameter is changed but no luck
selected_revisions outputs a list of strings… and you ask: is the Revision.Id from all clouds in that list of string
Not able to help without seeing your utils library for revisions
After investigating it is the selectCloudedRevisions that is the problem, it should be returning the clouds of revision instead of the revision itself, closing the topic
def selectCloudedRevisions(doc, sheet):
"""
Allow the user to select multiple clouded revisions from the list of revisions on the sheet
returns the clouds of selected revisions
"""
all_clouds = DB.FilteredElementCollector(doc,sheet.Id).OfCategory(DB.BuiltInCategory.OST_RevisionClouds).WhereElementIsNotElementType().ToElements()
all_revisions = set()
for cloud in all_clouds:
revision_id = cloud.RevisionId
print("found clouded revision: {}".format(revision_id))
all_revisions.add(revision_id)
all_revisions = [doc.GetElement(revision) for revision in all_revisions]
all_revisions.sort(key=lambda rev: rev.SequenceNumber) # Sort by sequence number
all_revisions_dict = dict()
for revision in all_revisions:
revision_text = "{} - {} - {}".format(sheet.GetRevisionNumberOnSheet(revision.Id), revision.Description, revision.RevisionDate)
all_revisions_dict.update({revision_text: revision})
selected_revisions = forms.SelectFromList.show(all_revisions_dict.keys(),
title="select Revision",
multiselect=True)
selected_revision_ids = [all_revisions_dict[revision].Id for revision in selected_revisions]
selected_clouds = []
for revision in selected_revisions:
print("selected revision: {}".format(revision))
for cloud in all_clouds:
if cloud.RevisionId in selected_revision_ids:
selected_clouds.append(cloud)
print("selected cloud: {}".format(cloud.Id))
return selected_clouds