How to split walls per selected Level?

How to split walls per level?

I have architect model and wall are created very random. I want to split wall per each Level I will select…threre is pllenty levels I want to select only at floor finish . So I have have wall…Level 0a to Level 2.
I want to select split at Level 0 and all walls that extend over level 0 will be split. obviosly if they start at level 0 thre is nothing to split.
Then I select Level 1 and all walls will be split at level 1.
My idea was to create surface at each level from point and then perform cut but I have warning when running nodes. Also my approach is a bit complicated I am sure there must be easier way.

SplitWallsperLevel.dyn (24.7 KB)

Project_Level.rvt (508 KB)

There is one post but can not adjust to my needs.
http://dynamobim.com/forums/topic/how-to-split-walls-by-levels/

1 Like

There is no way to split walls programmatically with dynamo or the Revit API automatically. The API methods which exist require a click and that means you’re basically doing it by hand anyway so no script help.

First up: I don’t recommend doing this as you’ll lose anything hosted to the base wall. In doing this you’re effectively starting a situation where you have to run piece by piece by piece through the model until you’ve redone all of their work programmatically or manually.

The solution: Querry the walls curve, and recreate it by that curve on intersecting levels with a top constraint of the level above. Then find anything hosted to the new wall and place it on the new hosted wall.

Before you start that mess, ask yourself: do you really NEED these walls to be separate elements or is there a better method available to accomplish what you want?

I am happy to find alternative method…at the end I am looking for all walls that start or cross at specific Level. So I can rebuild models in clean and organized way. I am happy to do all theses cuts in Arch model if required but better from linked model.
It is easy to find all walls that start at specific level but is difficult to find walls that just going though this level.
My idea was to split them and this will be easiest so I can select all walls use original type name and curve to rebuild in my model…

I’m lost on why you are splitting the walls in the first place? If they align level to level then maintaining them as single elements is likely more efficient to work with (one element to change instead of one change per level).

To find out if a wall is above and/or below a level, use an element.bounding box, then a bounding box min and bounding box max. Get the elevation of a level and the level above. If the box min z value = the level elevation, it starts at that level, if not remove it from the set.
If the box max level > the level above elevation then it needs a split per your workflow, if not remove it from the set.
Take the still included walls, get their type and location line, and create a new one at the level you ran the test with.

Repeat for all levels. You likely want to skip shafts and masonry walls in this process.

thanks for reply and ideas.
Basically, I need to be an accurate model from an arch model for simulation. If I leave walls going through 6 levels then when I select in my tool level 0 I will see all walls up to level 6 which makes no sense. I have to split everything per level.
I never experienced problems meaning walls split so this is not an issue.
Sounds like complex process…

Ah! Structural analysis on the walls i take it?

It’s not too complex, but it will take a few steps.
Assuming you have structural levels and associated plans set up already…

  1. Read the walls in their linked model.
  2. Generate a bounding box around said walls.
  3. Get the min and max points of the bounding box, and query the z values.
  4. Get the elevation of the active view’s associated level
  5. get the elevation of the level directly above
  6. Set up a bool logic to look at the min and max points of the bounding boxes to see if they have min and max points above the relevant level elevations. if both are true than include them. If not discard them.
  7. rebuild the walls based on the type and location.

Here is a Dynamo script that will split the walls by level. You select the wall(s) however, and it will split it by the levels.

Split Walls By Level.dyn (7.8 KB)

6 Likes

If any elements are hosted to the source wall like door openings or ducts will that be intact after splitting?

Hi Brad,
Can we split the wall and add an offset (say 50mm from RL) into the walls.
thanks.

I would assume so, but I am not the best person to help with that. This is a script I found on the forum so I am sure with a little research it could be done.

Hey @brad.witt,

Good work on finding the script, perhaps next time link to the original post so the author can answer questions?

I didn’t write the code, but it works great! It’s also really nicely written and annotated.

image

So as @jacob.small suggested, you’re losing the original wall Mark and dimensions . But what’s cool is that the doors, windows and sweeps in the wall stay. I presumed they would delete themselves :slight_smile: I guess doing it inside a transaction means the hosted elements don’t have a chance to notice!

Hope that’s useful,

Mark

1 Like

Is it possible to edit the Python code in such way it works with walls who are unconstrained?
Or in other words; walls without a top constraint.

image

image

I have these nodes unresolved although I have Lunchbox PK How can I fix Them

Lunchbox is downloaded and installed from here not package manager.

1 Like

Hello! It doesn’t work for Revit 2021:(
image

You need to make sure the Walls have a Top Constraint set to a level. If not, it throws this error.

1 Like

Hello

Sorry to open a closed topic, when i run the script i get this msg:

Im a noob with scripting, but from what i understand is that we cant use “walls” as a variable name since its already taken, so i had to change it. I tried changing the python script at the IN variables From “Run” and “Walls” to “A” and “B” respectively, and changed the code block to the same, but nothing happened no errors, but the wall is not split.

could someone help please