# Align Family instance to side of the wall

**URL:** <https://forum.dynamobim.com/t/align-family-instance-to-side-of-the-wall/92214>\
**Category:** Revit\
**Created:** [July 26, 2023, 12:30pm UTC](https://forum.dynamobim.com/t/align-family-instance-to-side-of-the-wall/92214 "2023-07-26T12:30:47Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ammad](https://avatars.discourse-cdn.com/v4/letter/a/f0a364/32.png) [@Ammad](https://forum.dynamobim.com/u/Ammad)\
**Post date:** [July 26, 2023, 12:30pm UTC](https://forum.dynamobim.com/t/align-family-instance-to-side-of-the-wall/92214/1 "2023-07-26T12:30:47Z")

</div>

Hi Everyone.

I am placing this desk family at the corners of the wall (Family origin point is the bottom left point of the Desk) with the help of dynamo. I placed it correctly as shown in the picture 1

I want to rotate it and align the longer side of the desk with the horizontal walls(Sometimes to the vertical walls). Can you please tell me how to do this. Manually i used the mirror command to make it look right.

 ![dynmao pic 1](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/1/4/14d64b04e1f3393863dd7ea9a4f5d25186dd2279.png)

i want to filter the walls if this a Bottom left corner, Top left corner, Right top corner or Right bottom corner. and then i can apply the mirror commands on that.

But i dont know how to filter the 4 types of corners. Or there is another easy way to do that?

---

<div class="post-metadata">

**Author:** ![Daan](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/daan/32/82246_2.png) [@Daan](https://forum.dynamobim.com/u/Daan)\
**Post date:** [July 26, 2023, 1:03pm UTC](https://forum.dynamobim.com/t/align-family-instance-to-side-of-the-wall/92214/2 "2023-07-26T13:03:10Z")

</div>

Hi @Ammad ,

This problem is a little bit more difficult than first meets the eye, lets say for example you have walls in a ‘8’-shape, on which side of the wall should the desk then be placed?

Could you please share what you have created in Dynamo so far? Please share some files from dynamo and the host aswel 🙂

---

<div class="post-metadata">

**Author:** ![Ammad](https://avatars.discourse-cdn.com/v4/letter/a/f0a364/32.png) [@Ammad](https://forum.dynamobim.com/u/Ammad)\
**Post date:** [July 26, 2023, 1:28pm UTC](https://forum.dynamobim.com/t/align-family-instance-to-side-of-the-wall/92214/3 "2023-07-26T13:28:31Z")

</div>

![Dynamo](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/f/b/fbf8bff53362164ec6342d11048425f68b44456c.png)  
Here is the graph. Actaully i am placing column family which it L shape and the longer side on the L shape should align the vertical walls.

I tried it for furniture first but actually i have to do it for the column.

---

<div class="post-metadata">

**Author:** ![Ammad](https://avatars.discourse-cdn.com/v4/letter/a/f0a364/32.png) [@Ammad](https://forum.dynamobim.com/u/Ammad)\
**Post date:** [July 26, 2023, 1:29pm UTC](https://forum.dynamobim.com/t/align-family-instance-to-side-of-the-wall/92214/4 "2023-07-26T13:29:43Z")

</div>

![dynmao pic 1](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/9/2/92005b0a5bdeb7fc25f6b96c6c875b6d9e380456.png)  
I want this result. I dont know how to rotate it si that the longer side of the L column is always aligned to the vertical walls

---

<div class="post-metadata">

**Author:** ![Daan](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/daan/32/82246_2.png) [@Daan](https://forum.dynamobim.com/u/Daan)\
**Post date:** [July 26, 2023, 1:56pm UTC](https://forum.dynamobim.com/t/align-family-instance-to-side-of-the-wall/92214/5 "2023-07-26T13:56:38Z")

</div>

Hi @Ammad ,

1. To rotate an element use Element.SetRotation after the FamilyInstance creation node. This node expects a rotation value as double.

2. To get the necessary rotation value you need to know which grid is the one you want to base your direction/ rotation value of. You could just pick one grid and use Line.Direction to get a vector or you could determine which (vertical) grid is the closest if they have different vectors (using Geometry.DistanceTo, List.MinimumItem, List.IndexOf and List.GetItemAtIndex, in that order with some list level management.).

3. From there using the AngleAboutAxis node you can transform that vector/ those vectors into a rotation value which you can use for the Element.SetRotation node.

From there I would bring in the walls to determine which of the 4 rotation/ mirrored states the element should be in.
