0

I used https://github.com/Autodesk-Forge/viewer-react-express-headless as a starting point for my Forge React application and I modified viewer = new Autodesk.Viewing.Viewer3D(viewerElement, {}); to viewer = new Autodesk.Viewing.Private.GuiViewer3D(viewerElement, {}); to change it back from a headless to a classic viewer.

I can load my model but it appears without edges and when I go to Settings -> Performance -> Display edges it is off by default, and when I try to set it back the edges stay invisible.

From my non wokring viewer: Screenshot with Display edges off Screenshot with Display edges on

When I try the same operation with the same model loaded on Autodesk Viewer it works as expected and I can toggle the visibility of the edges.

From the Autodesk Viewer Screenshot with Display edges off Screenshot with Display edges on

I found another seemingly related question on stackoverflow, but I tried viewer.js?v=v4.2, viewer.js?v=v5.0 and viewer.js?v=v6.3.1 and I still have the invisible edges issue.

I also posted a Github Issue

Thank you for your help.

Alexis

AlexisV
  • 77
  • 1
  • 7

1 Answers1

2

ok, if you are creating the viewer instance via Autodesk.Viewing.Private.GuiViewer3D directly, rather than the Autodesk.Viewing.ViewingApplication, then there is a magic configuration parameter that you will need to apply when initializing the Forge viewer, so that the lines will appear...

To fix it, an extra option isAEC: true must be passed into the modelOptions in your code, see below:

var modelOptions = {
    placementTransform: mat,
    globalOffset:{x:0,y:0,z:0},
    sharedPropertyDbPath: doc.getPropertyDbPath(),
    isAEC: true //!<<< Here is the missing line
};

viewer.loadModel(svfUrl, modelOptions, onLoadModelSuccess, onLoadModelError);
michael beale
  • 1,014
  • 1
  • 6
  • 5
  • Thank you Michael, Magic indeed. The Github starter I used [viewer.load](https://github.com/Autodesk-Forge/viewer-react-express-headless/blob/1a632a9f84a807f2dec2e935aaca0dfcb5ada242/src/components/Viewer/Viewer-helpers.js#L85), but switching to `viewer.loadModel` and adding `{isAEC:true}` solved my problem with no discernible side effect. – AlexisV Mar 01 '19 at 14:26