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.
Hi John, welcome
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
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
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.
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:
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.
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.
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.
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.
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.