{"id":15366297,"url":"https://github.com/petrbroz/forge-viewer-utils","last_synced_at":"2025-04-15T12:21:23.253Z","repository":{"id":51390230,"uuid":"176908524","full_name":"petrbroz/forge-viewer-utils","owner":"petrbroz","description":"Wrapper library for Autodesk Forge Viewer providing additional utility functions and documentation.","archived":false,"fork":false,"pushed_at":"2022-12-09T16:36:10.000Z","size":640,"stargazers_count":16,"open_issues_count":2,"forks_count":4,"subscribers_count":3,"default_branch":"develop","last_synced_at":"2025-03-28T20:06:04.520Z","etag":null,"topics":["autodesk","forge-viewer"],"latest_commit_sha":null,"homepage":"https://petrbroz.github.io/forge-viewer-utils/master","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/petrbroz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-03-21T09:06:28.000Z","updated_at":"2024-09-10T01:55:17.000Z","dependencies_parsed_at":"2023-01-25T22:32:03.030Z","dependency_job_id":null,"html_url":"https://github.com/petrbroz/forge-viewer-utils","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/petrbroz%2Fforge-viewer-utils","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/petrbroz%2Fforge-viewer-utils/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/petrbroz%2Fforge-viewer-utils/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/petrbroz%2Fforge-viewer-utils/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/petrbroz","download_url":"https://codeload.github.com/petrbroz/forge-viewer-utils/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249067955,"owners_count":21207415,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["autodesk","forge-viewer"],"created_at":"2024-10-01T13:18:27.686Z","updated_at":"2025-04-15T12:21:23.232Z","avatar_url":"https://github.com/petrbroz.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Forge Viewer Utils\n\nCollection of helpful tools for [Autodesk Forge Viewer](https://forge.autodesk.com/en/docs/viewer)\nthat are not (yet) part of its official [API](https://forge.autodesk.com/en/docs/viewer/v6/reference/javascript/viewer3d).\n\n## Why?\n\nDuring [Forge Accelerator](http://autodeskcloudaccelerator.com) events, there are often recurring themes\nof features that the attendees want to build, for example, finding a scene object under the mouse cursor,\nor being able to change the transform of an object. Unfortunately, many of these features cannot be built\nusing the official [APIs](https://forge.autodesk.com/en/docs/viewer/v6/reference/javascript/viewer3d),\nsending developers into the dreaded, undocumented area of internal APIs, also known as `viewer.impl`.\n\nThe goal of this wrapper library is to:\n- provide best practice examples of using the official APIs\n- show how commonly requested features can be implemented, for now, using `viewer.impl`\n- provide more documentation to both the official and the `viewer.impl` APIs\n- collect feedback for the [Forge Viewer](https://forge.autodesk.com/en/docs/viewer) dev team\n\n## Usage\n\nDrop the library in your webpage. You can either use the latest `master` version:\n\n```html\n\u003cscript src=\"https://petrbroz.github.io/forge-viewer-utils/master/Utilities.js\"\u003e\u003c/script\u003e\n```\n\nOr a specific tagged version, for example `v0.7.0`:\n\n```html\n\u003cscript src=\"https://petrbroz.github.io/forge-viewer-utils/0.7.0/Utilities.js\"\u003e\u003c/script\u003e\n```\n\n\u003e Similarly, the documentation is available both for the latest [master](https://petrbroz.github.io/forge-viewer-utils/master/index.html)\n\u003e version and for all tagged versions, for example, [0.7.0](https://petrbroz.github.io/forge-viewer-utils/0.7.0/index.html).\n\nStart using the `Autodesk.Viewing.Utilities` class, either by wrapping an existing instance\nof [Viewer3D](https://forge.autodesk.com/en/docs/viewer/v6/reference/javascript/viewer3d):\n\n```js\nconst utils = new Autodesk.Viewing.Utilities(viewer3d);\nutils.load(\"your-urn\");\n```\n\nOr by initializing everything using the static method `Autodesk.Viewing.Utilities.Initialize`:\n\n```html\n\u003cdiv id=\"viewer\"\u003e\u003c/div\u003e\n\u003cscript\u003e\n  async function getAccessToken(callback) {\n      const resp = await fetch('/api/auth');\n      const json = await resp.json();\n      callback(json.access_token, json.expires_in);\n  }\n  async function run() {\n      try {\n          const utils = await Autodesk.Viewing.Utilities.Initialize(document.getElementById('viewer'), getAccessToken);\n          const viewable = await utils.load(\"your-urn\");\n          console.log('Viewable loaded successfully', viewable);\n      } catch(err) {\n          console.error(err);\n      }\n  }\n  run();\n\u003c/script\u003e\n```\n\n## Development\n\n- install dependencies: `npm install`\n- build code documentation: `npm run build:docs`\n- running the examples\n  - you need two things: Forge app _credentials_, and an _urn_ of a model to view\n    - you can create a free Forge app at https://forge.autodesk.com\n    - to upload and translate a model for viewing, see the official [tutorial](https://forge.autodesk.com/en/docs/model-derivative/v2/tutorials/prepare-file-for-viewer)\n  - run the example server with your Forge credentials:\n  `FORGE_CLIENT_ID=\u003cclient_id\u003e FORGE_CLIENT_SECRET=\u003cclient_secret\u003e node examples/server.js`\n  - open one of the example html files with an urn of your model as a url query,\n  for example: http://localhost:3000/basic.html?dXyabcdefgh\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpetrbroz%2Fforge-viewer-utils","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpetrbroz%2Fforge-viewer-utils","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpetrbroz%2Fforge-viewer-utils/lists"}