diff --git a/src/core/controls/SelectInspect.ts b/src/core/controls/SelectInspect.ts index 278ea9f..f6c4f2d 100644 --- a/src/core/controls/SelectInspect.ts +++ b/src/core/controls/SelectInspect.ts @@ -203,7 +203,7 @@ export default class SelectInspect implements IControls { } // 创建红选包围盒 - private createRedSelectionBox(object: THREE.Object3D) { + private createRedSelectionBox(object: Object3DLike) { // 如果对象没有 entityId,则不创建包围盒线框 if (!object.userData.entityId) { return @@ -211,6 +211,7 @@ export default class SelectInspect implements IControls { let box: THREE.Box3 if (object instanceof PointManageWrap) { box = object.createBox3() + } else if (object instanceof THREE.Object3D) { box = new THREE.Box3().setFromObject(object) } diff --git a/src/core/manager/InstancePointManager.ts b/src/core/manager/InstancePointManager.ts index 8de512f..f2f9945 100644 --- a/src/core/manager/InstancePointManager.ts +++ b/src/core/manager/InstancePointManager.ts @@ -245,6 +245,7 @@ export class PointManageWrap { instancedMesh.getMatrixAt(this.meshIndex, matrix) // 创建包围盒并应用矩阵 const geometry = instancedMesh.geometry + //@ts-ignore const localBox = new THREE.Box3().setFromBufferAttribute(geometry.attributes.position) return localBox.clone().applyMatrix4(matrix) } diff --git a/src/example/example1.js b/src/example/example1.js index 478c946..2bb7e27 100644 --- a/src/example/example1.js +++ b/src/example/example1.js @@ -35,31 +35,31 @@ export default { { catalogCode: 'f1', t: 'floor', // 楼层 items: [ - // { - // id: 'rack1', - // t: 'rack', - // v: true, - // tf: [[2.9, 0.1, 3.5], [0, 0, 0], [1.5, 0.25, 0.1]], - // dt: { - // rackDepth: 1, // 货架深度 - // rackWidth: 5.6, - // rackHeight: 4.2, - // levelCount: 3, // 总层数 - // bayCount: 4, // 总列数 - // hideFloor: false, // 隐藏底板 - // extendColumns: true, // 扩展挡板 - // columnSpacing: 1, // 支脚跨越 - // bays: [ // 每列的配置 - // { - // bayWidth: 1.4, // 列的宽度 - // levelHeight: [1.4, 1.4, 1.4] // 每层的高度 - // }, - // { bayWidth: 1.4, levelHeight: [1.4, 1.4, 1.4] }, - // { bayWidth: 1.4, levelHeight: [1.4, 1.4, 1.4] }, - // { bayWidth: 1.4, levelHeight: [1.4, 1.4, 1.4] } - // ] - // } - // }, + { + id: 'rack1', + t: 'rack', + v: true, + tf: [[2.9, 0.1, 3.5], [0, 0, 0], [1.5, 0.25, 0.1]], + dt: { + rackDepth: 1, // 货架深度 + rackWidth: 5.6, + rackHeight: 4.2, + levelCount: 3, // 总层数 + bayCount: 4, // 总列数 + hideFloor: false, // 隐藏底板 + extendColumns: true, // 扩展挡板 + columnSpacing: 1, // 支脚跨越 + bays: [ // 每列的配置 + { + bayWidth: 1.4, // 列的宽度 + levelHeight: [1.4, 1.4, 1.4] // 每层的高度 + }, + { bayWidth: 1.4, levelHeight: [1.4, 1.4, 1.4] }, + { bayWidth: 1.4, levelHeight: [1.4, 1.4, 1.4] }, + { bayWidth: 1.4, levelHeight: [1.4, 1.4, 1.4] } + ] + } + }, { id: 'P1', t: 'measure', @@ -80,74 +80,74 @@ export default { v: true, tf: [[5, 0.1, 6.25], [90, 0, 0], [0.25, 0.25, 0.1]], dt: { in: [], out: [], center: ['P2'] } + }, + { + id: '39zML1rnSOOQGQYQ2YUMGy', + t: 'way', + v: true, + tf: [[-4, 0.1, 2], [90, 0, 0], [0.25, 0.25, 0.1]], + dt: { in: [], out: [], center: ['6wrGKiVJniwgKkoggOoEy6'] } + }, { + id: '6wrGKiVJniwgKkoggOoEy6', + t: 'way', + v: true, + tf: [[5, 0.1, 2], [90, 0, 0], [0.25, 0.25, 0.1]], + dt: { in: [], out: [], center: ['39zML1rnSOOQGQYQ2YUMGy'] } + }, { + id: '6UhIIw9QPYh6acwyW8OSGs', + t: 'gstore', + v: true, + tf: [[-1, 0.1, 0.55], [0, 0, 0], [1.5, 1.2, 0.1]], + dt: { in: [], out: [], center: [], storeWidth: 1.4, storeDepth: 1.4 } + }, { + id: '1D0WSRPj8JJJwIcmA0UMqG', + t: 'gstore', + v: true, + tf: [[0.75, 0.1, 0.55], [0, 0, 0], [1.5, 1.2, 0.1]], + dt: { in: [], out: [], center: [], storeWidth: 1.4, storeDepth: 1.4 } + }, { + id: 'gstore3', + t: 'gstore', + v: true, + tf: [[3, 0.1, 0.55], [0, 0, 0], [1.5, 1.2, 0.1]], + dt: { in: [], out: [], center: [], storeWidth: 1.4, storeDepth: 1.4 } + }, { + id: 'pallet1', + t: 'pallet', + v: true, + tf: [[0.75, 0.075, 0.55], [0, 0, 0], [1.5, 1.2, 0.1]], + dt: { in: [], out: [], center: [], palletWidth: 1, palletDepth: 1.2 } + }, { + id: 'pallet2', + t: 'pallet', + v: true, + tf: [[3, 0.075, 0.55], [0, 0, 0], [1.5, 1.2, 0.1]], + dt: { in: [], out: [], center: [], palletWidth: 1, palletDepth: 1.2 } + }, { + id: 'ptr1', + t: 'ptr', + v: true, + tf: [[0.75, 0.075, 2], [0, 0, 0], [1.5, 1.2, 0.1]], + dt: { in: [], out: [], center: [], ptrWidth: 1.5, ptrDepth: 1.5, ptrHeight: 1.98 } + }, { + id: 'ptr2', + t: 'ptr', + v: true, + tf: [[3, 0.075, 2], [0, 0, 0], [1.5, 1.2, 0.1]], + dt: { in: [], out: [], center: [], ptrWidth: 1.5, ptrDepth: 1.5, ptrHeight: 1.98 } + }, { + id: 'pallet3', + t: 'pallet', + v: true, + tf: [[3, 0.175, 1.88], [0, 0, 0], [1.5, 1.2, 0.1]], + dt: { in: [], out: [], center: [], palletWidth: 1, palletDepth: 1.2 } + }, { + id: 'pallet4', + t: 'pallet', + v: true, + tf: [[0.75, 0.175, 3.5], [0, 0, 0], [1.5, 1.2, 0.1]], + dt: { in: [], out: [], center: [], palletWidth: 1, palletDepth: 1.2 } } - // { - // id: '39zML1rnSOOQGQYQ2YUMGy', - // t: 'way', - // v: true, - // tf: [[-4, 0.1, 2], [90, 0, 0], [0.25, 0.25, 0.1]], - // dt: { in: [], out: [], center: ['6wrGKiVJniwgKkoggOoEy6'] } - // }, { - // id: '6wrGKiVJniwgKkoggOoEy6', - // t: 'way', - // v: true, - // tf: [[5, 0.1, 2], [90, 0, 0], [0.25, 0.25, 0.1]], - // dt: { in: [], out: [], center: ['39zML1rnSOOQGQYQ2YUMGy'] } - // }, { - // id: '6UhIIw9QPYh6acwyW8OSGs', - // t: 'gstore', - // v: true, - // tf: [[-1, 0.1, 0.55], [0, 0, 0], [1.5, 1.2, 0.1]], - // dt: { in: [], out: [], center: [], storeWidth: 1.4, storeDepth: 1.4 } - // }, { - // id: '1D0WSRPj8JJJwIcmA0UMqG', - // t: 'gstore', - // v: true, - // tf: [[0.75, 0.1, 0.55], [0, 0, 0], [1.5, 1.2, 0.1]], - // dt: { in: [], out: [], center: [], storeWidth: 1.4, storeDepth: 1.4 } - // }, { - // id: 'gstore3', - // t: 'gstore', - // v: true, - // tf: [[3, 0.1, 0.55], [0, 0, 0], [1.5, 1.2, 0.1]], - // dt: { in: [], out: [], center: [], storeWidth: 1.4, storeDepth: 1.4 } - // }, { - // id: 'pallet1', - // t: 'pallet', - // v: true, - // tf: [[0.75, 0.075, 0.55], [0, 0, 0], [1.5, 1.2, 0.1]], - // dt: { in: [], out: [], center: [], palletWidth: 1, palletDepth: 1.2 } - // }, { - // id: 'pallet2', - // t: 'pallet', - // v: true, - // tf: [[3, 0.075, 0.55], [0, 0, 0], [1.5, 1.2, 0.1]], - // dt: { in: [], out: [], center: [], palletWidth: 1, palletDepth: 1.2 } - // }, { - // id: 'ptr1', - // t: 'ptr', - // v: true, - // tf: [[0.75, 0.075, 2], [0, 0, 0], [1.5, 1.2, 0.1]], - // dt: { in: [], out: [], center: [], ptrWidth: 1.5, ptrDepth: 1.5, ptrHeight: 1.98 } - // }, { - // id: 'ptr2', - // t: 'ptr', - // v: true, - // tf: [[3, 0.075, 2], [0, 0, 0], [1.5, 1.2, 0.1]], - // dt: { in: [], out: [], center: [], ptrWidth: 1.5, ptrDepth: 1.5, ptrHeight: 1.98 } - // }, { - // id: 'pallet3', - // t: 'pallet', - // v: true, - // tf: [[3, 0.175, 1.88], [0, 0, 0], [1.5, 1.2, 0.1]], - // dt: { in: [], out: [], center: [], palletWidth: 1, palletDepth: 1.2 } - // }, { - // id: 'pallet4', - // t: 'pallet', - // v: true, - // tf: [[0.75, 0.175, 3.5], [0, 0, 0], [1.5, 1.2, 0.1]], - // dt: { in: [], out: [], center: [], palletWidth: 1, palletDepth: 1.2 } - // } ] }, {