Is element flipped on Workplane

Hi Everyone.

I have had an extensive look and cant seem to find any nodes that return whether an element has been flipped on its Workplane or not.
I have an issue in one of my models where some light fittings have been flipped (eg. are upside down) and i need to rectify them. I am wanting to save time by reporting the flipped status and then pushing the change so it fixes the issue.
I find plenty of scripts that can flip an element on its plane but nothing that returns its status.
The nodes I have tried do not report what i am after. (see below)


image

I apologise in advance if it has been discussed in here and I have missed it.

Thanks in advance

Brock

Did you have a look here?

1 Like

Hi There,
Yes i did look at this page unfortunately im not up to speed yet with Python and using the Revit API.
I was hoping there was a node out there that was able to “Is Element flipped on workplane”.

Meanwhile I am trying my best to get my head around python.

I am pretty much after a bool that will process the following API.

@bwilkeA77N6 try this one, it is an amendment of the script found in the page provided by @bvs1982
FlipComponent.dyn (7.7 KB), it will report which family can be flipped, which family is flipped, and which family is not flipped while you have the Bool set to False, once you check the families and would like to proceed, set the Bool to True and Run again, all flipped families will be restored, hope it helps:

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

import Autodesk.DesignScript.Geometry as geom

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.Elements)
clr.ImportExtensions(Revit.GeometryConversion)
clr.AddReference("RevitAPI")
from Autodesk.Revit.DB import *

def tolist(obj1):
	if hasattr(obj1,"__iter__"): return obj1
	else: return [obj1]

elem = UnwrapElement(IN[0])
flipEm = IN[1]

outList = []

TransactionManager.Instance.EnsureInTransaction(doc)

def tolist(obj1):
	if hasattr(obj1,"__iter__"): return obj1
	else: return [obj1]

elems = tolist(UnwrapElement(IN[0]))

TransactionManager.Instance.EnsureInTransaction(doc)
for elem in elems:
	if elem.CanFlipWorkPlane and elem.IsWorkPlaneFlipped == False:
		outList.append("The Work Plane is not Flipped")
	elif elem.CanFlipWorkPlane and elem.IsWorkPlaneFlipped == True:
		if flipEm == True:
			elem.IsWorkPlaneFlipped = False
			outList.append("Element is restored to its correct location")
		else:
			outList.append("The Work Plane is Flipped!")
	else:
		outList.append("Element cannot be flipped by its Workplane")
TransactionManager.Instance.TransactionTaskDone()

OUT = zip(elems,outList)

2 Likes

Thankyou this is exactly what i am after.
Will be excited the day when I have my head around python.

Thankyou everyone for the help!!

2 Likes

Hi everyone,

Thank you so much for this thread. It has been super useful to a beginner like me.

The question I have is that I can not make this script “FlipComponent.dyn” work with nested components. I get the status that those nested components that are flipped on the workplane are not. Whereas when I run this script inside the family where those components are located, I get that they are flipped, which is correct.

I would appreciate it if someone could help me to find a way to make this script work with nested components.