Mod Edit:
Initial post here: Get Value from Family Parameters No Output - Dynamo (dynamobim.com)
@Nick_Boyts I understand. I will try that, thank you!
Finally, if I want to set a shared parameter in this .rfa file with the value I just extracted, which block/function is the best?
The exact method would depend on how exactly you want to set that value. If it’s coming from an existing parameter you could just link the shared parameter to the driving parameter value. Or you could just set the shared parameter using the extracted value like you mentioned. Again, any of the custom packages that deal with family documents will likely be your best bet, but you may need to utilize the API if you can’t find anything that works for your scenario. I’d suggest searching the forum for similar topics.
Hi @Nick_Boyts I tried using Document.BackgroundOpen. It works and I’m able to extract all the values with FamilyParameter.Value. However I want to use these values to set other parameters in the files I’m opening.
To set values I’m trying to use Orchid’s FamilyParameter.SetValue. However it looks like it can only take one family document at a time. If I want to set many files (just like I wanted to Get Parameter values of many files) what would be the best way to go about it?
I’m not familiar with the specifics of how Orchid handles those family interactions, but if it can open multiple families I’d guess it can write to multiple families as well. You likely just have an issue with list levels and/or handling the order of the multiple transactions. Either way, it’s always easier if you show us what you’re dealing with so we have all the context.
1 Like
To makes things simpler, I just ran this with 2 files in the same folder, and adjusted the parameter name to focus on setting just 1 value.
After a little investigating, I found that the FamilyParameter.SetValue requires the same number of parameter names as Values, so I repeated “C6ix_Asset.Code” twice just to see if it works.
The value is indeed set on both files, however it has used the same value twice (TSY-PS-TPS-ETS-BLS-42). So basically in both files, the Asset Code parameter has the same value when they should be different.
@Nick_Boyts Am I missing something here or should I rethink my approach?
I don’t know if the null argument for FamilyType
is ok or not, but I’d suggest using list levels to force all the inputs to be 1-to-1 (@L1
).
@Nick_Boyts thank you, I don’t have to repeat the parameter name using L1 as you suggested.
It looks like the correct value was set properly for the first file, but the value for the second file is empty.
From my testing I found that the FamilyParameter.SetValue does work when I give it many values. The problem arises when I’m trying to set values for multiple files in the same folder.
The ultimate goal of this script is to extract values from many old files, and set them in many new files. Is it perhaps better if I split this into 2 scripts (one extract, one set)? Or is there a way to set values in many documents one by one?
You would still need the duplicate parameter list as an input with list levels. The list levels are an attempt to execute the node for each set of inputs at level 1. That means all the values need to exist at level 1 for each instance.
It’s possible that still doesn’t solve the issue, but we’re trying to troubleshoot what’s possible with the nodes you’re using. Similarly, separating your graph into two scripts might be a good idea, but that wouldn’t change anything with writing to multiple files at once. Have you tried looking through the forums at similar topics? I’m pretty sure this kind of thing has come up before. It’s likely that someone else has already solved this issue or at least proven that multiple families can be written to at once.
@Nick_Boyts Yes you’re right. I made some great progress and I opted to split the script into two different ones; one that extract the parameter values and saves them into an excel, and another that takes the excel values and sets them. I’ve been testing it and it looks like it’s mostly working.
The last issue I need to solve is what to do about parameter with the “Length” data type:
The extraction script extract these Length parameters and writes them as numbers in the excel file. However, when the second script tries to set this Length type parameter with this number, I get a “The storage type is not a double or integer type”.
Is there a way to cast a number value to a Length type in dynamo? I could not find a block that could accomplish this.
The core Data.ImportExcel
node has an input, readAsStrings
, that defaults to reading numeric values as numbers instead of strings. There’s also String.ToNumber
that will convert strings, but you’d have to know which strings to convert and which not to.
I have tried using the readAsString boolean, but I instead get “The storage type of family parameter is not a string type”.
The parameter setting works with numbers and texts just fine, it just really looks like it’s the Length data type. Is there no datatype conversions or casting in revit scripting/dynamo? (thank you for all your help on this)
Again, you need to show us exactly what you’re dealing with. If you’re having excel keep number formatting then you need to ensure that the cells in excel are also formatted as numbers (if not automatic). The error you’re getting is telling you the value wasn’t converted.
The String.ToNumber
node does exactly what you’re asking for with a type conversion but would only succeed on numeric values. You would need to determine which specific values need to be converted.
I wrote a test script to try setting this one specific “Length” parameter called “Depth”:
I extracted only the Depth value and fed it to the ToNumber block as you suggested. It runs, but it sets the wrong value (probably due to the conversion?). It should be 1750:
Just for more information, this is what my extraction dynamo script looks like. It works by extracting all the parameter values for .rfa files in a specified folder, into excel:
This is how the values appear in my excel document:
You can see in the screenshot that the string “1750” gets correctly converted to a numeric 1750 before being fed to your python node. You also need to account for project units when setting the value here. The reason you’re getting a different value (533400) is because your parameter value is already converted to whatever units your project settings use. This is different from the internal units used in the API method.
I see. It turns out that length is in fact a project unit:

Does this mean that there’s no way to set a parameter that uses project units? Or is there some conversion process I can do?
You have to convert it to Revit’s internal units, which are feet. The UI is showing you the length in project units (mm) but when you write that value back, it’s expecting internal units (ft).
1750ft == 533400mm
1 Like
thank you. With your help I have a running script that is able to convert exactly what I needed.
I recently had to update the Revit models and now I have a new parameter, Weight which has the project unit of “Weight” with 2 decimal places and with kN units.

I tried using the String.ToNumber block on the Weight value since it worked for the “Length” data types I mentioned above in this post. However, when I run my set script, it just sets the Weight value to 0 for some reason:
I even tried converting the value to float (since the weight has 2 decimal points in the project unit definition) in the Set function code, but it still sets the weight value as zero:
Is there a different conversion block/function that would work for this weight datatype (kn) that differs from Length?
The conversion is just math. Only the conversion factor would change, which can cause issues if you’re not using the same number types so always use doubles/floats for math to avoid rounding issues.
I’d also suggest you get your parameters via a name or builtin method to ensure you have the right parameter. Matching the parameter at index 12 with the value at index 12 is an easy way to mix up your parameters.
Besides that, you haven’t really shown much of what you’re doing with these new values. It would be easier if we could see the full code and where you’re making the conversion.