How to activate Autodesk Forge Snapper?

白昼怎懂夜的黑 提交于 2020-03-26 04:45:11

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!