ElementTransformUtils.RotateElement() not working using horizontal location line.

ElementTransformUtils.RotateElement() not working using horizontal location line.

Anonymous
Not applicable
1,510 Views
8 Replies
Message 1 of 9

ElementTransformUtils.RotateElement() not working using horizontal location line.

Anonymous
Not applicable

Hi,

 

I am trying to rotate a linear structural Framing family instance around its location line  to align it nicely with other elements in order to get "pretty" roll angle values afterward. 

 

My code seems to work ok for vertical members but does not work for horizontal member !!! 

// This does not work when line curve is horizontal ...

var beam = Document.Create.NewFamilyInstance(curve, _MemberProfileSymbolType, Level, StructuralType.Beam);

ElementTransformUtils.RotateElement(Document, beam.Id, (Line)curve, Math.PI * .25);

 

 

 I also tried using the Location.Rotate() method without success.

Any idea ?

 

0 Likes
1,511 Views
8 Replies
Replies (8)
Message 2 of 9

Anonymous
Not applicable

I did try the rotate command and I got the same problem. 

 

STR : 

Create an linear horizontal Structural Framing element.

Switch to an elevation view normal to the Structural Framing element direction.

Try to rotate the element. 

 

Note: I am using Revit 2021.1.2.

 

 

VinnyCout_1-1620820792648.png

 

0 Likes
Message 3 of 9

RPTHOMAS108
Mentor
Mentor

The section rotation can be set via the instance parameter:

 

STRUCTURAL_BEND_DIR_ANGLE -1001586

 

Which is noted as 'Cross Section Rotation' in the UI for English language Revit.

 

 

0 Likes
Message 4 of 9

Anonymous
Not applicable

@RPTHOMAS108

 

STRUCTURAL_BEND_DIR_ANGLE is what I call the Roll Angle.

 

I want to combine the Roll Angle and Rotation transform in order to get to the correct orientation. I know this could be achieved by only manipulating  the STRUCTURAL_BEND_DIR_ANGLE value however my aim is to position the members (Beams/Braces) so that the Roll Angle does not end up being to "complex".

Imagine placing  studs and braces to form the wall structural framing, it is much better to rotate the member relative to the wall direction rather than world coordinate system. My aim is to set the initial member transform (Roll Angle == 0) so that the Roll Angle (STRUCTURAL_BEND_DIR_ANGLE) can be set to pretty angle values ( 0, 90, 180 etc)

 

As I said in my initial post, I managed to achieve this for vertical members but for horizontal members the rotate operation does not work if the rotation axis is parallel to the location curve/ line.

 

The program seems to do something special when the location line is horizontal which causes different behaviour when rotation the member along its axis.

 

I hope this clarifies things. 

 

0 Likes
Message 5 of 9

RPTHOMAS108
Mentor
Mentor

Not following what your objectives are perhaps a visual example would help.

 

Your structural framing is likely hosted to a level (with that family instance creation overload) and so the range of orientations you get by manipulating the ends will be limited (to offsets from level).

A location line unlike a location point doesn't have a rotation orientation, it is just a line with infinite possible normal directions.

When member is vertical on it's hosted level the section can be rotated because the member direction angle (Yaw) coincides with section rotation angle (Roll). You are not changing the parametric section rotation parameter this way.

 

Does rotating the member around it's length direction work when it has a 45 degree pitch?

 

I'm not sure the Yaw, Pitch, Roll analogy is a good one because they are local to element. However I'm using them to define the three angle rotations that define orientation from a global starting point.

 

0 Likes
Message 6 of 9

Anonymous
Not applicable

 @RPTHOMAS108 

Here is an illustration. I am showing the family instance coordinate system and the cross section rotation.

 

you can see that the roll angle is 0 but the member is not aligned with the world coordinate system but it is aligned with the wall.

I achieved this by using ElementTransformUtils.RotateElement() method using the location line of the member as rotation axis and applied the appropriate angle to align the section with the wall without changing the the roll angle of the member.  Result : it is easier to manipulate the roll angle in relation to the wall line... 

 

Trying to do this on a horizontal member does not work. ElementTransformUtils.RotateElement() fails ...

 

VinnyCout_0-1620922941376.png

 

0 Likes
Message 7 of 9

RPTHOMAS108
Mentor
Mentor

You should probably be using structural columns for your vertical members (structural framing wasn't really intended to be put in vertical). In the past I find these kinds of modelling choices are the things that tend to go wrong when files are upgraded (or even sometimes when you open the same file later).

 

If you have a vertical wall then your horizontal members will have a section rotation of 90. If your wall is slanted your horizontal member section rotation will be set to suit the rake angle of the wall. 

 

As an extreme you could host the framing on a surface of the wall to forget about the section angle, perhaps (if you find suitable reference).

 

 

0 Likes
Message 8 of 9

Anonymous
Not applicable

I would expect to be able to place brace Structural Framing  elements in any orientation/position I want via the API.

 

These differences in behaviours depending on the Curve location make the API almost impossible to use to perform advanced operations. 

 

I noted that, in the case of non horizontal members, I needed to use the move function using zero displacement in order to get a correct transform matrix...

 

It is really frustrating to have to find silly tiny workaround to get things to work as anyone would expect.

0 Likes
Message 9 of 9

kevin.anggrek
Enthusiast
Enthusiast

Hi,

 

I encountered this problem today as well.

So basically, horizontal members can't be rotated around its Location Line (the Roll Axis) by using the ElementTransformUtils.RotateElement()? And the only way is to set the rotation angle to the STRUCTURAL_BEND_DIR_ANGLE BuiltInParameter?

 

I wonder why the method can't be applied to rotate the horizontal members around its Roll angle? is it because of the reasons stated in @RPTHOMAS108 's comment here:

 

Your structural framing is likely hosted to a level (with that family instance creation overload) and so the range of orientations you get by manipulating the ends will be limited (to offsets from level).

A location line unlike a location point doesn't have a rotation orientation, it is just a line with infinite possible normal directions.

When member is vertical on it's hosted level the section can be rotated because the member direction angle (Yaw) coincides with section rotation angle (Roll). You are not changing the parametric section rotation parameter this way.


 

0 Likes