Setparameter by name

Is using “Element.SetParameterByName” the correct way to change the family value? I need to adjust the stud width based on the structural width of the wall. When I use different wall types in the project, I want a single parametric stud family to automatically adjust its width according to the wall width. Please advise.

You are almost there. The way you have it, you would be setting the width of all studs to the very last inputted wall width value. You need to group the studs per wall and input the stud groups into the Set Parameter. You may have to use lacing and/or levels on the Set Parameter node.

Not resolving

Anything other way?

Show what you tried to do with grouping the studs per wall.

A single family with specific depth types or one type with varying instance widths? This is step one. Right now you’re changing a single type and not dealing with the other types (if they exist) or the instances (if that’s what you want to control).

Only one type column base stud family.

Then you would want the width properties of that stud to be controlled at the instance level, not the type level. You need to make that change to the family and then get all instances of those studs, grouped by wall type.


Can I set type or Instance to change the stud width?

Both will change the width. Type or Instance just varies whether all instances of a single type share the same value or whether all instances can have their own value. If you want one type with varying values then you’re saying that you want to control depth at the instance level. That also means that you need to modify the value for the element instances and not the types anymore. Your next step is getting all instances of that type.

You need to make that change to the family and then get all instances of those studs, grouped by wall type…How can I group?

What do you have so far? GroupByKey is usually the solution once you have some identifying value, but we don’t know how you have them identified. Do they have a host? Are you having to identify the associated wall based on location? We need more information.

I have done.


1 is ths wall width.


Not showing instance value.
How can I get instance value from dynamo?

This should be your general process:

  1. Get all stud instances.
  2. Get wall type/thickness associated with wall instance.
  3. Group stud instances by wall value.
  4. Apply wall width to stud instances in associated group.

The grouping may not even be necessary depending on how you’re associating wall depths. If you have a wall value for every stud then you can just apply the width to each instance directly. The grouping is only necessary if the identification of the wall is happening for multiple instances (like an intersection or attractor condition).

The question you need to solve is “which studs are located in which walls?”

That’s because you’re looking at the FamilyType and not a FamilyInstance. There are many ways to get instances in Dynamo. You can use All Elements of Category or you can get all instances of a specific Family or FamilyType through a number of nodes. I suggest you look at other threads on the forum dealing with element collection and filtering.

Something to add about the List.GroupByKey node @Vijays.

Lets say you have a list of Elements / Families (list A)
and a Parameter value of those Elements / Families (list B).

List A should go into [list] of the List.GroupByKey node and
list B should go into [keys] of the List.GroupByKey.

You might need to change your Levels or Flatten lists A and B.

NB
If list A is just a list of strings (or numbers) then that list
can go in both [list] and [keys] in the List.GroupByKey node.


Walls has been grouped.

  1. Group stud instances by wall value.
  2. Apply wall width to stud instances in associated group.

Which node can refer for above struction? Please advise.