【问题标题】:Problem Loading Forge Viewer bubble.JSON file, path seems to point to incorrect location加载 Forge Viewer bubble.JSON 文件时出现问题,路径似乎指向不正确的位置
【发布时间】:2021-03-22 05:59:49
【问题描述】:

我在本地加载可查看的 svf 时遇到问题。我正在加载bubble.json 文件作为我的文档。 (见下文)

function launchViewer(urn) {
  var options = {
    env: 'Local',
  };
  console.log(JSON.stringify(options));
  Autodesk.Viewing.Initializer(options, () => {
    viewer = new Autodesk.Viewing.Private.GuiViewer3D(document.getElementById('forgeViewer'));
    viewer.start();
    var documentId = "output/bubble.json";
    Autodesk.Viewing.Document.load(documentId, onDocumentLoadSuccess, onDocumentLoadFailure);
  });
}

我的输出文件夹包含bubble.json 文件和包含svf 内容的文件夹。

当我运行该函数时,我在控制台上收到以下错误

Logger.js:187 Error while processing SVF: {"url":"http://localhost:5500/output/output/1/result.svf","httpStatus":404,"httpStatusText":"Not Found"}

当我查看 json 文件时,它具有以下内容

"urn": "$file$/output/1/result.svf",

所以它似乎指向错误的地方。当我修改json文件时说

"urn": "$file$/1/result.svf",

模型加载得很好。我可以在加载文档之前简单地以编程方式移动文件或修改 json,但我想知道为什么翻译中的默认 json 文件指向错误的位置。

作为参考,我正在使用 Design Automation for Inventor 并按照此开发人员博客文章翻译我的模型。 [https://forge.autodesk.com/blog/speed-viewable-generation-when-using-design-automation-inventor][1]

【问题讨论】:

    标签: autodesk-forge autodesk-viewer autodesk-designautomation


    【解决方案1】:

    你是对的。 Inventor 将文件保存到无法用于在您的网站上加载的位置。在我们的http://inventor-config-demo.autodesk.io/ 演示应用程序中,我们完全按照您的描述进行操作,我们将bubble.json 文件移动到适当的位置。

    您可以在这里查看源代码https://github.com/Autodesk-Forge/forge-configurator-inventor/blob/238dbc7262f518decfbe484e6698b0d9356ca19b/AppBundles/CreateSVFPlugin/CreateSvfAutomation.cs#L101

    【讨论】:

      猜你喜欢
      • 2012-09-03
      • 1970-01-01
      • 2022-11-11
      • 2015-07-27
      • 2019-09-15
      • 2012-05-08
      • 2023-04-04
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多