Viewer
License
mailus
Stackoverflow
SegmentFault

本站Viewer文档仅供中文开发者参考,如有疑问请以官方文档为准

实用工具

问询方式

  • 全球支持的正式渠道 (Autodesk将会保证解答)

    1. Stackoverflow 上发帖(简单的英文即可),或查询已知讨论,通过此链接进一步了解。无需任何手续

    2. Email提问 forge.help@autodesk.com

      不便公开的问题或您要发送一些私有的材料,模型数据等。请务必提供简短的标题,适量的问题描述,以及必要的测试代码,文件,截图,视频等。切勿过于简略。第一次提交将得到Zendesk账号,专用于Forge相关问题提问。中英文皆可。推荐英文表达(辅助一点中文),这样全球的支持同事都可帮助。无需任何手续.

  • 中文咨询的方式(非正式渠道,Autodesk尽力解答)

    1. SegmentFault的Forge版面。国内类似StackOverflow的社区,请参考此链接了解详情: https://segmentfault.com/t/autodesk-forge

    2. Forge 微信群

      1号群已满,现在2号群开放,有兴趣加入的朋友,可先加梁晓冬微信thiscoldwood,把您拉进去。微信群是快速分享一些已知的方案或资料。各位朋友若遇到特定的问题,请通过Autodesk正式支持通道或SegmentFault

API Reference

This reference describes the API for the Forge Viewer.

The Forge Viewer is a javascript-based viewer for 2D drawings and 3D models served by Autodesk's Model Derivative API.
It can be embedded in a web page, or any browser-based application.
The viewer API allows you to control and customize the Viewer.

With it, you can do things like:

  • set up and initialize the Viewer in a web page
  • customize some aspects of the Viewer behavior, such as setting the navigation mode or background color.
  • switch between normal and full-screen viewing
  • control the camera in 3d models

Common Concepts

Translation

Assets in Forge are converted to a format that can be streamed and viewed by the Forge Viewer.
To request that a model file be translated for web viewing, use the Model Derivative API.

Authentication

Use of the Viewer requires authentication against Forge OAuth API.
Once authenticated, you are given an access token required to initialize your viewer using Autodesk.Viewing.Initializer.

Model Object Tree

Assets in the Forge Viewer have an object tree, a tree structure that represents the model hierarchy. For example, an Inventor
model object tree has a root node representing the model "assembly", with child nodes representing "sub-assemblies" and "parts".
Each node contains information about the element of the model it represents, including:

  • Name – The name of the object. For an Inventor model, this would be the name of the assembly or part instance.
  • dbId – This is a unique id for the element in the model. There is a one-to-one correspondence between a node and a dbId.
  • fragIds – fragIds are used by the Viewer's internal implementation to reference the meshes that are used to display the object. A single dbId can include one or more fragIds.
  • Parent – The ID of the node of which this node is a child.
  • Children – An array of dbId for nodes that are children to this node.

The dbId is used as a node identifier throughout. Use the InstanceTree API (Model.getData().instanceTree) to access the other properties.

See Viewer3D.getObjectTree()

Viewer versions

Multiple versions of the Forge Viewer are hosted in Autodesk's CDN.
You can specify a version for viewer files (javascript, css and any other resource) by including the version number in the URL.

<link rel="stylesheet" href="https://developer.api.autodesk.com/modelderivative/v2/viewers/6.*/style.min.css" type="text/css">
<script src="https://developer.api.autodesk.com/modelderivative/v2/viewers/6.*/viewer3D.min.js"></script>

We recommend using this feature for the following reasons:

  1. You want to hardcode a version number into your website so you can control when you move to a new Forge Viewer API version. You can switch to a newly released API version after you've tested it.
  2. If you later find problems with a newer version of the API, you can switch back to the older one.

See all avilable versions here.

Maintained by

Bryan Huang @ LinkedIn
Autodesk Forge Partner Development
https://forge.autodesk.com/