FamilyDocument.AddParameter A sub-transaction can only be active inside an open Transaction

I have successfully “Frankensteined” scripts that perform various parameter manipulations on all families within a Windows directory (thanks to many examples here :smiley: ). However, I’m stuck on what I think should be the simplest script…

I am trying to add a Family Parameter to all families in the folder. However, when I run the Dynamo script, I get the following error:

FamilyDocument.AddParameter operation failed. A sub-transaction can only be active inside an open Transaction. The script successfully adds the first parameter to the first family but then fails for the rest.

The issue seems to be with the way I am feeding families into the FamilyDocument.AddParameter node. This is the closest I have gotten to making it work. Originally, I used Gavin Crump’s (Crumple) FamilyDoc.Open node, however, it outputs Autodesk.Revit.DB.Document elements, while the FamilyDocument.AddParameter node requires input as Revit.Application.FamilyDocument, which can be retrieved via Revit.Application.Document but apparently not Autodesk.Revit.DB.Document.

I attached the dynamo script, image of the dynamo graph & the excel used by the script.
BIM-MAN-8_Parameter Create Family.xlsx (11.5 KB)
SOS-1.dyn (38.0 KB)

Appreciate any help :slight_smile:

Hello …something here seems to work for me in 24, if you will try with autodesk.revit.db.document Rhythm have some nodes for "convert to that as well.

Edit gues you are right…with that, anyway i would do it with birdtool, so we dont get transaction issues

1 Like

Thank you so much for introducing me to Bird Tools Dynamo Multi Player! I wish I had known about it earlier, it could have simplified many of my past workflows.

I’m currently on a time crunch, so I’ll proceed with this solution for now. In the future, however, I’d like to revisit it and see if I can get it to work with my original approach. I have similar scripts for adding shared parameters, changing parameter values, renaming, and converting parameters, which is why I was frustrated when I couldn’t get this to work. My backup plan was to add shared parameters and then convert them to family parameters :sweat_smile:.

1 Like