I am using rhino inside to try and programmatically add parameters in the document.
I understand that currently the RevitAPI does not support project parameters yet so adding those to the document via RiR won’t be achievable.
However, using the AddParameterKey.ByName component adds a shared parameter to the document. I noticed in the source code that the component has the ParameterType hardcoded to Text (see screenshot), would it be possible to allow for dynamic input here?
Also, there is currently no component to my knowledge that lets the user add global parameters to the document. I did a quick test using ghpython and it seemed to work fine (code and definition attached). Could this feature also be added into rhino inside with dynamic parameter type input? Thanks!
import clr
clr.AddReference('System.Core')
clr.AddReference('RhinoInside.Revit')
clr.AddReference('RevitAPI')
clr.AddReference('RevitAPIUI')
from System import Enum, Action
import rhinoscriptsyntax as rs
import Rhino
import RhinoInside
import Grasshopper
from RhinoInside.Revit import Revit, Convert
from Autodesk.Revit import DB
#access the active document object
doc = Revit.ActiveDBDocument
def create_global(doc):
pType = DB.ParameterType.Text
DB.GlobalParameter.Create(doc, name, pType)
if runIt:
Revit.EnqueueAction(Action[DB.Document](create_global))
a = "Success!"
else:
a = "Please press runIt"
Absolutely! Thanks a lot for the example code. I added an issue related to this so we can add the component. I’m gonna share your python code on Wiki until the component has been created
hi @kai.aurelien.zhu thanks for the example shared above. I know it’s already a long time since this conversation closed. Although I tried using the script you have shared before: GlobalParam.gh and a the following error popped up:
Solution exception:‘type’ object has no attribute ‘EnqueueAction’
Just to make you aware, I am using the script with the same porpuse: creating a global parameter inside my Revit file. And I am also using the variable “name” with “TEST” as its value, pretty much as your shared filed.
I would really appreciate if you give me a hint of what is up in the script and how can I solve it?