Determine if Project Shared Parameters are Type or Instance bound

Determine if Project Shared Parameters are Type or Instance bound

stephen_harrison
Advocate Advocate
998 Views
3 Replies
Message 1 of 4

Determine if Project Shared Parameters are Type or Instance bound

stephen_harrison
Advocate
Advocate

Apologies in advance if there is an obvious answer but I have been trying to resolve this for some time but appear to have a complete block on how to code the solution.

 

A little background before I start, I am using Revit 2016 and my code is C#. The aim of the code is to ascertain all the information on the bound Shared Parameters and export it to an Excel file.

I have code to obtain just about everything I require with the following exceptions:

 

Are the Parameters Type or Instance bound?

The value of the Type parameters?

 

The bases for retrieving this information is the code below:

 

foreach (Element elem in elementSet)

  {

  Parameter parameter = elem.get_Parameter(spGuid);

                   

From searching the internet I believe that once I have the Parameter. Element (elem) that I need to ascertain if this is derived from the ElementType base class. If so then it is a Type bound parameter, else an instance one? Is this correct and what am I missing with my code?

 

Any code sample would be much appreciated.

 

Also when I use

 

parameter.AsValueString();

 

I can obtain the value of the Instance bound parameters but for Type bound parameters it is blank?

 

Any Assistance would be much appreciated.

0 Likes
Accepted solutions (1)
999 Views
3 Replies
Replies (3)
Message 2 of 4

Anonymous
Not applicable

 

sorry wrong post

0 Likes
Message 3 of 4

Anonymous
Not applicable
Accepted solution
FamilyInstance.GetParameters will only return instance parameters if you want the type parameters, you need to get its symbol and then ask the symbol for its parameters.

Also, have you looked at this post on The Building Coder: http://thebuildingcoder.typepad.com/blog/2010/07/shared-type-parameter.html

There are several other posts on TBC that can help you with at least the parameter aspects of this project.
Message 4 of 4

jeremytammik
Autodesk
Autodesk

Dear Ken,

 

Thank you very much for jumping in!

 

My kudos!

 

Cheers,

 

Jeremy



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

0 Likes