!1354 功能:封边检查

pull/1354/MERGE
ZoeLeeFZ 4 years ago committed by ChenX
parent 3b2ae0993e
commit 6c88b288e3

@ -3,6 +3,7 @@ import { app } from "../ApplicationServices/Application";
import { arrayLast } from "../Common/ArrayExt";
import { EBoardKeyList } from "../Common/BoardKeyList";
import { safeEval } from "../Common/eval";
import { UpdateDraw } from "../Common/Status";
import { FixedNotZero } from "../Common/Utils";
import { CylinderHole, GangDrillType } from "../DatabaseServices/3DSolid/CylinderHole";
import { BoardIsLong, BoardIsShort } from "../DatabaseServices/BoardLinesReactor";
@ -376,7 +377,10 @@ export class BoardFindModify implements Command
case EBoardKeyList.LeftSealed:
case EBoardKeyList.RightSealed:
if (option[i])
{
br.BoardProcessOption[i] = option[i];
br.Update(UpdateDraw.Geometry);
}
break;
case "upDrill":
if (!br.IsSpecialShape)

@ -148,8 +148,8 @@ class SetSmoothEdgeFaces extends BoardGetFace
this.highSealingData[i].size = option.edge;
}
this.Board.BoardProcessOption.highSealed = this.highSealingData;
HandleRectBoardSealingData(this.Board, this.highSealingData, this.sealCus);
this.Board.BoardProcessOption.highSealed = this.highSealingData;
}
}

@ -191,4 +191,5 @@ export enum CommandNames
EditorBBS = "EDITORBBS",//编辑BBS
CuttingFace = "CUTTINGFACE",//切割面
DrawTempByImport = "DRAWTEMPBYIMPORT",
CheckEdge = "CHECKEDGE",
}

@ -340,7 +340,7 @@ export class ExtrudeHole extends Hole
}
InitDrawObject(renderType: RenderType = RenderType.Wireframe)
{
if (renderType === RenderType.Wireframe)
if (renderType === RenderType.Wireframe || renderType === RenderType.Edge)
{
return new LineSegments(this.EdgeGeometry, ColorMaterial.GetLineMaterial(this.ColorIndex));
}
@ -371,7 +371,7 @@ export class ExtrudeHole extends Hole
this._MeshGeometry = undefined;
this.MeshGeometry;
if (renderType === RenderType.Wireframe)
if (renderType === RenderType.Wireframe || renderType === RenderType.Edge)
{
let l = obj as LineSegments;
l.geometry = this.EdgeGeometry;

@ -181,7 +181,7 @@ export class SweepSolid extends Entity
InitDrawObject(renderType: RenderType): Object3D
{
if (renderType === RenderType.Wireframe)
if (renderType === RenderType.Wireframe || renderType === RenderType.Edge)
return new LineSegments(this.EdgeGeometry, ColorMaterial.GetLineMaterial(this.ColorIndex));
else if (renderType === RenderType.Conceptual)
{
@ -222,7 +222,7 @@ export class SweepSolid extends Entity
UpdateDrawObject(renderType: RenderType, obj: Object3D)
{
DisposeThreeObj(obj);
if (renderType === RenderType.Wireframe)
if (renderType === RenderType.Wireframe || renderType === RenderType.Edge)
{
let l = obj as LineSegments;
l.geometry = this.EdgeGeometry;

@ -26,6 +26,7 @@ import { ColorMaterial } from '../../Common/ColorPalette';
import { CylinderHole } from '../3DSolid/CylinderHole';
import { BlockTableRecord } from '../BlockTableRecord';
import { InitRectBoardHoleOption, SetRectHighHole, TempRectHoleOption, CyHoleInBoard } from '../../Add-on/DrawDrilling/HoleUtils';
import { GetBoardHighSeal, GetBoardSealingCurves } from '../../GraphicsSystem/CalcEdgeSealing';
//转换板件类型成为空间类型. 0x 1y 2z
export function ConverBoardTypeToSpaceType(type: BoardType): number
@ -130,11 +131,13 @@ export class Board extends ExtrudeSolid
if (Reflect.get(target, key, receiver) !== value)
{
this.WriteAllObjectRecord();
if (key === "highDrill" || key === "highSealed")
if (key === "highDrill" || key === EBoardKeyList.HighSealed)
{
let arr = this.CreateArray() as any[];
arr.push(...value);
target[key] = arr;
if (key === EBoardKeyList.HighSealed)
this.Update(UpdateDraw.Geometry);
return true;
}
let result = Reflect.set(target, key, value, receiver);
@ -839,14 +842,28 @@ export class Board extends ExtrudeSolid
}
InitDrawObject(renderType = RenderType.Wireframe)
{
let obj = super.InitDrawObject(renderType);
let obj: Object3D;
if (renderType === RenderType.Edge)
{
obj = new Object3D();
obj.add(new LineSegments(this.EdgeGeometry, ColorMaterial.GetLineMaterial(8)));
this.CheckSealing(obj);
}
else
{
obj = super.InitDrawObject(renderType);
}
this.HandleBoardMaterial(renderType, obj);
return obj;
}
UpdateDrawObject(renderType: RenderType, obj: Object3D)
{
let o = super.UpdateDrawObject(renderType, obj);
if (renderType === RenderType.Edge)
{
obj.add(new LineSegments(this.EdgeGeometry, ColorMaterial.GetLineMaterial(8)));
this.CheckSealing(obj);
}
this.HandleBoardMaterial(renderType, obj);
return o;
@ -883,6 +900,25 @@ export class Board extends ExtrudeSolid
}
}
}
CheckSealing(obj: Object3D)
{
let sealingInfo = new Map(userConfig.sealingColorMap.filter(d => d[0] && d[1]) as [string, string][]);
if (sealingInfo.size === 0) return;
let cus = GetBoardSealingCurves(this);
let highSeals = GetBoardHighSeal(this, cus);
for (let i = 0; i < cus.length; i++)
{
let size = highSeals[i].size.toString();
let color = sealingInfo.get(size);
if (color)
{
cus[i].Position = cus[i].Position.add(new Vector3(0, 0, this.thickness / 2));
let l = cus[i].GetDrawObjectFromRenderType(RenderType.Wireframe) as LineSegments;
l.material = ColorMaterial.GetLineMaterial(parseFloat(color));
obj.add(l);
}
}
}
DeferUpdate()
{
if (this.NeedUpdateFlag & UpdateDraw.Matrix)

@ -1731,7 +1731,7 @@ export class ExtrudeSolid extends Entity
}
private _EdgeGeometry: EdgesGeometry | BufferGeometry;
private get EdgeGeometry()
protected get EdgeGeometry()
{
if (this._EdgeGeometry)
return this._EdgeGeometry;

@ -455,6 +455,7 @@ export function registerCommand()
commandMachine.RegisterCommand(CommandNames.Physical, new ChangeRenderType(RenderType.Physical));
commandMachine.RegisterCommand(CommandNames.Physical2, new ChangeRenderType(RenderType.Physical2));
commandMachine.RegisterCommand(CommandNames.PrintType, new ChangeRenderType(RenderType.Print));
commandMachine.RegisterCommand(CommandNames.CheckEdge, new ChangeRenderType(RenderType.Edge));
//导入导出配置
commandMachine.RegisterCommand("downloadconfig", new DownLoadDConfig());

@ -30,7 +30,7 @@ export interface ICursorConfig extends IBaseOption
export class UserConfig implements IConfigStore
{
private readonly _version = 12;
private readonly _version = 13;
_renderType: RenderType = RenderType.Wireframe;
@observable maxSize: IMaxSizeProps = {
isShow: false,
@ -90,21 +90,24 @@ export class UserConfig implements IConfigStore
};
lineWidth = 2; //打印线框
@observable forceFilterPxl = true;
checkSealing = false;
sealingColorMap: [string, string][] = [];
constructor()
{
this.Init();
}
Init()
{
let type = localStorage.getItem(StoreageKeys.RenderType);
if (type)
this._renderType = parseFloat(type);
let type = Number(localStorage.getItem(StoreageKeys.RenderType));
if (type && type !== RenderType.Edge)
this._renderType = type;
}
set RenderType(t: RenderType)
{
if (t !== this._renderType)
{
this._renderType = t;
this.checkSealing = t === RenderType.Edge;
this.SetRenderTypeEvent();
localStorage.setItem(StoreageKeys.RenderType, t.toString());
@ -171,6 +174,8 @@ export class UserConfig implements IConfigStore
dimTextHeight: this.dimTextHeight,
lineWidth: this.lineWidth,
forceFilterPxl: this.forceFilterPxl,
checkSealing: this.checkSealing,
sealingColorMap: this.sealingColorMap
}
};
}
@ -228,6 +233,12 @@ export class UserConfig implements IConfigStore
if (config.option.version > 11)
this.forceFilterPxl = config.option.forceFilterPxl;
if (config.option.version > 12)
{
this.checkSealing = config.option.checkSealing;
this.sealingColorMap = config.option.sealingColorMap;
}
}
}

@ -24,6 +24,7 @@ export enum RenderType
Print = 5,
/**物理带线框 */
Physical2 = 6,
Edge = 7,
/******************************************** 在视口时的渲染模式 */
/**

@ -1443,6 +1443,15 @@ export const CommandList: ICommand[] = [
chName: "通过导入数据绘制模板",
chDes: "通过导入数据绘制模板",
},
{
typeId: "util",
link: "#",
defaultCustom: CommandNames.CheckEdge,
command: CommandNames.CheckEdge,
type: "工具",
chName: "封边检查",
chDes: "封边检查",
},
//#endregion
//#region 文件命令

@ -5,3 +5,36 @@
margin-right: 30px;
}
}
.drawconfig-1 {
display: flex;
&>div {
width: 50%;
}
.input {
width: 80px;
}
.sealingList {
height: 220px;
overflow-x: hidden;
overflow-y: auto;
padding: 2px;
&>li {
display: flex;
&>span {
outline: 1px #ccc solid;
text-align: center;
}
&>span,
&>input {
width: 50%;
}
}
}
}

@ -19,6 +19,9 @@ import { ChaiDanPanel } from "./ChaiDanModal";
import { PerformancePanel } from "./PerformancePanel";
import { GetCompoentObjectIdString } from "../../ComponentObjectId";
import { ColorMaterial } from "../../../../Common/ColorPalette";
import { RenderType } from "../../../../GraphicsSystem/RenderType";
import { Board } from "../../../../DatabaseServices/Entity/Board";
import { UpdateDraw } from "../../../../Common/Status";
export enum EOptionTabId
{
@ -34,6 +37,8 @@ export class ConfigStore extends Singleton
{
private oldBgcolor = app.Viewer.Renderer.getClearColor().getStyle();
@observable bgColor = "#000000";
@observable checkSealing = false;
@observable sealingArr: [string, string][] = Array.from({ length: 10 }, () => ["", ""]);
OnCanel = () =>
{
//背景色恢复上一次确定/应用时的
@ -69,6 +74,22 @@ export class ConfigStore extends Singleton
ColorMaterial.PrintLineMatrial.linewidth = userConfig.lineWidth;
ColorMaterial.GetPrintConceptualMaterial().polygonOffsetUnits = userConfig.lineWidth;
if (this.checkSealing !== userConfig.checkSealing)
userConfig.RenderType = this.checkSealing ? RenderType.Edge : RenderType.Wireframe;
userConfig.checkSealing = this.checkSealing;
//是否更新封边检查
let currentSealingArr = this.sealingArr.filter(d => d[0] && d[1]);
let isChangeData = userConfig.sealingColorMap.length === 0 || userConfig.sealingColorMap.some((d, i) => d[0] !== currentSealingArr[i][0] || d[1] !== currentSealingArr[i][1]);
if (true)
{
userConfig.sealingColorMap = toJS(currentSealingArr, { recurseEverything: true });
for (let b of app.Database.ModelSpace.Entitys)
if (b instanceof Board)
b.Update(UpdateDraw.Geometry);
app.Viewer.UpdateRender();
}
await userConfigStore.SaveConfig(BoardModalType.UserConfig, userConfig);
};
}
@ -77,7 +98,7 @@ export class ConfigStore extends Singleton
* (O)
*/
@observer
export class ConfigDialog extends React.Component
export class ConfigDialog extends React.Component<{ store: ConfigStore; }>
{
@observable private selectedTabId: EOptionTabId = EOptionTabId.Show;
@observable private curFileTitle = "图纸";
@ -85,7 +106,7 @@ export class ConfigDialog extends React.Component
private event: Function;
RegisterHandleKeyBoardEvent()
{
const store = ConfigStore.GetInstance() as ConfigStore;
const store = this.props.store;
this.event = begin(app.Editor.ModalManage, app.Editor.ModalManage.OnKeyDown, (e: KeyboardEvent) =>
{
if (GetCompoentObjectIdString(ConfigDialog) !== app.Editor.ModalManage.CurrentModalKey) return;
@ -105,6 +126,15 @@ export class ConfigDialog extends React.Component
this.RegisterHandleKeyBoardEvent();
await this.getFileName();
document.getElementById('modal').focus();
this.props.store.checkSealing = userConfig.checkSealing;
const sealingArr = this.props.store.sealingArr;
for (let i = 0; i < sealingArr.length; i++)
{
let d = sealingArr[i];
let d1 = userConfig.sealingColorMap[i];
d[0] = d1 ? d1[0] : "";
d[1] = d1 ? d1[1] : "";
}
}
componentWillUnmount()
{
@ -121,7 +151,7 @@ export class ConfigDialog extends React.Component
};
render()
{
const store = ConfigStore.GetInstance() as ConfigStore;
const store = this.props.store;
return (
<div
className={Classes.DIALOG_CONTAINER}
@ -150,7 +180,7 @@ export class ConfigDialog extends React.Component
<Tab id={EOptionTabId.File} title="文件" />
<Tab id={EOptionTabId.Show} title="显示" panel={<DisplayConfigPanel store={store} />} />
<Tab id={EOptionTabId.Sys} title="系统" panel={<SystemConfigPanel />} />
<Tab id={EOptionTabId.Draw} title="绘图" panel={<DrawConfigPanel store={userConfig} />} />
<Tab id={EOptionTabId.Draw} title="绘图" panel={<DrawConfigPanel store={store} config={userConfig} />} />
<Tab id={EOptionTabId.ChaiDan} title="拆单" panel={<ChaiDanPanel />} />
<Tab id={EOptionTabId.Perf} title="性能" panel={<PerformancePanel />} />
</Tabs>

@ -12,10 +12,13 @@ import { Board } from '../../../../DatabaseServices/Entity/Board';
import { CompositeEntity } from '../../../../DatabaseServices/Entity/CompositeEntity';
import { safeEval } from '../../../../Common/eval';
import { UpdateCompositeEntityBoard } from '../../../../Add-on/ShowLines';
import { ConfigStore } from './ConfigDialog';
import { ColorMaterial } from '../../../../Common/ColorPalette';
interface IConfigProps
{
store: UserConfig;
config: UserConfig;
store: ConfigStore;
}
@observer
@ -24,13 +27,13 @@ export class DrawConfigPanel extends React.Component<IConfigProps, {}> {
private oldShowLine: boolean;
private toggleDrillingReactor = () =>
{
const userConfig = this.props.store;
const userConfig = this.props.config;
userConfig.openDrillingReactor = !userConfig.openDrillingReactor;
app._drillingReactor.Enable = userConfig.openDrillingReactor;
};
UNSAFE_componentWillMount()
{
const cof = this.props.store;
const cof = this.props.config;
this.maxSizeConfig = DataAdapter.ConvertUIData(cof.maxSize);
this.oldShowLine = userConfig.showLines;
}
@ -53,47 +56,88 @@ export class DrawConfigPanel extends React.Component<IConfigProps, {}> {
}
public render()
{
const userConfig = this.props.store;
const userConfig = this.props.config;
const { kjlConfig } = userConfig;
return (
<Card>
<H5></H5>
<Checkbox
label="排钻反应器"
checked={userConfig.openDrillingReactor}
onChange={this.toggleDrillingReactor}
/>
<Checkbox
label="板边缘大孔过滤"
checked={userConfig.forceFilterPxl}
onChange={() => userConfig.forceFilterPxl = !userConfig.forceFilterPxl}
/>
{/* <H5></H5>
<Checkbox
label="自动切割"
checked={userConfig.openAutoCuttingReactor}
onChange={this.toggleAutoCuttingReactor}
/> */}
<H5></H5>
<Checkbox label="板件超长超短弹窗提示" checked={userConfig.maxSize.isShow} onChange={() => userConfig.maxSize.isShow = !userConfig.maxSize.isShow} />
{
[["板长", "height"], ["板宽", "width"]].map(([t, k]) =>
<Label className={Classes.INLINE}>
<span>{t}</span>
<ToasterInput
type={CheckObjectType.OnlyNumber}
option={userConfig.maxSize}
uiOption={this.maxSizeConfig}
optKey={k}
onBlur={(e, hasError) =>
{
if (hasError)
this.maxSizeConfig[k] = userConfig.maxSize[k].toString();
}}
/>
</Label>
)
}
<div className="flex drawconfig-1">
<div>
<H5></H5>
<Checkbox
label="排钻反应器"
checked={userConfig.openDrillingReactor}
onChange={this.toggleDrillingReactor}
/>
<Checkbox
label="板边缘大孔过滤"
checked={userConfig.forceFilterPxl}
onChange={() => userConfig.forceFilterPxl = !userConfig.forceFilterPxl}
/>
{/* <H5></H5>
<Checkbox
label="自动切割"
checked={userConfig.openAutoCuttingReactor}
onChange={this.toggleAutoCuttingReactor}
/> */}
<H5></H5>
<Checkbox label="板件超长超短弹窗" checked={userConfig.maxSize.isShow} onChange={() => userConfig.maxSize.isShow = !userConfig.maxSize.isShow} />
{
[["板长", "height"], ["板宽", "width"]].map(([t, k]) =>
<Label className={Classes.INLINE}>
<span>{t}</span>
<ToasterInput
inputClassName="input"
type={CheckObjectType.OnlyNumber}
option={userConfig.maxSize}
uiOption={this.maxSizeConfig}
optKey={k}
onBlur={(e, hasError) =>
{
if (hasError)
this.maxSizeConfig[k] = userConfig.maxSize[k].toString();
}}
/>
</Label>
)
}
<H5></H5>
<Checkbox label="显示纹路" checked={userConfig.showLines} onChange={() => userConfig.showLines = !userConfig.showLines} />
<Checkbox label="自动修改纹路" checked={userConfig.autoLines} onChange={() => userConfig.autoLines = !userConfig.autoLines} />
</div>
<div>
<Checkbox
label="封边检查"
checked={this.props.store.checkSealing}
onChange={() => this.props.store.checkSealing = !this.props.store.checkSealing}
/>
<ul className={Classes.LIST_UNSTYLED + " sealingList"}>
<li>
<span></span>
<span></span>
</li>
{
this.props.store.sealingArr.map(d =>
<li>
<input
type="text"
className={Classes.INPUT}
value={d[0]}
onChange={e => d[0] = e.target.value}
/>
<input
type="text"
className={Classes.INPUT}
value={d[1]}
onChange={e => d[1] = e.target.value}
style={{ background: `${parseFloat(d[1]) ? ColorMaterial.GetColor(parseFloat(d[1])).getStyle() : ""}` }}
/>
</li>
)
}
</ul>
</div>
</div>
<H5></H5>
<div className="flex-wrap kjl-config">
{
@ -114,9 +158,7 @@ export class DrawConfigPanel extends React.Component<IConfigProps, {}> {
)
}
</div>
<H5></H5>
<Checkbox label="显示纹路" checked={userConfig.showLines} onChange={() => userConfig.showLines = !userConfig.showLines} />
<Checkbox label="自动修改纹路" checked={userConfig.autoLines} onChange={() => userConfig.autoLines = !userConfig.autoLines} />
<H5></H5>
<Checkbox label="保持上次配置" checked={userConfig.keepConfig} onChange={() => userConfig.keepConfig = !userConfig.keepConfig} />
<Label className={Classes.INLINE}>

@ -89,8 +89,8 @@ export class SealingStore extends BoardEdgesEditor
for (let [b, cus] of this._brMap)
{
let data = this._dataMap.get(b);
b.BoardProcessOption.highSealed = data;
HandleRectBoardSealingData(b, data, cus.map(c => c.ApplyMatrix(b.OCSInv)));
b.BoardProcessOption.highSealed = data;
}
this._dataMap.clear();
}, "封边属性编辑");

@ -31,6 +31,7 @@ import { DownPanelStore } from "./DownPanelStore";
import { ColorMaterial } from "../../Common/ColorPalette";
import { BBSEditor } from "../Components/BBS/BBSEditor";
import { bbsEditorStore } from "./BBSEditorStore";
import { RenderType } from "../../GraphicsSystem/RenderType";
interface ISaveOption
@ -121,6 +122,10 @@ export class UserConfigStore extends Singleton
//更新打印材质
ColorMaterial.PrintLineMatrial.linewidth = userConfig.lineWidth;
ColorMaterial.GetPrintConceptualMaterial().polygonOffsetUnits = userConfig.lineWidth;
if (userConfig.checkSealing)
userConfig.RenderType = RenderType.Edge;
}
else
{

Loading…
Cancel
Save