Hello, I’m attempting to use Dynamo to modify dozens of Revit Material “Mark” parameters. I have a Material Take-Off schedule that populates certain materials by a filter reading the Mark parameter. In this project, we grouped materials by a prefix “N-” for a north building and we now want to move the “N-” prefix for all materials. I attempted the below script, which is similar to how I set up a bulk sheet renaming script but it’s not working as I expected. I feel I’m somewhat a beginner, especially when it comes to sorting lists, so I appreciate any advice. Thanks!
You are slicing the strings manually, but not the material elements, so the mark parameter is being set for the first 12 or so materials. Further you can’t slice the materials because the List.Sort on your strings is going to put things out of order.
Instead try this
- Get the materials as you were before
- Get the mark value
- Test the mark to see if it starts with the prefix to remove using a String.StartsWith node
- Use a list.FilterByBoolMask node to filter out the list of materials from step 1
- From the ‘in’ output of the filter by book mask node, build your graph as you has it before.
Thanks, Jacob. I updated my graph with String.StartsWith and the list filter. It seems much more logical, but still not seeing the change applied after the filtered list.
I wonder if I am inputting the wrong set of elements in the SetParameter node? You’ll see in the image that I connected it back to the All Elements of Type Node…if I’m supposed to connect the SetParameter node to one that is after the filtered list, what node am I missing? Thanks!
You want to filter the list of elements, not the strings.
1 is where you’d insert most of your prior graph, getting the parameter value, removing the first two characters, and then set the element (from the
1) parameter value for the new value.