JPais
JPais

Reputation: 135

How to assign parameters with angle in Dimension built-in group in Revit Family using Revit API

I am working on a project where I have to assign angle parameters to Dimension built-in group in Revit API c#
Here the angles are available in degrees as shown below

enter image description here

When I set the value in degree (say 11.5 degree) directly I get an error which says "Constraints not satisfied"
So I added the code to convert degree to radian, but even this fails.
My current code below

FamilyManager famManager = famDoc.FamilyManager;
double angle = 11.25; //value in degree
double dn = angle * Math.PI / 180; //Converting degree to radian
FamilyParameter fp = familyManager.get_Parameter("BEND ANGLE");
if (fp != null)
{
    familyManager.Set(fp, values);
}


Another method that I tried

double dn = UnitUtils.ConvertToInternalUnits(angle, DisplayUnitType.DUT_DECIMAL_DEGREES);

I am getting the same error.
Let me know if I am doing something wrong.

Upvotes: 1

Views: 735

Answers (1)

ManuelSL
ManuelSL

Reputation: 126

Your code is correct. Assuming "values" is equal to "dn".The problem is that you cannot assign the value of 11.25° to this parameter, try to do it manually and you will get the same errar message. There is a problem with the constraints of your model.

Upvotes: 1

Related Questions