Get or Set Global Parameter Group

Get or Set Global Parameter Group

SamBerk
Advocate Advocate
2,966 Views
9 Replies
Message 1 of 10

Get or Set Global Parameter Group

SamBerk
Advocate
Advocate

Hi all,

Is there a way to get or set a global parameter under a group through the api?

0 Likes
Accepted solutions (1)
2,967 Views
9 Replies
Replies (9)
Message 2 of 10

jeremytammik
Autodesk
Autodesk

Dear Sam,

 

Thank you for your query.

 

Please look at:

 

  

Please let us know how you end up solving this.

 

Thank you!

 

Best regards,

 

Jeremy



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

0 Likes
Message 3 of 10

SamBerk
Advocate
Advocate

Thanks, @jeremytammik for your respond

 

Let me better explain my question.

When I create a global parameter from the UI I have an option to set the parameter under a groupgp.JPG

But from the API, I don't have this option

gpa.JPG

So my question is, is it possible to get or set this information from the API?

 

0 Likes
Message 4 of 10

jeremytammik
Autodesk
Autodesk

Dear Sam,

 

Thank you for your appreciation and explanation.

 

I see the problem.

 

I have asked the development team for advice.

 

Best regards,

 

Jeremy

 



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

Message 5 of 10

jeremytammik
Autodesk
Autodesk

Dear Sam,

 

Thank you for your patience.

 

The development team replied:

 

It looks as if that currently it is not possible. The method exists internally, but it's not exposed to the public API. We compute an appropriate group when you create a global parameter based on the input ParameterType::Enum datatype.

It would not be a large effort to expose this for the next major release of Revit. However, the managers have to approve this modification first.

 

Best regards,

 

Jeremy

 



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

Message 6 of 10

SamBerk
Advocate
Advocate

Thanks for your help

0 Likes
Message 7 of 10

SamBerk
Advocate
Advocate
Accepted solution

Hi 

It's interesting but I found that it is actually possible to do it now.

 

GlobalParameter globalParameter = (GlobalParameter)DbApp.Document.GetElement(paramId);

// get
BuiltInParameterGroup group = globalParameter.GetDefinition().ParameterGroup;
// set
globalParameter.GetDefinition().set_ParameterGroup(BuiltInParameterGroup.PG_VISIBILITY);

Thanks

Message 8 of 10

jeremytammik
Autodesk
Autodesk

Dear Sam,

 

Wow, yes, interesting indeed!

 

Thank you for letting us know!

 

Yet once again, the Revit API add-in developer community discovers a possibility that the development team is not aware of.

 

Best regards,

 

Jeremy

 



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

0 Likes
Message 9 of 10

ahmedaelbary
Explorer
Explorer

Dear @SamBerk and @jeremytammik,

How could you access GlobalParameter.GetDefinition().set_ParameterGroup()?

As per my experiment, I had the error highlighted below;

'Autodesk.Revit.DB.InternalDefinition.ParameterGroup.set': cannot explicitly call operator or accessor (CS0571) 

 

I am looking for your kind advice.

Thanks in advance.

0 Likes
Message 10 of 10

whp.m.owens
Enthusiast
Enthusiast

Hi there!

 

Care to take the time to show me how to implement this in my script?

I have about 70 Parameters I need to send to a different parameter group.

 

Cheers,

Matt

0 Likes