Flip Family Instance in 180 Degree

Flip Family Instance in 180 Degree

patild
Contributor Contributor
2,500 Views
12 Replies
Message 1 of 13

Flip Family Instance in 180 Degree

patild
Contributor
Contributor

Hello,
     
      How to flip familyInstance in 180 degree(not to rotate base on Location Point).
      i am trying this..
      bool a = FamilyInstance.rotate();
      MessageBox.Show(a.ToString());
      but a is always returning false value.i am really frustrated with this.

      Please suggest.
 
 Thank You,
  Dhiraj

0 Likes
2,501 Views
12 Replies
Replies (12)
Message 2 of 13

Revitalizer
Advisor
Advisor

ElementTransformUtils.RotateElement or

ElementTransformUtils.MirrorElement

depending on what you are seaching for in detail




Rudolf Honke
Software Developer
Mensch und Maschine





0 Likes
Message 3 of 13

patild
Contributor
Contributor
Thank you for quick reply..
I tried both of your given ways, actually flip is what i m looking for pragmatically.
Mirror element is mirroring but i m drawing structure in slope, so unable to get required output with this.

Please suggest.
Thanks.
0 Likes
Message 4 of 13

Revitalizer
Advisor
Advisor

Hi,

 

if(yourFamilyInstance.CanFlipHand)

{

    yourFamilyInstance.flipHand();

}

 

Revitalizer




Rudolf Honke
Software Developer
Mensch und Maschine





0 Likes
Message 5 of 13

patild
Contributor
Contributor
Thank you for quick reply..
I tried this method . but doesn't work for me.
Only working case for me is manually "Flip Fitting" arrow besides fitting after selection.

Please suggest.
Thanks.
0 Likes
Message 6 of 13

Revitalizer
Advisor
Advisor

Hi patild,

 

no more ideas without more input.

All of the methods mentioned above should work, theoretically.

 

Since you are writing about "fitting": is your Element an MEP object, having connectors attached to it ?

Could you provide a screenshot ?

 

Another idea: could it be that the flip direction is connected to a parameter which can be set by you ?

 

 

Revitalizer




Rudolf Honke
Software Developer
Mensch und Maschine





0 Likes
Message 7 of 13

patild
Contributor
Contributor

Hello dear,

I have created a video showing, how it is done manually after pressing spacebar.

Please find attached.

 

I think this is revit inbuilt behaviour after pressing "Space Bar" key.

 

Thank you for your valuable time.

 

Regards,

Dhiraj.

0 Likes
Message 8 of 13

Revitalizer
Advisor
Advisor

Hi patild,

 

I've watched the video.

No idea how to simulate the space key behaviour.

 

As I stated in my first reply, you could use ElementTransformUtils.Rotate.

Get the pipe fitting's BoundingBoxXYZ, calculate its center point, calculate another point relative of it, in z direction.

Now you have the two points to define the rotation axis.

Rotation angle is Math.Pi/2, that's 90 degrees.

 

 

Now ideas, otherwise.

 

Regards,

Revitalizer




Rudolf Honke
Software Developer
Mensch und Maschine





0 Likes
Message 9 of 13

Revitalizer
Advisor
Advisor

Hi,

 

have you already tried to simultate pressing the space bar by using SendKeys ?

http://thebuildingcoder.typepad.com/blog/2008/12/driving-revit-from-outside.html

 

Revitalizer




Rudolf Honke
Software Developer
Mensch und Maschine





0 Likes
Message 10 of 13

jeremytammik
Autodesk
Autodesk

Dear Dhiraj,

 

I passed your query on to the development team.

 

The important things that you need to explain right from the start are:

 

I wish to programmatically flip an MEP fitting, like the built-in manual Revit 'Flip Fitting' command, also triggered by hitting the space bar.

 

That would have saved both of you two significant effort.

 

Many thanks to Revitalizer for his persistent attempts to help you!

 

Cheers,

 

Jeremy



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

0 Likes
Message 11 of 13

patild
Contributor
Contributor

Thank you Jeremy and specially Revitalizer for your valuable Time for reviewing this case.

 

I am waiting for positive feedback from your development team.

 

Thanks and Regards,

Dhiraj.

0 Likes
Message 12 of 13

jeremytammik
Autodesk
Autodesk

Dear Dhiraj,

 

Here is what I have heard back so far:

 

1. For flipping Structural Framing elements we use StructuralFramingUtils::flipEnds(). As I browsed code very quickly, it don’t have any excludings (except material) so it should work for every FamilyInstance (probably that is bad). This is not nice solution but I would give a try and check if StructuralFramingUtils::flipEnds() works. Flip for Structural Framing means “swap ends => exchange beginning with end”.

 

2 I think this question is more about the general family instance transform than MEP things, I am afraid I am not the best one to answer it , but here is some comments to my best knowledge:

 

2.1. FamilyInstance.rotate() is a flip operation actually, it will work only if FamilyInstance.CanRotate==True; e.g, when you select the family instance, some kinds of flip control should be shown. For the coupling the video, obviously, there is no such control after selection, so the FamilyInstance.rotate() wont’t work for it.

 

2.2. I think flip operation is just a kind of mirror operation, the difference is that, user can specify the axis for mirror while the axis for flip is computed. Not all Revit family instances can be mirrored or flipped;  but all family instance should be able to be generally  rotated.

 

I hope this helps.

 

Please let us know how it goes and how you end up solving this.

 

Thank you!

 

Cheers,

 

Jeremy



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

0 Likes
Message 13 of 13

patild
Contributor
Contributor

Thank you Jeremy for that step by step information. I have search for "CanRotate" property for mep fittings which have flip arrow but it is false for those fittings also.

 

Please Suggest.

 

Please find attached video for more info.

 

Thank you.

Dhiraj.

0 Likes