Change Category for Project Parameters

Hello,

I have a major/simple problem.
I added a bunch of project parameters assigning them to all categories, now I want to reassign specific categories for each parameter I’ve added.

I tried to use a node in the package Orchid called change category, but the node keeps throwing exceptions and fails to work.

Is there any other nodes/techniques you can help me with?

Thank you.

This may involve extensive use of the Revit API, but you can use the ReInsert method if the BindingMap Class. The description of this class in the API documentation is that it " Removes an existing parameter and creates a new binding for a given parameter." so it will probably erase all parameter values you have assigned to the existing parameters. The general process you will probably have to use is to:

  1. Retrieve parameter values of all elements (and their UniqueIds) in the categories = to which the parameter will be assigned to (e.g. if your parameter is originally assigned to Pipes, Pipe Fittings, and Pipe Accessories, store the values of the elements in the new categories (e.g. Pipes and Pipe Fittings), so that you can later re-assign the values when you re-insert the parameters).

  2. Re-Insert the parameters to the relevant categories using the BindingMap.ReInsert() method. If you access your Document.ParmaeterBindings property, it should return a BindingMap object. The ReInsert method should accept either an InstanceBinding (for instance paramters) or TypeBinding
    (for type parameters) object of a given CategorySet

  3. Rewrite the parameter values to all of your elements using your stored list of your elements’ UniqueIds and parameter values.

2 Likes