Hoe to get the value inside the parameters that are not BuiltIn parameters

Hoe to get the value inside the parameters that are not BuiltIn parameters

mahshid.motie
Contributor Contributor
730 Views
2 Replies
Message 1 of 3

Hoe to get the value inside the parameters that are not BuiltIn parameters

mahshid.motie
Contributor
Contributor

Hi,

 

I have created the parameter "Instance_Name" for all of the elements in my project and its has value in some of the elements and its empty in the rest. I want to check the value of the parameter but I dont know how to access it. Using revitlookup I found out that it exists in parameters. I have tried different methods like:

 

IList<Parameter> p = EF.GetParameters("Instance_Name");
string pp = p[0].ToString();
Parameter ppp = EF.LookupParameter(pp);
string pppp = ppp.AsString();
TaskDialog.Show("instance name", pppp);

 

or 

 

Parameter p = EF.LookupParameter("Instance_Name");
string pp = p.AsString();
TaskDialog.Show("instance name", pp);

 

Can you help me?

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

jeremytammik
Autodesk
Autodesk
Accepted solution

This question has been answered many times over elsewhere.

 

Your second code snippet is fine, with some caveats: avoid using the display name if possible, and it only works of you can guarantee that there is only one parameter with this display name. GetParameters returns all parameters with a given display name. get_Parameter also takes a GUID, if your parameter is a shared parameter.

 

https://thebuildingcoder.typepad.com/blog/2015/02/family-instance-area-and-auto-loading-a-project-fi...

 

https://thebuildingcoder.typepad.com/blog/2015/06/cnc-direct-export-wall-parts-to-dxf-and-sat.html#2...

 



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

Message 3 of 3

mahshid.motie
Contributor
Contributor

Thanks for the answer Jeremy 🙂

 

0 Likes