RiR Adding parameters to document - Shared vs Global vs Project parameters

Hello RiR dev team,

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?

ParamKey

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"

GlobalParam.gh (5.8 KB)

1 Like

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 :slight_smile:

2 Likes

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:

  1. 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?

Many thanks in advance!

Hi Juan,

You can add a Global Parameter using native components now.

3 Likes

thanks @Japhy. I just tried it and worked properly!

Hi Japhy,

Good day, how can l add a multiple instance parameters for a revit element?

Thanks

Hi Sketzjewel, Here’s the process of creating the parameter, adding a project parameter and adding the parameter to Revit Element.


Rir Adding Parameter to Revit Element.gh (10.0 KB)

This is also covered in our guide.

1 Like

Thank you Japhy, how can l add a x,y,z coordinates as an instance parameters? Thanks.

If you have a point you can deconstruct and format it into your text for your instance parameter.

1 Like