Create and modify Global Type Parameter with API

Create and modify Global Type Parameter with API

nicolas.calvi
Participant Participant
2,024 Views
4 Replies
Message 1 of 5

Create and modify Global Type Parameter with API

nicolas.calvi
Participant
Participant

Hi,

 

I try to create on runtime (API and C# on Revit 2020) some Global Parameter to a Type and set a default value.

Currently I do it with Shared Parameter, but I want to do it with Global Parameter of the current document.

 

Is there a way to acheive this with API ?

 

Thanks.

0 Likes
Accepted solutions (1)
2,025 Views
4 Replies
Replies (4)
Message 2 of 5

naveen.kumar.t
Autodesk Support
Autodesk Support

Hi  @nicolas.calvi ,

 

Global parameters may be created only in Project documents, not in families.

 

Global parameters can be created with almost any type of data, there are a few types that are not currently supported, such as the ElementId type. Programmers can test whether a particular data type is appropriate for a global parameter by using the IsValidDataType(ParameterType) method.

 

1)Create a global parameter

https://www.revitapidocs.com/2016/57899395-e9df-4066-121d-046ee7a7425e.htm 

 

2)Set value to global parameter

https://www.revitapidocs.com/2020/df012c22-6e65-8de5-1057-f15660d02288.htm

 

Also, have a look at this below link

https://forums.autodesk.com/t5/revit-api-forum/get-or-set-global-parameter-group/td-p/9172280

 

https://www.revitapidocs.com/2020/f3af05ec-1f0c-fe86-6708-0a211a40bcda.htm


Naveen Kumar T
Developer Technical Services
Autodesk Developer Network

0 Likes
Message 3 of 5

nicolas.calvi
Participant
Participant

Thanks, we try have a look to your links.

0 Likes
Message 4 of 5

nicolas.calvi
Participant
Participant

Ok, I think there was a problem of understanding. I'm actually trying to create a global (unshared) project setting, as the screenshot below shows.

 

Project.jpg

 

 

How do you do this with the Revit API.

0 Likes
Message 5 of 5

naveen.kumar.t
Autodesk Support
Autodesk Support
Accepted solution

Hi @nicolas.calvi ,

The dialog box in your screenshot image is related to the project parameter and shared parameters but not related to the global parameter.

 

The global parameter is different from the project parameter.

 

I think you are trying to create a project parameter.

 

I think it is not possible to create a non-shared project parameter via Revit API but you can create a shared project parameter via Revit API.

 

https://spiderinnet.typepad.com/blog/2011/05/parameter-of-revit-api-31-create-project-parameter.html 

 

I hope this helps.

 


Naveen Kumar T
Developer Technical Services
Autodesk Developer Network

0 Likes