SOLVED!
API for ExternalDefinitionCreationOptions:
http://forums.autodesk.com/t5/revit-api-forum/how-to-access-shared-parameter-tooltip-in-revit-2016/td-p/6026596
[…CODE…]
_description = IN[0][7]
def ParamBindingExists(_doc, _paramName, _paramType):
map = doc.ParameterBindings
iterator = map.ForwardIterator()
iterator.Reset()
while iterator.MoveNext():
if iterator.Key != None and iterator.Key.Name == _paramName and iterator.Key.ParameterType == _paramType:
paramExists = True
break
else:
paramExists = False
return paramExists
def RemoveParamBinding(_doc, _paramName, _paramType):
map = doc.ParameterBindings
iterator = map.ForwardIterator()
iterator.Reset()
while iterator.MoveNext():
if iterator.Key != None and iterator.Key.Name == _paramName and iterator.Key.ParameterType == _paramType:
definition = iterator.Key
break
message = None
if definition != None:
map.Remove(definition)
message = "Success"
return message
def addParam(doc, _paramName, _visible, _instance, _groupName, _paramGroup, _description, k):
message = None
if ParamBindingExists(doc, _paramName, _paramType):
if not RemoveParamBinding(doc, _paramName, _paramType) == “Success”:
message = "Param Binding Not Removed Successfully"
else:
message = None
group = file.Groups.get_Item(_groupName)
if group == None:
group = file.Groups.Create(_groupName)
if group.Definitions.Contains(group.Definitions.Item[_paramName]):
_def = group.Definitions.Item[_paramName]
else:
_def = group.Definitions.Create(opt)
param = doc.ParameterBindings.Insert(_def, bind, _paramGroup)
return message
#“Start” the transaction
TransactionManager.Instance.EnsureInTransaction(doc)
try:
file = app.OpenSharedParameterFile()
except:
message = "No Shared Parameter file found."
pass
k=0
while k<_paramName.Count:
builtInCategory = System.Enum.ToObject(BuiltInCategory, _category[k].Id)
cats = app.Create.NewCategorySet()
cats.Insert(doc.Settings.Categories.get_Item(builtInCategory))
if _instance[k] == “true”:
bind = app.Create.NewInstanceBinding(cats)
else:
bind = app.Create.NewTypeBinding(cats)
opt = ExternalDefinitionCreationOptions(_paramName[k], _paramType[k])
#Revit 2015 Fehler “ExternalDefinit[ i ]onCreationOptions”
opt.Visible = _visible[k]
opt.Description = _description[k]
if isinstance(_paramName[k], list):
for i in _paramName[k]:
message = addParam(doc, i, _visible[k], _instance[k], _groupName[k], _paramGroup[k], _description[k], k)
else:
message = addParam(doc, _paramName[k], _visible[k], _instance[k], _groupName[k], _paramGroup[k], _description[k], k)
k=k+1
“End” the transaction
TransactionManager.Instance.TransactionTaskDone()