Create Parameters in a Revit Family

Here is one result from the search field that could help to get started:

Here is a current discussion that could also be of help here…

See if these posts can help for this part of your question:

Once you found something useful for your workflow, just send a screenshot of what you tried :slightly_smiling_face:

1 Like

Thanks for your time @Yna_Db

I will do all, I don’t know how to use Python, but I will try.

Thank you again :slight_smile:

Hi @VictorTrevijano,

I also concerned this one and I’ve figured it out couple day ago. (by someone’s code in forum :grinning:)
Very happy, if my work would help you out.
image

Here is the Python Node

Please use this workflow in Family Edit environment.

6 Likes

@NicoleChuong
Some additional explanation would be useful to quickly understand what you did and where this comes from :slightly_smiling_face:

Hi @VictorTrevijano,

I think the “Rhythm” and “DanEDU” packages could be very useful in this case.

https://forum.dynamobim.com/t/node-to-perform-load-into-project-action/14812/10

The Rhythm package contains nodes that can open (and close) a list of families from a directory path.
The DanEDU package cantains nodes that can perform actions on these (background opened families). The best thing about that is that it’s modular. You can pick the nodes you need, and pass the family documents on to the next in line.

Kind regards,
Mark

1 Like

Thank you so much @NicoleChuong
I hope it works for me. I let you know

@VictorTrevijano
This code is similar to the one in the first link I sent, please try what is proposed when people answer you. If I remember well, you first answered that it was not what you were looking for (and even flagged it, or was it flagged by someone else?).

Thanks for your time @MJB-online

The DanEDU doesn’t work well for me, I don’t have the last version of Dynamo

I know @Yna_Db. Now I am bit busy, but I will try everything, don’t worry :slight_smile:

I didn’t flag your answer, someone else did.

1 Like

Thanks for letting me know. If you can’t read the screenshots in the link, try to open them in a new window by right click…

@erfajo i cannot upload my Dynamo, then I cannot download the last DanEDU version. I have the package (it works perfectly) but It does not have all the nodes.

What version of dynamo do you have installed?

@erfajo @jacob.small I have 1.2 Dynamo version and this is all that I can have when I download DanEDU.

Captura

I check all the Links that @Yna_Db posted here and finally I found the solution. It is so similar to the @NicoleChuong answer, so i will select it like solution because it is in the same topic.

Thank you all for your help and your time :slight_smile:

That’s all that I have in the package, nothing else. It could be strange, but it is the true :pensive:

PD: Hope to solve this to see FEM-Design soon

Can you also post a screenshot of the manage > node and package paths dialog box?

Thanks very much @VictorTrevijano :grinning:
i just want to help people whenever i can for no glory, mate :grinning:

1 Like

Hi I think this is gonna be a easy one for you.
I replicated your code and it works flawlessly when trying to create One parameter. But how Do I run it to create Multiple Parameters. Say a list of Parameter Names.

1 Like

This is for one parameter type, Example is HVACDuct Size. If you have multiple kinds of parameter types like Length, Angle, Yes/No… You have to run each parameter type separately so that’s why you see the crossed out Await node.
You’ll need to create an excel file with all your parameters but put the different parameter types on their own sheets.
The code at the bottom is the red circled Python Node that you need to create to assign the formulas.


Create Params & Formulas excel1

import clr

clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc =  DocumentManager.Instance.CurrentDBDocument
app = DocumentManager.Instance.CurrentUIApplication.Application

clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.Elements)
clr.ImportExtensions(Revit.GeometryConversion)

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

def tolist(obj1):
	if hasattr(obj1,"__iter__"): return obj1
	else: return [obj1]

pNames = tolist(IN[0])
fString = tolist(IN[1])

outList = []
errors = []
test = []
names = []

if doc.IsFamilyDocument:
	fMan = doc.FamilyManager	
	params = fMan.GetParameters()
	for pName,fStr in zip(pNames,fString):
		for p in params:
			pd = p.Definition
			pn = pd.Name
			names.append(pn)
			if pName == pn:
				if p.CanAssignFormula:
					TransactionManager.Instance.EnsureInTransaction(doc)
					if fMan.IsParameterLocked(p):
						fMan.SetParameterLocked(p,False)					
					try:
						fMan.SetFormula(p,fStr)
						test.append(pn)
						outList.append("Succeeded")
					except Exception, e:
						outList.append(e)
					TransactionManager.Instance.TransactionTaskDone()
				else:
					errors.append(pn)
	
	no =  set(names).difference(set(test))
OUT = outList, no