如何将查看器环境设置为本地,将日志级别设置为调试

时间:2017-03-20 12:28:51

标签: autodesk autodesk-forge autodesk-viewer

我在查看器中看到以下代码:

avp.LogLevels = {
    DEBUG: 5,
    LOG: 4,
    INFO: 3,
    WARNING: 2,
    ERROR: 1,
    NONE: 0
};

并且:

avp.initializeProtein = function () {

    //For local work, don't redirect texture requests to the CDN,
    //because local ones will load much faster, presumably.
    if (avp.ENABLE_DEBUG && avp.env == "Local" && !auth /* when auth is true, the viewer is operating under

如何将avp.env设置为Local并设置日志级别?

2 个答案:

答案 0 :(得分:1)

初始化查看器时,请将envdocument选项作为本地资源传递。

function initialize() {
    var options = {
        'document' : './shaver/0.svf',
        'env':'Local'
        };

    var viewerElement = document.getElementById('viewer');

    viewer = new Autodesk.Viewing.Private.GuiViewer3D(viewerElement, {});

    Autodesk.Viewing.Initializer(options,function() {
    viewer.initialize();
    viewer.load(options.document);
    });
}

答案 1 :(得分:1)

您可以查看我关于online/offline use of the viewer API

的博客文章

对于日志级别使用:

Autodesk.Viewing.Private.logger.setLevel(5) //debug