简体   繁体   English

如何使用 Revit API 在 Revit 系列中的 Dimension 内置组中分配带有角度的参数

[英]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#我正在开发一个项目,我必须在 Revit API c# 中将角度参数分配给 Dimension 内置组
Here the angles are available in degrees as shown below此处的角度以度为单位可用,如下所示

在此处输入图片说明

When I set the value in degree (say 11.5 degree) directly I get an error which says "Constraints not satisfied"当我直接设置度数(比如 11.5 度)的值时,我收到一个错误,上面写着"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.如果我做错了什么,请告诉我。

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.假设“values”等于“dn”。问题是你不能给这个参数赋值11.25°,尝试手动进行,你会得到同样的错误信息。 There is a problem with the constraints of your model.您的模型的约束存在问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM