0

right now I am working on a project, which should get the roomnames from a plan view and compare each room name with a database. If the roomname if found in the database, the parameter in the room called "IS_IN_DATABASE" should be updated with "YES"

Unfortunately I have no Idea, how to get the roomnames from one plan view...

I found this post: https://forums.autodesk.com/t5/revit-api-forum/how-to-retrieve-rooms-filtered-by-level/td-p/6627076
but it does not work because I always get a exception:

viewId is not a view. Parameter name: viewId

clem995
  • 319
  • 2
  • 16

2 Answers2

0

It would be easier to do if you provided some code, but does this work?

View activeView = doc.ActiveView;

List<Room> rooms = new FilteredElementCollector(doc, activeView.Id).OfClass(typeof(Room)).Cast<Room>().ToList();

To get only the names in a list you could use something like this:

List<string> rooms = new FilteredElementCollector(doc, activeView.Id).OfClass(typeof(Room)).Select(a => a.Name).ToList();

Put using Autodesk.Revit.DB.Architecture on top, otherwise it won't recognize rooms.

Jan Buijs
  • 98
  • 1
  • 6
0

Already answered in the Revit API discussion forum thread on getting room names and changing parameter value.

It would be better if you raised separate questions for these two separate issues.

Jeremy Tammik
  • 7,333
  • 2
  • 12
  • 17