Get room centerline(s) and intersections

Dear all,

I am currently trying to get the centerline(s) of a room (see picture attached). In addition, I would like to place family instances right on the intersection/edge points.
Does anybody know a smart and simple way to do so?

Thanks in advance!
Martin

Hi Martin,
This would be my take on this problem:

Hope this helps!

1 Like

Thanks, I’ll try it asap!

Unfortunately, thats my result:

EDIT:
If I set the tolerance to 5000, for example, it will only display one of the neighboring points, but not the center either.

I think it works, all the little blue dots are the points from the intersection. You just have to input an actual family type in the dynamo graph.

These are the points you wanted, right?

1 Like

I think my description was a little unclear, excuse me!

I want something like this:

btw: I removed the instances to keep a clear overview :).

It seems kind of impossible to me, because you want te points in the middle of the room. Perhaps some genius can think of a solution :).
What i would suggest as a temporary fix would be to manually draw model lines in Revit and extract the points with dynamo. But that would still require much manual work.

Hi,

for the centerlines you could try a code like this:

import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *

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

clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.GeometryConversion)
#The inputs to this node will be stored as a list in the IN variables.

rooms = UnwrapElement(IN[0])
boundaries = []

options = SpatialElementBoundaryOptions()
options.SpatialElementBoundaryLocation = SpatialElementBoundaryLocation.Center

for r in rooms:
	lines = []
	for loop in r.GetBoundarySegments(options):
		for segment in loop:
			c = segment.GetCurve()
			p0 = c.GetEndPoint(0).ToPoint()
			p1 = c.GetEndPoint(1).ToPoint()
			#line = Line.CreateBound(p0,p1)
			line = Autodesk.DesignScript.Geometry.Line.ByStartPointEndPoint(p0,p1)
			lines.append(line)
	boundaries.append(lines)

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

In the python node you just input the room list. Output would be a nested list of room boundaries (as dynamo lines) - a sublist per room.
Can’t have more time at the moment to look at the intersections part, but maybe you can work it out from here…

1 Like

My try :slight_smile:
Capture Centre of Corridor.dyn (56.8 KB)

image

1 Like

Thanks for your response! I’d really like to try it, but i can’t find the node “curves.superjoin” within the archi-lab.net package :frowning:

Hey, updated version… Think it’s mainly OOTB nodes and that particular one wasn’t needed…

It is based on walls being perpendicular (otherwise we get into Voroni kinds of solutions which I think will kill your PC). I have picked 3m as the maximum corridor width (it determines what is a cross wall and what is an end wall, this is fallible but mostly will work), you can vary this…

It is built for a single room right now, so you’d have to do some list level management to make it work for a whole building.

Hope that’s useful…

image

Centre of Corridor-1.dyn (80.7 KB)

Cheers,

Mark

Edit: There will be much better options out there I’m sure and there is a lot of opportunity for improving this solution.

3 Likes

Hi guys!

Ok, this is my work in progress: super simple cause Element.GetLocation should give you the centerline of the wall. Then just get the start point and end point and prune duplicates, check it out:

The next step would be to exclude start and endpoints of the lines that dont intersect with anything so you can throw away the points that are just on the beginning or end of a wall.


EDIT:

Ok, I think I got it this time!
I just used the Geometry.Intersect node with cross product lacing, flattened it out and filtered points and pruned again the duplicates. :smiley:
Check it out:

@MrMinister give it a try see if it works for you!
Paolo

2 Likes

Hi Paolo, thanks for your great idea. Unfortunately, I just get the edgepoints…I’ve tried both variants.sol3

btw: It’s about the centerline of a room :slight_smile:

Ok, have you tried swapping the first blocks to get all centerlines of rooms instead? then the rest is similar to the previous version, like so:

57