I am using the below Dynamo script with the python script node, it is not showing any error, but the python script node is showing empty results.
Please help me to solve this issue.
The script is in the attachment.
I appreciate any help you can provide.
Split Walls By Level.dyn (13.8 KB)
This’s dynamo solution, may be help you
from Autodesk.Revit.DB import FilteredElementCollector,BuiltInCategory
from RevitServices.Persistence import DocumentManager
doc = DocumentManager.Instance.CurrentDBDocument
levels = FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_Levels).WhereElementIsNotElementType().ToElements()
chop = 
n = 0
m = 1
for i in range(len(levels)-1):
start = 
end = 
for i in chop:
OUT = start,end
The script works, but you should have your top and bot constraints set to a level and base/top offsets should be zero. Otherwise, the code does not work stable from my side. I think you need to modify the code if you want to use it for any conditions.
Hi @Amir.Moeini.Sh, Thanks for your response. I am running the above-shared script in Revit 2023. Per your suggestion, I keep the base and Top offset set to zero, and the top and base constraints imposed to a level. It shows an empty result.
Please take a look, and looking forward to hearing back from you.
Hi @manhgt214, Thanks for your response.
I used the above script, which is helpful for a single run for a single wall, but when I try to run on a closed fence, as mentioned below, it shows an error and deletes the selected partition. Please see attached images below for reference.
When I select the second wall.
Please suggest the solution for groups of walls at a single script run.
I ran the script on this model and it worked without error. (Revit 2023)
If the code does not work on your end based on the settings I mentioned, maybe something is wrong with your example model or Dynamo version issues.
SplitWall_ByLevel.rvt (4.8 MB)
Hi @Amir.Moeini.Sh Thanks for the confirmation.
I find my mistake ,I was running with CPython ,when I choose IronPython ,it run successfully.