功能:根据排版面改颜色

pull/1496/MERGE
ChenX 3 years ago
parent db1026bdbf
commit 25baa00f2f

@ -0,0 +1,33 @@
import { Intent } from "@blueprintjs/core";
import { app } from "../../ApplicationServices/Application";
import { EBoardKeyList } from "../../Common/BoardKeyList";
import { Board } from "../../DatabaseServices/Entity/Board";
import { Command } from "../../Editor/CommandMachine";
import { PromptStatus } from "../../Editor/PromptResult";
import { AppToaster } from "../../UI/Components/Toaster";
import { ComposingType } from "../../UI/Store/BoardInterface";
export class Command_ChangeBoardColorByPBFace implements Command
{
async exec()
{
AppToaster.show({
message: "根据板件的排版面改颜色,红色=正面,反面=黄色,可翻转=绿色",
timeout: 5000,
intent: Intent.SUCCESS,
}, "ChangeBoardColorByPBFace");
let ssRes = await app.Editor.GetSelection({ Filter: { filterTypes: [Board] }, UseSelect: true });
if (ssRes.Status !== PromptStatus.OK) return;
let ents = ssRes.SelectSet.SelectEntityList as Board[];
for (let br of ents)
{
if (br.BoardProcessOption[EBoardKeyList.ComposingFace] === ComposingType.Positive)
br.ColorIndex = 1;
else if (br.BoardProcessOption[EBoardKeyList.ComposingFace] === ComposingType.Reverse)
br.ColorIndex = 2;
else
br.ColorIndex = 3;
}
}
}

@ -181,7 +181,8 @@ export enum CommandNames
Text2Curve = "TEXT2CURVE",
R2b = "RECT2BOARD",
RecyleBin = "RECYCLEBIN",
ChangeColorByMaterial = "CHANGECOLORBYMATERIAL",
ChangeColorByMaterial = "CHANGECOLORBYMATERIAL",//根据板材改颜色
ChangeBoardColorByPBFace = "CHANGEBOARDCOLORBYPBFACE",//根据排版面改颜色
RestoreColor = "RESTORECOLOR",
SelectAll = "SELECTALL",
CheckHoles = "CHECKHOLES",

@ -1,15 +1,10 @@
import { Box3, BufferGeometry, Line as TLine, Line3, Matrix3, Matrix4, Object3D, Shape, Vector3 } from 'three';
import { Line2 } from 'three/examples/jsm/lines/Line2';
import { LineGeometry } from 'three/examples/jsm/lines/LineGeometry';
import { ColorMaterial } from '../../Common/ColorPalette';
import { Box3, Line3, Matrix3, Matrix4, Shape, Vector3 } from 'three';
import { reviseMirrorMatrix } from '../../Common/Matrix4Utils';
import { Status } from '../../Common/Status';
import { ObjectSnapMode } from '../../Editor/ObjectSnapMode';
import { BufferGeometryUtils } from '../../Geometry/BufferGeometryUtils';
import { AsVector2, equaln, equalv3, isParallelTo, MoveMatrix } from '../../Geometry/GeUtils';
import { PlaneExt } from '../../Geometry/Plane';
import { IntersectEllipseAndLine, IntersectLineAndArc, IntersectLineAndCircle, IntersectLineAndLine, IntersectOption, IntersectPolylineAndCurve, reverseIntersectOption } from '../../GraphicsSystem/IntersectWith';
import { RenderType } from '../../GraphicsSystem/RenderType';
import { Factory } from '../CADFactory';
import { CADFiler } from '../CADFiler';
import { SwapParam } from './../../Common/CurveUtils';

@ -13,6 +13,7 @@ import { DeleteRelevance } from "../Add-on/BoardCutting/DeleteRelevance";
import { LinearCutting, RectLinearCutting } from "../Add-on/BoardCutting/LinearCutting";
import { NonAssociativeCutting } from "../Add-on/BoardCutting/NonAssociativeCutting";
import { ReferenceCutting } from "../Add-on/BoardCutting/ReferenceCutting";
import { Command_ChangeBoardColorByPBFace } from "../Add-on/BoardEditor/ChangeBoardColorByPBFace";
import { Command_ClearBoard2DModeling } from "../Add-on/BoardEditor/ClearBoard2DModeling";
import { SetBoardLines } from "../Add-on/BoardEditor/SetBoardLines";
import { UpdateBoardInfos } from "../Add-on/BoardEditor/UpdateBoardInfos";
@ -606,6 +607,7 @@ export function registerCommand()
commandMachine.RegisterCommand(CommandNames.RecyleBin, new ShowRecycleBin());
commandMachine.RegisterCommand(CommandNames.ChangeColorByMaterial, new ChangeColorByMaterial());
commandMachine.RegisterCommand(CommandNames.ChangeBoardColorByPBFace, new Command_ChangeBoardColorByPBFace());
commandMachine.RegisterCommand(CommandNames.SelectAll, new SelectAll());

@ -663,6 +663,15 @@ export const CommandList: ICommand[] = [
chName: "根据板材修改颜色",
chDes: "根据板材修改颜色",
},
{
typeId: "bjbj",
link: "#",
defaultCustom: CommandNames.ChangeBoardColorByPBFace,
command: CommandNames.ChangeBoardColorByPBFace,
type: "板件编辑",
chName: "根据排版面改颜色",
chDes: "根据排版面改颜色",
},
{
icon: IconEnum.RestoreColor,
typeId: "bjbj",

Loading…
Cancel
Save