问题
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.
回答1:
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();
来源:https://stackoverflow.com/questions/58487001/how-to-activate-autodesk-forge-snapper