[英]How to convert a created wall type to a family file in revit api c#
I am working on a project in Revit API where I need to我正在 Revit API 中的一个项目中工作,我需要
I did the first 3 parts, but when I filter to extract family我做了前 3 部分,但是当我过滤以提取家庭时
FilteredElementCollector collector = new FilteredElementCollector(doc);
Family famType = collector.OfClass(typeof(Family)).FirstOrDefault(x => x.Name == "Basic Wall") as Family;
List<FamilyInstance> list = new FilteredElementCollector(RevitData.Document).OfCategory(BuiltInCategory.OST_Walls).OfClass(typeof(FamilyInstance)).Cast<FamilyInstance>().ToList<FamilyInstance>();
Walls are System Families and you cannot save them as a *.rfa File.墙是系统系列,您不能将它们保存为 *.rfa 文件。
Your collector is not working because you are using the wrong classes in the filter, the class Wall or WallType is the correct one.您的收集器无法正常工作,因为您在过滤器中使用了错误的类,class Wall 或 WallType 是正确的。
To exchange WallTypes between projects, you can transfer Project Standards -> Wall Types, however there is no API for that.要在项目之间交换 WallTypes,您可以传输 Project Standards -> Wall Types,但是没有 API。 As alternative you could use the method ElementTransformUtils.CopyElements() to copy the Wall or WallType, or try to regenerate the WallType in the target Document using an existing WallType and the Duplicate method setting all the Parameters as in the source Document.
作为替代方案,您可以使用方法 ElementTransformUtils.CopyElements() 来复制 Wall 或 WallType,或者尝试使用现有的 WallType 和 Duplicate 方法在源文档中设置所有参数来重新生成目标文档中的 WallType。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.