Determine space or room height at a given point

Determine space or room height at a given point

jeroen.vanvlierden
Enthusiast Enthusiast
764 Views
6 Replies
Message 1 of 7

Determine space or room height at a given point

jeroen.vanvlierden
Enthusiast
Enthusiast

Hello

 

I am writing a program that determines all room boundarysegments for given rooms (or spaces)

 

var options = new SpatialElementBoundaryOptions();
var segments = roomOrSpace.GetBoundarySegments(options).SelectMany(x => x).ToList();

 

foreach (var x in segments)
{
var c = x.GetCurve();
var p1 = c.GetEndPoint(0);
var p2 = c.GetEndPoint(1);
points.Add(p1);
points.Add(p2);
}

 

The z-coordinate is always 0, unfortunately. With a cubical space that is not a problem, but when there are sloping walls or a roof, I don't know the height

 

Wat is the best way to retrieve this?

cheers

Jeroen

 

 

 

0 Likes
Accepted solutions (1)
765 Views
6 Replies
Replies (6)
Message 2 of 7

ridaabderrahmane
Enthusiast
Enthusiast

you can get the room level and look for its elevation:

var level = document.GetElement(room.LevelId) as Level;

var Z = level.Elevation;

 

 

0 Likes
Message 3 of 7

RPTHOMAS108
Mentor
Mentor

Room.ClosedShell => GeometryElement containing solid.

 

Get the top face of such compare with bottom face (face origin difference).

 

Probably there are other was such as using ReferenceIntersector.

0 Likes
Message 4 of 7

jeroen.vanvlierden
Enthusiast
Enthusiast

This assumes that the room or space has the same height everywhere. And that is my problem, the height is sloped and is different at different x,y coordinates

0 Likes
Message 5 of 7

jeroen.vanvlierden
Enthusiast
Enthusiast

Thanks but your answer does only work when the room has the same height everywhere

 

jeroenvanvlierden_0-1637917327537.png

 

0 Likes
Message 6 of 7

jeroen.vanvlierden
Enthusiast
Enthusiast

Thanks, but I don't completely understand what I need to do here...

I will probably have to intersect with the roof.

0 Likes
Message 7 of 7

jeroen.vanvlierden
Enthusiast
Enthusiast
Accepted solution

Forgot to answer my own question:

Found a solution that determines the faces of the room geometry.

After that I define a line from the given point towards a very high z-coordinate and let this line intersect with the room faces. This method works for me

 

public static IList<Face> GetRoomFaces(this Room room)
{
var geom = room.get_Geometry(new Options());
var geometryOfRoom = geom.OfType<Solid>().FirstOrDefault();
var faces = geometryOfRoom.Faces.OfType<Face>().ToList();
return faces;
}

0 Likes