如何将 BIM360 PushPin Extension 与 Forge Viewer 一起使用?

Posted

技术标签:

【中文标题】如何将 BIM360 PushPin Extension 与 Forge Viewer 一起使用?【英文标题】:How to use the BIM360 PushPin Extension with Forge Viewer? 【发布时间】:2021-07-10 07:34:33 【问题描述】:

我正在尝试使用 PushPin 扩展在我的自定义 Forge 查看器中加载问题,我按照the official documentation 中描述的步骤操作,但在调用PushPinExtension.createItem 后出现以下错误:

  issues.forEach(function (issue) 
    var issueAttributes = issue.attributes;
    var pushpinAttributes = issue.attributes.pushpin_attributes;
    // Notice the last rendering condition, which will enforce rendering the pushpin on the current sheet.
    // We simply compare the issue sheet metadata against the current sheet.
    if (pushpinAttributes && issueAttributes.sheet_metadata &&
          issueAttributes.sheet_metadata.sheetGuid === viewerApp.selectedItem.guid()) 
      PushPinExtensionHandle.createItem(
        id: issue.id, // The issue ID.
        label: issueAttributes.identifier, // The value displayed when you select the pushpin.
        // The shape and color of the pushpin, in the following format: ``type-status`` (e.g., ``issues-open``).
        status: issue.type && issueAttributes.status.indexOf(issue.type) === -1 ?
                  `$issue.type-$issueAttributes.status` : issueAttributes.status,
        position: pushpinAttributes.location, // The x, y, z coordinates of the pushpin.
        type: issue.type, // The issue type.
        objectId: pushpinAttributes.object_id, // (Only for 3D models) The object the pushpin is situated on.
        viewerState: pushpinAttributes.viewer_state // The current viewer state. For example, angle, camera, zoom.
      );
     // if
   // forEach
;

查看那个扩展的source code,似乎现在有一个pushPinManager 负责添加项目,但我无法足够快地弄清楚如何使用它。

如果您可以使用该扩展程序的最新版本提供一个工作示例并确保您的文档是最新的,这将有助于避免第三方开发人员方面的一些紧张;)

【问题讨论】:

嘿菲利普! :) 你好吗! 【参考方案1】:

:) 你好吗!

是的,您发现文档不会随着扩展的最新更改而更新。虽然 Pushpin 示例已迁移到最新版本。它演示了使用 Pushpin 扩展加载问题和创建新问题的工作流程。

https://github.com/Autodesk-Forge/forge-bim360-issues/blob/master/bim360issues/wwwroot/js/BIM360IssueExtension.js

如果它不能回答您的问题,请告诉我们。

我已转发要求更新文档的建议。

【讨论】:

以上是关于如何将 BIM360 PushPin Extension 与 Forge Viewer 一起使用?的主要内容,如果未能解决你的问题,请参考以下文章