GetParameterValue2

GetParameterValue2

Anonymous
Not applicable
797 Views
7 Replies
Message 1 of 8

GetParameterValue2

Anonymous
Not applicable

Hi,

 

how to get  "GetParameterValue2"  varaible from Revit API, where i'm iterating through Family instances.

 

 

Thanks 

-RK

0 Likes
Accepted solutions (1)
798 Views
7 Replies
Replies (7)
Message 2 of 8

IbrahimNaeem
Advocate
Advocate
Accepted solution
// doc is the current document in the revit session 
foreach( Element e in Elmnts)
 {
   String content = doc.GetElement(e.Id).LookupParamater("GetParameterValue2").AsValueString();
}
0 Likes
Message 3 of 8

Anonymous
Not applicable

Hi,

 

Thanks Ibrahim

for your reply.

 

-RK

 

 

 

 

 

 

0 Likes
Message 4 of 8

IbrahimNaeem
Advocate
Advocate

@Anonymous if this solved your problem so kindly mark it as answer so others can follow if they reach out this post. 

 

Thanks, Ibrahim Naeem 

0 Likes
Message 5 of 8

Anonymous
Not applicable

 

Hi, ibrahim

 

having an error that snap attached here.

 

Thanks

-RK.

 

 

0 Likes
Message 6 of 8

IbrahimNaeem
Advocate
Advocate

Alright, this depends on the type of the parameter which name is written here so sometimes .AsValueString() works , other time .Asdouble() works and so on, so try to cast it with these different methods until you get the right method to go with. 

 

Thanks, Ibrahim Naeem 

0 Likes
Message 7 of 8

Revitalizer
Advisor
Advisor

Hi,

 

it seems that you just want to get the elements' IDs.

That's just: yourElement.Id.IntegerValue

 

Are you sure your parameter is named like a function, "GetParameterValue2" ?

The Null exception indicates that the given Element does not have such a parameter.

Also, if your Element does not have the desired parameter, it may be that it is attached to the Element's ElementType.

 

 

Revitalizer




Rudolf Honke
Software Developer
Mensch und Maschine





0 Likes
Message 8 of 8

Revitalizer
Advisor
Advisor

Hi,

 

the method to use depends on the parameter's StorageType, I think ?

So no need to test all variants...

 

 

Revitalizer




Rudolf Honke
Software Developer
Mensch und Maschine