Get-Family Type Parameter to Set-Shared Parameter

Hello all.

I was wondering if Dynamo can get a electrical family type parameter (Number of Poles) and set this value to shared instance parameter that is present in the project schedule.

I do have access to the shared parameter file.

I get an error: Element.setparamterbyname operation failed. No parameter found by that name.

Thanks for your help.

Hi John, welcome :wave:
What you are attempting is to update a parameter in the Same Element type and, as the warning indicated, the type will not have that parameter if it is an instance parameter.
Get the instances from the type once you have eliminated duplicates

Note that ‘Number of Poles’ is a built in parameter which is associated with an ElectricalSystem Class, however it can appear as a family parameter

Edit: Please note this is an indicative graph only - it will wipe all instance comments


Mike you are a life saver lol. That worked!

Now I am running into another issue.

I would like to extract a Circuit Number (7) under electrical loads and set that value to a specified shared text parameter.

I am getting some errors.

Your help would be greatly appreciated.

It’s a bit hard without knowing what the errors are or what the inputs beforehand are - pin the outputs of the List.UniqueItems node and outline what are the reported errors

There are a few things going on here.

As you can see from your list of null ElementTypes, circuits don’t have a type. You’re essentially running into the same issue you had above either way: the Circuit Number parameter is an instance parameter so you need to retrieve it from the circuit instance.

There’s also some confusion around which element you want to be modifying. You’re selecting the Electrical Circuit elements in the Dynamo screenshot but showing the Electrical Equipment in the Revit screenshot. If you’re wanting to modify the panel (Electrical Equipment) then you need to work with those elements - pull the Circuit Number from the instance and then write directly back to the panel. The FamilyInstance.ByFamilyType node is attempting to create a new family instance (this is not what you want). You can just reuse the list of elements you’re pulling the initial value from.

1 Like

Never mind, I got it to work using your suggestion, Nick. Thank you all for your help.

Greatly appreciated.

It sounded like you just wanted to copy one parameter value to another, within the same element. FamilyInstance.ByFamilyType and List.UniqueItems are both likely unnecessary. All they’re doing is reordering and grouping your original list of elements, which isn’t necessary since you’re dealing with instances. You should be able to get rid of this whole section:

You are correct Nick.

I took out the 3 commands and it works much faster now.

Thanks for your help.

A caveat to removing the 3 commands is that it will NOT work for getting Family parameters for some reason. The script runs with no errors but nothing is filled out afterwards. I reverted to the below script as Mike suggested for Family parameters. Can someone please explain why this happens.

It’s the same issue you’ve had every time now. Getting more familiar with Revit’s native structure (particularly with Families, Types, and Instances) and how Dynamo mirror’s that is going to make this much easier.

Parameters for loadable families are either associated with the FamilyType (Type parameters) or the FamilyInstance (Instance parameters). You need to work with the correct object depending on the parameter you want. “Circuit Number” is an Instance parameter so you work with the FamilyInstance. “Number of Poles” is a Type parameter so you have to get the FamilyType from the instance before accessing the parameter.

1 Like

Thank you Nick. That makes sense.

I am now running into another issue. I am trying to only GET families if they have the word PANEL in the name of the family and then SET a parameter value to only these elements.

Thanks for your help.

Error is shown below

You are feeding the All Elements of Family Type node strings, you need to plug the instances into the filter using the Family Name, then get the types and finally reduce with a List.GroupByKey node

I’ll also say your use of All Elements of Family Type (like your previous use of FamilyInstance.ByFamilyType) seems misunderstood and unnecessary. You already have all the instances from All Elements of Category. After filtering or getting the Type/Family, you don’t need to then get all instances again, which is actually getting all instances per input - meaning you’re creating tons of redundancy most likely. All you have to do is revert back to the original list of instances. In Mike’s example, he filters the original list of instances because he needs the element (not the string) but also because the instance is the base object he’s dealing with. From the instance, he can get the type directly, without creating duplicates or changing the list structure.

1 Like

Thanks for the info Nick.

Any thoughts on how to combine two parameters into one shared project parameter. If there is no value present, then the value should be blank. I am getting a weird output.

You’re not getting a weird output. You got what you ‘asked’ for.

blank + - + blank = -

The - isn’t gonna disappear when you join two empty Strings (blanks)

You can replace / remove the single - (after). There are multiple ways to do that.

But all the output values are set to X01 2834092

I want the output to be the same value as the String.Join value.

It’s not pushing anything to the HAS_Circuit parameter.

Ah, i see. I guess / think you need to fix your Levels or Flatten your List.

And…

… are not the output values, that are the Elements. In this case it looks like a Family Type. @Nick_Boyts already touched that part.

PS

I highly recommend you to read the Dynamo Primer.

After I flattened it by 1 it worked. Thanks

I have another issue. I am trying to find the LEVEL the family resides on. The level has a very long name so I want to shorten it to 1 letter and 1 number. For example, the LEVEL name is

FIS_L2 DEPARTURES LEVEL

I want to SET the value, L2, to a different parameter HAS_LEVEL.

What I have so far is not working. Can you please give me your advice.