How to get text-notes / boundingbox or PointAtSpace

Hello :slight_smile:

according to this tread How to get the elements inside a boundingbox?
i want to figure out, if it is possible to get text-notes --> out of the dynamo-script.

For the creation of the boundingbox i want to use spaces.

I was looking at the Revit.API http://www.revitapidocs.com/2017/eb8735d7-28fc-379d-9de9-1e02326851f5.htm#exampleToggle but i didn’t found a solution yet.

I’m still a beginner, so sorry - if I ask some nonsene.

Is there maybe a workaround to the text-notes, that they can be handeld as elements?

@Einar_Raknes I hope it is okay for you, to post your hard work here again?!

import clr
clr.AddReference('RevitAPI')
clr.AddReference('System')
clr.AddReference('RevitNodes')
clr.AddReference('RevitServices')
import Revit
import RevitServices
from Autodesk.Revit.DB import *
from System.Collections.Generic import List
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
clr.ImportExtensions(Revit.Elements)
clr.ImportExtensions(Revit.GeometryConversion)
doc = DocumentManager.Instance.CurrentDBDocument

#Functions for list handling
def ProcessList(_func, _list):
   return map( lambda x: ProcessList(_func, x) if type(x)==list else _func(x), _list )

#Preparing input from dynamo to revit

def ToRevit(item):
	return item.ToRevitType(True)

if isinstance(IN[0], list):
	bblist = ProcessList(ToRevit, IN[0])
else:
	bblist = [ToRevit(IN[0])]

def collectElementsInBB(bb):
	outline = Outline(bb.Min, bb.Max)
	#filter = BoundingBoxIntersectsFilter(outline)
	filter = BoundingBoxIsInsideFilter(outline)
	collector = FilteredElementCollector(doc, doc.ActiveView.Id).WherePasses(filter)
	return [e.ToDSType(True) for e in collector]

OUT = ProcessList(collectElementsInBB, bblist)

getTextNotesFromBoundingBox_nonworking.dyn (15.5 KB)

Here is the RVT File - because of the limitation - it is an downloadlink
https://we.tl/zmkcFEhfPP

If you just want to get the model text then you need to use Element Types and All Elements of Type.
image

Hello @Nick_Boyts

thx for reply.

The aim behind is, that i have text-notes - which are placed in spaces.
I need to know, in which space which text is.

I have been reading a lot about this in the forum and there are several ways with an “generic model” but no one with “just spaces”.

I’m not sure what you mean by this.

You’ll either have to check the model text and the spaces for a geometry intersection or you can get the model text location (point) and see which space is at that point.

This kind of depends on what you’re looking for. If you have large text that overlaps multiple spaces you’ll have to use the geometry method. If you only care about the origin of the model text you can use the point method - which is much cleaner and faster.

I already tried the “point” stuff. This works fine, if you have an “model” or “rooms”.
But if i use “spaces” the output is always “false”.

002_boundbox_text_pointvar_v01.dyn (15.8 KB)

Here is the view in 3D to check the lines…
image

There’s a node Space at Point (or something similar) that you’ll want to use. Think it’s in MEPover or DynamoMEP maybe.
And fyi, you rarely want to use bounding boxes for large geometry because they are aligned globally. With easy geometry, especially rooms and spaces, you’ll want to use Element.Geometry and a geometry intersect test.

1 Like

@Nick_Boyts

Hey Nick, you are awesome - the MEPover - SpaceAtPoint did it all the way :slight_smile:
I changed the name of the thread - that the “SpaceAtPoint” also can be found.

So could you tell me, where do you use the boundingboxes??

I tend to use bounding boxes for smaller geometry aligned to the global axes or large collections of elements for general grouping.

Bounding boxes obviously have a bit of a buffer/error because they take the full extents of an object, not just its exact geometry. A bounding box is also aligned to the global coordinate system so they do not rotate with the angle of an element. For this reason, they’re not always great for judging the geometry or exact location of an object. But they can be useful for general collecting or grouping of a number of elements. Bounding boxes are easy to create and quick to query when it comes to processing your graph though, so they do have that benefit.

Really, it just comes down to what works best for your graph.

1 Like