!2602 功能:排钻配置添加允许大孔在板边缘选项

pull/2598/MERGE
黄诗津 7 months ago committed by ChenX
parent d8da5345c3
commit b96aed0786

@ -729,14 +729,14 @@ export class DrawDrillingTool extends Singleton
else else
{ {
let ocs = interBoard.OCSInv.multiply(this.m_Face.OCS).multiply(MoveMatrix(new Vector3(dist))); let ocs = interBoard.OCSInv.multiply(this.m_Face.OCS).multiply(MoveMatrix(new Vector3(dist)));
return CyHoleInBoard(this.drillEnts as CylinderHole[], interBoard, ocs); return CyHoleInBoard(this.drillEnts as CylinderHole[], interBoard, ocs, false, this.m_Option.allowPxl);
} }
} }
private CheckWoodInBoard(dist: number) private CheckWoodInBoard(dist: number)
{ {
let br = this.m_Face.InterBoard; let br = this.m_Face.InterBoard;
let ocs = br.OCSInv.multiply(this.m_Face.OCS).multiply(MoveMatrix(new Vector3(dist))); let ocs = br.OCSInv.multiply(this.m_Face.OCS).multiply(MoveMatrix(new Vector3(dist)));
return CyHoleInBoard(this.woodPins as CylinderHole[], br, ocs); return CyHoleInBoard(this.woodPins as CylinderHole[], br, ocs, false, this.m_Option.allowPxl);
} }
private CheckModelingCollision(localBoxs: Box3[], intBox3s: Box3[], dist: number) private CheckModelingCollision(localBoxs: Box3[], intBox3s: Box3[], dist: number)
{ {
@ -953,8 +953,8 @@ export class DrawDrillingTool extends Singleton
needRemoveDrillList.add(hole); needRemoveDrillList.add(hole);
} }
//偏移后判断是否在板件外面 //偏移后判断是否在板件外面
else if (!CyHoleInBoard(moveAfterDrills, this.m_Face.InterBoard, this.m_Face.InterBoard.OCSInv) && else if (!CyHoleInBoard(moveAfterDrills, this.m_Face.InterBoard, this.m_Face.InterBoard.OCSInv, false, this.m_Option.allowPxl) &&
!CyHoleInBoard(moveAfterDrills, this.m_Face.LocalBoard, this.m_Face.LocalBoard.OCSInv)) !CyHoleInBoard(moveAfterDrills, this.m_Face.LocalBoard, this.m_Face.LocalBoard.OCSInv, false, this.m_Option.allowPxl))
{ {
this._InteractionLog(`${isWoodPinss ? "木销" : "通孔排钻"}偏移后在板件外,跳过绘制`); this._InteractionLog(`${isWoodPinss ? "木销" : "通孔排钻"}偏移后在板件外,跳过绘制`);
needRemoveDrillList.add(hole); needRemoveDrillList.add(hole);

@ -14,7 +14,7 @@ import { DrillType } from "./DrillType";
export const SCALAR = 0.1; export const SCALAR = 0.1;
export function CyHoleInBoard(cys: CylinderHole[], br: Board, ocs: Matrix4, checkAll = false) export function CyHoleInBoard(cys: CylinderHole[], br: Board, ocs: Matrix4, checkAll = false, allowPxl = false)
{ {
if (!checkAll && cys.length === 1 && cys[0].Type === GangDrillType.Ymj) if (!checkAll && cys.length === 1 && cys[0].Type === GangDrillType.Ymj)
return true; return true;
@ -86,10 +86,10 @@ export function CyHoleInBoard(cys: CylinderHole[], br: Board, ocs: Matrix4, chec
{ {
let center = cy.Position.applyMatrix4(ocs).setZ(0); let center = cy.Position.applyMatrix4(ocs).setZ(0);
let cir = new Circle(center, pxl.Radius - SCALAR); let cir = new Circle(center, pxl.Radius - SCALAR);
if (HostApplicationServices.forceFilterPxl) if (allowPxl || !HostApplicationServices.forceFilterPxl)
return outline.IntersectWith(cir, 0).length > 0 || !outline.PtInCurve(center);
else
return outline.IntersectWith(cir, 0).length <= 1 && !outline.PtInCurve(center); return outline.IntersectWith(cir, 0).length <= 1 && !outline.PtInCurve(center);
else
return outline.IntersectWith(cir, 0).length > 0 || !outline.PtInCurve(center);
})) }))
return false; return false;
} }

@ -392,6 +392,30 @@ export class DrillModal extends React.Component<{ store?: DrillStore; }, {}> {
store.m_Option.canSameType = !store.m_Option.canSameType; store.m_Option.canSameType = !store.m_Option.canSameType;
}} }}
/> />
<div style={{ width: "100%", display: "flex", alignItems: "center" }}>
<Checkbox
checked={store.m_Option.allowPxl}
style={{ marginTop: 10 }}
label="允许大孔在板边缘"
onChange={() =>
{
store.m_Option.allowPxl = !store.m_Option.allowPxl;
}}
/>
<Button
text="应用所有规则"
className={Classes.INTENT_PRIMARY}
style={{ marginLeft: 3, minHeight: 20, height: 20 }}
onClick={() =>
{
store.rules.forEach((rule) =>
{
rule.allowPxl = store.m_Option.allowPxl;
});
store.SaveRuleOption();
}}
/>
</div>
</div> </div>
</div> </div>
<div className={Classes.CARD + " small-input flex flex-col"}> <div className={Classes.CARD + " small-input flex flex-col"}>

@ -50,7 +50,7 @@ export class DrillStore extends BoardStore
private GetDefaultOption() private GetDefaultOption()
{ {
let originOption: DrillingOption = { let originOption: DrillingOption = {
version: 6, //排钻模板新版本 version: 7, //排钻模板新版本
startDist: 0, startDist: 0,
endDist: 49, endDist: 49,
//位置参数 //位置参数
@ -96,6 +96,7 @@ export class DrillStore extends BoardStore
tempId: "", tempId: "",
tempName: "", tempName: "",
autoDeviation: false, autoDeviation: false,
allowPxl: false,
}; };
let opt1 = Object.assign({}, originOption); let opt1 = Object.assign({}, originOption);
opt1.count = 2; opt1.count = 2;
@ -355,6 +356,11 @@ export class DrillStore extends BoardStore
conf.version = 6; conf.version = 6;
conf.autoDeviation = false; conf.autoDeviation = false;
} }
if (conf.version < 7)
{
conf.version = 7;
conf.allowPxl = false;
}
if (conf.useTemp && conf.tempId) if (conf.useTemp && conf.tempId)
{ {

@ -53,4 +53,5 @@ export interface DrillingOption extends IBaseOption
tempId: string; //排钻模板id tempId: string; //排钻模板id
tempName: string; //模板名称 tempName: string; //模板名称
autoDeviation: boolean;//排钻自动偏移 autoDeviation: boolean;//排钻自动偏移
allowPxl: boolean; //是否允许大孔在板边缘
} }

Loading…
Cancel
Save