# Finding wall in between

**URL:** <https://forum.dynamobim.com/t/finding-wall-in-between/112857>\
**Category:** Revit\
**Tags:** dynamo\
**Created:** [October 28, 2025, 10:07am UTC](https://forum.dynamobim.com/t/finding-wall-in-between/112857 "2025-10-28T10:07:44Z")\
**Posts on this page:** 4\
**Page:** 2

<div class="post-metadata">

**Author:** ![c.poupin](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/c.poupin/32/89152_2.png) [@c.poupin](https://forum.dynamobim.com/u/c.poupin)\
**Post date:** [November 3, 2025, 8:43am UTC](https://forum.dynamobim.com/t/finding-wall-in-between/112857/21 "2025-11-03T08:43:58Z")

</div>

The code needs to be slightly adapted for a list of rooms as input instead of a single room. I’ll gpost the complete solution if you get stuck.

---

<div class="post-metadata">

**Author:** ![Kai.Wildeman](https://avatars.discourse-cdn.com/v4/letter/k/8e8cbc/32.png) [@Kai.Wildeman](https://forum.dynamobim.com/u/Kai.Wildeman)\
**Post date:** [November 3, 2025, 12:49pm UTC](https://forum.dynamobim.com/t/finding-wall-in-between/112857/22 "2025-11-03T12:49:57Z")

</div>

okay so ive got it working with the following python node

[Python script\_V1.txt](https://forum.dynamobim.com/uploads/short-url/c2od68Od9MKtJfbiC6aEA5erd0H.txt) (3.6 KB)

 ![V2_python related_2025-11-03_01-46-45](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/c/d/cd7acade5aa107f0e0348c7351f47b030ab49690.png)

---

<div class="post-metadata">

**Author:** ![Kai.Wildeman](https://avatars.discourse-cdn.com/v4/letter/k/8e8cbc/32.png) [@Kai.Wildeman](https://forum.dynamobim.com/u/Kai.Wildeman)\
**Post date:** [November 3, 2025, 12:53pm UTC](https://forum.dynamobim.com/t/finding-wall-in-between/112857/23 "2025-11-03T12:53:15Z")

</div>

my next problem is that im trying to place my module but it wont rotate the right way. do you guys have any idea on how to fix that? the back of the module needs to face the wall we found between both rooms. right now this is what i get when i place the modules. the red circles are the modules that are placed right

 ![afbeelding](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/0/7/078fa94393de4c63c24b223b14ca72aa734dd6ef.png)

---

<div class="post-metadata">

**Author:** ![c.poupin](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/c.poupin/32/89152_2.png) [@c.poupin](https://forum.dynamobim.com/u/c.poupin)\
**Post date:** [November 3, 2025, 7:40pm UTC](https://forum.dynamobim.com/t/finding-wall-in-between/112857/24 "2025-11-03T19:40:30Z")

</div>

Here is an example of how to get the angle from XYZ.BasisY in radians (You can also use XYZ.BasisX, depending on the orientation of your family.)

```python
import clr
import sys
import System
#
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
import Autodesk.DesignScript.Geometry as DS

#import Revit API
clr.AddReference('RevitAPI')
import Autodesk
from Autodesk.Revit.DB import *
import Autodesk.Revit.DB as DB

#import transactionManager and DocumentManager (RevitServices is specific to Dynamo)
clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument

    
def find_wall_by_adjacent_room(room, adajcent_room_name):
    #
    calculator = SpatialElementGeometryCalculator(doc)
    #
    if calculator.CanCalculateGeometry(room):
        results = calculator.CalculateSpatialElementGeometry(room)
        roomSolid = results.GetGeometry()
        for face in roomSolid.Faces:
            for subface_info in results.GetBoundaryFaceInfo(face):
                if subface_info.SubfaceType == SubfaceType.Side:     
                    lnkelemId = subface_info.SpatialBoundaryElement 
                    elem = doc.GetElement(lnkelemId.HostElementId )
                    if isinstance(elem, Wall):
                        subface = subface_info.GetSubface()
                        bbxuv = subface.GetBoundingBox()
                        face_normal = subface.ComputeNormal((bbxuv.Min + bbxuv.Max) / 2)
                        # compute the angle to XYZ.BasisZ
                        factor = 1 if face_normal.CrossProduct(XYZ.BasisY).Z > 0.01 else -1
                        angle = face_normal.AngleTo(XYZ.BasisY) * factor
                        #
                        # set the length of the vector
                        face_normal = face_normal * elem.Width * 1.1 # 1.1 --> margin offset vector
                        midpt = subface.Evaluate((bbxuv.Min + bbxuv.Max) / 2)
                        project_pt = midpt + face_normal
                        ajacent_room = doc.GetRoomAtPoint(project_pt)
                        if ajacent_room is not None and adajcent_room_name in ajacent_room.Name : 
                            print(angle)
                            return elem
    
input_room = UnwrapElement(IN[0])
adajcent_room_name = IN[1]

OUT = find_wall_by_adjacent_room(input_room, adajcent_room_name)

```

[Previous page](https://forum.dynamobim.com/t/finding-wall-in-between/112857.md?page=1)
