Place unplaced room.

Place unplaced room.

Anonymous
Not applicable
3,148 Views
7 Replies
Message 1 of 8

Place unplaced room.

Anonymous
Not applicable

I have created a number of unplaced rooms in my model. I want to be able to place them in specific locations. From the Revit interface, I can choose an existing scheduled (unplaced) room from the pull down and place it, but that list is cumbersome. 

 

I have been trying to find a way to select an enclosed area. Using 'PlanTopology.Circuts' is as close as I can get, but I can't do anything useful with that. Odd that you can get the area of each circuit, but not the location or boundary. 

 

Is there a way to duplicate the room creation/selection process? I want to be able to filter the available unplaced room list by level, square footage, department, something to simplify placement of unplaced rooms. Thanks.

0 Likes
3,149 Views
7 Replies
Replies (7)
Message 2 of 8

Anonymous
Not applicable

I came across the post below. Is this still the bast way to acomplish this? The code 

 

if( Geometry.BoundingBoxXYZContains(
      roomNueva.get_BoundingBox( null ), 
      xyz ) )

is out of date. What has replaced 'Geometry.BoundingBoxXYZContains'.  Would I use BoundingBoxContainsPointFilter and a FilteredElementCollector? Thanks.

 

http://thebuildingcoder.typepad.com/blog/2009/03/create-room-on-level-in-phase.html

0 Likes
Message 3 of 8

jeremytammik
Autodesk
Autodesk

Dear Bryan,

Thank you for your query.

I explained the situation regarding 'Geometry.BoundingBoxXYZContains' in my answer to your previous case 08656833 [Check to see if a point is inside bounding box], generated from the forum thread

http://forums.autodesk.com/t5/Autodesk-Revit-API/Check-to-see-if-a-point-is-inside-bounding-box/m-p/...

From what I can tell, your best bet is to use the Document.NewRoom method taking a Level and an UV argument and use that to create placed rooms in the desired locations.

I hope this helps.

Best regards,

Jeremy



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

0 Likes
Message 4 of 8

Anonymous
Not applicable

Hi,

 

I have a new project that demands placing unplaced rooms using a method more sophisticated then the revit built-in one. 

We are going to make a UI where the user can search for unplaced rooms and then place them.
From the looks of the API this seems like it requires relatively complex code for such a seemingly simple task.

For you guys out there needing to do this Im thinking of doing it in one of the two ways: 
the first way:

Get the point of the room from the user by using pickpoint. 

Then find the first plancircuit on the level and phase in question that does not already have a room placed in it and place the room there using the CreateNewRoom(Room,PlanCircuit)
Then move the room to the correct location. 
You need to make sure that you find a plan circuit that does not have a room already placed, because if you dont the user will recieve a warning from Revit about multiple rooms in the same plan circuit. This warning can obviously be captured and silenced, but its just less code this way. 
There is a drawback with not handling the warning and that is if there are no "free" plancircuits.

Then you wont find any and you will have to find a plancircuit to place it and the user will see a warning about dubplicate rooms with the possibility of it beeing in the wrong place when the warning is shown. 

 

Second way: post the create new room command and capture the event of the created room in a IUpdater and copy the parameter values from the correct room. 
The problem with this approach is that we cannot abort the place room command (that I know of, can we?). But it has the added benefit of the "normal" user experience when placing rooms. 

 

If we could just get an API-addition to check if a point is inside  a planregion or something to distinguish where to place our room!

 

Both ways have their dissadvantages. Does anyone have any input on how I could improve my room placement?

 

 

0 Likes
Message 5 of 8

jeremytammik
Autodesk
Autodesk

Dear Erik,

 

Thank you for your interesting query.

 

Is there any way to query the plan circuit for its boundaries and make use of a simple point containment algorithm on those?

 

http://thebuildingcoder.typepad.com/blog/2012/08/room-in-area-predicate-via-point-in-polygon-test.ht...

 

Cheers,

 

Jeremy



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

0 Likes
Message 6 of 8

FAIR59
Advisor
Advisor

I would use a temporary transaction(group) to make all the "unused" rooms in the plantopology. And let the user choose from those rooms.

After collecting all the information rollback the transaction(group) and make your new definitive room(s).

0 Likes
Message 7 of 8

Anonymous
Not applicable

 

I think I have a very good solution when Im posting the create new room command. However I only want to place one room I want the command to cancel after the first placement. 
Is there a way to accomplish this?

0 Likes
Message 8 of 8

JulioPolo
Participant
Participant

I'm running some commands that create rooms on batch without opening the revit documents on the UI.
I've found that the rooms don't get created on the Existing phase that is where I need them when I run them that way.
As you cannot change the phase of an already created Room, I was thinking of using NewRoom (Phase) but it creates an unplaced room.  https://www.revitapidocs.com/2017/0bf2d8e2-593f-1ba7-c0dc-5274749abe19.htm
How could I set the Room.Location of those unplaced rooms? That attribute is null at the moment due to being unplaced.

0 Likes