!434 fix #IZQJT 优化排钻在造型里时的情况

pull/434/MERGE
ZoeLeeFZ 5 years ago committed by ChenX
parent 8460b66973
commit 8e924f0baa

@ -16,6 +16,8 @@ import { equaln, MoveMatrix, ZAxis } from "../../Geometry/GeUtils";
import { FaceDirection } from "../../UI/Store/BoardInterface"; import { FaceDirection } from "../../UI/Store/BoardInterface";
import { DrillingOption, SpacingType } from "../../UI/Store/drillInterface"; import { DrillingOption, SpacingType } from "../../UI/Store/drillInterface";
import { begin } from "xaop"; import { begin } from "xaop";
import { IsPointInPolyLine } from "../../DatabaseServices/PointInPolyline";
import { Polyline } from "../../DatabaseServices/Entity/Polyline";
export class DrawDrillingTool extends Singleton export class DrawDrillingTool extends Singleton
@ -231,7 +233,9 @@ export class DrawDrillingTool extends Singleton
{ {
if (this.CheckModelingCollision(this.m_Face.m_InterBoard, this.drillEnts[0], dist)) if (this.CheckModelingCollision(this.m_Face.m_InterBoard, this.drillEnts[0], dist))
continue; continue;
//检测排钻是否在板件内
if (userConfig.openExactDrill && !this.CheckDrillInBoard(this.m_Face.m_InterBoard, this.drillEnts[0], dist))
continue;
if (this.drillEnts.length === 3) if (this.drillEnts.length === 3)
{ {
if (this.CheckModelingCollision(this.m_Face.m_LocalBoard, this.drillEnts[2], dist)) if (this.CheckModelingCollision(this.m_Face.m_LocalBoard, this.drillEnts[2], dist))
@ -273,6 +277,12 @@ export class DrawDrillingTool extends Singleton
} }
return false; return false;
} }
private CheckDrillInBoard(br: Board, en: GangDrill, dist: number)
{
let cu = br.ContourCurve;
let p = en.Position.setX(dist).applyMatrix4(this.m_Face.OCS).applyMatrix4(br.OCSInv);
return IsPointInPolyLine(cu as Polyline, p);
}
// 分析当前排钻 // 分析当前排钻
private ParseDrillList(drills: ObjectId[][]) private ParseDrillList(drills: ObjectId[][])
{ {

@ -329,4 +329,5 @@ export enum StoreageKeys
PlatSession = "platSession", PlatSession = "platSession",
UserName = "userName", UserName = "userName",
RenderType = "renderType", RenderType = "renderType",
ExactDrill = "openExactDrill",
} }

@ -16,6 +16,8 @@ export class UserConfig
@observable private _drillConfigs: Map<string, DrillingOption[]> = new Map(); @observable private _drillConfigs: Map<string, DrillingOption[]> = new Map();
@observable openDrillingReactor = true; @observable openDrillingReactor = true;
@observable openAutoCuttingReactor = true; @observable openAutoCuttingReactor = true;
/**打开将检测排钻是否在板件内*/
@observable openExactDrill = true;
winerackConfig: IWineRackOption; winerackConfig: IWineRackOption;
constructor() constructor()
{ {
@ -26,6 +28,8 @@ export class UserConfig
let type = sessionStorage.getItem(StoreageKeys.RenderType); let type = sessionStorage.getItem(StoreageKeys.RenderType);
if (type) if (type)
this._renderType = parseFloat(type); this._renderType = parseFloat(type);
this.openExactDrill = localStorage.getItem(StoreageKeys.ExactDrill) === "true";
} }
set RenderType(t: RenderType) set RenderType(t: RenderType)
{ {

@ -3,6 +3,7 @@ import { observer } from 'mobx-react';
import * as React from 'react'; import * as React from 'react';
import { app } from '../../../../ApplicationServices/Application'; import { app } from '../../../../ApplicationServices/Application';
import { UserConfig } from '../../../../Editor/UserConfig'; import { UserConfig } from '../../../../Editor/UserConfig';
import { StoreageKeys } from '../../../../Common/KeyEnum';
interface IConfigProps interface IConfigProps
{ {
@ -35,6 +36,15 @@ export class DrawConfigPanel extends React.Component<IConfigProps, {}> {
checked={userConfig.openDrillingReactor} checked={userConfig.openDrillingReactor}
onChange={this.toggleDrillingReactor} onChange={this.toggleDrillingReactor}
/> />
<Checkbox
label="精确排钻"
checked={userConfig.openExactDrill}
onChange={() =>
{
userConfig.openExactDrill = !userConfig.openExactDrill;
localStorage.setItem(StoreageKeys.ExactDrill, String(userConfig.openExactDrill))
}}
/>
<H5></H5> <H5></H5>
<Checkbox <Checkbox
label="自动切割" label="自动切割"

Loading…
Cancel
Save