Change Orientation of Duct Tap

Hello all,
I am trying to create a script that can flip all duct taps to the correct orientation for the flow direction. But I can’t find a way to flip a duct tap using Dynamo or even what method it would be in the Revit API docs. I looked at flipFacing Method but the ChatGPT generated script gave me false for the duct taps so I don’t think that is the correct method.

This post seems to have this figured out but no information other than the .gif.

Here is my current Dynamo script, the Element.System node is thanks to the MEPover package.

Here is the python script generated using ChatGPT for that last python node

# Import Revit and Dynamo libraries
import clr
clr.AddReference('RevitServices')
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

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

# Input: A single duct fitting or a list of duct fittings from Dynamo
duct_fittings = IN[0]

# Ensure the input is a list (for single input handling)
if not isinstance(duct_fittings, list):
  duct_fittings = [duct_fittings]

# Get the current Revit document
doc = DocumentManager.Instance.CurrentDBDocument

# Start a transaction to modify the Revit document
TransactionManager.Instance.EnsureInTransaction(doc)

# Output lists to store results of flip operations and error messages
output = []
error_messages = []

# Loop through each duct fitting and attempt to flip its facing
for fitting in duct_fittings:
  try:
      # Use the FlipFacing method if it is available for the fitting
      if hasattr(fitting, 'FlipFacing'):
          fitting.FlipFacing()
          output.append(True)  # Successful flip
      else:
          output.append(False)  # FlipFacing method not available
  except Exception as e:
      output.append(False)  # Any error during the operation
      error_messages.append(f"Error with element {fitting.Id}: {str(e)}")

# End the transaction
TransactionManager.Instance.TransactionTaskDone()

# Output the result (True for successful flip, False otherwise) and any error messages
OUT = (output, error_messages if error_messages else None)

@Kulkul If you can point me in the right direction that would be very much appreciated. Or maybe another MEP dynamo user can help.
Thanks!

My Guess is that you are looking to use this.

1 Like

Hi @tom123 you can try thi one from clockwork written i python

Revit_vffXWa1R18

1 Like