Get ParameterType from ParameterId in Schedule

Get ParameterType from ParameterId in Schedule

Anonymous
Not applicable
751 Views
7 Replies
Message 1 of 8

Get ParameterType from ParameterId in Schedule

Anonymous
Not applicable

Hi 

I have a schedule and I can get ParameterId for every field. Now I need to retrieve ParameterType from ParameterId.

How can I do that?

Best

0 Likes
752 Views
7 Replies
Replies (7)
Message 2 of 8

Sean_Page
Collaborator
Collaborator

I think you need to get the Internal Definition then use that to get the ParameterType.

 

https://www.revitapidocs.com/2020/e08c6586-26b2-2c2b-a699-3d4186dc3393.htm

Sean Page, AIA, NCARB, LEED AP
Partner, Computational Designer, Architect
Message 3 of 8

SamBerk
Advocate
Advocate

But how can I get the Internal Defenition from a PrameterId?

0 Likes
Message 4 of 8

lukaskohout
Advocate
Advocate

You can try this:

ParameterElement pe = doc.GetElement(yourParameterId) as ParameterElement;            
Definition d = pe.GetDefinition();
ParameterType pType = d.ParameterType;

 

 


Hitting Accepted Answer is a Community Contribution from me as well as from you.
======================================================================
Message 5 of 8

SamBerk
Advocate
Advocate

Thanks @lukaskohout 

 

It looks like your solution only works for Project Parameters or Sheard Parameters, is there any way to get the parameter definition of a built-in parameter?

0 Likes
Message 6 of 8

lukaskohout
Advocate
Advocate

And what you get when you call Document.GetElement(ElementId elementId) on the built-in parameter?(I have no Revit available right now)

 

Can you get anything else from the schedule than ElementId? Can you get the element with that parameter?


Hitting Accepted Answer is a Community Contribution from me as well as from you.
======================================================================
0 Likes
Message 7 of 8

SamBerk
Advocate
Advocate

it returns: null

 

i want to know if there is a way even if i don't have any element using this parameter

0 Likes
Message 8 of 8

lukaskohout
Advocate
Advocate

Well I do not know about anything for that. I always use shared parameters, and also mostly there is some element in the schedule.

 

It is well described here as well:

https://forums.autodesk.com/t5/revit-api-forum/getting-parameter-information-from-a-schedule/m-p/680...

 

Long story short, you need an element with given builtin parameter to get its definition.


Hitting Accepted Answer is a Community Contribution from me as well as from you.
======================================================================