Swapping family materials through directory path

Hi guys,

I would like to “reset” all the materials associated with family geometry (extrusions, sweeps, etc) in a specific folder. I don’t want to open every single family since it would take too much time.

After some research, the solution I found is:

Everything works well until I get the error almost at the end of the graph:

  1. Is it possible to achieve what I want?
  2. If yes, can anyone please explain me what is wrong with the node/code?
  3. I didn’t find a way of set the Material parameter of the extrusion to By Category so I just assigned it to Default material. Is there any possibility to do it? The geometry should have the parameter associated like this:

Revit_3cppoI2d54

Thanks everyone!

This is a transaction error, as it states. Somewhere in the backround open you’ll need to add a transaction start and transaction end node to the backround processing file(s). I am not sure this is doable with the currently available nodes (but I could be wrong).

Why not just bulk delete the materials that are in the file?

Running this on a family document removes the material from the document, setting the value to the default (by category).

That graph + some Dynamo for Automation is likely all you need.

Thank for the input Jacob! This can be also a solution, but I want to do it for all families in a specific folder.

If Dynamo for Automation is the way to go, I will give it a try. The DynamoAutomation website states that the software works with "Any Dynamo 0.9.x or 1.x build.

I am using Dynamo 2.0.2, would that be a problem?

This was launched when 1.x was still kinda new, so best to test it out. You may have to ensure Dynamo 1.x is uninstalled as a troubleshooting step.

Sure, I will first see how it can be used since I never touched it.

Anyways, I kind of made the script work but in two steps.

First I ran the script with Element.Delete and Document.Close nodes frozen:

Then I unfreeze the two nodes and ran the script again and it seems that all materials are gone.

I would like to this at once. I tried to use Passthrough node so Element.Delete only acts after the materials are gathered, but it doesn’t work. Maybe I am doing the wiring in a wrong way. The error “Modifying is forbidden because the document has no open transaction.” appears.

Halfway through!