Element.AddInsulation

Hi everyone,

I am trying to automate adding pipe insulation using Dynamo in Revit 2026, but I’m having trouble with the Element.AddInsulation node.

Goal
Automatically add insulation to selected pipe elements.

  1. The node receives the Element Type of the insulation, not the string name. You can pull it off the Element Class output without the name query, unless you’re planning to use the names to correct for index values in deployment.
  2. You may need to install IronPython 2.7 via the package manager if you have not already.

Thanks for your suggestion.

I tried using the Type instead of the instance for the insulation input, but unfortunately it still does not work.

I also confirmed that IronPython 2.7 is installed and available in my Dynamo.

You’re going to find the that MEPover node may not work as intended or have limited functionality
Here is some python which will work with Revit 2026 (tested on all versions of python)

import clr

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


clr.AddReference("RevitAPI")
from Autodesk.Revit.DB import (
    BuiltInCategory,
    ElementId,
    InsulationLiningBase,
    SpecTypeId,
    UnitUtils,
)
from Autodesk.Revit.DB.Plumbing import PipeInsulation
from Autodesk.Revit.DB.Mechanical import DuctInsulation

from System.Collections.Generic import List

doc = DocumentManager.Instance.CurrentDBDocument
units = doc.GetUnits().GetFormatOptions(SpecTypeId.Length).GetUnitTypeId()


PIPE_CATS = [
    BuiltInCategory.OST_PipeCurves,
    BuiltInCategory.OST_PipeFitting,
    BuiltInCategory.OST_PipeAccessory,
]

DUCT_CATS = [
    BuiltInCategory.OST_DuctCurves,
    BuiltInCategory.OST_DuctFitting,
    BuiltInCategory.OST_DuctAccessory,
]


def to_list(item, func=lambda x: x):
    if isinstance(item, list):
        return [func(i) for i in item]
    return [func(item)]


def add_insulation(element, insultype, size, mep_type):
    insul_ids = InsulationLiningBase.GetInsulationIds(doc, element.Id)

    # Insulation has to be deleted before applying another
    if len(insul_ids) > 0:
        doc.Delete(List[ElementId](insul_ids))

    mep_type.Create(doc, element.Id, insultype.Id, size)


pipes = to_list(IN[0], UnwrapElement)
insultype = to_list(IN[1], UnwrapElement)
size = to_list(IN[2])

size = list(map(lambda s: UnitUtils.ConvertToInternalUnits(s, units), size))

num_insultype = len(insultype)
num_sizes = len(size)

output = dict()

TransactionManager.Instance.EnsureInTransaction(doc)

for i, pipe in enumerate(pipes):
    size_idx = i % num_sizes
    insul_idx = i % num_insultype
    mep_type = None
    bic = pipe.Category.BuiltInCategory

    if bic in PIPE_CATS:
        mep_type = PipeInsulation

    if bic in DUCT_CATS:
        mep_type = DuctInsulation

    if mep_type:
        add_insulation(pipe, insultype[insul_idx], size[size_idx], mep_type)
        output.setdefault("success", []).append(pipe)

    else:
        output.setdefault("failed", []).append(pipe)

TransactionManager.Instance.TransactionTaskDone()

OUT = output