I realized that I could not find a solution on the forum or any packages (that I already had) that allows adding a new family type to a family document while in a project file, after seeing this post here and searching:
There are already shared workflows/nodes that allow users to create new family types within the project environment, but I couldn’t find any that would save those new family types within the family documents themselves, as well.
Given the API docs show that the Family Manager has a NewType method, I went ahead and tried making a Python script that could achieve just that, utilizing code written by @erfajo from the DanEDU Dynamo package nodes.
It works perfectly for me, so figured I should post here since I could not find other shared methods! (notes in image above indicate source packages for non-OOTB nodes)
Here is the Python code:
from Autodesk.Revit.DB import*
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
uiapp = DocumentManager.Instance.CurrentUIApplication
app = uiapp.Application
#input assigned the IN variable
docs = IN
names = IN
#wrap input inside a list (if not a list)
if not isinstance(docs, list): docs = [docs]
if not isinstance(names, list): names = [names]
#default document set to DocumentManager.Instance.CurrentDBDocument
if docs == 'Current.Document':
docs = [DocumentManager.Instance.CurrentDBDocument]
#core data processing
for doc in docs:
for name in names:
log = 'NewType created successfully'
log = 'An error occurred! Please verify setting'
#output assigned the OUT variable
OUT = docs, log
Many thanks to @erfajo and his family document nodes, because this code was made by editing just a few lines from the node DanEDU.FamilyDocument.SetFormulaByName
Hope this will be of use to others