Changing ParameterGroup with InternalDefinition.ParameterGroup property

Changing ParameterGroup with InternalDefinition.ParameterGroup property

Anonymous
Not applicable
636 Views
1 Reply
Message 1 of 2

Changing ParameterGroup with InternalDefinition.ParameterGroup property

Anonymous
Not applicable

Hi, I'm trying to change a parameter group using InternalDefinition.ParameterGroup property as it has as getter as setter for it comparing to Definition.ParameterGroup property. I get the InternalDefinition of the parameter by casting Definition to InternalDefinition class for FamilyParameter instance or with GetDefinition() method for SharedParameterElement. All these steps return me the InternalDefinition but trying to get the ParameterGroup property returns me only Definition.ParameterGroup which has only getter. I found a tricky way to change the group by replacing the parameter with a familyparameter with necessary group and then to replace it back to shared. But probably there's a possibility to use InternalDefinition in right way?

 

Here's a part of the code I use:

private void ChangeParameterGroup(FamilyParameter par, BuiltInParameterGroup group)
{
(par.Definition as InternalDefinition).ParameterGroup = group;
}

or:
private void ChangeParameterGroup(SharedParameterElement par, BuiltInParameterGroup group)
{
par.GetDefinition().ParameterGroup = group;
}

 

PS. Using Python to process the same way lets me to change parameter group but after saving and closing the family document the result reverts back.

Thanks.

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

Moustafa_K
Collaborator
Collaborator
Accepted solution

believe there is no way you can do that. unless i miss interpret your question.

May you please explain why you do need to do that, or the aim you are targeting that lead you to think of changing the built group parameter? may be we can suggest some alternative routs.

Moustafa Khalil
Cropped-Sharp-Bim-500x125-Autodesk-1