[英]Import IFC in Revit using Forge (automatically generate ifc.rvt)
I am trying to automate the import of IFC file in Revit in order to automaticcally generate ifc.rvt files using Forge:我正在尝试在 Revit 中自动导入 IFC 文件,以便使用 Forge 自动生成 ifc.rvt 文件:
AppBundle & Activity which I want to use我想使用的 AppBundle 和 Activity
private void ChangeIfcToRev(DesignAutomationData data)
{
Application rvtApp = data.RevitApp;
string modelPath = data.FilePath;
Document doc = rvtApp.OpenIFCDocument(modelPath);
ModelPath path = ModelPathUtils.ConvertUserVisiblePathToModelPath("result.rvt");
doc.SaveAs(path, new SaveAsOptions());
}
Right now everytime I start my Plugin I get this error:现在每次我启动插件时都会收到此错误:
Autodesk.Revit.Exceptions.InvalidOperationException: The document can not be opened.
at Autodesk.Revit.ApplicationServices.Application.OpenDocumentFile(ModelPath modelPath,
OpenOptions openOptions)
at DesignAutomationFramework.DesignAutomationData..ctor(Application revitApp, String
mainModelPath)
at DesignAutomationFramework.DesignAutomationReadyEventArgs..ctor(Application revitApp, String
mainModelPath)
at DesignAutomationFramework.DesignAutomationBridge.SetDesignAutomationReady(Application
revitApp, String mainModelPath)
at RevitCoreEngineTest.RceConsoleApplication.Program.UserMain(CommandLineArgs cl)
Thats really weird because I dont use the OpenDocumentFile
function in my code.这真的很奇怪,因为我没有在我的代码中使用
OpenDocumentFile
function。 Im using the OpenIFCDocument
function.我正在使用
OpenIFCDocument
function。 Since I didn't get any further, I tried to only resave the ifc file.由于我没有进一步了解,我试图只重新保存 ifc 文件。 Same error.
同样的错误。
Then I tried to use the samplePlugin from the Forge Tutorial: https://learnforge.autodesk.io/#/designautomation/appbundle/然后我尝试使用 Forge 教程中的 samplePlugin: https://learnforge.autodesk.io/#/designautomation/appbundle/
The samplePlugin works fine with.rvt files but not with.ifc files. samplePlugin 适用于 .rvt 文件,但不适用于 .ifc 文件。 Also there I get an error.
还有一个错误。
What do I wrong?我错了什么? Thanks for your help!
谢谢你的帮助!
Possibly, Forge DA for Revit insists on starting up Revit with an RVT
input file argument provided. Forge DA for Revit 可能坚持使用提供的
RVT
输入文件参数启动 Revit。 To work with this requirement, you might be able to provide a minimal dummy RVT
file as an input argument and simply ignore it, continuing to open your IFC
file as a second open document and saving that as RVT
just like you are already doing now.要满足此要求,您可以提供一个最小的虚拟
RVT
文件作为输入参数并简单地忽略它,继续将您的IFC
文件作为第二个打开的文档打开并将其保存为RVT
,就像您现在已经在做的那样。
Looking more closely and the instructions to Publish an Activity , I see that the input file is specified in the command line:仔细查看Publish an Activity的说明,我看到输入文件是在命令行中指定的:
"commandLine": [ "$(engine.path)\\\\revitcoreconsole.exe /i \"$(args[rvtFile].path)\" /al \"$(appbundles[DeleteWallsApp].path)\"" ],
What input file are you specifying there?你在那里指定什么输入文件?
Can you simply omit it?你可以简单地省略它吗?
I heard back from the development team, and the solution is simpler still.我收到了开发团队的回复,解决方案仍然更简单。
Just omit the input argument in your commandLine
specification:只需在命令行规范中
commandLine
输入参数:
"commandLine": [ "$(engine.path)\\\\revitcoreconsole.exe /al \"$(appbundles[mybundles].path)\"" ]
This is not new, and most customers probably know it.这并不新鲜,大多数客户可能都知道。 Still, I agree we can update the Forge docs to explicitly state this usage.
不过,我同意我们可以更新 Forge 文档以明确 state 这种用法。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.