Batch Create Shared Parameters In Families From Directory

Hi I have several family documents in a directory, I am trying to first filter them based on the category and a paramater, In the second step I am trying to add shared parameters to these families.

Work Flow Chart:

The script shows no errors but the issues arise, when I check the output. When I open the families it gives me the following error and the parameters are not added.

Capture

After I close it and re-open, I can see that the parameters are added. But If I dont save the file it reverts back to the previous version without the parameters.

I know the problem is with 2 of the nodes -

“Document.Close” and “Family.Load”

The Graph

I highly recommend avoiding the opening of files in the background with rhythm or orchid and just use the OOTB nodes to do this on a document by document basis.

This video gives an overview of how to batch simpler graphs over a directory.

1 Like

Thanks for sharing the video. I came across this solution but I am looking to solve issues in the above graph with background open and close. :slight_smile:

Sounds good. Re: orchid the author prefers you ask about his package over on github, but either way good luck with the graph! Perhaps others can chime in here as well.

I only looked at the first image but it looks like you:

  1. Open the FamilyDocuments and filter for specific category
  2. Load those Families and filter FamilyTypes by parameters
  3. Get the FamilyDocuments back from the FamilyTypes
  4. Add shared parameters to the FamilyDocuments

If I had to guess, you’re doing too many things in too many places. Loading the families probably wont let you save the family document since the family is still open. I also don’t think you need to look at each family type since they would still share the same family document if they’re from the same family. Again, you’d be opening and modifying the same document more than once that way.

You should be able to do everything directly in the family document once you’ve opened it. It may require additional packages or the Revit API.

Thanks @Nick_Boyts for your response. What can be the solution? …

Which node can I use instead of “Family.Load” Or How can I close the loaded families and save after adding the parameter?

What would be the best way to filter the families with category and than with a parameter? After filtering I would like to add the shared parameters also

There are custom packages that deal with the FamilyDocument environment. I don’t know if they’ll have exactly what you need but it would be a good start. You can still do everything you’re doing in your current graph, you would just have to do it within the family environment. You would likely filter your list of original families into lists of those that do get parameters and those that don’t. You could then close and save or just close those families respectively.

Can you recommend any such packages?

Orchid is the only one that I can remember off the top of my head.

I have used Orchid nodes that I could find in my graph.

This might be of use: Add parameters to Revit families using Dynamo (and Crumple)! - YouTube

It uses the package crumple instead

2 Likes

@waqar.a.khan949 once you run the script, why don’t you close Revit then re-open it and check the families? The families are loaded in your Revit project and you are opening them at the same time, see if it helps.

Hi, Just checked. Doesn’t work. The parameters are not added. I am wondering which node can I use instead of “Family.Load” … Seems like that is causing the issues. I need to get families as elements or elements from the families to filter them with the parameter.

Right now I need to run the script 2 times to make it work.

@waqar.a.khan949 check this out, maybe SaveAs without loading the families will work for you:

You could use this post as a base for following @Nick_Boyts suggested path.

You really shouldn’t cross post like this - not the way forums are typically used - posts in a thread should relate to posts in that thread. Your threads are visible in the topics board for everyone to see.

1 Like

Alright Sir :slight_smile:

1 Like

To help you out here in regards to before, I’m also playing with opening/editing/loading families currently. I seem to have managed to get the process to work but am still testing it. This script should open all doors in a project, add a parameter to them, then load them back to the project. Hope it helps give some ideas, it mostly uses Python but also has Clockwork/Crumple in it.

I know the forums generally don’t like background open processes when it comes to families, but it might be helpful. Can’t guarantee it’s 100% perfect, but seems to work for me.

This is just a prototype so I suggest learning more about Python/Revit API if you wish to take it further.

Open from project add parameter then load.dyn (27.8 KB)

3 Likes

Hi Gavin,

I actually solved this issue. Will post the solution here soon. Thanks for helping out

1 Like

@GavinCrump the image you posted comes close to what i need… i just don’t need a shared parameter… just to be able to add some parameters