I want to caculate all volume of objects in viewer but return arrayVolume = [] and vol = 0; Where did I go wrong ? Thank in advanced for all
$("#kl").click(function(){
viewer.model.getExternalIdMapping(data => kl(data));
function kl(data){
var arrayVolume = [];
var vol;
for(var key in data){
var dbId = data[key];
viewer.getProperties(dbId, function(e){
//console.log('Entire object response ',e);
//console.log('Properties ',e.properties);
var propertiesObj = e.properties;
propertiesObj.forEach(obj => {
if(obj.displayName === "Volume"){
var volume = obj.displayValue;
arrayVolume.push(volume);
}
});
});
}
vol= arrayVolume.reduce(function(a,b){return a+ b;},0)
alert('w: '+arrayVolume);
alert('w: '+vol);
}
question from:
https://stackoverflow.com/questions/66058260/caculate-all-volume-of-objects-in-viewer-autodesk-forge 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…