Split Walls By Level…

I was following the link above, but i encountered a warning on my script. can anyone help me?help Split Walls.dyn (12.5 KB)

I see what you mean there. Is it possible to change it into the properties instead of parameters? I notice the base constraint is at the properties window.

Thank you for your reply.

Could you clarify what you mean? The data shown in the properties panel is just the parameter name and parameter value, organized by parameter group (e.g. “Text” or “Identity Data”). If you want to access the parameter by its name, you can use LookupParameter method like this:

p = w.LookupParameter('Base Constraint')

However, as shown in the blog, it is advised to access the parameter directly since LookupParameter will not account for multiple parameters with the same name.

Thank you for your reply, how can I possibly access the parameter directly?

I think I was confused, I thought the Base Constraint couldn’t be found in the parameters.

As @jbo has stated above, there was a typo on one of your lines:


You have to match the BuiltInParameter name exactly or else your code won’t work. In your case, you just have to remove the “S” from “WALLS”:


@cgartland I did that and this is what I got. . . I am new to dynamo and codes so I couldn’t quite understand what it is that the warning is trying to tell me. Thank you for your patience.

The error implies that one of your functions returned a null object, most likely this line:

base = doc.GetElement(p.AsElementId())

I can’t test it myself, but it is possible that the element has no top constraint (unconnected). You can add a conditional statement to check whether either of your variables (top or base) are null (or None in Python) to avoid getting that particular error.

if isinstance(w, Wall):
    p = w.Parameter[BuiltInParameter.WALL_BASE_CONSTRAINT]
    base = doc.GetElement(p.AsElementId())
    p = w.Parameter[BuiltInParameter.WALL_HEIGHT_TYPE]
    top = doc.GetElement(p.AsElementId())
    # Iterate loop if either base or top are None
    if (base is None) or (top is None):
    if base.Id.IntegerValue != top.Id.IntegerValue:
        # Get levels, copy wall by level, etc.
1 Like

Thank you! Finally I was able to run my script. Tho I did not get my expected result. I was able to split my walls by levels bearing in mind that rebars are hosted to walls. So I thought that if I split walls my rebars will also adjust haha. I was able to split walls but the rebars remain the same.

Can anyone enlighten me on that thought?