Pipe Accessory cannot be rotated when family is not "Always vertical" and family instance is not vertical

Pipe Accessory cannot be rotated when family is not "Always vertical" and family instance is not vertical

ABertzouanis9F98Y
Enthusiast Enthusiast
1,921 Views
5 Replies
Message 1 of 6

Pipe Accessory cannot be rotated when family is not "Always vertical" and family instance is not vertical

ABertzouanis9F98Y
Enthusiast
Enthusiast

Revit API Community,

 

Pipe accessories Families which do not have the parameter "Always vertical" activated, if their instances are not vertical, then those cannot be rotated using the RotateElement method giving the error message below.

ABertzouanis9F98Y_4-1636389136924.png

 

Pipe fitting can be rotated (rotation is achieved without errors):

ABertzouanis9F98Y_0-1636388465713.png

ABertzouanis9F98Y_1-1636388477987.png

 

Pipe fitting cannot be rotated (the above error shows up): 

ABertzouanis9F98Y_2-1636388524203.png

ABertzouanis9F98Y_3-1636388563501.png

To reproduce:

Please use the "Gland Cocks Valve - 8-40 mm - Joined" family which comes with the out of the Box Revit Family Library, edit the family, untick the "Always vertical" family parameter and load back in the project. Create an instance of this family, select it and click once at the  following grips to rotate this 90 degrees. Then use the rotate Revit command to rotate across the Z Axis.

ABertzouanis9F98Y_5-1636389333332.png

 

 

I also noticed that the CanRotate family instance parameter returns true when the Pipe fitting cannot be rotated. This parameter should at least return false. 

 

I am wondering if there is any reason for the above limitations?

 

Regards

0 Likes
1,922 Views
5 Replies
Replies (5)
Message 2 of 6

MarryTookMyCoffe
Collaborator
Collaborator

canRotate is true because you still can rotate on a plane, you just can't rotate on local axis X, but rotate on local axis Z is possible.

-------------------------------------------------------------
--------------------------------|\/\/|------------------------
do not worry it only gonna take Autodesk 5 years to fix bug
0 Likes
Message 3 of 6

ABertzouanis9F98Y
Enthusiast
Enthusiast

@MarryTookMyCoffe - many thanks for your comment.

 

Could you please advise how to rotate this family instance on the family Z axis?  Please, refer to the attached Revit file.

 

It seems that Revit only allows to rotate the element on the Project Z axis and not on the Family's Z axis.

 

ABertzouanis9F98Y_0-1636710950627.png

 

0 Likes
Message 4 of 6

RPTHOMAS108
Mentor
Mentor

It's a common theme and more Revit than RevitAPI and not just for plumbing.

 

If it were work plane based it probably could be manipulated that way, you would host it on a ref plane and rotate it on that.

 

I would suggest changing it but I don't know why it was created as not being work plane based (from what I can tell most pipe accessories are that way). 

 

https://forums.autodesk.com/t5/revit-architecture-forum/can-t-rotate-a-family-that-i-created/td-p/10...
https://forums.autodesk.com/t5/revit-architecture-forum/rotate-error-quot-can-t-rotate-element-into-...
https://forums.autodesk.com/t5/revit-mep-forum/can-t-rotate-element-into-this-position/m-p/8855112#M...

0 Likes
Message 5 of 6

ABertzouanis9F98Y
Enthusiast
Enthusiast

@RPTHOMAS108 This is not a Revit issue as element can still be rotated by the UI using the rotation grips (refer to the image below). The problem is just about the Revit API which currently does not offer this rotation functionality (equally to the UI clicking at the rotation grips). 

 

ABertzouanis9F98Y_0-1636727024675.png

 

0 Likes
Message 6 of 6

RPTHOMAS108
Mentor
Mentor

You are right but I think in reality the element isn't being rotated about local x it is instead being mirrored about midway between local Y and Z (which gives same result).

 

I find the below mirror operation works for both always vertical and not always vertical.

 

Dim Fi As FamilyInstance = IntDoc.GetElement(R)
Dim T As Transform = Fi.GetTransform

'Doesn't work if always vertical not selected
'ElementTransformUtils.RotateElement(IntDoc, Fi.Id, Line.CreateBound(T.Origin, T.Origin + T.BasisX), 0.5 * Math.PI)

'Doesn't work if always vertical not selected
'Fi.Location.Rotate(Line.CreateBound(T.Origin, T.Origin + T.BasisX), 0.5 * Math.PI)

'Create mirror plane with normal midway between local Y and Z
THIS BELOW WORKS
Dim P1 As Plane = Plane.CreateByNormalAndOrigin((T.BasisZ + T.BasisY).Normalize, T.Origin)
ElementTransformUtils.MirrorElements(IntDoc, {Fi.Id}.ToList, P1, False)

'Mirrors single element similar to above but creates copy (so not suitable)
'ElementTransformUtils.MirrorElement(IntDoc, Fi.Id, P1)

 

0 Likes