Family Instance by Point - Replacing other families in the model

Hi all,

I’m having a small issue with my script.
While it does what it’s supposed to do, after a first batch of families are created, if I try and load some other families in the model, for some reason they will replace some of the existing ones.
Any ideas what I’m doing wrong?

1 Like

Hi @Victor01 ,

I think that this has to do with element binding, Dynamo is created in such a way that the results of previous runs don’t stay when you’re running the code again with other inputs. There should be a way in the script to disable this, but I’m not sure how, @jacob.small probably knows how though.

Another way to prevent this is by using the Dynamo player.

Hi Dan,

Unfortunately, I get the same result using the player.

Can you explain, step by step, what your process is and what’s happening? Sounds like something is missing here.

I’m trying to place some family instances as selected. The UI will prompt the user to select which of the components loaded in the model to place at project base point and use in the project.
What goes wrong here is that if at a later date you plan on adding more components, the older one get replaced with the new ones.
Hope that makes sense.

So you

  1. Run the script with the selected families.
  2. Correct instances are placed.
  3. Additional families are loaded into the model.
  4. The script is ran again with a new selection of families.
  5. The original family instances get replaced with new families.

Is that correct? Do the original family instances get replaced by the newly added families? Are the newly added families the ones being selected the second time the script is run? Are you only selecting the new families on the second run or are you selecting all families that need to exist?

Yes, the original families get replaced by the new ones.
I am selecting only new families on the second run.

Still sounds like a binding issue but I’m not sure where it would be coming from.

Can you just select all necessary components for each run? Does that work?

Yes that works just fine, I can load all of them with no problem.

But what happens when you rerun it multiple times? Does it work as long as you always include all components? Is that a viable workflow for you?

Yes, it works every time.
I guess it could be ok as long as I have more than before :slight_smile:
I would also want to get to the roots of why it’s not working, it’s not good for my OCD :sweat_smile:

Yes, I agree with both statements, but wanted to make sure you at least had a workaround.

To ensure that you always have the correct outputs, you could also delete all instances of those families before placing the new ones. Then the previous selections shouldn’t matter. This is also just good practice for workflows that may be running more than once in a project and could potentially “stack up” on each other.

Otherwise I suggest looking into element binding and/or maybe looking at another way to write your graph (same logic, just different methods).

I know Player is supposed to eliminate binding. As a test, open your script in Dynamo. Disconnect the first input to make the script run without inputs and error out. Reconnect the first input and save the script without re-running it. This is basically clearing out all bindings. Then run the script in player from that point. Reason for my madness. I have a script for creating schedules. No matter what I changed the name of the schedule to, it always updated the existing schedule. So advice on another thread from @jacob.small, the steps above fixed the issue.

1 Like

Yep,

That actually worked :laughing:

Thank you

1 Like

Hello @Victor01

We also struggled with element bindings, wondering why we were losing hundreds of families again and again. It was because we had so many scripts for family placement that were copies of each other.

Now as I`m aware of the problem, I build my graphs with a function apply node, like jacob small recommended in another thread. This way no element bindings are saved in the graph.

1 Like

Likely this is the post in question: Element Binding in Revit

2 Likes