!2081 优化:铰链避让,铰链避让距离可以自定义 #353 #338 #528

pull/2264/MERGE
林三 1 year ago committed by ChenX
parent 95f2d453ff
commit dc3ccb02b8

@ -27,6 +27,12 @@ import { ITemplateParam } from "../../../UI/Store/RightPanelStore/ITemplateParam
import { DrillType } from "../../DrawDrilling/DrillType";
import { IsDoor, IsHandle, IsHinge } from "../../HideSelect/HideSelectUtils";
/**
* ()
* store.option.deviationMoveNum
*
* @type {*}
* */
const MoveNum = 8;
export class DrawDoorTool
@ -509,7 +515,6 @@ export class DrawDoorTool
{
let boards: Board[] = [];
let doors: Entity[] = [];
let layers: Entity[] = [];
let ironwareEnts: HardwareCompositeEntity[] = []; //五金
let hardwareCompositeEnts: Entity[] = [];//除铰链和把手以外的复合实体
let layerBoards: Entity[] = []; //层板 左右门板判断铰链碰撞
@ -523,6 +528,17 @@ export class DrawDoorTool
layerBoards.push(en);
else if (en.BoardType === BoardType.Vertical)
verticalBoards.push(en);
else if (en.BoardType === BoardType.Behind)
{
if (IsDoor(en))
doors.push(en);
else
{
layerBoards.push(en);
verticalBoards.push(en);
}
continue;
}
}
else if (en instanceof HardwareCompositeEntity)
{
@ -530,9 +546,9 @@ export class DrawDoorTool
ironwareEnts.push(en);
else if (!IsDoor(en))
{
layers.push(en);
hardwareCompositeEnts.push(en);
layerBoards.push(en);
verticalBoards.push(en);
}
else //只剩下复合门板 加入HCEBoard 用于判断铰链归属
hardwareCompositeEnts.push(en);
@ -609,7 +625,7 @@ export class DrawDoorTool
SetHingeType(br, ironware);
}
}
else if (isParallelTo(ironware.Normal, br.Normal))
else if (isParallelTo(ironware.Normal, br.Normal) || !IsDoor(br)) //不是门板也判断碰撞
{
let hingeTr = ironware.Template.Object as TemplateRecord;
let hingeSpaceTr = hingeTr.Parent.Object as TemplateRecord;
@ -620,12 +636,12 @@ export class DrawDoorTool
if (isUpDownDoor)
{
if (RecordHingeTrSizeX(hingeTr2Size_Map, hingeTr, size.x)) continue;
number = this.GetHingeMoveNum(doorWidth, ironBoxInDoorSpace, ironBox, verticalBoards, size.x / 3, number, isUpDownDoor);
number = this.GetHingeMoveNum(doorWidth, ironBoxInDoorSpace, ironBox, verticalBoards, this.option.deviation, number, isUpDownDoor);
}
else
{
if (RecordHingeTrSizeX(hingeTr2Size_Map, hingeTr, size.z)) continue;
number = this.GetHingeMoveNum(doorHight, ironBoxInDoorSpace, ironBox, layerBoards, size.z / 3, number, isUpDownDoor);
number = this.GetHingeMoveNum(doorHight, ironBoxInDoorSpace, ironBox, layerBoards, this.option.deviation, number, isUpDownDoor);
}
if (number === 0)
@ -634,7 +650,7 @@ export class DrawDoorTool
continue;
}
hingeSpaceTr.GetParam("SY").value = (isUpDownDoor ? size.x : size.z) * number / 3; //超出情况往下偏移
hingeSpaceTr.GetParam("SY").value = this.option.deviation * number; //超出情况往下偏移
needUpdate = true;
continue;
}
@ -665,20 +681,20 @@ export class DrawDoorTool
{
let doorWidth = doorBox.getSize(new Vector3).x;
if (RecordHingeTrSizeX(hingeTr2Size_Map, hingeTr, ironSize.x)) continue;
number = this.GetHingeMoveNum(doorWidth, ironBoxInDoorSpace, ironBox, verticalBoards, ironSize.x / 3, number, isUpDownDoor);
number = this.GetHingeMoveNum(doorWidth, ironBoxInDoorSpace, ironBox, verticalBoards, this.option.deviation, number, isUpDownDoor);
}
else
{
let doorHight = doorBox.getSize(new Vector3).z;
if (RecordHingeTrSizeX(hingeTr2Size_Map, hingeTr, ironSize.z)) continue;
number = this.GetHingeMoveNum(doorHight, ironBoxInDoorSpace, ironBox, layerBoards, ironSize.z / 3, number, isUpDownDoor);
number = this.GetHingeMoveNum(doorHight, ironBoxInDoorSpace, ironBox, layerBoards, this.option.deviation, number, isUpDownDoor);
}
if (number === 0)
{
moveFail = true;
continue;
}
hingeSpaceTr.GetParam("SY").value = (isUpDownDoor ? ironSize.x : ironSize.z) * number / 3; //超出情况往下偏移
hingeSpaceTr.GetParam("SY").value = this.option.deviation * number; //超出情况往下偏移
needUpdate = true;
continue;
}

@ -464,6 +464,7 @@ export namespace CheckoutValid
case "doorThickness":
case "startDist":
case "endDist":
case "deviation":
if (isNaN(val))
return "数值不能为空且必须为数字";
if (!(val > 0))

@ -423,7 +423,7 @@ export const DefaultLatticOption: ILatticeOption = {
Object.freeze(DefaultLatticOption);
export const DefaultDoorOption: IDoorConfigOption = {
version: 6,
version: 7,
col: 2,
row: 1,
isAllSelect: true,
@ -474,6 +474,7 @@ export const DefaultDoorOption: IDoorConfigOption = {
lbSealedLeft: 1,
lbSealedRight: 1,
lbHightDrillOption: { up: "", down: "", left: "", right: "" },
deviation: 100
};
Object.freeze(DefaultDoorOption);
export const DefaultHingeOption: IHingeConfigOption = {
@ -481,6 +482,7 @@ export const DefaultHingeOption: IHingeConfigOption = {
hindeTopDist: 0,
hindeBottomDist: 0,
useRule: false,
deviation: 100
};
Object.freeze(DefaultHingeOption);
export const DefaultDrawerOption: IDrawerConfigOption = {

@ -61,6 +61,13 @@ export class HingeRules extends React.Component<IHingeRulesProps> {
option={store.m_Option}
uiOption={uiOption}
/>
<SetBoardDataBlock
type={CheckObjectType.Do}
className="hinge-rule"
pars={[["deviation", "偏移量"]]}
option={store.m_Option}
uiOption={uiOption}
/>
<Checkbox
label="使用铰链规则"
inline

@ -319,8 +319,19 @@ export class TemplateDrawHingeTool
brs.push(en);
if (en.BoardType === BoardType.Layer)
layers.push(en);
if (en.BoardType === BoardType.Vertical)
else if (en.BoardType === BoardType.Vertical)
verticals.push(en);
else if (en.BoardType === BoardType.Behind)
{
if (!IsDoor(en))
{
layers.push(en);
verticals.push(en);
}
else
doors.push(en);
continue;
}
}
else if (en instanceof HardwareCompositeEntity)
{
@ -410,7 +421,7 @@ export class TemplateDrawHingeTool
SetHingeType(br, ironware);
}
}
else if (isParallelTo(ironware.Normal, br.Normal))
else if (isParallelTo(ironware.Normal, br.Normal) || !IsDoor(br)) //不是门板也判断碰撞
{
let size = realityBox.getSize(new Vector3);
@ -490,10 +501,11 @@ export class TemplateDrawHingeTool
Width = size.x;
}
let distance = (HingeStore.GetInstance() as HingeStore).m_Option.deviation;
if (isLROpen)
{
let doorHight = Height;
let distance = inventedBox1.getSize(new Vector3).z / 3;
inventedBox1.translate(new Vector3(0, 0, distance * number));
realityBox1.translate(new Vector3(0, 0, distance * number));
@ -527,7 +539,6 @@ export class TemplateDrawHingeTool
else
{
let doorHight = Width;
let distance = inventedBox1.getSize(new Vector3).x / 3;
inventedBox1.translate(new Vector3(distance * number, 0, 0));
let box1Z = inventedBox1.getCenter(new Vector3).x;

@ -209,6 +209,11 @@ export class DoorStore extends DoorDrawerStore
Object.assign(opt.lbHightDrillOption, { up: drilltypes[0], down: drilltypes[0], left: drilltypes[0], right: drilltypes[0] });
Object.assign(opt.cbHightDrillOption, { up: drilltypes[0], down: drilltypes[0], left: drilltypes[0], right: drilltypes[0] });
}
if (opt.version < 7)
{
opt.version = 7;
opt.deviation = 100;
}
}
get UIRule()
{

@ -60,6 +60,7 @@ export interface IDoorConfigOption extends IDoorAndDrawerConfigOption
frontAndBackDrill: boolean; //正反面排孔
layerBoardName: string;
cbHightDrillOption: IHightDrillOption; //层板高级排钻
deviation: number; //铰链碰撞单次偏移量
}
/**
@ -71,6 +72,7 @@ export interface IHingeConfigOption extends IBaseOption
hindeTopDist: number;
hindeBottomDist: number;
useRule: boolean,
deviation: number; //铰链碰撞单次偏移量
}
/**

Loading…
Cancel
Save