Autodesk forge 在Forge Viewer中的Design Automation上生成的Forge可视对象的方向与Inventor中的方向不匹配

Autodesk forge 在Forge Viewer中的Design Automation上生成的Forge可视对象的方向与Inventor中的方向不匹配,autodesk-forge,autodesk-designautomation,autodesk-inventor,Autodesk Forge,Autodesk Designautomation,Autodesk Inventor,我正在使用设计自动化API从模型导出SVF。对于某些模型,可查看对象的查看器中的方向与Inventor中的方向不匹配。 如何更正此问题,使所有模型的查看器方向与输入Inventor模型相匹配? 下面的代码是导出SVF的地方。关于此功能的博客文章会很有帮助 私有字符串可保存可查看(Inventor.Document){ 字符串viewableOutputDir=null; 使用(新的HeartBeat()){ //日志跟踪($“**保存SVF”); 试一试{ TranslatorAddIn-o

我正在使用设计自动化API从模型导出SVF。对于某些模型,可查看对象的查看器中的方向与Inventor中的方向不匹配。

如何更正此问题,使所有模型的查看器方向与输入Inventor模型相匹配? 下面的代码是导出SVF的地方。关于此功能的博客文章会很有帮助

私有字符串可保存可查看(Inventor.Document){
字符串viewableOutputDir=null;
使用(新的HeartBeat()){
//日志跟踪($“**保存SVF”);
试一试{
TranslatorAddIn-oAddin=null;
foreach(inventorApplication.ApplicationAddIns中的ApplicationAddIn项){
如果(item.ClassistString==“{C200B99B-B7DD-4114-A5E9-6557AB5ED8EC}”){
//Trace.TraceInformation(“SVF翻译插件可用”);
oAddin=(TranslatorAddIn)项;
打破
}
else{}
}
if(oAddin!=null){
//Trace.TraceInformation(“SVF翻译插件可用”);
TranslationContext oContext=inventorApplication.TransientObjects.CreateTranlationContext();
//设置上下文类型
oContext.Type=IOMechanismEnum.kFileBrowseIOMechanism;
NameValueMap oOptions=inventorApplication.TransientObjects.CreateNameValueMap();
//创建数据媒体;
DataMedia oData=inventorApplication.TransientObjects.CreateDataMedia();
Trace.TraceInformation(“SVF保存”);
var workingDir=Path.GetDirectoryName(doc.FullFileName);
var sessionDir=Path.Combine(workingDir,“SvfOutput”);
//确保我们先删除输出目录中的所有旧内容,
//这是用于本地调试的。在DA4I中,工作目录总是干净的
if(Directory.Exists(sessionDir)){
Delete(sessionDir,true);
}
oData.FileName=Path.Combine(sessionDir,“result.collaboration”);
var outputDir=Path.Combine(sessionDir,“output”);
var bubbleFileOriginal=Path.Combine(outputDir,“bubble.json”);
var bubbleFileNew=Path.Combine(sessionDir,“bubble.json”);
//设置SVF选项
if(oAddin.get_HasSaveCopyAsOptions(doc、oContext、oOptions)){
oOptions.set_值(“GeometryType”,1);
oOptions.set_值(“EnableExpressTranslation”,true);
设置_值(“SVFFileOutputDir”,sessionDir);
oOptions.set_值(“ExportFileProperties”,false);
oOptions.set_值(“模糊标签”,true);
}
oAddin.SaveCopyAs(doc、oContext、oOptions、oData);
LogTrace($“**将SVF保存为{oData.FileName}”);
File.Move(bubbleFileOriginal、bubbleFileNew);
viewableOutputDir=sessionDir;
}
}
捕获(例外e){
日志错误($“*******导出为SVF格式失败:{e.Message}”);
返回null;
}
}
返回viewableOutputDir;
}

我们也遇到了这个问题,这是我们的SVF输出设置,它尊重您的设计基础:

oOptions.set_Value("EnableExpressTranslation", false);
oOptions.set_Value("ExportFileProperties", true);
oOptions.set_Value("ObfuscateLabels", false);

有关完整代码,您可以看到我们新的示例应用程序存储库

我实际上无法将“可查看”设置为正确的方向,也无法更改主屏幕-ViewCube似乎有问题。我点击一个角,它会翻转成我想要的方向的旋转视图。