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:


Sorry for being late, but it is summer… and i have until now used it on making a new hardword terrace :slight_smile:

Could you please upload the needed files for testing this? this include the graph file (.dyn) and one family (.rfa). Then I will try to look into this :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)

I am sorry, but I am from the SI world, so I dont know how you feed Imperial units. I have added a converter so I could show how to solve it.

The problem is that you feed the value as a string for a lenght parameter and that is not allowed.

Besides did I “unconnect” the open/close document feed, since I tested on the current document.

SetCaseworkDepthTo23_5.dyn (26.8 KB) --> Dynamo 2.1.0

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.”

The output from the former node must give you the documents several times. The close document can only close the document once :slight_smile:

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

well no… but if you end sending the same 3 documents 3 times, then put in a codeblock taking only out[0] before the close node :slight_smile:

please notice the differences if you use list level somewhere at a node…

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

The nine list comes while you send three lists of familytypes and you send the same three documents, this will give 3x3 lists… however, it will only find one familytype in each document, so it is waste of computational time.

this means that you could use list level like this
SetCaseworkDepthTo23_5.dyn (28.1 KB)

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: