Select all elements on level and change to another level

Hi - just starting out on Dynamo and would like to run a script to select all elements on a particular level and move them to another level. I know this will have some limitations (like rooms, wall hosted elements etc) but would like to do what can be done.

I know my first run at the script won’t work since there are various parameters that need to be changed (level, base constraint, base level etc). How would I go about filtering out elements that don’t have the parameter I need to change?ChangeLevel

You could try extracting the element’s parameters similar to this:
2015-06-25_14-37-24

 

 

 

Note that the lacing on the “List.ContainsItem” is set to longest.

Thanks. The filtering works great however why wouldn’t element.setparameter act on every element selected? Also, when I undo the action in Revit and run the script again I get a different result with different elements changing level. The warnings I get are all for trying to change read-only parameters which is understandable.

ChangeLevel

Not sure why it’s affecting different elements every time. Tho you can filter elements with read-only parameters with the “Element.ParameterIsReadOnly” node from the Clockwork package.

Thanks for that. I can’t get my head around how to use the ParameterIsReadOnly node. Whether I use it with a list of elements or a single instance it always returns an empty list for me. I’m assuming this is the root cause of the other elements not changing level correctly. I’ve pulled it out of the rest of the script just to try to get it working at this stage. It works great with the Base Constraint and Base Level parameters.

ParameterIsReadOnly ChangeLevel3

You’ll need to combine “Element.ParameterIsReadOnly” with a “List.Map” node. Try something along the lines of this:

2015-06-26_15-45-20

Thank you so much for your help so far. I’ve done what you suggested and on the face of it I get the correctly filtered list but when I run I still end up with errors saying i’m trying to change a read only value and it won’t change every element in the list.ChangeLevel4

Hi Michael, I’m not sure why the floor element is failing - it’s the only type that should work without a hitch. Doors and windows will give you an error as you guessed at the start. Just a shot in the dark here but one possibility is that when dynamo tries to process a door/window and gets interrupted by an unknown error the “parameter is read-only” debug message is returned by mistake?

No problem. I’ll keep plugging away at it and see what I end up with. Thanks again for your help.

/Michael Dunn , did you find any any solution? I’ve got exactly the same problem…

Hello! Where I can download “<strong style=“font-weight: 600;”>Element.ParameterIsReadOnly” ?