Unable to Change Revision cloud parameters

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


However, I could do it via dynamo:

Does anyone know this is just a pyrevit thing?

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

also your print statement should be inside your if scope, because right now, it prints out everytime the loop goes through each item of all_clouds

Pretty sure claude would have been as good as me at spotting that ;p

target revision should be a Revision Id as the Revision parameter looks for a Revision Id

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