Access revit toolbar

I searched and didn’t find anything about it. Does anyone know how to create an environment delimited by model elements? Creating environments is done through the Revit toolbar - Architecture - Environment. Or how to access this tool in Revit using Dynamo? I’m going to create a routine with Passthrough, but I need this step for the others. Any help is appreciated.

Where exactly? I don’t see anything in the toolbar for environment, perhaps it’s a translation issue?

This is my Architecture menu in Revit 2024 (2022 is the same items but with a different look).

That’s strange. See where it is located. But anyway, is it possible to access a Revit tool and execute it through Dynamo?

Ah. In English that is the new room tool. So that’d be a translation issue. :slight_smile:

You can’t call on the toolbar directly, but you can create a room using Dynamo as shown here: Dynamo Dictionary

It doesn’t work because it asks to select points on the face, but there is no face yet. I have to create the environment specifically for that purpose, so that the next routines can identify the area of the environment. There are only walls, so the routine should identify the delimited areas between the walls and create the environment. Do you know how I could do that?

So all walls have been created, and each cell of enclosed space wants to create a new room?

If so this is the API method you need (or one of the similar methods):

Give it a shot and shee where you get.

This is one of my attempts, but I am not succeeding.

Looks like someone has posted some Python which should do what you need in this thread: Creating Rooms from Spaces - #7 by dineshsubramani

Try implementing that, and reply here so we know where you get. :slight_smile:

1 Like

I couldn’t, the code just gives error. Do you know what it could be?

Try implementing the UnWrap method. More here:

It could not be simpler? Without using python?
Because in fact I’m not succeeding and I’m trying through nodes only, with the intention of taking the walls created in revit, identifying the areas between them, and creating an environment. It would be possible?

I do t know any package which has this built in unfortunately.

Once you get the Python it’s pretty straight forward. If you join the unwrap and the code in the link I posted it should work. Work with the code line by line, commenting out as you go. When you get stuck like this and have to implement a new tech it’s a chance to learn. Going over the Dynamo Python primer I previously linked you will help. Do each exercise one by one, skipping nothing. Each exercise is foundational to help you get past these types of hurdles. There is also the Dynamo office hours #18 and 28 here: Dynamo Office Hours - YouTube

I’ll try and post something Monday when I get back to my PC.

The code works for me.

doc = DocumentManager.Instance.CurrentDBDocument
uiapp = DocumentManager.Instance.CurrentUIApplication
app = uiapp.Application
uidoc=DocumentManager.Instance.CurrentUIApplication.ActiveUIDocument

levels = UnwrapElement(IN[0])
newRoomList = []

TransactionManager.Instance.EnsureInTransaction(doc)

for level in levels:
		newRoom = doc.Create.NewRooms2(level)
		for r in newRoom:
			newRoomList.append(doc.GetElement(r))
					
TransactionManager.Instance.TransactionTaskDone()
OUT = newRoomList
3 Likes

Yes. Now yes. I was wrong to use the code block.
Thanks!