[英]How to set “Room Bounding” attribute on all elements in Revit API
I want to go over all elements in the document and set their "Room Bounding" attribute positive if they have a Room Bounding attribute.我想对文档中的所有元素进行 go 并在它们具有 Room Bounding 属性的情况下将其“Room Bounding”属性设置为正。
Iterating the walls I can do this:迭代墙壁我可以这样做:
Parameter param = e.get_Parameter(BuiltInParameter.WALL_ATTR_ROOM_BOUNDING).Set("Yes");
However how do I do that for Columns?但是,我该如何为 Columns 做到这一点? Or any other element who have this attribute?
或者任何其他具有此属性的元素?
I've tried going over all elements and get their parameters using:我尝试过所有元素并使用以下方法获取它们的参数:
IList<Parameter> ps = e.GetOrderedParameters();
but which attribute do I look for?但我要寻找哪个属性? is it "Room Bounding"?
是“房间边界”吗? Do I set it to "Yes" or any other thing?
我是否将其设置为“是”或其他任何内容?
Edit: I first started with this: https://thebuildingcoder.typepad.com/blog/2008/09/selecting-all-w.html adjusting the code to retrive the Room Bounding parameter.编辑:我首先从这个开始: https://thebuildingcoder.typepad.com/blog/2008/09/selecting-all-w.html调整代码以检索房间边界参数。
Then changing my code to support all elements, as my question mentioned and using: https://thebuildingcoder.typepad.com/blog/2018/05/getting-all-parameter-values.html然后更改我的代码以支持所有元素,正如我提到的问题并使用: https://thebuildingcoder.typepad.com/blog/2018/05/getting-all-parameter-values.html
And I've used it to print all parameters names and their value, however I can't find the Room Bounding parameter in columns.我用它来打印所有参数名称及其值,但是我在列中找不到 Room Bounding 参数。 I could easily do it in walls.
我可以很容易地在墙上做到这一点。
I tried using https://forums.autodesk.com/t5/revit-api-forum/get-the-value-of-shared-a-parameter-of-a-structural-column/td-p/8249860 and using我尝试使用https://forums.autodesk.com/t5/revit-api-forum/get-the-value-of-shared-a-parameter-of-a-structural-column/td-p/8249860并使用
mycolumnList[i].LookupParameter("Room Bounding").AsInteger() != 1)
but this also didn't work.但这也没有用。
Should I look for "Room Bounding" in instance parameter or in type parameter?我应该在实例参数或类型参数中寻找“房间边界”吗?
Please follow the standard approach to research and solve a Revit API programming task :请按照标准方法研究和解决 Revit API 编程任务:
RevitAPI.chm
installed locally or online at revitapidocs.com provides detailed info on classes, properties and methods. RevitAPI.chm
本地安装或在线安装在 revitapidocs.com提供有关类、属性和方法的详细信息。SDKSamples.sln
shows how Revit API objects work together to solve specific tasks. SDKSamples.sln
管理,展示了 Revit API 对象如何协同工作以解决特定任务。 After you have exhausted those options, search the Internet for 'revit api' or 'thebuildingcoder' plus the Revit API names that you are interested in.用尽这些选项后,在 Internet 上搜索“revit api”或“thebuildingcoder”以及您感兴趣的 Revit API 名称。
I very much hope that this addresses your question in full and does not only feed you for the moment, but also supports you in the process of being transformed into a competent future fisherman.我非常希望这能全面解决您的问题,不仅暂时满足您的需求,而且在您转变为称职的未来渔夫的过程中提供支持。
Thought I'll post a solution to help others who had similar issue.以为我会发布一个解决方案来帮助其他有类似问题的人。
Given an column e the following code change the "Room Bounding" parameter to True.给定 e 列,以下代码将“Room Bounding”参数更改为 True。 (Please notice this code do not handle exceptions)
(请注意此代码不处理异常)
FamilyInstance famInst = e as FamilyInstance;
Parameter family_bound_param = famInst.LookupParameter("Room Bounding");
if (family_bound_param.AsValueString() == "No")
{
using (Transaction t = new Transaction(doc, "param"))
{
t.Start();
family_bound_param.Set(1);
t.Commit();
}
}
Thanks Jeremy for the guidance!感谢杰里米的指导!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.