Announcements

The Autodesk Community Forums has a new look. Read more about what's changed on the Community Announcements board.

Iupdater doesn't trigger

Gilles.Lagrilliere
Advocate

Iupdater doesn't trigger

Gilles.Lagrilliere
Advocate
Advocate

Hello Everyone

 

I made an updater that changes the systemType when I change my pipeType and vice versa.

but when I change my systemType my pipeType wont change, the updater wont even trigger.

 

This are my triggers:

        public static void RegisterPipeUpdater(AddInId addinId)
        {
            Pipes pipeUpdater = new Pipes(addinId);
            UpdaterId id = pipeUpdater.GetUpdaterId();

            UpdaterRegistry.RegisterUpdater(pipeUpdater);
            UpdaterRegistry.AddTrigger(id,
                new ElementCategoryFilter(BuiltInCategory.OST_PipeCurves),
                Element.GetChangeTypeElementAddition());

            UpdaterRegistry.AddTrigger(id,
                new ElementCategoryFilter(BuiltInCategory.OST_PipeCurves),
                Element.GetChangeTypeParameter(new ElementId(BuiltInParameter.RBS_START_OFFSET_PARAM)));

            UpdaterRegistry.AddTrigger(id,
                new ElementCategoryFilter(BuiltInCategory.OST_PipeCurves),
                Element.GetChangeTypeParameter(new ElementId(BuiltInParameter.RBS_END_OFFSET_PARAM)));

            UpdaterRegistry.AddTrigger(id,
                new ElementCategoryFilter(BuiltInCategory.OST_PipeCurves),
                Element.GetChangeTypeParameter(new ElementId(BuiltInParameter.RBS_PIPE_OUTER_DIAMETER)));

            UpdaterRegistry.AddTrigger(id,
                new ElementCategoryFilter(BuiltInCategory.OST_PipeCurves),
                Element.GetChangeTypeParameter(new ElementId(BuiltInParameter.ELEM_TYPE_PARAM)));

// It wont trigger when I change this parameter in my project.
            UpdaterRegistry.AddTrigger(id,
                new ElementCategoryFilter(BuiltInCategory.OST_PipeCurves),
                Element.GetChangeTypeParameter(new ElementId(BuiltInParameter.RBS_PIPING_SYSTEM_TYPE_PARAM)));

            UpdaterRegistry.DisableUpdater(id);
        }

 

It does trigger when I use the 'Element.GetChangeAny()'.

 

Is this a bug in Revit? Or am I doing something wrong?

Reply
440 Views
3 Replies
Replies (3)

ricaun
Advisor
Advisor

Should work the 'Element.GetChangeAny()', which I have used in some projects.

 

Why are you disabling the updater at the end of the method?

 

UpdaterRegistry.DisableUpdater(id);

 

I suppose is not gonna trigger if the updater is diabled.

Luiz Henrique Cassettari

ricaun.com - Revit API Developer

AppLoader EasyConduit WireInConduit ConduitMaterial CircuitName ElectricalUtils

Gilles.Lagrilliere
Advocate
Advocate

The updater works if I use 'Element.GetChangeAny(). But I don't wont to trigger the updater with every change.

 

I'm disabling the updater so that the user can choose to use the updater. If the user want to use the updater he can enable it by clicking on a button.

ridaabderrahmane
Enthusiast
Enthusiast

Your code seems right to me, as @ricaun suggested you don't need to Unregister the updater at the end of your function.

You can instead Register your updater and add the triggers at the the onStartUp event.

create a static bool variable. 

in your updater classe, in the execute function execute only if the static bool variable is true.

And you can handle the value of this static variable on the button click.

This way the updater is always in the Revit plugin, but he will trigger only if the static bool variable is true, which is handled by the user by clicking on a button.

Hope this helps.