Element.geometry giving error when creating room geometrie

Hi all!
I’m trying to make a script that reads out a (generic) annotation family and the room it is positioned in.
The annotation has a parameter value in it, wich i want to input the roomheight at the position of that family in.

The problem that i’m having is at the room geometry creation. I keep getting this error:
“trim with edge loops requires all curves to touch surface”.

It seems to happen when the room is defined by curved walls.
I have already found the post below:

forum post by Ewan_Opie

But the solution whereby you take the edge curves doens’t solve my problem since i don’t just want to extrude a surface. Different parts of a room can have different heights, wich is the whole point of the script :). To read the different heights at different point within a room without manual input.

Below a picture of the scrip and a plane with some rooms of wicht he geomertie is not being generated:
(it seems i can only one picture per post srr :frowning:

Thx for all your idea’s and input in advance :slight_smile:

1 Like

below the pictures :slight_smile:

1 Like

Filter your Rooms for Unplaced/Unbounded first

Hej Marcel,

thx for your answer, but unfortunatly it doesn’t seems to help the case.
below a screenshot, all rooms are placed and have there boundaries.

i have actived the room.boundaries to show the missing rooms.

I have completed the script for the height calculation but right now i still need to filter for the room that only create geometrie.
Now the error has changed to : can’t create arc.
part 1:

part 2:

Can you use a PolySurface instead of a Solid?
Then you can use the RevitDB.Face geometry conversion to attain this even with stepped Rooms.
:wink:

## Import Reference Examples

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

clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

clr.AddReference('RevitAPIUI')
from  Autodesk.Revit.UI import *

clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.GeometryConversion)

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

doc = DocumentManager.Instance.CurrentDBDocument

def tolist(obj1):
	if hasattr(obj1,"__iter__"): return obj1
	else: return [obj1]

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

calculator = SpatialElementGeometryCalculator(doc)
result_list = []

for room in rooms:
	
	results = calculator.CalculateSpatialElementGeometry(room)
	
	# Revit DB Room Solid
	roomSolid = results.GetGeometry()
	
	pack = []

	for face in roomSolid.Faces:
		
		faceEdge = face.EdgeLoops
		for f in faceEdge:
			pack2 = []
			for x in f:
				pack2.append(x.AsCurve().ToProtoType())
			poly = PolyCurve.ByJoinedCurves(pack2)
			surf = Surface.ByPatch(poly)
			
			pack.append(surf)

	result_list.append(pack)
			
OUT = result_list
1 Like

Hi Ewan,

First, big thx for sharing your knowledge :slight_smile: !
Seems like a valid solution to the solid creation and i could definetly work with (or around) the surfaces!

When i try your solution i get an error (see screen shot) for line 50 in the python script.
This is at the point where you ‘assemble/pack’ the surfaces.
The error also states that a wire from an edge is self intersecting, wich makes me believe that there isn’t so much a problem with the script but rather the model?

The rooms in the model are created with modeled walls and linked walls from the structural model.
Could we extarct the room(s) that give the error?

@Ewan_Opie I have been testing your script and it does work but it is having the same problem as the Element.Geomtry node.
it doesn’t seems to have to do with the fact that i’m working with a linked model, but rather with the ellipse-shapes of the design.

We already found out early in the process that an offset of an ellipse is not an ellipse…

Elliptical walls in revit are been drawn by there centre reference lines.
So i supect that since the roomboundaries of the rooms are the other edges of the walls that there are non-elliptical walls (offset of the centre ellipse).
And that by this fact Revit can’t handle them?

@jacob.small is my above interpretation correct in your opinion?
A friend of mine (Laura_POLO) told me i could this this with you :slight_smile: .

Happy to be @ mentioned. Tell @Laura_BIMChick I say hello. :slight_smile:

Your geometry considerations are correct; an offset ellipse is not an ellipse, and as such the layers of walls are not elliptical. Similar deformations happen with nurbs and other non-uniform offsets. Not BASIC math but geometry consistent enough that you can do the exercise with a pair of nails into a sheet of plywood and some string to draw the ellipse, then cut the string shorted and draw it again, then measure the distances between the two. Revit will certainly handle these offsets, but show the geometry transfers over I am not sure.

That said, I don’t think this is just an ellipse issue, but a bigger problem around geometry scaling. I see a few rooms which certainly look rectangular and are failing after all.

  • Project units are in MM or meters? Try switching it to feet and see what you get when running the graph.
  • Also is everything near the internal origin?
  • What happens if you change your geometry scaling, does that fix things?

All of that said… you’re on a unnecessary goose chase here. It feels as if the room geometry is the best way to do this, but the height should be from the elevation of the placement point up to the ceiling or floor above, right? So in requesting room geo you’re going to convert all rooms to solids, then draw a line and intersect all the lines with the solids and that is going to be slow because a LOT of stuff is being moved from Revit to Dynamo and back and it’s a BUNCH of Boolean operations on a complex list of solids. And you’ve got solid issues with the rooms!

Personally I would use a raybounce onto those categories and get your height that way. You can even limit what you raybounce on by getting the room’s boundary elements and isolating portions of the building at a time in that view. Once you have the bounced point get the distance from point A to point B. The only things moving between Revit and Dynamo this way are points and a double, so 7 numbers per test.

This will still take a bit as it’s a complex, but it will be accurate and verifiable. I would recommend using a two point adaptive family with a tag associated to this rather than a generic annotation, as the later has no intelligence built in and the tag and family can readily be created by end users for a ‘change here or there.

Best of luck!

3 Likes

@jacob.small Thank you very much for your input!
i’ll give it a go! Never used the raybounce feature before.

I have just one thing that pops in my mind reading your post:
The reason why i went with the roomvolume and not the (filtered) roombouding elements is because we work with linked models most of the time.
The structural model is then set to roombounding.

I know i can find those elements via the Clockwork packagenode Room.Boundaries.
This returns them as RevitLinkInstances, refering to the structural model itself.
Using other ways i could find the elements in the linked file but not the room they are associated with in the architectural model.
Hence why i went for the rooms and the volume.

But i’'l try and learn on the way! Again, thank your for your helpfull insight :hugs:!

1 Like