Set Parameter by Name shows errors, saves family and does not close

I’m trying to build a dynamo script to change the value of some casework families (set “depth” to 23" instead of the currently entered 24"). I’ve built the dynamo script in the attached screen shot based on some other threads I found via search here but it seems to be getting stuck processing it. The node “FamilyDocument.Name” gives the following:
“Warning: FamilyDocument.Name operation failed.
Please run this command in a family document.”

I’m running this file on a folder with only 3 family files in it, no projects/templates exist within the folder. The families have no default type so I added the node FamilyDocument.CreateFamilyType. Everything else was added to support the operation, what would be causing the error?

I’m guessing you’re running your graph from a project file though. FamilyDocument.Name does not have a document input so it runs in the current document.

I launched a project from our default template to open Dynamo. I tried just now relaunching all except using a family template to get Revit going and launch Dynamo. Now I get a different error at setparameterbyname:
“Warning: FamilyDocument.SetParameterByName operation failed.
Specified cast is not valid.”

Unfortunately it’s not that easy. You’re in a family document but you’re not in that family document. I’m not sure if there’s a way to do that for a list of families as it needs to be the active document all the way through. You would probably have to use Python to specify the document.

Thanks for clarifying about which family document it might be looking for. I got the impression from the other posts on Orchid package that this would be possible to run on a batch of families. Perhaps @erfajo will chime in with a way to do this in orchid…

Anyone have any ideas to resolve this?

Looking at the last image it looks like your trying to write the text “23” into a length parameter?


Well that ain’t working :slight_smile:

@JoshuaB - It worked at one point in my script modifications, it just wasn’t closing the families.

No worries @erfajo, I bet that deck is gonna be fabulous!
files attached.SetCaseworkDepthTo23_5.dyn (31.0 KB)
TD-CW-WIC 101.rfa (476 KB)

Thanks for pointing me to that!
Now at the Document.Close node, I get a different warning:
“Warning: Document.Close operation failed.
The referenced object is not valid, possibly because it has been deleted from the database, or its creation was undone.”

So is there a different way I should arrange the nodes so it doesn’t try to save the documents 3 times?

OK, I see what you are saying. Basically, in my image below, Document.BackgroundOpen creates list ‘0’, FamilyDocument.CreateFamilyType creates list ‘1’ and FamilyDocument.AllFamilyType creates list ‘2’. Then the script remembers all 3 lists until the very end, essentially running the command FamilyDocument.SetParameterByName 3 times on each family that is open, then lastly we are filtering it to only save/close list ‘0’.

I wasn’t thinking it would remember each of these 3 nodes as separate lists, rather that it would simply carry it forward. Still getting used to Dynamo, thanks for the guidance!

1 Like

WooHoo!!! Thanks @erfajo - now it really cooks fast!

Is the FamilyDocument.SetParameterByName node in your script new? It has little boxes with @L1 inside them and my node doesn’t…

This is the List@Levels feature, see here:


Thanks @awilliams - I figured it had to do with the lists, I now have some light reading to do. :slight_smile: I was more curious why his node had that option and mine didn’t from the Orchid package…

Your nodes do have this option! :slight_smile: You are able to modify the list levels by selecting the arrows on the node inputs


OMG. Brilliant. Thank you!

1 Like

18 posts were split to a new topic: Set Parameters of Multiple Family Documents and Types