简体   繁体   English

Autodesk Forge Viewer3D 中的默认 model 和测量单位

[英]Default model & measurement units in Autodesk Forge Viewer3D

Is there any way to globally set measure units and precision in Viewer3D?有没有办法在 Viewer3D 中全局设置测量单位和精度? We do following steps after extension is loaded:加载扩展后,我们执行以下步骤:

onExtensionLoaded(e) {
    if (e.extensionId === 'Autodesk.Measure') {
        const ext = this.viewer.getExtension('Autodesk.Measure');
        ext.snapper.setSnapToPixel(true);
        ext.sharedMeasureConfig.units = 'm';
        ext.sharedMeasureConfig.precision = 3;
        ext.measureTool.setUnits('m');
    }
    ...
}

We are not successful with predefining measure unit in Calibration dialog to meters.我们没有成功在校准对话框中将测量单位预定义为米。 Also call:也叫:

ext.calibrationTool.getCurrentUnits();

Returns inches.返回英寸。

After investigation we found this magic line of code, where the zero index in combobox is selected:经过调查,我们发现了这条神奇的代码行,其中选择了 combobox 中的零索引:

CalibrationPanel.js:

this.unitList = new avp.OptionDropDown("Unit type", this.tbody, unitNames, 0, null, { paddingLeft: 0, paddingRight: 15});

We have not found any way to globally set units in Viewer3D.我们还没有找到在 Viewer3D 中全局设置单位的任何方法。 Are we missing anything?我们错过了什么吗?

Thanks for help.感谢帮助。

There is no global way to obtain the info.没有获取信息的全局方法。 you wanted since the measure tool now is a viewer extension.你想要的,因为测量工具现在是一个查看器扩展。 So, please use the following functions instead:因此,请改用以下功能:

  • For units: ext.getUnits()对于单位: ext.getUnits()
  • For precision: ext.getPrecision()对于精度: ext.getPrecision()

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM