Rotate & swap values

When spatial planning, some practices prefer to use proxy Revit elements to speed up the design iteration process. At BVN, we have developed a suit of families which we call ‘Push-it’. We use this methodology for the early stages of healthcare projects where the schedule of accommodation is critical.

 

In this workflow, an architectural column family is created which represents a ‘real’ Revit room. It contains various instance parameters including the width and length. This allows users to easily flex the family without fear of the room ‘breaking’ due to a missing wall. Hence, it is a quick and dirty spatial planning tool before we proceed to substituting these families for real Revit rooms and walls.

The family has a 2D door family nested into it. Using instance parameters, the user can decide where the door is to be placed. However, to ensure fast computation, only two adjacent walls are available for the door to be placed. If the door is required to be in the opposite wall, the family can simply be flipped using the instance hands. Sometimes when placing the family, users will not set the rotation correctly, resulting in doors not opening onto the corridor. To fix this, since only two door locations are possible, the family must be rotated 90 degrees, flipped if required, and then the width and length parameters swapped.

Obviously, prevention is better than cure but if some families do manage to slip through the gaps, you can use the ‘Family.RotateAndSwapParameters’ custom node available in the BVN Dynamo package (v1.4.2). The node will rotate the family 90 degrees and swap the width and length parameters. By default, these parameters are named ‘SP_Width’ and ‘SP_Depth’ but they can be updated to suit your own shared parameter names. After running the script, the room should look exactly the same but with the door on the adjacent wall.

The custom node first calculates the existing rotation of the family. Known as ‘Facing orientation’, the rotation is actually expressed as a vector within the Revit API. If you simply try to rotate the family 90 degrees using the ‘FamilyInstance.SetRotation’ node, it will override the facing orientation rather than adding 90 degrees to the existing rotation.

Therefore, we need to use the ‘Vector.AngleAboutAxis’ node to compare the existing facing orientation to the Y-axis to calculate the existing rotation in degrees.  Once calculated, we can set the rotation to equal the existing rotation plus 90 degrees. After that, it is just a matter of swapping the width and length values.

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: