How to change instance parameters

Hello Community

I have trouble changing heights and widths of a list of windows.

 

I tried Element.SetParameterByName but i cant get i to work. I keep get the same error message:

“Element.SetParameterByName operation failed. No parameter found by that name.”

When using Element.SetParameterByName for changing the window type i get no error but i cant use it for changing the dimensions.

set_window_height

 

 

 

 

 

 

 

I also tried the packages “Set Multiple Family Instance Parameters” and “Set List Instance Parameters”, but they seem too cause Revit to crash every time.

 

Any ideas on how to get it to work?? or explanation on why Element.SetParameterByName dont work with Height and Width??

Hi Mads, do your windows have a parameter called “Height”? That property might be called “Sill Height”, for example.

Hi Colin. Yes its has both “Height” and “Sill height” and i get an error when trying to change any of them. When typing “Sill height” i get the following error:

“Warning: Element.SetParameterByName operation failed. The parameter’s storage type is not a string”

The window family properties. I tried with different windows with same result:

Windowfamily

You’re getting that error because you’re trying to pass a string (a.k.a. text) as the parameter value when what you’ll actually want to do is pass a double (a.k.a. number).

Or in other words: in your code block type 100; instead of “100”;

Hey Andreas

Thanks, that makes good sence! Unfortunately i cant completely get it to work with a double as a value.

It still doesn’t work with “Height” or “Width” but gives the error:

“Warning: Element.SetParameterByName operation failed. No parameter found by that name.”

 

It does however work with “Sill Heigh” and “Head height”

Is there a reason why the parameters visible in “properties” are adjustable but the ones in the “Type properties” are not?

Yes, there certainly is a reason for that:

You are pointing at a family instance, so all the parameters you can change are the instance parameters. If you want to change a type parameter you first need to point at the family type. To get from a family instance to its family type you need to look for “Symbol” in the node browser- that’ll get you nodes like FamilyInstance.Symbol. If you’re dealing with system families, try my node Element.Type (package Clockwork) instead. Depending on your original selection you may want to remove duplicate types from the list (use List.UniqueItems for that) so that you’re not seting the same type parameter multiple times.

Alternatively, if you know which family types you want to change, you can also use the Family Types node that lets you select a family type using a dropdown menu.

Perfect! The Element.Type node did the trick. Good stuff!

Thanks alot!

I played around with it a little more and i seem to get stuck at the same point from different approches.

I want the script to change a window family to another window family with the same height and width. I can make a script that changes the height, one that chanes the width, but i cant get it to work together.

One of the simplest (but also not working) script is the one below. By making small alterations different things seem to fail.

The script reads the width and height of a family type, changes the family to a new type and gives that family the old width and height (only it doesnt work together).

from_type

If i give it an input from category-elements-Element.GetParameterValueByName it changes the family and types of all window (since its from category), but the width and height changes fail. I dont want it to be reliant on category by the family type, but it was just a test to see if i could change family and type at all.

from_elements

If i leave the family and type change out, everything seems to work (but nothing happens since it changes the height and width to the same height and width):

no_family_change

What am I doing wrong? Do I need to convert type to element to change family types (the oppesite of the Element.Type node) in some way?

All of the screenshots you attached to your post are only thumbnails. Can you try to post them again?

Off course. Ill give it a try

from_type

 

 

from_elements

 

no_family_change

I am not sure that I understand completely what it is you’re trying to achieve.

Do you want to change the family type of a number of family instances and then change the width and height of the newly assigned family type?

Could you give a step-by-step description of your envisioned workflow?

Sure.

I want to to select a type of windows of any dimension. Then these windows should be replaced by another window family having the same dimentions. In the end i want to duplicate this function a coulpe of times.

In a scenario:

Windowtype1, Windowtype2 and Windowtype3 will be exhanged with windowx (having the dimentions of the window it replaces)

all windowtype1 (height 1000 width 2000) exehanged with windowx1 (height 1000 width 2000)

all windowtype2 (height 800 width 2000) exehanged with windowx2 (height 800 width 2000)

all windowtype3 (height 800 width 1000) exehanged with windowx3 (height 800 width 1000)

I know nearly got it to work. I now only need to know how to select items from a list based on their family type. If i continue to have problems with this ill open a new thread since my question is no longer related to the title.

Hi I came across this forum thread when searching to modify instance parameters. I’m hoping to change yes/no parameters which corresponding the a visible/invisible setting on a sheet Title Block. I’ve successfully used different tools with Grimshaw and Clockwork to isolate to my desired sheets, extract elements on sheets, and filter to the Title Block family itself. The problem is actually changing my instance parameters on multiple sheets with a single click. The specific goal is controlling my key plan but the bigger goal is controlling that yes/no parameter type. What do you guys think?

Hi Tim,

For controlling yes/no parameter you need to use integer values to “SetParameterNode”. YES/NO parameter storage type is an integer (1 is YES and 0 is NO). See below graph. Good Luck!

 

1 Like

YES! This did the trick. I was slightly confused at first when changes weren’t happening but it was because of how I was filtering upstream. Works like a charm! It’s also good to know that Dynamo doesn’t distinguish between Type/Instance parameters when extracting and reassigning values. Thanks KulKul!

I have been working and all of the sudden the component “Elements on Sheet” has failed and returning null. This is one as part of the Archi-Lab Grimshaw library of tools. It was working 2 days ago but now nothing… I have attached the Dynamo file. The goal is to be able to apply instance parameters to the sheet as well as title block in a single click. I’m hoping to get the current active sheet based on my definition as it stands. There was only current active view component but was unable to gather the current active sheet. Any thoughts on how to solve this?

Download Dynamo File here…

Hi,

I am trying to do exactly this. Replace Architects Windows with our Window family.
Did you get any further for this?

Thanks,