1. 说明(属性)
1.1. 设备组装模拟类
位于:BOS3D.Plugins.Assemble 模拟设备模型的组装过程。 支持设备组件的展示,可以自定义展示位置。(与需求中的拆开位置) 支持设备组件按自定义顺序组装。 支持设备中几个组件一块儿组装。 支持自定义组件完成组装后的偏移位置,以便于展示错误的组装位置。
1.2. 结构
该功能由两个类实现,路径生成器类lineManager.js
和组装模拟器类assemble.js
。
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("回调函数");}
})