1. 说明(属性)

1.1. 设备组装模拟类

位于:BOS3D.Plugins.Assemble 模拟设备模型的组装过程。 支持设备组件的展示,可以自定义展示位置。(与需求中的拆开位置) 支持设备组件按自定义顺序组装。 支持设备中几个组件一块儿组装。 支持自定义组件完成组装后的偏移位置,以便于展示错误的组装位置。

1.2. 结构

该功能由两个类实现,路径生成器类lineManager.js和组装模拟器类assemble.js

  • 路径生成器类,生成每个构件由展示的位置到复原的位置的路径。
  • 组装模拟器类,控制构件的组装动画开始、播放、暂停等功能。

    1.3. 构造函数

constructor(props)

构造函数参数:

名称 类型 是否必须 默认值
props - -
props.viewer3D object -
props.cptKeyList array -
props.cptKeyList.showPoint object -
props.cptKeyList.offset object -
props.isCustom bool false
props.overallOffset object {status: false, position: {x: 0, y: 0, z: 0}} -
props.callbackFunc function -

调用示例:

const keyList = viewer3D.getAllComponentsKey();  // 使用模型的全部构件
const cptKeyList = keyList.map((cptKey, index) => { // 自定义构件的展示坐标和偏移坐标 
            if (index % 2 === 0) {
              return {
                cptKey: cptKey,
                showPoint: undefined,
                offset: { x: 10000, y: 10000, z: 10000 }
              }
            } else {
              return {
                cptKey: cptKey,
                showPoint: {x: 5000, y: 5000, z: 50000},
                offset: { x: 1000, y: 1000, z: 1000 }
              }
            }
})
// 默认的展示
let assemble;
assemble = new BOS3D.Plugins.Assemble({
    viewer3D,
    cptKeyList,
    isCustom: false, // 是否自定义
    overallOffset: { // 是否整体偏移
      status: false,
      position: {x: 0, y: 0, z: 0} // 偏移坐标
    },
    callbackFunc: () => {console.log("回调函数");}
})

// 整体偏移显示
assemble = new BOS3D.Plugins.Assemble({
    viewer3D,
    cptKeyList,
    isCustom: false, // 是否自定义
    overallOffset: { // 是否整体偏移
      status: true,
      position: {x: 0, y: 0, z: 10000} // 偏移坐标
    },
    callbackFunc: () => {console.log("回调函数");}
})

// 用户自定义位置展示
assemble = new BOS3D.Plugins.Assemble({
    viewer3D,
    cptKeyList,
    isCustom: true, // 是否自定义
    overallOffset: { // 是否整体偏移
      status: false,
      position: {x: 0, y: 0, z: 0} // 偏移坐标
    },
    callbackFunc: () => {console.log("回调函数");}

})
版权所有@盈嘉互联(北京)科技有限公司 京ICP备15051988号-9 Copyright © 2021 all right reserved,powered by Gitbook该文件修订时间: 2021-12-20 09:59:48

results matching ""

    No results matching ""