Felipe
Felipe

Reputation: 4375

How to use the BIM360 PushPin Extension with Forge Viewer?

I am trying to use the PushPin extension to load issues in my custom Forge viewer, I follow the steps described in the official documentation but getting the following error after calling 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
};

enter image description here

Looking at the source code of that extension, it seems there is now a pushPinManager which is responsible for adding items, but I couldn't figure out quickly enough how to use it.

It would help if you could provide a working example using the latest version of that extension and also make sure your doc is up-to-date, which will avoid some tension on the third party devs side ;)

Upvotes: 0

Views: 449

Answers (1)

Xiaodong Liang
Xiaodong Liang

Reputation: 2196

:) how are you!

yes you found the truth that the document does not update with the latest change of the extension. While the Pushpin sample has been migrated to the latest version. It demos the workflow of loading issues and creating new issues with Pushpin extension.

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

Please let us know if it does not answer your question.

I have forwarded the suggestion asking for document updating.

Upvotes: 1

Related Questions