JavaScript SDK版本3.6.130

2021-04-07

三维模型
  • 新增了设置曲线宽度类型的方法
// 设置宽度类型,"DisplayWidth"为显示宽度,单位为pixel,"ActualWidth"为实际宽度,单位跟随场景单位
splineCurve.setWidthType("ActualWidth");
// 设置宽度为3000
splineCurve.setWidth(3000);
  • 新增房间与模型融合的功能,可通过设置开启房间的深度检测将房间与模型融合显示
var roomConfig= new Glodon.Bimface.Plugins.SpatialRelation.RoomConfig();
roomConfig.viewer=viewer3D;
var room= new Glodon.Bimface.Plugins.SpatialRelation.Room(roomConfig);
//根据房间id列表开启深度检测,使房间与模型融合显示
room.enableDepthTest(roomIds,true);
// 根据构造点创建曲线
splineCurve = new Glodon.Bimface.Plugins.Geometry.SplineCurve(points);
// 将曲线作为外部构件载入模型
var extObjMng = new Glodon.Bimface.Viewer.ExternalObjectManager(viewer3D);
extObjMng.addObject("curve", splineCurve);
// 开启曲线仅贴地形的效果
splineCurve.clampMode({mode:'Ground'});
// 开启曲线仅贴模型的效果
splineCurve.clampMode({mode:'Model'});
// 开启曲线贴地形和模型的效果
splineCurve.clampMode({mode:'Both'});
// 恢复空间曲线效果
splineCurve.clampMode({mode:'Space'});
模型效果
// 定义热力图绘制区域
let heatMapBoundary = [
  { x: -6430, y: -3365, z: 6040 },
  { x: -6430, y: -80, z: 9200 },
  { x: 13050, y: -80, z: 9200 },
  { x: 13050, y: -3365, z: 6040 }
  ];
/* 构造二维热力图配置项,配置热力图数据、边界、图例、viewer对象等参数
 * 支持任意空间平面,若提供的边界点不在一个平面上时,则由前三点决定平面位置,其余点则隐射至该平面内,确定平面边界
 * 支持三维空间内任意点位的数据,其结果将投影至指定的热力图绘制区域内,投影方向为热力图平面的法线方向
 */
let heatMap2DConfig = new Glodon.Bimface.Plugins.Heatmap.Heatmap2DConfig();
heatMap2DConfig.data = data;
heatMap2DConfig.boundary = heatMapBoundary;
heatMap2DConfig.enableColorLegend = true;
heatMap2DConfig.viewer = viewer;
// 构造二维热力图对象
heatmap2D = new Glodon.Bimface.Plugins.Heatmap.Heatmap2D(heatMap2DConfig);
// 更新
heatmap2D.setData(heatMapData);
模型集成
  • 支持用户在模型集成时自定义构件树层级
// 请求体示例,在config.customizedTree中自定义目录树的层级
{
  "sources": [
    {
      "fileId": 2018762920515712
    },
    {
      "fileId": 2018225038112448
    },
    {
      "fileId": 2018225054758592
    },
    {
      "fileId": 2018225070028480
    }
  ],
  "name": "模型集成示例",
  "config": {
    "customizedTree": [
      {
        "type": "model",
        "name": "道路",
        "fileId": "2018762920515712"
      },
      {
        "type": "group",
        "name": "结构",
        "items": [
          {
            "type": "model",
            "name": "主体结构",
            "fileId": "2018225038112448"
          },
          {
            "type": "model",
            "name": "围护结构",
            "fileId": "2018225054758592"
          }
        ]
      },
      {
        "type": "model",
        "name": "给排水",
        "fileId": "2018225070028480"
      }
    ]
  }
}
矢量图纸
  • 新增了获取文本图元的文本内容的方法
// 根据文本图元ID获取文本内容,2020年10月之前的图纸需要重新转换
viewer2D.getTextByElementId("21548", function(data){console.log(data)});