|
|
|
@ -3,11 +3,12 @@ import { fnNumberSort } from '@jscad/modeling/src/utils';
|
|
|
|
|
import { Intersection, Vector3 } from 'three';
|
|
|
|
|
import { app } from '../../ApplicationServices/Application';
|
|
|
|
|
import { HostApplicationServices } from '../../ApplicationServices/HostApplicationServices';
|
|
|
|
|
import { arrayLast } from '../../Common/ArrayExt';
|
|
|
|
|
import { Draw } from '../../Common/Draw';
|
|
|
|
|
import { RoomHolePolyline } from '../../DatabaseServices/Room/Entity/Wall/Hole/RoomHolePolyline';
|
|
|
|
|
import { RoomWallBase, WallFaceType } from "../../DatabaseServices/Room/Entity/Wall/RoomWallBase";
|
|
|
|
|
import { RoomWallLine } from '../../DatabaseServices/Room/Entity/Wall/RoomWallLine';
|
|
|
|
|
import { RoomWallPlaceIHoleHelper } from '../../DatabaseServices/Room/ParseService/Hole/RoomWallPlaceIHoleHelper';
|
|
|
|
|
import { ParseWallRange, RoomWallPlaceIHoleHelper } from '../../DatabaseServices/Room/ParseService/Hole/RoomWallPlaceIHoleHelper';
|
|
|
|
|
import { RoomWallPlaceLHoleHelper } from '../../DatabaseServices/Room/ParseService/Hole/RoomWallPlaceLHoleHelper';
|
|
|
|
|
import { RoomWallPlaceUHoleHelper } from '../../DatabaseServices/Room/ParseService/Hole/RoomWallPlaceUHoleHelper';
|
|
|
|
|
import { GetAllWalls } from '../../DatabaseServices/Room/ParseService/RoomParseUtil';
|
|
|
|
@ -338,28 +339,66 @@ export class Command_DrawHole implements Command
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
let [wall1, wall2] = walls;
|
|
|
|
|
|
|
|
|
|
let length1 = v.routes[0].length;
|
|
|
|
|
let length2 = v.routes[1].length;
|
|
|
|
|
|
|
|
|
|
let needRevrse = false;
|
|
|
|
|
|
|
|
|
|
if (equalv3(wall1.StartPoint, v.position, 1e-3))
|
|
|
|
|
{
|
|
|
|
|
wall1.Reverse();
|
|
|
|
|
let wall1Range = ParseWallRange(orgWalls[0])[0];
|
|
|
|
|
length1 *= wall1Range[1];
|
|
|
|
|
|
|
|
|
|
//需要翻转洞的方向
|
|
|
|
|
if (wall1Range.left !== WallFaceType.Inside)
|
|
|
|
|
needRevrse = true;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
let wall1Range = arrayLast(ParseWallRange(orgWalls[0]));
|
|
|
|
|
length1 *= 1 - wall1Range[0];
|
|
|
|
|
|
|
|
|
|
//需要翻转洞的方向
|
|
|
|
|
if (wall1Range.right !== WallFaceType.Inside)
|
|
|
|
|
needRevrse = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (equalv3(wall2.EndPoint, v.position, 1e-3))
|
|
|
|
|
{
|
|
|
|
|
wall2.Reverse();
|
|
|
|
|
|
|
|
|
|
let length1 = v.routes[0].length;
|
|
|
|
|
let length2 = v.routes[1].length;
|
|
|
|
|
let wall2Range = arrayLast(ParseWallRange(orgWalls[1]));
|
|
|
|
|
length2 *= 1 - wall2Range[0];
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
let wall2Range = ParseWallRange(orgWalls[1])[0];
|
|
|
|
|
length2 *= wall2Range[1];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//这里看起来不大行 使用打断后的曲线 会有过长的问题 需要得到真正的可以放置的区域(但是似乎也不需要实现非常精确的放置区域,实现成本有点麻烦 干脆不做了 问题也不大)
|
|
|
|
|
if (length1 < 800)
|
|
|
|
|
wall1.StartPoint = v.routes[0].to.position;//直接用最大的
|
|
|
|
|
wall1.StartPoint = wall1.GetPointAtDistance(wall1.Length - length1);//直接用最大的
|
|
|
|
|
else
|
|
|
|
|
wall1.StartPoint = wall1.GetPointAtDistance(wall1.Length - 800);
|
|
|
|
|
|
|
|
|
|
if (length2 < 800)
|
|
|
|
|
wall2.EndPoint = v.routes[1].to.position;//直接用最大的
|
|
|
|
|
wall2.EndPoint = wall2.GetPointAtDistance(length2);//直接用最大的
|
|
|
|
|
else
|
|
|
|
|
wall2.EndPoint = wall2.GetPointAtDistance(800);
|
|
|
|
|
|
|
|
|
|
fakerWalls.push(wall1);
|
|
|
|
|
fakerWalls.push(wall2);
|
|
|
|
|
|
|
|
|
|
if (needRevrse)
|
|
|
|
|
{
|
|
|
|
|
fakerWalls.reverse();
|
|
|
|
|
walls.reverse();
|
|
|
|
|
orgWalls.reverse();
|
|
|
|
|
for (let w of fakerWalls) w.Reverse();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
let lowestwall = walls.reduce((pre, cur) => //高度最低的墙
|
|
|
|
|
{
|
|
|
|
|
return pre.Height < cur.Height ? pre : cur;
|
|
|
|
|