JavaScript SDK版本3.6.148

2021-08-11

三维模型
  • 新增了构件树节点的点击事件
// 设置WebApplication3D的配置项
let webAppConfig = new Glodon.Bimface.Application.WebApplication3DConfig();
// 创建WebApplication3D,用以显示模型
let app = new Glodon.Bimface.Application.WebApplication3D(webAppConfig);
// 定义回调函数
let getData = function (data){console.log(data)}
// 添加构件树节点的点击事件
app.addEventListener(Glodon.Bimface.Application.WebApplication3DEvent.ModelTreeNodeClicked, getData);
// 移除构件树节点的点击事件
app.removeEventListener(Glodon.Bimface.Application.WebApplication3DEvent.ModelTreeNodeClicked, getData);
  • 新增根据拉伸平面切分构件的方法,适用于环形构件的切分。
// 构造拉伸面用于切分构件,由一条线、一个拉伸方向即可确定一个面(将线沿着某一方向拉伸成面),适用于环形构件的切分
var splitPlane = {
  points: [
    { x: 0, y: 6184, z: 0},
    { x: 0, y: 6184, z: 250},
    { x: 0, y: 5900, z: 250}
  ],
  stretch: {direction: 'X'}
};
// 切分构件
viewer3D.getModel().splitComponentByStretchedPlane("componentId", splitPlane);
模型转换
  • 优化了stp模型的颜色及材质解析,提升了显示效果
场景应用
  • 控制台场景编辑界面新增对文件夹进行加载优先级设置的字段,允许对文件夹下所有资源的加载优先级进行统一调整。

  • 新增根据ID获取对应构件或要素ObjectData的接口。

// 获取BIMLayer对应的构件管理器
let componentMng = bimLayer.getComponentManager();
// 获取并输出id为1的构件的ObjectData
console.log(componentMng.getObjectDataById('1'));

// 获取FeatureLayer对应的要素管理器
let featureMng = featureLayer.getPolygonFeatureManager();
// 获取并输出id为2的面要素的ObjectData
console.log(featureMng.getObjectDataById('1'));
// 获取BIMLayer对应的构件管理器
let componentMng = bimLayer.getComponentManager();
// 将id为1、2、3的构件不透明度设置为0.5
componentMng.overrideOpacity({ids:['1','2','3']},0.5);
// 将楼层为F2的构件不透明度设置为0.7
componentMng.overrideOpacity({objectData:[{levelName:'F2'}]},0.7);
// 将所有构件的不透明度设置为0.6
componentMng.overrideOpacity({all:true},0.6);
// 取消所有构件的不透明度设置
componentMng.restoreOpacity({all:true});