Create finishing layers in general areas

Hi all. I am trying to create a script where finishing layers are modeled in all rooms that are a general area. To define the area’s im using a parameter called “Algemene ruimte”. When this parameter is true, finishing layers are modeled in this room. Actually my script is working perfectly exept the walls are not joining with the existing walls.

For the joining part i am using a python script which i’ve found on the internet. The two parts of the script are working when they run seperatly but when i combine them the walls wont get joined. Anyone out there who can help me?

This is the python script:

Blockquoteimport clr

clr.AddReference(“RevitAPI”)
from Autodesk.Revit.DB import *

def overlap1D(a1, a2, b1, b2):
if a2>=b1 and b2>=a1:
return True
return False

def bbIntersect(bbA, bbB):

return overlap1D(bbA.Min.X,bbA.Max.X,bbB.Min.X,bbB.Max.X) and overlap1D(bbA.Min.Y,bbA.Max.Y,bbB.Min.Y,bbB.Max.Y) and overlap1D(bbA.Min.Z,bbA.Max.Z,bbB.Min.Z,bbB.Max.Z)

#The inputs to this node will be stored as a list in the IN variables.
listA = UnwrapElement(IN[0])
listB = UnwrapElement(IN[1])

output =

for a in listA:
bbA = a.get_BoundingBox(None)
if not bbA is None:
for b in listB:
bbB = b.get_BoundingBox(None)
if not bbB is None:
if bbIntersect(bbA,bbB):
output.append([a,b])

#Assign your output to the OUT variable.
OUT = output

Blockquote

Create finishing layers on walls.dyn (93.1 KB)

Sorry this took so long to post, but there was more than the ‘obvious’ issue at play.

The updated graph I’d recommend is this:

There were two issues at play.

  1. Joining geometry requires taking an element A’s geometry object (not the same as the element itself), and making a reference to element B’s geometry object (again, not the same as the element itself) and is then modified (and vice versa for element B to element A). To do this, the geometry elements both need to be modified, which means they need to be committed to the database for them to be updated. This means that Dynamo needs to write them in in permanence. Your graph works in separate pieces because it forces the two transactions - the Transaction.Start and Transaction.End nodes in my example do jus this - telling Dynamo to commit the work it’s done to that point to the Revit DB, and then start a new transaction with the database.
  2. Your Pythonscript for joining data utilized bounding boxes to test for intersection. This is problematic for any sort of angled wall because you’ll get a BUNCH of false positive intersections because of bounding boxes don’t work on the actual geometry, but are the XYZ aligned cuboid which contains all of the element’s geometry. I started to look into the DataShapes node for Element.IntersectsElement node which would work, but I realized you already have a 1:1 mapping of ‘new wall’ and the ‘associated wall’ it needs to join to. Adding the extra List.FilterByBoolMask gets you that association, and odes so without having to ‘go back to the well’ so to speak.
6 Likes

I hope people often tell you that you are great, becouse you are! Thank you very much for the help.

1 Like

Glad to help.

:slight_smile: