Help with Iupdater

Hello,
I’m trying to implement this code by DmitroSE in a project of mine
IUpdater by DmytroSE
The idea is:

  1. Create a detail shape of a rebar
    2.Link the detailed item family with the rebar shape family by a shared parameter
  2. Build updater which will update the shape of the detailed family when the link rebar shape geometry is changed.

So far the 1 and 2 are ready. For now i am testing the updater with a simple case. If a rebar geometry is changed, it’s mark should be 123213.It’s doesn’t work for me and I don’t know what i am doing wrong. Can someone help a bit.
Here is the code:

# -*- coding: UTF-8 -*-
import os
import os.path as op
from pyrevit import framework
from pyrevit import HOST_APP, DB
from pyrevit import script
from pyrevit.framework import AppDomain
import Autodesk
from Autodesk.Revit.UI import *
from Autodesk.Revit.DB import *
import System
from System import Guid
from pyrevit.coreutils import envvars


location = os.path.realpath(os.path.join(os.getcwd(), os.path.dirname(__file__)))

UPDATER_TEST = 'create_updater'
class MyUpdater(IUpdater):

    def __init__(self, addin_id):
        '''type UpdaterId, mix of Addin ID and updater GUID
           choose a different GUID for each updater !!! '''
        self.updaterID = UpdaterId(addin_id,
            Guid("1997cb26-02ca-4196-a346-6d52c63f6770"))
        self.TaskDialog = TaskDialog

    def GetUpdaterId(self):
        return self.updaterID

    def GetUpdaterName(self):
        return 'MyUpdater'

    def GetAdditionalInformation(self):
        return 'MyUpdater (explanation, details, warnings)'

    def GetChangePriority(self):
        return ChangePriority.Structure

    def Execute(self, UpdaterData):
        up_doc = UpdaterData.GetDocument()   #document
        uidoc = __revit__.ActiveUIDocument
        #elems = updaterData.GetAddedElementIds()
        elems = UpdaterData.GetModifiedElementIds()
        # use a subtransaction in the current opened transaction
        if script.get_envvar(UPDATER_TEST):

            t = SubTransaction(up_doc)
            t.Start()
            try:
                if elems:
                    for h in elems:
                        el = up_doc.GetElement(h)
                        mark = el.GetParameters("Mark")
                        for i in mark:
                            i.Set("123213")
                t.Commit()
            except:
                t.RollBack()

app = __revit__.Application
def __selfinit__(script_cmp, ui_button_cmp, __rvt__):
    my_updater = MyUpdater(app.ActiveAddInId)
    if UpdaterRegistry.IsUpdaterRegistered(my_updater.GetUpdaterId()):
        UpdaterRegistry.UnregisterUpdater(my_updater.GetUpdaterId())
    UpdaterRegistry.RegisterUpdater(my_updater)
    filter = ElementCategoryFilter(BuiltInCategory.OST_Rebar)
    UpdaterRegistry.AddTrigger(my_updater.GetUpdaterId(),filter,
        Element.GetChangeTypeGeometry())#GetChangeTypeElementAddition())

def togglestate():
    new_state = not script.get_envvar(UPDATER_TEST)
    script.set_envvar(UPDATER_TEST, new_state)
    script.toggle_icon(new_state)

if __name__ == '__main__':
    togglestate()

Hi Kris! Welcome to the forum. The formatting of your post makes it hard to read but I think you could change how you get the Mark parameter. I don’t have my computer with me but look around online for another way to access and change a parameters. I think Erik Frits has a great YouTube video about it: Revit API Parameters: How to Get/Set Parameters with Python. - YouTube

I edited the code part for the sake of it😁
@scartmell