Edges not showing up in Autodesk.NPR Extension

30 Views Asked by At

I've created my 3D Viewer using apis of v7 Forge Autodesk Viewer. I am tying to show the edges of models but with below codes the edges is not showing up :

    viewer.loadExtension('Autodesk.NPR');
    var ext = await viewer.getExtension('Autodesk.NPR');
    ext.setParameter("edges", true);

When I use : ext.setParameter("style", "cel") it works and even works for style: edging. I don't know what I am missing. And when I work with same model this extension works for 'style' but when I refresh the page the 'ext' object becomes null.

I tried Autodesk.NPR for v7 verison but didn't worked.

1

There are 1 best solutions below

0
Petr Broz On

The edges parameter can't be used on its own, in other words, the edges can only be displayed as part of one of the NPR styles like edging, cel, graphite, or pencil.

You could add the following piece of code to your application (right after the viewer itself is initialized) to make sure that the NPR style is always activated automatically:

// initialize the viewer ...

const ext = await viewer.loadExtension("Autodesk.NPR");
ext.setParameter("style", "graphite");
ext.setParameter("edges", true);