Set HandFlipped bool parameter or mirror by ElementTransformUtils.MirrorElements, how?

Hello Dynamiters,

I am trying to set the door to the left or right or up or down automatically, and Im not sure how to do it, I thought I can set the parameters HandFlippet to True or False, as well as the parameter HandFlipped but it doesnt seems to be possible.

facing.append(door.FacingFlipped)
hand.append(door.HandFlipped)
facing_param = door.LookupParameter("FacingFlipped")
hand_param = door.LookupParameter("HandFlipped")
facing_param.Set(True)
hand_param.Set(False)

or
door.HandFlipped = True
door.FacingFlipped = True

When I also tried to mirror the door by using the MirroElement method doesnt seem to work either
ElementTransformUtils.MirrorElements(doc, icollection, plane, False)

How could I possibly automate the flipping and mirroring of a door or what I am doing wrong? Any light on the issue?

Thanks in advance!

FacingFlipped and HandFlipped are both read-only properties. There are separate methods to set their values - flipFacing() and flipHand(). You can find them both on this Revit API Docs page, which I highly recommend for API questions likes this.

I think Clockwork also has nodes for this already.

thanks Nick_Boyts, that was the solution, I will paste the code when I am done with the logic.

import clr

# Import ToDSType(bool) extension method
clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.Elements)

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

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

doc = DocumentManager.Instance.CurrentDBDocument

#unwrap inputs
door = UnwrapElement(IN[0])

hand, facing = [], []
TransactionManager.Instance.EnsureInTransaction(doc)

if door.HandFlipped == IN[1]:
	pass
else:
	door.flipHand()
	hand.append(door.HandFlipped)
	
if door.FacingFlipped == IN[2]:
	pass
else:
	door.flipFacing()
	facing.append(door.FacingFlipped)
	
TransactionManager.Instance.TransactionTaskDone()

1 Like