AlexAR
AlexAR

Reputation: 1324

How to activate Autodesk Forge Snapper?

I'm trying to activate the new Snapper extension implemented since version 7.3 of the viewer.

So I load the extension like that :

viewer.loadExtension('Autodesk.Snapping')

Seems to work. And after, I tried to access described methods like that but I always got this error " getSnapResult is not a function" :

viewer.loadExtension('Autodesk.Snapping').then(extension =>{
    snapper = extension;
});

snapper.getSnapResult();

I'm still using the old extension made by Philippe Leefsma a few years ago : https://forge.autodesk.com/cloud_and_mobile/2015/09/geometry-snapping-and-selection-commands-with-view-data-api.html

But as it's not working anymore in version up to 7.3, I would like to replace with the new one.

Upvotes: 0

Views: 522

Answers (1)

Jaime Rosales
Jaime Rosales

Reputation: 1288

getSnapResult() is a function within the Snapper class. Here is a link to the documentation:

https://forge.autodesk.com/en/docs/viewer/v7/reference/Snapping/Snapper/

And you can try the following:

var snapper = new Autodesk.Viewing.Extensions.Snapping.Snapper();
//...
snapper.getSnapResult();

Upvotes: 1

Related Questions