mirror of https://gitee.com/cf-fz/WebCAD.git
!2295 新增:空间绘制层立板自动按缺口尺寸绘制出异形板件
parent
60d3829c7c
commit
e954fff373
@ -0,0 +1,46 @@
|
||||
import { Matrix4 } from "three";
|
||||
import { app } from "../../ApplicationServices/Application";
|
||||
import { ExtrudeHole } from "../../DatabaseServices/3DSolid/ExtrudeHole";
|
||||
import { Board } from "../../DatabaseServices/Entity/Board";
|
||||
import { ExtrudeSolid } from "../../DatabaseServices/Entity/Extrude";
|
||||
import { HardwareCompositeEntity } from "../../DatabaseServices/Hardware/HardwareCompositeEntity";
|
||||
import { Box3Ext } from "../../Geometry/Box";
|
||||
|
||||
/**
|
||||
* 缺口(柱子、梁)柜内空间绘制层立板自动按缺口尺寸绘制出异形板件
|
||||
* 切割凸出部分
|
||||
*
|
||||
* @param {Box3Ext} spaceBox
|
||||
* @param {Matrix4} spaceOCS
|
||||
* @param {Board[]} brs
|
||||
*/
|
||||
export function CuttingProtrudingPart(spaceBox: Box3Ext, spaceOCS: Matrix4, brs: Board[])
|
||||
{
|
||||
// 获取解析空间包围框
|
||||
let box = spaceBox.clone().applyMatrix4(spaceOCS);
|
||||
// 获取包围框里的实体
|
||||
let intersectsEnt = app.Database.ModelSpace.Entitys.filter((ent) =>
|
||||
{
|
||||
return !ent.IsErase && (ent instanceof Board || ent instanceof HardwareCompositeEntity) && box.intersectsBox(ent.BoundingBox);
|
||||
});
|
||||
// 获取包围框里的实体与需要绘制实体碰撞的实体
|
||||
let brKfs = intersectsEnt.filter((ent) => ent instanceof Board) as Board[];
|
||||
// 处理碰撞的复合实体
|
||||
let hardwareEnt = intersectsEnt.filter((ent) => ent instanceof HardwareCompositeEntity) as HardwareCompositeEntity[];
|
||||
let hardwareKfs: ExtrudeSolid[] = [];
|
||||
for (let h of hardwareEnt)
|
||||
{
|
||||
let ens = h.GetAllEntity(true, e => e instanceof ExtrudeSolid || e instanceof ExtrudeHole) as (ExtrudeSolid | ExtrudeHole)[];
|
||||
for (let e of ens)
|
||||
{
|
||||
if (e instanceof ExtrudeHole)
|
||||
hardwareKfs.push(e.Convert2ExtrudeSolid());
|
||||
|
||||
else
|
||||
hardwareKfs.push(e);
|
||||
}
|
||||
}
|
||||
//直接切掉
|
||||
for (let br of brs)
|
||||
br.Subtract([...hardwareKfs, ...brKfs]);
|
||||
}
|
Loading…
Reference in new issue