I’m just learning Dynamo and the first practical script I want to create is something that can rename and sort elements(doors, windows, walls etc) by type name.
Background: We almost always name our types by size and assign letters to types with equal size, so two 1000mm doors in a project would be D10a and D10b. During a project, as more and more disciplines add their requirements on different elements these types tend to get scrambled, a lot.
The way I want to solve this is exporting a bunch of parameters to Excel, sort them, import back to Revit and overwrite existing parameters. I’ve created two scripts for this, only trouble is, when I run the import script I get the following error: “Warning: Element.SetParameterByName operation failed.
The parameter is read-only.”. I’ve narrowed this down to the Type Name parameter. So, basically, how do I write text to that parameter?
I have another issue with this though. All of the parameters I want to change are type, however the list I get is instance. Still works as long as I change all of the instances to the same value, but can I somehow group all instances of the same type in the list to make a more compact excel file?
Brilliant! My last question is the warning I get when I run the script to import the parameters back. Everything works fine as far as I can tell but both last nodes return: “Warning: Element.SetParameterByName operation failed.
The call is ambiguous between the following methods or properties: ‘Revit.Elements.InternalUtilities.ElementUtils.SetParameterValue(Autodesk.Revit.DB.Parameter, Revit.Elements.Element)’ and ‘Revit.Elements.InternalUtilities.ElementUtils.SetParameterValue(Autodesk.Revit.DB.Parameter, string)’”
No, it’s not unsafe, its just that your script won’t run because of it
Mind you, there may be other problems aswell, but fix this first and i’ll try to help you to the next step (if required)
Actually the script runs and the parameters change. Thing is some of these cells will always be empty, for example one of the parameters are Fire Rating and in any given project not all doors are fire rated. As long as I’m sure that’s what’s giving me a warning it’s fine.
Just tried adding a dash to all empty cells and the script ran without warnings