Room separation lines aren't room bounding!

I’ve used Python to place some room separation lines, They’re at exactly the right level and form closed loops.

image

On floor 00 they work - a room is placed and it’s bounded.

However, on the other levels they’re not bounding.
This is level 01 for example:
image.

I’m guessing it’s maybe to do with the Z coordinate rounding maybe?

How do I overcome this?

Pull onto plane might work, if the node still exists

I think it wants me to give it a view for each level. :frowning:

I just tested it with a different active view and got a different result.

1 Like

They’re still not room bounding:

import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.GeometryConversion)
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
from Revit.Elements import SketchPlane
doc = DocumentManager.Instance.CurrentDBDocument
TransactionManager.Instance.EnsureInTransaction(doc)

SketchPlaneVec = IN[0]
CornerPointList = UnwrapElement(IN[1]) 
view = IN[2]

doccreation = doc.Create
curves = []
RoomSeparators = []

#Convert the Dynamo rectangles into Revit SketchPlane
sketchplanes =  []
for i in SketchPlaneVec:
	sketchplanes.append(SketchPlane.ByPlane(i))
	
# Create Revit lines based on the corner points
for CornerPoints in CornerPointList:
	curvearray = CurveArray()
	for i in range(len(CornerPoints)): 
		start_point = CornerPoints[i].ToRevitType()
		end_point = CornerPoints[(i + 1) % 4].ToRevitType()
		revit_line = Line.CreateBound(start_point, end_point)
		curvearray.Append(revit_line)
	curves.append(curvearray)
	RoomSeparators.append(doccreation.NewRoomBoundaryLines(UnwrapElement(sketchplanes[0]), curvearray, UnwrapElement(view[i])))

elementlist = []
for items in RoomSeparators:
	for item in items:
	    elementlist.append(item)
    
OUT = elementlist

TransactionManager.Instance.TransactionTaskDone()


OK, I think this may be a glitch.
@jacob.small tagging you :smiley: … Is this a known glitch?
Or is it my code?

If I delete the room bounding at the same level this room stays.
If I delete ALL the room bounding (all levels) then the room is unbounded.

The room bounding lines, regardless of which level they’re at are only bounding one level.

Not sure what you did, so I can’t confirm anything being a glitch or not.

You’re not iterating through each plane (which doesn’t actually matter because the lines have Z coordinates) or views (which is causing your problem). You’re using sketchplanes[0] and view[i] for all boundaries. The problem is that you don’t iterate through i in the for CornerPoints in CornerPointList: loop, you iterate through it in the next subloop. So by the time you get to view[i] for the boundary creation you’ve already iterated through to i = 4.

2 Likes

Changed this bit:

for index, cur in enumerate(curves): 
	RoomSeparators.append(doccreation.NewRoomBoundaryLines(UnwrapElement(sketchplanes[index]), cur, UnwrapElement(view[index])))

and it seems to work :slight_smile:

Thanks all :smiley:

2 Likes