Hi all,
Apologies if this is a known bug al though I hope it is simply a mistake on my part.
I was trying to add shared parameters to a rebar shape family through the API.
I have attached my script which works fine for other families.
However, for rebar shapes the API seems to behave differently.
Regardless of attempting to assign the parameter as instance or type using the familyManage.AddParameter, the parameter simply doesn’t show up anywhere.
Attempting to add the parameter manually works perfectly fine.
Manually added parameters are visible in the edit family UI and loads into the project as expected.
Except if the code has been run prior in this case, the parameter is added but I am only able to find it through Revit Lookup. It does not appear in the UI and does not load into project files.
Has anyone experienced this as well and perhaps knows a fix / different method to add shared parameters for rebar shapes?
Thanks in advance
import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
clr.AddReference('RevitAPI')
from Autodesk.Revit import DB
clr.AddReference('RevitServices')
from RevitServices.Persistence import DocumentManager as DM
from RevitServices.Transactions import TransactionManager as TM
#The inputs to this node will be stored as a list in the IN variables.
dataEnteringNode = IN
o = []
doc = DM.Instance.CurrentDBDocument
app = doc.Application
sharedParamFile = app.OpenSharedParameterFile()
pNames = IN[0]
okNames = []
newParams = []
for group in sharedParamFile.Groups:
for definition in group.Definitions:
if definition.Name in pNames:
if definition.Name not in okNames:
okNames.append(definition.Name)
newParams.append(definition)
tx = DB.Transaction(doc, 'Add Shared Parameters')
tx.Start()
familyManager = doc.FamilyManager
for defi in newParams:
famParam = familyManager.AddParameter(defi, DB.BuiltInParameterGroup.PG_IDENTITY_DATA, False)
o.append([defi.Name, famParam.ToString()])
tx.Commit()
OUT = o
TestParameters.txt (850 Bytes)FORUM_AddSharedParam2Family.dyn (5.4 KB)