Warm tip: This article is reproduced from serverfault.com, please click

Autodesk Forge: I created an app to translate CAD files, but cannot see properties for an assembly

发布于 2020-11-30 20:39:12

So I created a nodejs app to translate CAD files and to display them in the viewer. For .rvt files and individual Inventor components I can see the properties by going to Model Browser and clicking on each component, however, I cannot see properties for an entire Inventor assembly. How can I go about seeing assembly properties?

I am using this sample: https://github.com/Autodesk-Forge/viewer-walkthrough-online.viewer

Only change I made was set compressedUrn to true and added a rootFileName to allow Inventor assemblies to be translated.

Questioner
thewire
Viewed
1
Adam Nagy 2020-12-02 03:30:31

There is an option called modelBrowserExcludeRoot that you can set to false when creating the Viewer. In that case, the root object of the model will be visible in the Model browser and when selecting it you'll see the properties of the assembly in the Properties palette e.g.

Autodesk.Viewing.Initializer(options, () => {
  viewer = new Autodesk.Viewing.GuiViewer3D(
    document.getElementById('forgeViewer'), 
    { 
      modelBrowserExcludeRoot: false 
    }
  );
  viewer.start();
  var documentId = 'bubble.json'; 
  Autodesk.Viewing.Document.load(documentId, onDocumentLoadSuccess, onDocumentLoadFailure);
});

Also have written a blog post about it just now: Root object not visible in Model browser