How to get change parameter value of a family type in dynamo and get it update in the model in Revit

Hello

I want to change the parameter value of the height of the beam which parameter is “h”, but when I do it and run the program tha family type in Revit don’t update, is still the same as the initial one.

How can I change the geometry (height, width, etc) of a family type from Dynamo?

Are you trying to change the Type parameters in the current project, or in the Family itself? Right now your graph is changing the parameter in the Family Document, but you aren’t loading it back into the current project. If you are just trying to update the values for the beams in a current project you just need to get those elements or Types and use Element.SetParameterValueByName.

Thank you for your answer.

I want to change the parameter value in the family and reloading into the current project, how can I do that?

How can I load the Family Document to my current Revit Project?

So I was looking through the nodes available and was hitting a little bit of a road block so I put together a python version of what you were trying to do including the reloading.

#Sean Page, 2021
import clr

clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *

clr.AddReference('RevitAPIUI')
from Autodesk.Revit.UI import *

clr.AddReference('System')
from System.Collections.Generic import List

clr.AddReference('RevitNodes')
import Revit
clr.ImportExtensions(Revit.Elements)

clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

class FamilyOption(IFamilyLoadOptions):
	def OnFamilyFound(self,familyInUse,overwriteParameterValues):
		overwriteParameterValues = True
		return True
		
	def OnSharedFamilyFound(self, sharedFamily, familyInUse, FamilySource, overwriteParameterValues):
		overwriteParameterValues = True
		return True

doc = DocumentManager.Instance.CurrentDBDocument
uidoc=DocumentManager.Instance.CurrentUIApplication.ActiveUIDocument

#Preparing input from dynamo to revit
family = UnwrapElement(IN[0])
status = []

#Do some action in a Transaction
TransactionManager.Instance.EnsureInTransaction(doc)
for symbId in family.GetFamilySymbolIds():
	symbol = doc.GetElement(symbId)
	if not symbol.IsActive:
		symbol.Activate()
		
TransactionManager.Instance.TransactionTaskDone()
TransactionManager.Instance.ForceCloseTransaction()
if IN[4]:
	try:
		famDoc= doc.EditFamily(family)
		params = famDoc.FamilyManager.Parameters
		types = famDoc.FamilyManager.Types
		trans = Transaction(famDoc)
		trans.Start("test")
		for type in types:
			if type.Name == IN[1]:
				famDoc.FamilyManager.CurrentType = type
		for param in params:
			if param.Definition.Name == IN[2]:
				famDoc.FamilyManager.Set(param,IN[3])
		trans.Commit()
		famDoc.LoadFamily(doc,FamilyOption())
		famDoc.Close(False)
		status.append("Success")
	except:
		status.append("Failed")

OUT = status

Change Family Parameter_2021-04-09_06-42-08

Change Family Parameter.dyn (12.0 KB)

3 Likes