Trying To Change Family Types Using Excel


I’m trying to make an Excel schedule in which I can change the model number of a piece of equipment(heat pump in this case), then use Dynamo to push that change to Revit. We have a heat pump family that has different model numbers for different family types. I’m able to create the excel spreadsheet using Element.GetParameterValueByName, however when using Element.SetParameterByName to bring it back in it says “The parameter’s storage type is not a string.” even though I’m using the exact same string I used in GetParameter. Below is what I have so far. I’m using the same format to change equipment CFM and equipment numbers, both of which are instance parameters. Can anyone help?

it means that you are casting the wrong type to the parameter. Turn it into an integer (or double)

Thanks erfajo, however I’m still getting errors. When I try to do it numric back to string, I get a “No parameter found by that name” error. Below is what I’m getting. I can only post one photo per post, so I’ll have to post another one for going string to numric.

When I do string to numric, it tries to change the parameter name to str so i also get the “No parameter found by that name” error. Do you see anything else I may be doing wrong?

As far as i know “ParameterName” is Always a string.

Erfajo means change the “value” to integer

Try to set String.ToNumber between List.GetItemAtIndex and the “value” from Element.SetParameterByName

1 Like

exactly what @EzDoesIt has written, it is only the value of a parameter which you need to change, test your parameter inside revit which type it takes… string or number.
the value of a parameter is always a string… always!

your error “no parameter found by that name” indicates that the parameter doesnt exist!
the error could be that you want to change a type parameter but it is a instance parameter or the other way around. To fix that you need to feed your ‘setter’ with the right type… type or instance.

Thanks for clearing that up! I’ve never done any kind of coding before so I’m just learning from Youtube and Google. I set the String.ToNumber between List.GetItemAtIndex and the “value” from Element.SetParameterByName like you suggested and still get an error. It’s weird because it’s acting like this code block is changing the parameter name to str. Any ideas on how to fix this?

with the node object.type you can see what kind of type (string, double, …) your trying to pass

put the object.type on the “item” from List.GetitemAtIndex and show the elements in both List.GetitemAtIndex and the object.type with the watch node

The information that is coming from the List.get module is a likley not a valid item that can be converted to a number. put a watch so that we can see what is at index [3] and or pin module down so we can see it.

this will not work due to the string is three written

Sorry but it would help a lot if you provided the graph as a .dyn file and a snip of your excel file and whatever dummy files is needed.

this will work because the number is in

quotes thus making it a string.

Thanks for all the replies yesterday! I was out of the office but am digging back into this now. Below is a snip with a watch on the item from the List.Get module(showing most of the parameter, you have to scroll right to see all of it). I’ve also added a Object.Type with a watch on it as advised by @EzDoesIt. @erfajo I’m happy to upload any files you need if you want to get into my .dyn and play around with it. What all do you need other than the .dyn and excel file? Do you need my Revit file as well? Since I’m new to the forums I’ll have to upload each of those in individual posts, but that’s not a big deal for me. Thanks again everyone for the help on this!

As you can see there in the watch that is not a valid number and the reason you are getting the errors converting it to a number. please refer to my other two post showing you what the String.ToNumber is looking for.

You are trying to pass “Family Type: TTV026, Family: H - Hea…” into parameter “Type” i guess this is not the correct value.
You can adjust this in your excel file.

You have to evaluate which files is needed to help you. If you want help, then provide all what is needed, that is in your case the graph (.dyn file), excel and revit. BUT kept in an absolute minimum size, dont upload anything not needed for the exact problem. We dont need excel lists with hundreds of lines and revit files with an entire template or project.

I expect you have read these links very careful as a step one in using the forum.

Thanks @erfajo. Being a new member of the forum, I’m unable to upload files to the forum. I’ll take the info everyone provided here and do my best at getting my dyn to work.

“There are some limitations for new users. These limitations is set up to defend the community against misusage of the community for file transfer etc. Therefore is it recommendable for new users to provide files etc. using a fileshare services (Dropbox, Google Drive…). New users are accepted to upload files if they show a real user behavior, which entail… entering at least 5 topics, reading at least 30 posts, or spend a total of 10 minutes reading posts.”