猿问

怎么获取BIM模型中的categroy、family、familyTypes

1、categroy、family、familyTypes分别代表什么?
2、怎么获取categroy、family、familyTypes对应的数据?

料青山看我应如是
浏览 708回答 1
1回答

慕婉清6462132

问题1:尝试用网络上一张图和自己截取的一个对象数组可以很明显的表示其意思问题2、调用BIMFACE官网提供js的api链接描述在模型加载完毕之后var categroy=[];var family=[];var familyTypes=[];viewer.addEventListener(eventManager.ViewAdded,function() {viewer.getModeTree(gettree);//获取模型树的数据viewer.render();});function gettree(treedata) {for(var i=0;i<treedata.length;i++){&nbsp; &nbsp; //获取所有的categroy&nbsp; &nbsp; categroy.push(treedata[i].categoryName);&nbsp; &nbsp; for (var j = 0;j<treedata[i].families.length;j++) {&nbsp; &nbsp; &nbsp; &nbsp; //获取所有的family&nbsp; &nbsp; &nbsp; &nbsp; family.push(treedata[i].families[j].family);&nbsp; &nbsp; &nbsp; &nbsp; for(var k=0;k<treedata[i].families[j].familyTypes.length;k++){&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //获取所有的familyTypes&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; familyTypes.push(treedata[i].families[j].familyTypes[k]);&nbsp; &nbsp; &nbsp; &nbsp; }&nbsp; &nbsp; }}console.log(categroy);console.log(family);console.log(familyTypes);}
随时随地看视频慕课网APP

相关分类

JavaScript
我要回答