When spatial planning, some practices prefer to use proxy Revit elements to speed up the design iteration process. For example, 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 Revit room. It contains various instance parameters, including the width and length. This workflow 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 substitute these families for real Revit rooms and walls.
Proxy Revit element
The family has a 2D door family nested into it. The user can decide where the door is to be placed by using instance parameters. 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 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. 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.
Rotate and swap parameters
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. 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 shared parameter names. After running the script, the room should look the same but with the door on the adjacent wall.
Existing rotation
The custom node first calculates the existing rotation of the family. Known as ‘Facing orientation‘, the rotation is expressed as a vector within the Revit API. If you 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.
Rotation angle
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.