Flip Work Plane Equivalent

I am trying to flip several families and I was wondering if there was a node or method in Python to access the flip work plane action/button

I’ve tried several flip face orientation nodes but they had no effect and I am aware of the ability to mirror or rotate but ideally I would like to access the flip work plane command if possible. I know there has been an example in the API so I do believe it is possible. Anyone have a quick solution? Thanks!

1 Like

@Dynamonkey
these two nodes from Clockwork package should do what you want

Hi @Dynamonkey,

If you want to get jiggie with python I think the FamilyInstance method flipFacing() might be what you want.

Although, i would use @Mostafa_El_Ayoubi’s solution. Easier.

Cheers,
Dan

1 Like

Hey @Daniel_Woodcock1 & @Mostafa_El_Ayoubi

I will take a look again but yes as mentioned in my post, I’ve tried those flip face nodes but unfortunately had no success. I have a feeling python is the way to go. The API example I was referring to calls for:

famInst.IsWorkPlaneFlipped = true

is there any equivalent for this in Python?

Hi @Dynamonkey,

Instead of elem.flipFacing() Just use elem.IsWorkPlaneFlipped(b) where “b” is a bool value.

There are several flip methods (although the one you mention is a property).

Family Instance Members (Flip)

Family Instance Properties (Flip)

I think we are getting closer. I did a quick test literally adding onto the python code in the FlipFacing node by adding IN[1] to receive a Boolean toggle value and switching item.FlipFacing() to item.IsWorkPlaneFlipped(b) where b = IN[1]. Output is empty and family instance(s) remains unchanged.

Hi @Dynamonkey,

Sorry, it was my fault, I made a mistake with how I told you to set the property (rookie mistake). Properties need to be set with an = so elem.IsWorkPlaneFlipped = b and not elem.IsWorkPlaneFlipped(b).

It seems to work fine here, see below (script attached also)…

FlipComponent.dyn (5.5 KB)

Cheers,
Dan

4 Likes

Now that’s what I call teamwork. Glad we got this one sorted out.

1 Like

Is there any way we can apply the same principle to do it for multiple elements? I tried replacing the node with the one for multiple elements but it wouldn’t work.

1 Like

Hi @Viraj_Voditel1,

Yes, this is pretty simple. The following demostrates how to do this…

import clr

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]

elems = tolist(UnwrapElement(IN[0]))
bools = tolist(IN[1])
TransactionManager.Instance.EnsureInTransaction(doc)
for elem,b in zip(elems, bools):
	elem.IsWorkPlaneFlipped = b
TransactionManager.Instance.TransactionTaskDone()

Hope this helps.

Cheers,
Dan

3 Likes

Hi @Daniel_Woodcock1

I’ve tried to run your script with multiple but it will only slip one still? I also have an error I don’t know how to fix in the python script. Are you able to provide some help or spot the one thing I am missing?

Thanks if you can!

image

Hi @Jade,

Yes, two problems I can see.

  1. The Boolean list needs to have the same number of bools as you do elements. It’s a 1:1 operation as the elements/bools are zipped.

  2. You are trying to flip a tag element and this doesn’t support flipping (the yellow balloon warning message) since they are not hosted to planes as they are 2d elements. I don’t think tags actually support flipping at all, only switching between orientation (horizontal/vertical) or changing their Family Type.

Hope this solves your problem.

Cheers,
Dan

Hi @Daniel_Woodcock1

Thanks for responding. Where do I place 1. Do I have that in the code block and adjust the list or do I need to place the value in the python script?

  1. is working fine, it flips tagged or untagged, it just only flips one instead of all. Which ^ should fix hopefully!

Kind regards

HI @Jade,

Yeah, you have 2 boolean values in the code block, but the number of these needs to match the number of elements you want to flip. So, in this instance, you need 7 as you have 7 Elements in the Select Model Elements node.

if you only need True or only need false, use the List.Cycle node. See examples below…

2 Likes

Hi @Daniel_Woodcock1 thank you for responding I am sure this will work now when I test run! Thank you again for being so helpful much appreciated!

1 Like

Hi Daniel_Woodcock1,

Where is that image you posted of the properties from?

Thanks,

Thank you for your help @Daniel_Woodcock1. Much Appreciated.

The FlipFacingOrientation node has the same port for in and out (familyInstance) these are usually different.

The newer nodes have extra ports as well.

I can get my script to point at all selected light fixtures, but nothing happens in the model.

Thanks

Hello,t

I would like to flip those lighs fixtures, I ve tried lots methodes and script.
But idea using dynamo. Someone have idea ?

Thanks

Light fixtures are PLANE based and insert upside down 9 times out of 10 unless you build them the right way.

I will write a “flipper” script for you.