简体   繁体   English

Forge 设计自动化 API 中的链接文件问题

[英]Issue with linked file in forge design automation apis

We are using forge design automation apis in our project.我们在我们的项目中使用伪造设计自动化 API。 We have a requirement where we need to pass linked file with are main revit file as shown below.我们有一个要求,我们需要将链接文件与主 revit 文件一起传递,如下所示。 We are using revit 2020 as engine.我们使用 revit 2020 作为引擎。

|-- LinkA.rvt
|   |-- LinkA1.rvt
|   |-- LinkA2.rvt
|
|-- LinkB.rvt

But when we are getting the linked file using below code in c# revit addin.但是,当我们在 c# revit 插件中使用以下代码获取链接文件时。 Then its return an empty array.然后它返回一个空数组。

List<Element> linkCollector = new FilteredElementCollector(_doc).OfCategory(BuiltInCategory.OST_RvtLinks).WhereElementIsNotElementType().ToList();

Can any one please help me to figure out the solution for this problem?任何人都可以帮我找出解决这个问题的方法吗?

Are you trying to find RevitLinkInstance or RevitLinkType .您是要查找RevitLinkInstance还是RevitLinkType The code you have seems to be trying to collect RevitLinkInstance and if you get an empty list, it is likely due to fact that there are no instances placed for the linked files in the host document.您拥有的代码似乎正在尝试收集RevitLinkInstance ,如果您得到一个空列表,这可能是因为在宿主文档中没有为链接文件放置实例。

Do you get an empty array if you drop WhereElementIsNotElementType() in your filter?如果您将WhereElementIsNotElementType()放入过滤器中,您会得到一个空数组吗?

List<Element> linkCollector = new FilteredElementCollector(_doc).OfCategory(BuiltInCategory.OST_RvtLinks).ToList();

To explicitly collect RevitLinkType you can also do:要显式收集RevitLinkType ,您还可以执行以下操作:

List<Element> linkCollector = new FilteredElementCollector(_doc).OfClass(typeof(RevitLinkType)).ToList();

To explicitly collect RevitLinkInstance you can also do:要显式收集RevitLinkInstance ,您还可以执行以下操作:

List<Element> linkCollector = new FilteredElementCollector(_doc).OfClass(typeof(RevitLinkInstance)).ToList();

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

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