Creating a Project Parameter

92 views
Skip to first unread message

Coen Claus

unread,
May 30, 2018, 10:02:37 AM5/30/18
to RevitPythonShell
I know I can set the value of existing parameters with the following code

t = Transaction(doc. 'Set Parameter')
t
.Start
 
for i in elements_list:
    a
= i.LookupParameter('CHB_level')
    a
.Set('First Floor')
 
 t
.Commit()

I was wondering if I can create a Project Parameter with RevitPythonShell. After some Googling I found this website.

Now I am completely cluess about C# , but I was trying to understand what was going on. So on that site it is written

It may be worth of a few more words about the third method. It creates a temporary shared parameter file and switch the current shared parameter file over regardless of what it is, creates the named shared parameter in a temporary DefinitionGroup, creates a type binding or instance binding accordingly for the shared parameter, adds the Binding to the BindingMap got from the ParameterBindings property of the Revit Document of concern, and finally switches back to the original shared parameter file.

After reading this I am completely lost. I also could not find a simple Python script which can create a Project Parameter. Or if it is even possible.

Thanks in advance.

Callum

unread,
May 31, 2018, 9:56:30 PM5/31/18
to RevitPythonShell
Hi Coen, I've completely had the challenge before, and solved it using that 'third method' mentioned.

Unfortunately I'm on paternity leave so can't post code, but if you break down that paragraph into steps it's totally possible.

Out of interest, I used it to create a text Project Info parameter - which surprisingly can be multi-line - that I write XML into. Hello Saved Settings! If you use BIM link, you will see that they have made an XML project parameter like this on you project.

Cyril Waechter

unread,
Jun 1, 2018, 2:54:42 AM6/1/18
to RevitPythonShell
Hi Coen,

I made a project parameter and shared parameter manager here : https://github.com/CyrilWaechter/pyRevitMEP/tree/master/lib/pypevitmep/parameter
You may want to have a look. You can use it in pyRevitMEP extension to see how it works and analyse it.

I thought I had a simple example but I can't find it out.

I might also want to check Ehsan project : https://github.com/eirannejad/rsparam (it manage only shared parameter, not project parameter).

Cheers

Daren Thomas

unread,
Sep 24, 2018, 4:00:23 AM9/24/18
to RevitPythonShell
Hey Callum, congratulations! regarding paternity leave :-)
Reply all
Reply to author
Forward
0 new messages