Skip to content
This repository has been archived by the owner on Jan 11, 2024. It is now read-only.

Autodesk-Forge/FusionData_Workflows

Repository files navigation

Fusion Data Workflows

Platforms License

Forge API: oAuth2 Fusion Data API Forge Data Events


This repository contains several samples illustrating use of Fusion Data API in context of various workflows:

  1. Read the Complete Model Hierarchy of a Design

    • based on the path to a model (hub name, project name and file name) you can get the full model hierarchy - similar to what is shown inside Fusion 360.
  2. Know when a Milestone is Available

    • subscribe to the milestone.created event of a specific model in order to be notified when a milestone is created for a given version of it.
  3. Find the Thumbnail of a specific Part

    • based on the path to a model (hub name, project name and file name) you can get the thumbnail of a given model.

Prerequisites

  1. Forge Account: Learn how to create a Forge Account, activate subscription and create an app at this tutorial;
  2. Node.Js with version > v16.13.2 and basic knowledge of JavaScript;

Notes

Though the samples start with the hubs(){} query, there are many other options for you. The easiest is to check the QUERIES section on the DOCS tab in the Fusion Data Explorer sample to see what other starting points are available.

Query

As you can see, you could e.g. start directly with a given file version if you already know the parameters it requires: hubId, projectId and versionId. Perhaps you already have the necessary values from a previous GraphQL request or via the Data Management API

Query

In that case the query might look like this:

{
  fileVersion(
    hubId: "a.YnVzaW5lc3M6YXV0b2Rlc2s2MTA0",
    projectId: "a.YnVzaW5lc3M6YXV0b2Rlc2s2MTA0IzIwMjIwMjA0NDkzNjczNjA2",
    versionId: "urn:adsk.wipprod:fs.file:vf.0pdKmY_sTHW957H5fthyLw?version=5"
  ) {
    ... on DesignFileVersion {
      id
      rootComponent {
        name
      }
    }
  }
}

and the reply could be:

{
  "data": {
    "fileVersion": {
      "id": "urn:adsk.wipprod:fs.file:vf.0pdKmY_sTHW957H5fthyLw?version=5",
      "rootComponent": {
        "name": "Box"
      }
    }
  }
}

You could also get to a specific folder or file using the item(){} query if you know the id of the specific file or folder, e.g.:

{
  item(
    hubId: "a.YnVzaW5lc3M6YXV0b2Rlc2s2MTA0",
    projectId: "a.YnVzaW5lc3M6YXV0b2Rlc2s2MTA0IzIwMjIwMjA0NDkzNjczNjA2",
    itemId: "urn:adsk.wipprod:fs.folder:co.SC8l0gh1RKa_MkpcNCYExw"
  ) {
    ... on Folder {
      name
    }
  }
}

and the reply could be:

{
  "data": {
    "item": {
      "name": "Test folder"
    }
  }
}

License

These samples are licensed under the terms of the MIT License. Please see the LICENSE file for full details.

Written by

Adam Nagy adam.nagy@autodesk.com, Forge Partner Development

Denis Grigor denis.grigor@autodesk.com, Forge Partner Development