JavaScript SDK版本3.6.101

2020-09-16

三维模型
  • 新增了射线检测的方法,可以获取指定点位与周边构件的关系
// 定义射线的发射起点与终点
var startPt = { x: -15846.798818323823, y: -19133.614823244905, z: 8480.830675552756 };
var endPt = { x: 81438.02967375112, y: -19133.614823244905, z: 8480.830675552756 };
// 获取射线方向,不要求归一化处理
var direction = { x: endPt.x - startPt.x, y: endPt.y - startPt.y, z: endPt.z - startPt.z };
// 仅计算family字段为基本墙的构件与射线的交点
var condition = [{ family: "基本墙" }];
// 根据起点、方向及筛选条件发射射线,获取构件信息
var ptArr = viewer3D.getComponentByRaycaster(startPt, direction, condition);
// 根据ID列表设置被剖切的构件、外部构件、房间对象
sectionPlane.setObjectsById(["15456"]);
// 根据筛选条件设置被剖切的构件对象
sectionPlane.setObjectsByObjectData([
{
  categoryId: "-2000011",
  family: "基本墙"
},
{
  categoryId: "-2001330"
}
]);
// 恢复默认的被剖切对象
sectionPlane.restoreObjects();
  • 新增了GIS场景中的地形拍平功能,可以模拟场地整平
// 构造地图配置项
var mapConfig = new Glodon.Bimface.Plugins.TileMap.MapConfig();
mapConfig.viewer = viewer3D;
// 设置开启DEM
mapConfig.enableElevationModel = true;
// 构造地图对象
map = new Glodon.Bimface.Plugins.TileMap.Map(mapConfig);
// 根据多个点及标高将指定区域拍平
map.addFlattenRegion('flattenRegion', flattenRegionBoundary, 5040);
// 根据ID列表移除拍平区域
map.removeFlattenRegionsById(['flattenRegion']);
// 清空所有拍平区域
map.clearFlattenRegions();
  • 新增了聚光灯功能,可以自定义灯光效果
// 构造聚光灯配置项
var spotLightConfig = new Glodon.Bimface.Light.SpotLightConfig();
spotLightConfig.viewer = viewer3D;
spotLightConfig.position = { 'x': 27, 'y': -1614, 'z': 9753 };
spotLightConfig.target = { 'x': 27, 'y': -1614, 'z': 0 };
spotLightConfig.intensity = 3;
spotLightConfig.distance = 10000;
spotLightConfig.penumbra = 0.1;
spotLightConfig.color = new Glodon.Web.Graphics.Color(255, 215, 0, 1);
spotLightConfig.angle = Math.PI / 6;
spotLightConfig.shadow = true;
// 构造聚光灯对象
spotLight = new Glodon.Bimface.Light.SpotLight(spotLightConfig);
spotLight.show();
  • 新增了Navisworks模型的构件树
服务端API
交互
// 创建房间编辑器工具条的配置
var roomEditorToolbarConfig = new Glodon.Bimface.Plugins.SpatialRelation.RoomEditorToolbarConfig();
roomEditorToolbarConfig.viewer = viewer3D;
roomEditorToolbarConfig.roomId = room.id;
// 创建房间编辑器工具条
roomEditorToolbar = new Glodon.Bimface.Plugins.SpatialRelation.RoomEditorToolbar(roomEditorToolbarConfig);