Mirroring a family

Hello I have a non hosted family that I cannot get to mirror. it doesnt even want to import the element.geometry most of the time. my idea here is to get the location of the origin of the family find its relative Y axis and then mirror. However, none of it is working. can anyone point out what I did wrong please? Thanks

Try “Mirror an Element” node from Bakery package.

1 Like

Thanks but I my IT wont let me install packaages :frowning:

Try make a custom node based on bakery node:

import clr
clr.AddReference('RevitAPI')
import Autodesk
from Autodesk.Revit.DB import ElementTransformUtils, Plane

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

doc = DocumentManager.Instance.CurrentDBDocument

clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.GeometryConversion)

clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *

walls = UnwrapElement(IN[0])
planes = IN[1]
rvt_planes =list()
mirrored = list()
count = 0

def Dyn2RvtPlane(pl1):
	normal1 = pl1.Normal.ToXyz(True)
	origin1 = pl1.Origin.ToXyz(True)
	return Autodesk.Revit.DB.Plane(normal1, origin1)

TransactionManager.Instance.EnsureInTransaction(doc)
for p in planes:
	rvt_planes.append(Dyn2RvtPlane(p))
for w, rp in zip(walls, rvt_planes):
	try:
#		item.Flip()
		ElementTransformUtils.MirrorElement(doc, w.Id, rp)
		count += 1
	except:
		count += 0
TransactionManager.Instance.TransactionTaskDone()
		
OUT = "%s elements mirrored" %count

I cant get it to work, what do I put in for the plane list?

Plane, not vector e.g.
2017-08-31 00_34_21-Dynamo

Try make your own plane: Geometry -> Plane

Still no dice.

Try mirror selected element not geometry in family.
553e4ef983b1b9d18d3e023e86639d2d3c59dd90

A word of warning about mirroring items: it’s really bad practice in Revit & BIM in general.

Why? Any given object might refer to a real-world item that is handed. Revit has no way of determining this, as there is no reliable way in Revit of determining the ‘true’ handedness of an object.

Thus you might be inadvertently creating an object that will cause big problems on site.

Not so important for a chair. Rather important (and very costly) for an MRI suite, and yes, I have seen this happen.

If you need to ‘turn something around’, then rotate 180 around z vector.

If you need to mirror something - well, there IS a flag you can set - use the API and RevitLookup to find it, but be warned that it is very inconsistent in its application and use. You’ll need to use some Python to enact it, the following code will attempt to identify Mirrored (Facing Flipped) elements.

#Copyright(c) 2014-2016, DanEDU Dynamo
#Erik Falck Jørgensen, Technical University of Denmark (DTU)
#Modified (butchered?) by Adrian Esdaile

import clr
clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.Elements)

#Inputs is stored in the IN variable
element = list(UnwrapElement(IN[0]))

#check if element is FacingFlipped
list0 = []
list0 = [ (True if i.FacingFlipped else False) for i in element ]

#Assign output to the OUT variable
OUT = list0

Hello,
I still cannot get this to work. I tried all three planes as well. Please advise.

The script is waiting for a list of planes

Why would I want to mirror over more than one plane? Can I pull in the planes from the origin coordinates ie: the front/back plane from in the family? if so, how?

You might not, but you might want to mirror each of the elements by a different plane…

1 Like

This looks like a possible solution indeed: with no code modification, you could simply try to duplicate the plane by the amount of elements (I did not test it actually, I surely would if it was no so late already…)

1 Like

Is there a way to access the element which this nodes creates via the mirror process? I want to be able to set some of its parameters. Thanks!

What are the outputs of the node now? May be best to start a new thread linking back here as this question could help others and we can’t have two solutions on this thread.