Verify if a parameter is a shared parameter

Verify if a parameter is a shared parameter

Anonymous
Not applicable
613 Views
1 Reply
Message 1 of 2

Verify if a parameter is a shared parameter

Anonymous
Not applicable

In here, a piece of a code

 

foreach (Parameter param in elementType.Parameters) //Pega Type
{
if (param.Definition.Name == "CotaA")
{
trans.Start();
if ((CotaA != 0) && (param.IsShared))
{
param.Set(CotaA);
}
else
return Result.Failed;
trans.Commit();
}
}

 

and always fail.

 

I want to check if the parameter in revit "CotaA" is a Shared Parameter.

Tks.

0 Likes
614 Views
1 Reply
Reply (1)
Message 2 of 2

Anonymous
Not applicable

1. transaction need a name to start with, try trans.start("some action");

 

2. if elementType is a FamilyInstance, then this should work, but if elementType is FamilyType, you should use FamilyManager to set the value.

 

3. can you make sure the paramater value type is same type of variable CotaA ? because you can not use a string value to set a parameter which is integer value.

0 Likes