无法在Autodesk Forge中获取AEC模型数据

问题描述 投票:0回答:1

我尝试在Autodesk Forge Viewer中激活Revit级别和2D Minimap扩展,但是无法获取AEC模型数据。我穿了这个衣服。

enter image description here

我尝试使用此代码获取AEC数据

const url = window.location.search;
console.log(url);
const svf_path = `${url.replace("?", "/storage/").replace(/%20/g, " ")}`;

Autodesk.Viewing.endpoint.getItemApi = (endpoint, derivativeUrn, api) => {
  return svf_path;
};

Autodesk.Viewing.Initializer(options, async () => {
  const paths = svf_path.split("/");
  const [dest, svf_dir] = [paths[2], paths[3]];

  const url = `/api/viewer/dest/${dest}/svf/${svf_dir}/manifest`;
  const response = await fetch(url);
  const manifest = await response.json();

  const init_div = document.getElementById("init_div");
  viewer = new Autodesk.Viewing.GuiViewer3D(init_div, config3d);

  const viewerDocument = new Autodesk.Viewing.Document(manifest);
  const viewable = viewerDocument.getRoot().getDefaultGeometry();
  viewer.start();

  await viewerDocument.downloadAecModelData();

  viewer.loadDocumentNode(viewerDocument, viewable)
  .then(function (result) {
    Autodesk.Viewing.Document.getAecModelData(viewable);
  })
});

我的代码有错吗?

javascript autodesk-forge forge
1个回答
0
投票

警告来自BubbleNode.prototype.getAecModelData方法。您没有在代码中调用它,但是LevelsExtension本身可能会调用它。尝试配置扩展名,以免通过传入{ autoDetectAecModelData: false }作为扩展名选项来自动检测AEC数据。

顺便说一句。要调试您方面的问题,您还可以尝试获取viewer3D.js的最小版本,在记录警告的位置放置一个断点,并在命中该断点时查看调用堆栈。 >

© www.soinside.com 2019 - 2024. All rights reserved.