【问题标题】:Problem launching Forge Viewer locally instead of through Design Automation/OSS在本地而不是通过 Design Automation/OSS 启动 Forge Viewer 时出现问题
【发布时间】:2020-09-22 08:59:09
【问题描述】:

我首先告诉查看器使用指定为 bubble.json 文件的文档启动:

Helpers.launchViewer('viewerDiv', 'urn:' +  '/resources/41bbc339-294e-4eb1-b5ee-f4f303df46bbviewable/bubble.json');//this.props.modelPath);





function launchViewer(div, urn) {
    getToken.accessToken.then((token) => {
        var options = {
            'document': urn,
            'env': 'Local',
          };

          Autodesk.Viewing.Initializer(options, () => {
            viewer = new Autodesk.Viewing.GuiViewer3D(document.getElementById(div));
            viewer.start(options.document, options);
            Autodesk.Viewing.Document.load(urn, options, onDocumentLoadSuccess, onDocumentLoadFailure);
            viewer.loadExtension('Autodesk.ModelStructure');
          });
    });
}

然后我得到以下错误:

Xhr.js:940 POST http://localhost:3000/oss-ext/v2/acmsessions 404(不是 找到)

Otg.js:198 Uncaught TypeError: Cannot read property 'manifest' of null 在 Otg.js:198 在功能。 (Otg.js:143) 在 l (Xhr.js:564) 在 XMLHttpRequest.u (Xhr.js:668)

我想知道当我从我的服务器返回文件时,是否有我不包括的信息是需要的,或者我做错了什么。谢谢!

编辑: 我也尝试加载 result.svf 而不是气泡,并得到以下错误:

处理 SVF 时出错: {"url":"/derivativeservice/v2/derivatives/urn%3Aresources%2F0d3f37ff-d195-451b-9a3c-35402f326f4dviewable%2Foutput%2F1%2Fresult.svf","exception":"SyntaxError: 无法在“XMLHttpRequest”上执行“打开”:无效 URL","stack":"错误:在 'XMLHttpRequest' 上执行 'open' 失败: Object.g._rawGet 处的 URL 无效\n (blob:http://localhost:3000/a2115ade-285d-4398-8b8b-ae7704e9cc25:1:60485)\n 在 blob:http://localhost:3000/a2115ade-285d-4398-8b8b-ae7704e9cc25:1:59206\n 在 n ...

【问题讨论】:

    标签: autodesk-forge autodesk-viewer


    【解决方案1】:
    1. 你不需要在离线查看器中添加 urn 前缀
    2. 查看器只支持http/https url作为文档
    3. 参考0.svf文件进行渲染

    更多信息请查看question

    【讨论】:

      【解决方案2】:

      我自己解决了这个问题 - Autodesk 文档规定在加载文档时“urn:”必须位于 urn 之前。在本地加载文档,应该使用相对文件路径,不带 'urn:' 词缀。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2022-11-11
        • 2020-04-04
        • 2020-09-12
        • 2017-10-17
        • 2020-04-02
        • 1970-01-01
        • 2021-09-17
        • 2019-08-07
        相关资源
        最近更新 更多