All parameter to Component Family

I am in a family and want to add parameters. Below is my python node but I am missing something.

import clr

#import module for Revit
clr.AddReference(“RevitNodes”)
import Revit
clr.ImportExtensions(Revit.Elements)
clr.ImportExtensions(Revit.GeometryConversion)

#import Revit API
clr.AddReference(“RevitAPI”)
import Autodesk
from Autodesk.Revit.DB import *

#import module for the Document and transcactions
clr.AddReference(“RevitServices”)
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

import System
from System.Collections.Generic import *

doc = DocumentManager.Instance.CurrentDBDocument
uiapp = DocumentManager.Instance.CurrentUIApplication
app = uiapp.Application

paramName = IN[0]
exec(“paramGroup = BuiltInParameterGroup.%s” % IN[1])
exec(“paramType = ParameterType.%s” % IN[2])
paramBool = IN[3]

addParam = doc.FamilyManager
TransactionManager.Instance.EnsureInTransaction(doc)

try:
newParam = addParam.AddParameter(paramName,param_Group,paramType,paramBool)
except:
newParam = “could not create new parameter”

TransactionManager.Instance.TransactionTaskDone()

OUT = newParam

When sharing code please paste it as preformatted text - this post here shows a gif on how to do so properly:

However, you do not need to use Python here as there is a node for adding parameters in a Family Document in the Orchid package

2 Likes

Thank you for the reply. Yes I am aware of Orchid and have a previous version to the newest downloaded in Dynamo. The purpose for asking the question is a learning lesson using the API.chm, dynamo and python.
I believe I have all necessary references and variables included. I called for the Family Manager and Add Parameter method with all necessary variables but no joy. In my script the (try and except) is indented as required (not as shown above).
Any help is appreciated.

Patrick

No Orchid work as designed. Just trying to learn to code myself, most of the time I can work thru but this has me stumped

erfajo,

Sorry I didn’t recognize you are the developer of Orchid and be assured I have no desire to post, copy or steal any of your content. I very seldom post on any of the forums any longer. I have been working with Revit from 2003 and I am near the end of my career and just having fun now. Also totally understand your point of view and appreciate you work.

Thanks for your reply.