Based on our experiences in the past decades, it’s fun to play with Revit API. Here is one. The method FamDoc.FamilyManager.SetFormula(…) needs a transaction, otherwise: 'A sub-transaction can only be active inside an open Transaction.' But FamDoc.FamilyManager.AddParameter(…) does not! It should have started one inside itself.

Click here to view the entire blog post.