Editing nested families parameters - cannot save in family file

Hi there,

As part of bigger script, I am trying to load families to the project, modify them in the project, and then save these families to the folder.

I have main families (valves) which I load to the project. They have nested families (actuators). The nested families are linked with label parameter “Actuator Type” (type parameter, shared). This label parameter defines which type of Actuator is applied at the moment in the host.

The logic of script:

  1. Get Types of host (valve)
  2. Read from types the value of “Actuator Type” label parameter. As values we have there actuator’s family types
  3. I try to set new value to one parameter of Actuator types (of nested families)
  4. Save the host families (valves) to the folder

The issue is that, when I open newly saved host families, the new values in nested families are not saved.

In the Revit project, where I was modifying the families, I see these changes. But also not always properly. For example if I put new instance of actuator family to the model, then new value is there. But if I use assembly (main host family, which contains this actuator), then in some cases I see the changes, in other cases it might be old values. In one of the scripts to see new values applied in assembly, I was setting again same value (same nested type) to “Actuator Type” parameter of host, triggering some change. And at least I was able to see proper picture in Revit project, but in saved family still not.

In the second test script I see all changes in Revit project without additional triggering (do not touch label parameter “Actuator Type”), but still not in newly saved families :frowning:

I was trying to end and start transaction and also regenerating with Regenerate node from Archilab, but still no effect.

I am attaching screenshot of test script. There are some warnings, but I believe it is because of binding, as first launches were without errors).

I think you’ll need to input the actual family type into Element.SetParameterByName, not just a string.
image

No, what am I trying to do is to set new value to the parameter “Model” of the nested family types. The parameter is text, so the new value is a String as well

pretty sure you’ll need to work directly with the nested families. If they are shared would make it even easier directly from the project.

I was sure as well that it should work, and it was my idea to do exactly as you describe. But it doesn’t save these changes to new host family file. In project, as I mentioned, the nested family is changed after script launch. If I place the new instance of nested, or new instance of assembly (host which includes nested) in both cases new instances have updated values of parameters. If I check with project browser, clicking on nested type, it also has the changes.

But if I try to save this host family from project, even if I do it manually without Dynamo, the new file saved from the project has old values. Which is weird and seems like a bug for me. Also, if I try to click edit family, and open host family from project in family editor, the changes are not there (although second ago I was putting instances of the same family to model, and these instances had the changes if to check them through schedule or just click on elements).

And yes, what I am doing is equal to direct editing of nested family in project, bypassing the host. Element IDs for nested family types are exactly same, not depending on whether I get the types directly from project or read them as values from label parameter of host.

What you’re recommending is exactly same to what is on screenshot, but you offer to get nested types directly from project. I tried this way as well, just in case, and unfortunately it doesn’t change a thing.

P.s. forgot to mention previously: revit 2023

seems revit is remembering the original family’s data.
i guess you could try setting the parameter’s formula to force your values?
are you saving to a new directory or overwriting the old family?
tried saving families with a new name (prefix/suffix etc.)?

I would try all of this just natively in revit to get it working, then replicate the workflow in dynamo.

I have found the workable way around which is to trigger reload of nested families to the project.

In current implementation: from the project I use editing of needed nested families in background with Orchid node Family.Edit. Then make the changes in background family documents of nested families. Next load them to the project which lead to update of parameters, and then close the background documents.

1 Like