05 Sep

Dynamo: Copy values between Revit® parameters

To copy values between different Revit parameters quickly, use Dynamo script. Let’s say that we entered information (parameters values) into many Revit family instances in our project just to realize that it should be on another place (in another parameter). Or we change our minds during the project (it happens).
So, in order to do the boring task of copying parameter values to another place quickly, let’s use the power of Dynamo.

The script is simple, it just uses Element.GetParameterValueByName and Element.SetParameterByName methods to get and set the values.
All you need to do is:

  1. Adjust selection method (example gets all instances of a category or select the elements manually),
  2. Type in the parameters names,
  3. Set if the parameters are type or instance,
  4. Run the script!

Make sure you are copying values of the same type. If not, make sure to cast into appropriate value type (integer, string, etc.)
Also, this script will not work on system families (see solution below).
Dynamo script for copying values between instace or type parameters in Revit family instances

 

For system families we will tweak the script a little bit:

Replace FamilyInstance.GetType node with two additional nodes: FamilyType.Name and FloorType.ByName (or WallType.ByName, or RoofType.ByName etc.)

Dynamo script that copies values between type and instance parameters in Revit System FamiliesDownload the scripts from the Warehouse

Dynamo: Copy Parameters Values

Additional tip: if you have multiple lacing going from one point, use Watch node as an intermediate knot holder.

14 thoughts on “Dynamo: Copy values between Revit® parameters

    • You are right, I get the error message “Use Element.ElementType instead” on FamilyInstance.GetType node.
      I have Dynamo 2.0.3.8810 an it works fine when I replace FamilyInstance.GetType node with Element.ElementType node. That node does not depend on any package.
      Dynamo replace FamilyInstance.GetType with Element.ElementType node

  1. Hi,

    Do you what could be a problem that is doesn’t work for any wall, roof, floor families, but it works perfectly fine for doors, windows?

    • Hi, if you carefully look at the images above, and read my instructions, you will see that there are two approaches.
      One for system families (walls, floors, roofs).
      The other for external families (doors, windows etc).

  2. HI
    I can’t find the script to download in the Warehouse…how or where Can I download this script? Many thanks

  3. Hi, thanks for the script. I tried it and it doesn’t seem to work well with parameters of the ‘integer’ type. I get the warning “Warning: Element.SetParameterByName operation failed.
    The parameter’s storage type is not a string.” How can i do a workaround?

  4. Hi Mirko, Thank you so much for the script. I am trying to use your script to copy “Workset” Value to a Shared Parameter, but it seams, it is nessassary for me to take a different apporach for copy&pasting “Workset” parameters. Would you please let me know what it needs to be done?

    • Hi, yes, I know, you get just a number.
      You need to create custom Python script and put this code in:

      import clr

      clr.AddReference("RevitServices")
      import RevitServices
      from RevitServices.Persistence import DocumentManager

      clr.AddReference("RevitAPI")
      import Autodesk
      from Autodesk.Revit.DB import *

      worksetnumber = IN[0]

      doc = DocumentManager.Instance.CurrentDBDocument
      collector = FilteredWorksetCollector(doc)
      worksets = collector.OfKind(WorksetKind.UserWorkset).ToWorksets()

      w = ''
      for workset in worksets:
      if str(workset.Id) == str(worksetnumber):
      w = workset.Name
      break

      OUT = w

      Stupid WordPress. Please add one tab in front of IF command and two tabs in front of BREAK command.

      • Thank you so much for your reply. Exactly, I just get numbers. I have Tried your code and it says –
        “IronPythonEvaluator.EvaluateIronPythonScript operation failed. expected an indented block” –
        (I made sure to added 1-tabs in front of “IF” command and 2-tabs in front of break command)

        If you could offer a DYN file, it will truly save my day..

        • Just Kidding.!! it worked! [Run Completed]

          import clr

          clr.AddReference(“RevitServices”)
          import RevitServices
          from RevitServices.Persistence import DocumentManager

          clr.AddReference(“RevitAPI”)
          import Autodesk
          from Autodesk.Revit.DB import *

          worksetnumber = IN[0]

          doc = DocumentManager.Instance.CurrentDBDocument
          collector = FilteredWorksetCollector(doc)
          worksets = collector.OfKind(WorksetKind.UserWorkset).ToWorksets()

          w = ”
          for workset in worksets:
          if str(workset.Id) == str(worksetnumber):
          w = workset.Name
          break

          OUT = w

          However,I could not see the target result(out put Parameter) its empty at the moment.

  5. what should I use to copy Keynote from walls parameter to a shared parameter of the part of that wall?

Leave a Reply

Your email address will not be published. Required fields are marked *