How do I go from a FamilyParameter to a Parameter on a FamilyInstance?

How do I go from a FamilyParameter to a Parameter on a FamilyInstance?

David_Robison
Advocate Advocate
982 Views
1 Reply
Message 1 of 2

How do I go from a FamilyParameter to a Parameter on a FamilyInstance?

David_Robison
Advocate
Advocate

Short version:

 

I have a FamilyParameter.IsInstance is set to True on it.

 

I have a FamilyInstance.

 

How do I get the Parameter from the FamilyInstance that corresponds to the FamilyParameter?

 

Long version:

 

I'm trying to get the load on an electrical device. I have the FamilyInstance in the project.

 

The load is set in the connector. To get the load from the connector, I have to go the family document. See this other forum post for background.

 

On the connector, I get the load parameter.

 

But! The has set the built-in load parameter to depend on a family parameter that he has created. It is an instance parameter so that in the project he can set the load for each device. I need to find this load.

 

I Use GetAssociatedFamilyParameter to get the FamilyParameter that is being used.

 

I check FamilyParameter.IsInstance and see that it is an instance parameter.

 

Now I need to go back to the instance and find the parameter to get the value.

 

I can't get the parameter using the definition (returns null) or GUID (not a shared parameter so doesn't exist).

 

In the Definition the names match but not the Id. I could iterate over all the parameters and find it that way, but if there are two parameters with the same name, I'm not sure how to make sure I found the right one. And that doesn't "feel" like the right way to get the parameter, but it could be my intuition is off on this.

0 Likes
Accepted solutions (1)
983 Views
1 Reply
Reply (1)
Message 2 of 2

jeremytammik
Autodesk
Autodesk
Accepted solution

Dear David,

 

I am sorry to say that you are right.

 

The only way I know to identify a non-shared family parameter on the instance is by using its display name.

 

I recommend never to use the display name to identify and retrieve a parameter if you can avoid it.

 

In this single case, I do not believe you can.

 

Sorry about that.

 

Cheers,

 

Jeremy



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