!2181 新增:输出日志分类及交互,命令搜索列表颜色区分

pull/2225/MERGE
林伟强 1 year ago committed by ChenX
parent ea5cb6f080
commit 65310883cc

@ -1,6 +1,6 @@
import { Intent } from "@blueprintjs/core";
import { app } from "../ApplicationServices/Application";
import { Log } from "../Common/Log";
import { Log, LogType } from "../Common/Log";
import { Board } from "../DatabaseServices/Entity/Board";
import { RemoveTemplate } from "../DatabaseServices/Template/TempateUtils";
import { TemplateRecord } from "../DatabaseServices/Template/TemplateRecord";
@ -41,7 +41,7 @@ export class ActicityLayerBoard implements Command
let rules = store.rules;
if (rules.length === 0)
{
Log("错误:层板钉数量为空");
Log("错误:层板钉数量为空", LogType.Error);
}
let brs = brRes.SelectSet.SelectEntityList as Board[];

@ -1,9 +1,10 @@
import { Command } from "../Editor/CommandMachine";
import { app } from "../ApplicationServices/Application";
import { PromptStatus, PromptPointResult } from "../Editor/PromptResult";
import { LogType } from "../Common/Log";
import { Board } from "../DatabaseServices/Entity/Board";
import { Polyline } from "../DatabaseServices/Entity/Polyline";
import { equalv3, AsVector2 } from "../Geometry/GeUtils";
import { Command } from "../Editor/CommandMachine";
import { PromptPointResult, PromptStatus } from "../Editor/PromptResult";
import { AsVector2, equalv3 } from "../Geometry/GeUtils";
abstract class PtOnBoard implements Command
{
@ -58,12 +59,12 @@ export class AddPtOnBoard extends PtOnBoard
let index = brContour.GetParamAtPoint(npt);
if (isNaN(index))
{
app.Editor.Prompt('加点出错了');
app.Editor.Prompt('加点出错了', LogType.Error);
return undefined;
}
if (index % 1 === 0)
{
app.Editor.Prompt('检测加点位置在点的位置.加点失败.');
app.Editor.Prompt('检测加点位置在点的位置.加点失败.', LogType.Error);
return undefined;
}
newPt.applyMatrix4(brContour.OCSInv);
@ -90,19 +91,19 @@ export class DeletePtOnBoard extends PtOnBoard
}
if (!pindex)
{
app.Editor.Prompt("该位置没有点,无法删除");
app.Editor.Prompt("该位置没有点,无法删除", LogType.Error);
return undefined;
}
newPt.applyMatrix4(br.OCSInv).setZ(0);
let index = brContour.GetParamAtPoint(newPt);
if (isNaN(index))
{
app.Editor.Prompt('删点出错了');
app.Editor.Prompt('删点出错了', LogType.Error);
return undefined;
}
if (index % 1 === 0.5)
{
app.Editor.Prompt('中点无法删除');
app.Editor.Prompt('中点无法删除', LogType.Error);
return undefined;
}
brContour.RemoveVertexAt(index);

@ -4,6 +4,7 @@ import { app } from '../ApplicationServices/Application';
import { CheckObjectType, CheckoutValid } from '../Common/CheckoutVaildValue';
import { DataAdapter } from '../Common/DataAdapter';
import { Draw } from '../Common/Draw';
import { LogType } from '../Common/Log';
import { Singleton } from '../Common/Singleton';
import { FixedNotZero } from '../Common/Utils';
import { Hole } from '../DatabaseServices/3DSolid/Hole';
@ -207,7 +208,7 @@ export class Command_Array implements Command
fillAngle = Math.round(ptRes6.Distance);
if (fillAngle === 0 || betweenAngle === 0)
{
app.Editor.Prompt("错误:填充角度或者项目间角度为0!");
app.Editor.Prompt("错误:填充角度或者项目间角度为0!", LogType.Error);
}
else if (option.method === CirArrMethod.itemsAndAngle)
{

@ -1,5 +1,6 @@
import { app } from "../ApplicationServices/Application";
import { EBoardKeyList } from "../Common/BoardKeyList";
import { LogType } from "../Common/Log";
import { Board } from "../DatabaseServices/Entity/Board";
import { Command } from "../Editor/CommandMachine";
import { PromptStatus } from "../Editor/PromptResult";
@ -55,7 +56,7 @@ export class AutoHoleFaceSetting implements Command
{
if (ret.Distance <= 0 || isNaN(ret.Distance))
{
app.Editor.Prompt("请输入为正数的高度!");
app.Editor.Prompt("请输入为正数的高度!", LogType.Warning);
}
this.store.config.option.hight = Math.abs(ret.Distance);
userConfigStore.SaveConfig(BoardModalType.AutoHoleFaceSetting, this.store, { toaster: false });

@ -1,8 +1,9 @@
import { app } from "../../ApplicationServices/Application";
import { CommandNames } from "../../Common/CommandNames";
import { LogType } from "../../Common/Log";
import { Board } from "../../DatabaseServices/Entity/Board";
import { userConfig } from "../../Editor/UserConfig";
import { CuttingBoardByBoard } from "./CuttingUtils2";
import { CommandNames } from "../../Common/CommandNames";
export class AutoCuttingReactor
{
@ -20,7 +21,7 @@ export class AutoCuttingReactor
if (cmdName !== "插入模块" && cmdName !== "购买模块并插入" && cmdName !== CommandNames.Drawer)
if (brs.length > 10)
{
app.Editor.Prompt("复制的板件超过10个,取消触发切割反应器!");
app.Editor.Prompt("复制的板件超过10个,取消触发切割反应器!", LogType.Error, brs);
return;
}

@ -1,6 +1,6 @@
import { Box3 } from "three";
import { app } from "../../ApplicationServices/Application";
import { Log } from "../../Common/Log";
import { InteractionLog } from "../../Common/Log";
import { ExtrudeHole } from "../../DatabaseServices/3DSolid/ExtrudeHole";
import { Board } from "../../DatabaseServices/Entity/Board";
import { ExtrudeSolid } from "../../DatabaseServices/Entity/Extrude";
@ -60,7 +60,7 @@ export function CuttingBoardByBoard(meats: Board[], knifs: Board[], isRelevance
}
catch (error)
{
Log("自动非关联切割失败!");
InteractionLog([{ msg: "自动非关联" }, { msg: `被切割的${br.Name}`, entity: [br] }, { msg: "与" }, { msg: "切割的knifs", entity: knifs }, { msg: "切割失败,请检查" }]);
}
}
@ -134,7 +134,7 @@ export async function CuttingBoardByHardware(meats: Board[], hardwares: Hardware
}
catch (error)
{
Log("自动关联切割失败!");
InteractionLog([{ msg: "自动关联" }, { msg: `被切割的${meats[i].Name}`, entity: [meats[i]] }, { msg: "与" }, { msg: "切割的hardwareEnts", entity: hardwareEnts }, { msg: "切割失败,请检查" }]);
}
// down.EndProgress();

@ -1,17 +1,17 @@
import { observable } from "mobx";
import { app } from "../../ApplicationServices/Application";
import { Sleep } from "../../Common/Sleep";
import { safeEval } from "../../Common/eval";
import { ExtrudeHole } from "../../DatabaseServices/3DSolid/ExtrudeHole";
import { Board } from "../../DatabaseServices/Entity/Board";
import { Command } from "../../Editor/CommandMachine";
import { PromptStatus, PromptSsgetResult } from "../../Editor/PromptResult";
import { HardwareCompositeEntity } from "../../DatabaseServices/Hardware/HardwareCompositeEntity";
import { ExtrudeSolid } from "../../DatabaseServices/Entity/Extrude";
import { ExtrudeHole } from "../../DatabaseServices/3DSolid/ExtrudeHole";
import { CuttingBoardByBoard, CuttingBoardByHardware } from "./CuttingUtils2";
import { Sleep } from "../../Common/Sleep";
import { observable } from "mobx";
import { HardwareCompositeEntity } from "../../DatabaseServices/Hardware/HardwareCompositeEntity";
import { Command } from "../../Editor/CommandMachine";
import { PromptSsgetResult, PromptStatus } from "../../Editor/PromptResult";
import { ModalState } from "../../UI/Components/Modal/ModalInterface";
import { IGrooveOption } from "../../UI/Store/BoardInterface";
import CuttingPropsModal from "./CuttingPropsModal";
import { ModalState } from "../../UI/Components/Modal/ModalInterface";
import { safeEval } from "../../Common/eval";
import { CuttingBoardByBoard, CuttingBoardByHardware } from "./CuttingUtils2";
const Cutting_Option: IGrooveOption = observable({

@ -1,4 +1,5 @@
import { app } from "../../ApplicationServices/Application";
import { InteractionLog, LogType } from "../../Common/Log";
import { Board } from "../../DatabaseServices/Entity/Board";
import { Line } from "../../DatabaseServices/Entity/Line";
import { Polyline } from "../../DatabaseServices/Entity/Polyline";
@ -47,7 +48,7 @@ export class ReferenceCutting implements Command
brs.push(ent);
}
}
app.Editor.Prompt(`选择了被切割的板件: 总计${brs.length}`);
app.Editor.Prompt(`选择了被切割的板件: 总计${brs.length}`, LogType.Info);
//偏移量
let offset: number;
@ -79,6 +80,7 @@ export class ReferenceCutting implements Command
else
return;
const failList = new Set<Board>();
let failCount = 0;
for (let [i, br] of brs.entries())
{
@ -89,7 +91,8 @@ export class ReferenceCutting implements Command
if (!equaln(brNorm.dot(brKnifNorm), 0))//垂直测试
{
failCount++;
app.Editor.Prompt('板件不垂直,无法切割!');
failList.add(br);
InteractionLog([{ msg: `板件${br.Name}`, entity: [br] }, { msg: "与" }, { msg: `板件${brKnife.Name}`, entity: [brKnife] }, { msg: "不垂直,无法切割!" }], LogType.Error);
continue;
}
@ -111,7 +114,8 @@ export class ReferenceCutting implements Command
if (pts1.length < 2 && pts2.length < 2)
{
failCount++;
app.Editor.Prompt("板件与板件没有交集.");
failList.add(br);
InteractionLog([{ msg: `板件${br.Name}`, entity: [br] }, { msg: "与" }, { msg: `板件${brKnife.Name}`, entity: [brKnife] }, { msg: "没有交集" }], LogType.Error);
continue;
}
@ -146,7 +150,8 @@ export class ReferenceCutting implements Command
if (contours.length === 0)
{
//预期之外.
app.Editor.Prompt(`切割中断:第${i}个切割失败了!`);
failList.add(br);
app.Editor.Prompt(`切割中断:第${i}个切割失败了!`, LogType.Error, [br]);
return;
}
@ -166,6 +171,6 @@ export class ReferenceCutting implements Command
br.HandleSpliteEntitys(spliteEntitys);
br.GrooveCheckAllAutoSplit();
}
app.Editor.Prompt(`切割成功: 有效${brs.length - failCount}个, 无效${failCount}`);
app.Editor.Prompt(`切割成功: 有效${brs.length - failCount}个, 无效${failCount}`, LogType.Info, Array.from(failList));
}
}

@ -1,4 +1,5 @@
import { app } from "../../ApplicationServices/Application";
import { LogType } from "../../Common/Log";
import { FixedNotZero } from "../../Common/Utils";
import { Board } from "../../DatabaseServices/Entity/Board";
import { Command } from "../../Editor/CommandMachine";
@ -48,7 +49,7 @@ export class SelectThinBehindBoard implements Command
{
if (ret.Distance <= 0 || isNaN(ret.Distance))
{
app.Editor.Prompt("请输入为正数的厚度!");
app.Editor.Prompt("请输入为正数的厚度!", LogType.Error);
return;
}
this.store.config.option.thickness = Math.abs(ret.Distance);

@ -1,6 +1,7 @@
import { Vector3 } from "three";
import { app } from "../ApplicationServices/Application";
import { Draw } from "../Common/Draw";
import { LogType } from "../Common/Log";
import { Circle } from "../DatabaseServices/Entity/Circle";
import { Curve } from "../DatabaseServices/Entity/Curve";
import { RoomWallBase } from "../DatabaseServices/Room/Entity/Wall/RoomWallBase";
@ -57,7 +58,7 @@ export class Command_Break implements Command
if (divRes.Distance === 0)
{
app.Editor.Prompt("距离不能为0!");
app.Editor.Prompt("距离不能为0!", LogType.Warning);
continue;
}
let lenDiv = cu.Length / divRes.Distance;
@ -72,7 +73,7 @@ export class Command_Break implements Command
if (divRes.Distance < 1)
{
app.Editor.Prompt("个数不能小于1!");
app.Editor.Prompt("个数不能小于1!", LogType.Error);
return;
}
let divCount = divRes.Distance;
@ -83,7 +84,7 @@ export class Command_Break implements Command
}
else
{
app.Editor.Prompt("未知输入!");
app.Editor.Prompt("未知输入!", LogType.Warning);
continue;
}

@ -1,5 +1,6 @@
import { Intent } from "@blueprintjs/core";
import { app } from "../ApplicationServices/Application";
import { LogType } from "../Common/Log";
import { ExtrudeHole } from "../DatabaseServices/3DSolid/ExtrudeHole";
import { Board } from "../DatabaseServices/Entity/Board";
import { ExtrudeSolid } from "../DatabaseServices/Entity/Extrude";
@ -46,9 +47,9 @@ export class CheckModeling implements Command
}
if (errGrooves.length > 0 || errHoles.length > 0)
app.Editor.Prompt(`检测到${errGrooves.length}个无法加工的造型和${errHoles.length}个无法加的自定义排钻!旋转视图可以隐藏板件查看造型位置!`);
app.Editor.Prompt(`检测到${errGrooves.length}个无法加工的造型和${errHoles.length}个无法加的自定义排钻!旋转视图可以隐藏板件查看造型位置!`, LogType.Warning, [...errHoles, ...errGrooves]);
else
app.Editor.Prompt(`未检测到无法加工的造型!`);
app.Editor.Prompt(`未检测到无法加工的造型!`, LogType.Info);
if (errGrooves.length > 0 || errHoles.length > 0)
{

@ -1,4 +1,5 @@
import { app } from "../ApplicationServices/Application";
import { LogType } from "../Common/Log";
import { Board } from "../DatabaseServices/Entity/Board";
import { Command } from "../Editor/CommandMachine";
import { PromptStatus } from "../Editor/PromptResult";
@ -9,7 +10,7 @@ export class Command_SetBRXAxis implements Command
{
async exec()
{
app.Editor.Prompt("命令:设置拉伸实体的X轴指向.");
app.Editor.Prompt("命令:设置拉伸实体的X轴指向.", LogType.Command);
let enRes = await app.Editor.GetEntity({ Filter: { filterTypes: [Board] } });
if (enRes.Status !== PromptStatus.OK) return;
let br = enRes.Entity as Board;

@ -1,6 +1,6 @@
import { Intent } from '@blueprintjs/core';
import { app } from '../ApplicationServices/Application';
import { Log } from '../Common/Log';
import { Log, LogType } from '../Common/Log';
import { DuplicateRecordCloning } from '../Common/Status';
import { CylinderHole, GangDrillType } from '../DatabaseServices/3DSolid/CylinderHole';
import { ExtrudeHole } from '../DatabaseServices/3DSolid/ExtrudeHole';
@ -53,7 +53,7 @@ export class Command_Copy implements Command
{
if (app.Viewer.CurrentViewport)
{
Log("视口模式禁止复制");
Log("视口模式禁止复制", LogType.Error);
return;
}

@ -1,5 +1,6 @@
import { Matrix4, Vector3 } from "three";
import { app } from "../ApplicationServices/Application";
import { LogType } from "../Common/Log";
import { Command } from "../Editor/CommandMachine";
import { PromptPointResult, PromptStatus } from "../Editor/PromptResult";
import { UCSPsotion } from "../Editor/UCSServices";
@ -66,7 +67,7 @@ export class CustomUcs implements Command
{
if (equalv3(xRes.Point, p1Res.Point))
{
app.Editor.Prompt("与第一个点重复!");
app.Editor.Prompt("与第一个点重复!", LogType.Error);
}
else
{
@ -93,7 +94,7 @@ export class CustomUcs implements Command
else if (yRes.Status === PromptStatus.OK)
{
if (equalv3(yRes.Point, p1Res.Point))
app.Editor.Prompt("与第一个点重复!");
app.Editor.Prompt("与第一个点重复!", LogType.Error);
else
{
yv = yRes.Point.sub(p1Res.Point).normalize();

@ -1,4 +1,5 @@
import { app } from '../ApplicationServices/Application';
import { LogType } from '../Common/Log';
import { Curve } from '../DatabaseServices/Entity/Curve';
import { Point } from '../DatabaseServices/Entity/Point';
import { RoomWallBase } from '../DatabaseServices/Room/Entity/Wall/RoomWallBase';
@ -51,7 +52,7 @@ export class CMD_Divide implements Command
let divCount = numRes.Distance;
if (divCount <= 1)
{
app.Editor.Prompt("等分个数必须大于1!");
app.Editor.Prompt("等分个数必须大于1!", LogType.Error);
return;
}
if (enRes.Entity instanceof Curve)
@ -75,7 +76,7 @@ export class CMD_Divide implements Command
let divLen = numRes.Distance;
if (divLen === 0)
{
app.Editor.Prompt("分段长度不能为0");
app.Editor.Prompt("分段长度不能为0", LogType.Error);
return;
}
if (enRes.Entity instanceof Curve)
@ -84,7 +85,7 @@ export class CMD_Divide implements Command
let len = cu.Length;
if (divLen > len)
{
app.Editor.Prompt("分段长度不能超过对象长度");
app.Editor.Prompt("分段长度不能超过对象长度", LogType.Error);
return;
}
let divCount = len / divLen;

@ -1,6 +1,6 @@
import { Vector3 } from "three";
import { Log, LogType } from "../../Common/Log";
import { safeEval } from "../../Common/eval";
import { Log } from "../../Common/Log";
import { Board } from "../../DatabaseServices/Entity/Board";
import { TemplateWineRackRecord } from "../../DatabaseServices/Template/ProgramTempate/TemplateWineRackRecord";
import { TemplateRecord } from "../../DatabaseServices/Template/TemplateRecord";
@ -30,7 +30,7 @@ export function BuildLayerBoards(opt: LayerBoardOption, space: ISpaceParse, groo
if (width <= 0)
{
Log("宽度无效,可能前缩过大,请修正");
Log("宽度无效,可能前缩过大,请修正", LogType.Error);
return [];
}
@ -41,7 +41,7 @@ export function BuildLayerBoards(opt: LayerBoardOption, space: ISpaceParse, groo
let len = size.x - leftShrink - rightShrink;
if (len <= 0)
{
Log("长度无效,可能左缩右缩过大,请修正");
Log("长度无效,可能左缩右缩过大,请修正", LogType.Error);
return [];
}
let board = Board.CreateBoard(len, width, thickness, BoardType.Layer);
@ -107,7 +107,7 @@ export function BuildVerticalBoards(opt: VerticalBoardOption, space: ISpaceParse
if (width <= 0)
{
Log("宽度无效,可能前缩过大,请修正");
Log("宽度无效,可能前缩过大,请修正", LogType.Error);
return [];
}

@ -2,10 +2,10 @@ import { toJS } from "mobx";
import { Box3 } from "three";
import { app } from "../../ApplicationServices/Application";
import { EBoardKeyList } from "../../Common/BoardKeyList";
import { safeEval } from "../../Common/eval";
import { Log } from "../../Common/Log";
import { Log, LogType } from "../../Common/Log";
import { DuplicateRecordCloning } from "../../Common/Status";
import { FixedNotZero } from "../../Common/Utils";
import { safeEval } from "../../Common/eval";
import { Board } from "../../DatabaseServices/Entity/Board";
import { HardwareCompositeEntity } from "../../DatabaseServices/Hardware/HardwareCompositeEntity";
import { HardwareTopline } from "../../DatabaseServices/Hardware/HardwareTopline";
@ -85,7 +85,7 @@ export class DrawDrawrer implements Command
if (tempIds.size === 0)
{
Log("未选择抽屉模板");
Log("未选择抽屉模板", LogType.Error);
return;
}
@ -121,7 +121,7 @@ export class DrawDrawrer implements Command
if (idTempMap.size === 0)
{
Log("选择抽屉模板无效");
Log("选择抽屉模板无效", LogType.Error);
return;
}
@ -479,7 +479,7 @@ export class DrawDrawrer implements Command
if (info.tempInfo.temp.id)
this.GetHandleTemp(info, idTempMap, opt, rowTemplate);
else
Log("没选择抽屉模板");
Log("没选择抽屉模板", LogType.Error);
return rowTemplate;
}

@ -1,7 +1,7 @@
import { Intersection, Vector3 } from 'three';
import { app } from '../../ApplicationServices/Application';
import { CommandNames } from '../../Common/CommandNames';
import { Log } from '../../Common/Log';
import { Log, LogType } from '../../Common/Log';
import { TransformVector } from '../../Common/Matrix4Utils';
import { GetEntity } from '../../Common/Utils';
import { Board } from '../../DatabaseServices/Entity/Board';
@ -233,7 +233,7 @@ export class DrawLeftRight implements Command
await selectSpace.Select();
if (!selectSpace.ParseOK)
{
Log("请选择有效板件");
Log("请选择有效板件", LogType.Error);
return;
}
let store = SideBoardStore.GetInstance() as SideBoardStore;

@ -1,15 +1,16 @@
import { Matrix4 } from "three";
import { app } from "../../ApplicationServices/Application";
import { LogType } from "../../Common/Log";
import { FixedNotZero } from "../../Common/Utils";
import { safeEval } from "../../Common/eval";
import { Board } from "../../DatabaseServices/Entity/Board";
import { ExtrudeSolid } from "../../DatabaseServices/Entity/Extrude";
import { Command } from "../../Editor/CommandMachine";
import { SpecialShapeBoardModal } from "../../UI/Components/Board/SpecialBoardModal";
import { ModalState } from "../../UI/Components/Modal/ModalInterface";
import { BoardType } from "../../UI/Store/BoardInterface";
import { SpecialShapeStore } from "../../UI/Store/BoardStore";
import { ExtrudeApplyContour, SelectExtrudeContours } from "./DrawSpecialShapeBoardTool";
import { Matrix4 } from "three";
import { safeEval } from "../../Common/eval";
import { BoardType } from "../../UI/Store/BoardInterface";
import { ModalState } from "../../UI/Components/Modal/ModalInterface";
export class DrawSpecialShapedBoard implements Command
{
@ -104,6 +105,6 @@ export class DrawSpecialShapedBoard implements Command
}
else
app.Editor.Prompt('选择对象无效');
app.Editor.Prompt('选择对象无效', LogType.Error);
}
}

@ -1,6 +1,6 @@
import { app } from "../../ApplicationServices/Application";
import { CommandNames } from "../../Common/CommandNames";
import { Log } from "../../Common/Log";
import { Log, LogType } from "../../Common/Log";
import { TemplateTopBottomBoard } from "../../DatabaseServices/Template/ProgramTempate/TemplateTopBottomBoard";
import { SetTemplatePositionAndSetParent } from "../../DatabaseServices/Template/TempateUtils";
import { Command } from "../../Editor/CommandMachine";
@ -36,7 +36,7 @@ export class DrawTopBottomBoard implements Command
});
if (!selectSpace.ParseOK)
{
Log("请选择有效板件");
Log("请选择有效板件", LogType.Error);
return;
}
if (!store.topBoardOption.isDraw && !store.bottomBoardOption.isDraw) return;

@ -1,5 +1,5 @@
import { app } from "../../ApplicationServices/Application";
import { Log } from "../../Common/Log";
import { Log, LogType } from "../../Common/Log";
import { Intent } from "../../Common/Toaster";
import { Board } from "../../DatabaseServices/Entity/Board";
import { Polyline } from "../../DatabaseServices/Entity/Polyline";
@ -60,7 +60,7 @@ export class FixIntersectSelfContour implements Command
}
else
{
Log("修正自交失败," + br.Name + " 板件可能仍存在自交,请手动修复");
Log("修正自交失败," + br.Name + " 板件可能仍存在自交,请手动修复", LogType.Error, [br]);
fixErrorBrs.push(br);
}
}

@ -2,7 +2,7 @@ import { Matrix4, Vector3 } from 'three';
import { app } from '../ApplicationServices/Application';
import { ComputerCurvesNormalOCS } from '../Common/CurveUtils';
import { Draw } from '../Common/Draw';
import { Log } from '../Common/Log';
import { Log, LogType } from '../Common/Log';
import { Arc } from '../DatabaseServices/Entity/Arc';
import { Circle } from '../DatabaseServices/Entity/Circle';
import { Entity } from '../DatabaseServices/Entity/Entity';
@ -156,7 +156,7 @@ export class DrawCircle implements Command
if (radRes.Status !== PromptStatus.OK) return;
if (radRes.Distance < minRadius)
Log("指定的半径不能小于最小值!");
Log("指定的半径不能小于最小值!", LogType.Error);
let radius = radRes.Distance;
@ -199,7 +199,7 @@ export class DrawCircle implements Command
}
else
{
Log("无法绘制指定半径的相切圆!");
Log("无法绘制指定半径的相切圆!", LogType.Error);
}
}
}
@ -252,7 +252,7 @@ export class DrawCircle implements Command
if (!p1 || !p2 || !p3)
{
Log("不能选择平行线");
Log("不能选择平行线", LogType.Error);
return;
}

@ -1,5 +1,6 @@
import { Matrix4, Vector3 } from "three";
import { app } from "../../ApplicationServices/Application";
import { LogType } from "../../Common/Log";
import { UpdateDraw } from "../../Common/Status";
import { LineAngularDimension } from "../../DatabaseServices/Dimension/2LineAngularDimension";
import { Arc } from "../../DatabaseServices/Entity/Arc";
@ -130,7 +131,7 @@ export class Command_Draw2LineAngularDim
let derv2 = l2.GetFistDeriv(0).normalize();
if (isParallelTo(derv1, derv2))
{
app.Editor.Prompt("两直线平行!");
app.Editor.Prompt("两直线平行!", LogType.Error, [l1, l2]);
return;
}
@ -150,7 +151,7 @@ export class Command_Draw2LineAngularDim
}
if (!ocs)
{
app.Editor.Prompt("绘制的标注实体和当前的UCS坐标系不一致,绘制失败.");
app.Editor.Prompt("绘制的标注实体和当前的UCS坐标系不一致,绘制失败.", LogType.Error);
return;
}
let dim = new LineAngularDimension();

@ -2,6 +2,7 @@ import { Box3, Vector3 } from "three";
import { app } from "../../ApplicationServices/Application";
import { arrayRemoveDuplicateBySort, arraySortByNumber } from "../../Common/ArrayExt";
import { Draw } from "../../Common/Draw";
import { LogType } from "../../Common/Log";
import { AlignedDimension } from "../../DatabaseServices/Dimension/AlignedDimension";
import { Board } from "../../DatabaseServices/Entity/Board";
import { Command } from "../../Editor/CommandMachine";
@ -48,11 +49,11 @@ export class Command_FastDimBrs implements Command
if (brs.length === 0)
{
app.Editor.Prompt(`可标注板件数: 0, 已退出`);
app.Editor.Prompt(`可标注板件数: 0, 已退出`, LogType.Error);
return;
}
app.Editor.Prompt(`可标注板件数: ${brs.length}`);
app.Editor.Prompt(`可标注板件数: ${brs.length}`, LogType.Info, brs);
let tool = new FastDimTool(brs);
tool.enableDimAll = dimAll;

@ -1,5 +1,5 @@
import { app } from "../../ApplicationServices/Application";
import { Log } from "../../Common/Log";
import { Log, LogType } from "../../Common/Log";
import { Board } from "../../DatabaseServices/Entity/Board";
import { Command } from "../../Editor/CommandMachine";
import { PromptStatus } from "../../Editor/PromptResult";
@ -36,6 +36,6 @@ export class CheckHasHoleBoard implements Command
}
app.Viewer.OutlinePass.selectedObjects = noHolesBoard.map(e => e.DrawObject);
Log(`${noHolesBoard.length}个板件没孔`);
Log(`${noHolesBoard.length}个板件没孔`, LogType.Info, noHolesBoard);
}
}

@ -7,7 +7,7 @@ import { appCache } from "../../Common/AppCache";
import { arrayLast, arrayRemoveIf } from "../../Common/ArrayExt";
import { EBoardKeyList } from "../../Common/BoardKeyList";
import { safeEval } from "../../Common/eval";
import { Log } from "../../Common/Log";
import { InteractionLog, Log, LogType } from "../../Common/Log";
import { Singleton } from "../../Common/Singleton";
import { Sleep } from "../../Common/Sleep";
import { UpdateDraw } from "../../Common/Status";
@ -468,19 +468,19 @@ export class DrawDrillingTool extends Singleton
{
if (dist > this.m_Face.Length - ljgRad || dist < ljgRad)
{
Log(`移动距离${dist.toFixed(2)},碰撞面宽度${this.m_Face.Length.toFixed(2)},排钻将绘制在板外,跳过绘制`);
Log(`移动距离${dist.toFixed(2)},碰撞面宽度${this.m_Face.Length.toFixed(2)},排钻将绘制在板外,跳过绘制`, LogType.Warning);
continue;
}
if (this.CheckModelingCollision(localBox3, intBox3, dist))
{
this._isDrillTouch = true;
Log(`${this.m_Face.LocalBoard.Name}-${this.m_Face.InterBoard.Name}有排钻与造型碰撞,跳过绘制`);
InteractionLog([{ msg: `板件${this.m_Face.LocalBoard.Name}`, entity: [this.m_Face.LocalBoard] }, { msg: "-" }, { msg: `板件${this.m_Face.InterBoard.Name}`, entity: [this.m_Face.InterBoard] }, { msg: "有排钻与造型碰撞,跳过绘制" }], LogType.Warning);
continue;
}
if (!this.CheckDrillInBoard(dist))
{
Log(`${this.m_Face.LocalBoard.Name}-${this.m_Face.InterBoard.Name}有排钻在板件外,跳过绘制`);
InteractionLog([{ msg: `板件${this.m_Face.LocalBoard.Name}`, entity: [this.m_Face.LocalBoard] }, { msg: "-" }, { msg: `板件${this.m_Face.InterBoard.Name}`, entity: [this.m_Face.InterBoard] }, { msg: "有排钻在板件外,跳过绘制" }], LogType.Warning);
continue;
}
@ -536,13 +536,13 @@ export class DrawDrillingTool extends Singleton
{
if (dist >= this.m_Face.Length - ljgRad || dist <= ljgRad)
{
Log(`移动距离${dist.toFixed(2)},碰撞面宽度${this.m_Face.Length.toFixed(2)},木销将绘制在板外,跳过绘制`);
Log(`移动距离${dist.toFixed(2)},碰撞面宽度${this.m_Face.Length.toFixed(2)},木销将绘制在板外,跳过绘制`, LogType.Warning);
continue;
}
if (!this.CheckWoodInBoard(dist))
{
Log(`${this.m_Face.LocalBoard.Name}-${this.m_Face.InterBoard.Name}有木销在板件外,跳过绘制`);
InteractionLog([{ msg: `板件${this.m_Face.LocalBoard.Name}`, entity: [this.m_Face.LocalBoard] }, { msg: "-" }, { msg: `板件${this.m_Face.InterBoard.Name}`, entity: [this.m_Face.InterBoard] }, { msg: "有木销在板件外,跳过绘制" }], LogType.Warning);
continue;
}
//新的排钻列表
@ -567,7 +567,7 @@ export class DrawDrillingTool extends Singleton
else
{
this._isDrillTouch = true;
Log(`${this.m_Face.LocalBoard.Name}-${this.m_Face.InterBoard.Name}有木梢与造型碰撞,跳过绘制`);
InteractionLog([{ msg: `板件${this.m_Face.LocalBoard.Name}`, entity: [this.m_Face.LocalBoard] }, { msg: "-" }, { msg: `板件${this.m_Face.InterBoard.Name}`, entity: [this.m_Face.InterBoard] }, { msg: "有木梢与造型碰撞,跳过绘制" }], LogType.Warning);
}
}
}
@ -1007,7 +1007,7 @@ export class DrawDrillingTool extends Singleton
let suitableOptions = this.GetRuleByFace(f);
if (suitableOptions.length === 0)
{
app.Editor.Prompt("长度" + f.Length + "没有合适的规则,或者当前配置不存在" + f.DrillType + "类型排钻");
app.Editor.Prompt("长度" + f.Length + "没有合适的规则,或者当前配置不存在" + f.DrillType + "类型排钻", LogType.Error);
return;
}
for (let suitableOption of suitableOptions)
@ -1033,7 +1033,7 @@ export class DrawDrillingTool extends Singleton
{
if (totalDist >= f.Length)
{
Log("起始距离超过碰撞范围");
Log("起始距离超过碰撞范围", LogType.Warning);
continue;
}
}
@ -1065,7 +1065,7 @@ export class DrawDrillingTool extends Singleton
}
if (this.drillEnts.length === 0 && this.woodPins.length === 0)
{
Log("没排钻并且没木销");
Log("没排钻并且没木销", LogType.Error);
return;
}
//获得排钻移动距离表

@ -1,5 +1,6 @@
import { Geometry, Line, Mesh, Points, PointsMaterial } from 'three';
import { app } from '../ApplicationServices/Application';
import { LogType } from '../Common/Log';
import { Command } from '../Editor/CommandMachine';
/**
@ -11,7 +12,7 @@ export class DrawGripStretch implements Command
{
if (app.Viewer.OutlinePass.selectedObjects.length === 0)
{
app.Editor.Prompt("未选择对象:");
app.Editor.Prompt("未选择对象:", LogType.Error);
return;
}

@ -1,7 +1,7 @@
import { Matrix4 } from 'three';
import { app } from '../ApplicationServices/Application';
import { ComputerCurvesNormalOCS } from '../Common/CurveUtils';
import { Log } from '../Common/Log';
import { Log, LogType } from '../Common/Log';
import { Curve } from '../DatabaseServices/Entity/Curve';
import { Region } from '../DatabaseServices/Entity/Region';
import { Spline } from '../DatabaseServices/Spline';
@ -15,7 +15,7 @@ export class DrawRegion implements Command
ocs: Matrix4;
async exec()
{
Log("尚未支持样条线变面域!");
Log("尚未支持样条线变面域!", LogType.Warning);
let ssRes = await app.Editor.GetSelection({
UseSelect: true, Filter: {
filterFunction: (o, e) =>

@ -1,5 +1,6 @@
import { Vector3 } from "three";
import { app } from "../ApplicationServices/Application";
import { LogType } from "../Common/Log";
import { RevolveSolid } from "../DatabaseServices/3DSolid/RevolveSolid";
import { Line } from "../DatabaseServices/Entity/Line";
import { Polyline } from "../DatabaseServices/Entity/Polyline";
@ -83,7 +84,7 @@ export class Command_DrawRevolve implements Command
let n = p1.sub(p0.Point);
if (equalv3(n, ZeroVec))
{
app.Editor.Prompt("重合!");
app.Editor.Prompt("重合!", LogType.Error);
return;
}

@ -1,6 +1,6 @@
import { app } from '../ApplicationServices/Application';
import { IsDev } from '../Common/Deving';
import { Log } from '../Common/Log';
import { Log, LogType } from '../Common/Log';
import { GetEntity } from '../Common/Utils';
import { RoomFlatBase } from '../DatabaseServices/Room/Entity/Flat/RoomFlatBase';
import { RoomRegion } from '../DatabaseServices/Room/Entity/Region/RoomRegion';
@ -13,7 +13,7 @@ export class Command_Erase implements Command
{
if (app.Viewer.CurrentViewport)
{
Log("布局视口空间不能删除实体");
Log("布局视口空间不能删除实体", LogType.Error);
return;
}

@ -1,11 +1,11 @@
import { app } from '../ApplicationServices/Application';
import { Log, LogType } from '../Common/Log';
import { Arc } from '../DatabaseServices/Entity/Arc';
import { Circle } from '../DatabaseServices/Entity/Circle';
import { Line } from '../DatabaseServices/Entity/Line';
import { Text } from '../DatabaseServices/Text/Text';
import { Command } from '../Editor/CommandMachine';
import { PromptStatus } from '../Editor/PromptResult';
import { Text } from '../DatabaseServices/Text/Text';
import { Log } from '../Common/Log';
export class Command_Explode implements Command
{
@ -13,7 +13,7 @@ export class Command_Explode implements Command
{
if (app.Viewer.CurrentViewport)
{
Log("视口模式下暂不支持");
Log("视口模式下暂不支持", LogType.Error);
return;
}
@ -26,7 +26,7 @@ export class Command_Explode implements Command
{
if (en instanceof Line || en instanceof Arc || en instanceof Circle || en instanceof Text)
{
app.Editor.Prompt('无法分解');
app.Editor.Prompt('无法分解', LogType.Warning);
continue;
}
let ens = en.Explode();

@ -1,5 +1,6 @@
import { Object3D, Vector3 } from "three";
import { app } from "../ApplicationServices/Application";
import { LogType } from "../Common/Log";
import { Entity } from "../DatabaseServices/Entity/Entity";
import { Command } from "../Editor/CommandMachine";
import { PromptStatus } from "../Editor/PromptResult";
@ -57,7 +58,7 @@ export class Command_ExplosionMap implements Command
if (this.moveObjs.length === 0)
{
app.Editor.Prompt("没有检测到板件,无法展示爆炸图");
app.Editor.Prompt("没有检测到板件,无法展示爆炸图", LogType.Error);
return;
}

@ -1,6 +1,7 @@
import pako from "pako";
import { app } from "../ApplicationServices/Application";
import { CURRENT_HOST } from "../Common/HostUrl";
import { LogType } from "../Common/Log";
import { RevolveSolid } from "../DatabaseServices/3DSolid/RevolveSolid";
import { SweepSolid } from "../DatabaseServices/3DSolid/SweepSolid";
import { Board } from "../DatabaseServices/Entity/Board";
@ -39,7 +40,7 @@ export class Command_ExportView implements Command
})
.catch(error =>
{
app.Editor.Prompt(error);
app.Editor.Prompt(error, LogType.Error);
});
}
}

@ -2,7 +2,7 @@ import { app } from "../../ApplicationServices/Application";
import { FileHistoryFilesUrl, FileHistoryUrl } from "../../Common/HostUrl";
import { inflateBase64 } from "../../Common/inflate";
import { KeyWord } from "../../Common/InputState";
import { Log } from "../../Common/Log";
import { Log, LogType } from "../../Common/Log";
import { StoreageKeys } from "../../Common/StoreageKeys";
import { CADFiler } from "../../DatabaseServices/CADFiler";
import { FileServer } from "../../DatabaseServices/FileServer";
@ -22,7 +22,7 @@ export class Command_OpenHistory implements Command
{
let fileServer = FileServer.GetInstance() as FileServer;
if (!fileServer.m_CurFileId)
Log("无法获得当前文件的id");
Log("无法获得当前文件的id", LogType.Warning);
let fileId = fileServer.m_CurFileId;
let userName = localStorage.getItem(StoreageKeys.UserName);

@ -1,10 +1,11 @@
import hotkeys from 'hotkeys-js-ext';
import { end } from 'xaop';
import { app } from '../ApplicationServices/Application';
import { safeEval } from '../Common/eval';
import { KeyWord } from '../Common/InputState';
import { KeyCode } from '../Common/KeyEnum';
import { LogType } from '../Common/Log';
import { FixedNotZero } from '../Common/Utils';
import { safeEval } from '../Common/eval';
import { Board } from '../DatabaseServices/Entity/Board';
import { Curve } from '../DatabaseServices/Entity/Curve';
import { Ellipse } from '../DatabaseServices/Entity/Ellipse';
@ -176,7 +177,7 @@ export class CommandFillet implements Command
UpdateFilletRadius(newRadius: number)
{
if (newRadius < 0 || isNaN(newRadius))
app.Editor.Prompt("半径不能为负!");
app.Editor.Prompt("半径不能为负!", LogType.Warning);
this._FilletRadius = Math.abs(newRadius);
window.localStorage.setItem(RADKEY, this._FilletRadius.toString());
@ -208,7 +209,7 @@ export class CommandFillet implements Command
br.ContourCurve = fres;
}
else
app.Editor.Prompt(fres);
app.Editor.Prompt(fres, LogType.Error);
}
async SelectCurve(keyword: KeyWord[]): Promise<PromptEntityResult>

@ -1,10 +1,11 @@
import { Vector2, Vector3 } from "three";
import { app } from "../../ApplicationServices/Application";
import { LogType } from "../../Common/Log";
import { Board } from "../../DatabaseServices/Entity/Board";
import { CommandWrap } from "../../Editor/CommandMachine";
import { CommandState } from "../../Editor/CommandState";
import { GestureDir, GestureDirEqual } from "../../Editor/Gesture";
import { MoveMatrix, AsVector3 } from "../../Geometry/GeUtils";
import { AsVector3, MoveMatrix } from "../../Geometry/GeUtils";
import { ClampSpaceParseRay } from "../../Geometry/SpaceParse/ClampSpaceParseRay";
import { PointSelectBoards } from "../../Geometry/SpaceParse/PointSelectBoards";
import { BoardType } from "../../UI/Store/BoardInterface";
@ -23,7 +24,7 @@ export async function Gesture_DrawLayerBoard(dirs: GestureDir[], path: Vector2[]
if (ptSelect.SelectBoards.length === 0)
{
app.Editor.Prompt("请选择有效的板件,或者周围没有效板件");
app.Editor.Prompt("请选择有效的板件,或者周围没有效板件", LogType.Error);
return;
}

@ -1,4 +1,5 @@
import { app } from "../ApplicationServices/Application";
import { LogType } from "../Common/Log";
import { GetEntity } from "../Common/Utils";
import { CylinderHole } from "../DatabaseServices/3DSolid/CylinderHole";
import { Board } from "../DatabaseServices/Entity/Board";
@ -36,7 +37,7 @@ export class Command_HideSelected implements Command
for (let e of ents)
e.Visible = false;
else
app.Editor.Prompt("没有选中实体,隐藏失败!");
app.Editor.Prompt("没有选中实体,隐藏失败!", LogType.Error);
}
}
}
@ -89,7 +90,7 @@ export class Command_HideUnselected implements Command
return !o.IsErase && !set.has(o) && !(o instanceof Light);
});
if (hideEnts.length === 0)
app.Editor.Prompt("没有未选中的实体,隐藏失败!");
app.Editor.Prompt("没有未选中的实体,隐藏失败!", LogType.Error);
else
hideEnts.forEach(e => e.Visible = false);
}

@ -1,12 +1,12 @@
import { Vector2, Vector3 } from "three";
import { arrayLast } from "../../Common/ArrayExt";
import { EBoardKeyList } from "../../Common/BoardKeyList";
import { Log } from "../../Common/Log";
import { Log, LogType } from "../../Common/Log";
import { Singleton } from "../../Common/Singleton";
import { Arc } from "../../DatabaseServices/Entity/Arc";
import { Board } from "../../DatabaseServices/Entity/Board";
import { Polyline } from "../../DatabaseServices/Entity/Polyline";
import { AsVector2, equalv3, isParallelTo, XAxis, YAxis } from "../../Geometry/GeUtils";
import { AsVector2, XAxis, YAxis, equalv3, isParallelTo } from "../../Geometry/GeUtils";
import { ISpaceParse } from "../../Geometry/SpaceParse/ISpaceParse";
import { BoardType, DrillType, IHighSealedItem } from "../../UI/Store/BoardInterface";
import { ELatticeArrayType, ILatticeOption } from "../../UI/Store/LatticeInterface";
@ -119,12 +119,12 @@ export class DrawLatticeDrawerTool extends Singleton
config.arcLen = addH;
}
else
Log("挡板高度大于等于格子抽板高度,无法自动识别弧度!");
Log("挡板高度大于等于格子抽板高度,无法自动识别弧度!", LogType.Error);
}
if (this.haveTopBr)
{
Log("顶板不为空,绘制格子抽可能错误!");
Log("顶板不为空,绘制格子抽可能错误!", LogType.Error);
}
}
private ChangeLeftRightBr(refBr: Board)
@ -256,7 +256,7 @@ export class DrawLatticeDrawerTool extends Singleton
{
if (config.arcLen > size.z || config.arcLen > size.y)
{
Log("圆弧角过大");
Log("圆弧角过大", LogType.Error);
return false;
}
let cu = br.ContourCurve as Polyline;

@ -1,6 +1,6 @@
import { Matrix4, Vector3 } from 'three';
import { app } from '../ApplicationServices/Application';
import { Log } from '../Common/Log';
import { Log, LogType } from '../Common/Log';
import { CylinderHole, GangDrillType } from '../DatabaseServices/3DSolid/CylinderHole';
import { ExtrudeHole } from '../DatabaseServices/3DSolid/ExtrudeHole';
import { Hole } from '../DatabaseServices/3DSolid/Hole';
@ -16,7 +16,7 @@ export class Command_Move implements Command
{
if (app.Viewer.CurrentViewport)
{
Log("暂不支持视口内移动实体");
Log("暂不支持视口内移动实体", LogType.Error);
return;
}

@ -1,7 +1,7 @@
import { Vector3 } from 'three';
import { app } from '../ApplicationServices/Application';
import { GetPointAtCurveDir } from '../Common/CurveUtils';
import { Log } from '../Common/Log';
import { Log, LogType } from '../Common/Log';
import { Curve } from '../DatabaseServices/Entity/Curve';
import { Line } from '../DatabaseServices/Entity/Line';
import { Polyline } from '../DatabaseServices/Entity/Polyline';
@ -84,7 +84,7 @@ export class Command_Offset implements Command
let nor = new Vector3().setFromMatrixColumn(oldUCS, 2);
if (isParallelTo(nor, cu.Normal))
{
Log("无法在当前视图方向偏移该对象");
Log("无法在当前视图方向偏移该对象", LogType.Error);
continue;
}
}
@ -229,7 +229,6 @@ export class Command_Offset implements Command
if (dir !== Math.sign(offsetDist))
offsetDist = -offsetDist;
this.DrawOffset(cu, offsetDist);
if (isMulti)
continue;
else

@ -2,7 +2,7 @@ import { Intent } from "@blueprintjs/core";
import { Box3, MathUtils, Matrix4, Object3D, Vector3 } from "three";
import { app } from "../../ApplicationServices/Application";
import { arrayRemoveIf } from "../../Common/ArrayExt";
import { Log } from "../../Common/Log";
import { Log, LogType } from "../../Common/Log";
import { Hole } from "../../DatabaseServices/3DSolid/Hole";
import { Dimension } from "../../DatabaseServices/Dimension/Dimension";
import { Board } from "../../DatabaseServices/Entity/Board";
@ -50,7 +50,7 @@ export class Command_OpenCabinet implements Command
{
if (this._MoveDrawerObjs.length > 0 || this._MoveDoorObjs.length > 0) //判断之前是否开过门板、抽屉
{
Log("关闭门板、抽屉");
Log("关闭门板、抽屉", LogType.Warning);
canOpen = true;
}
else

@ -3,6 +3,7 @@ import { Color, Line, Object3D, Scene, Vector3 } from "three";
import { app } from "../ApplicationServices/Application";
import { HostApplicationServices } from "../ApplicationServices/HostApplicationServices";
import { ColorMaterial } from "../Common/ColorPalette";
import { LogType } from "../Common/Log";
import { Sleep } from "../Common/Sleep";
import { AAType } from "../Common/SystemEnum";
import { Hole } from "../DatabaseServices/3DSolid/Hole";
@ -17,7 +18,7 @@ import { Text } from "../DatabaseServices/Text/Text";
import { ViewportEntity } from "../DatabaseServices/ViewportEntity";
import { Command } from "../Editor/CommandMachine";
import { PromptStatus } from "../Editor/PromptResult";
import { GetBox, isParallelTo, XAxis, YAxis, ZAxis } from "../Geometry/GeUtils";
import { GetBox, XAxis, YAxis, ZAxis, isParallelTo } from "../Geometry/GeUtils";
import { RenderType } from "../GraphicsSystem/RenderType";
import { HotCMD } from "../Hot/HotCommand";
import { AppToaster } from "../UI/Components/Toaster";
@ -785,7 +786,7 @@ async function PrintImage2(ens: Entity[])
var win = window.open();
if (!win)
{
app.Editor.Prompt("无法弹出新的窗口,请允许新窗口弹出!(地址栏右侧)");
app.Editor.Prompt("无法弹出新的窗口,请允许新窗口弹出!(地址栏右侧)", LogType.Error);
return;
}
win.document.body.style.border = "10px double #000";
@ -859,7 +860,7 @@ export function GetPrintWindow()
const win = window.open('', '', 'status=1,menubar=yes,toolbar=yes');
if (!win)
{
app.Editor.Prompt("无法弹出新的窗口,请允许新窗口弹出!(地址栏右侧)");
app.Editor.Prompt("无法弹出新的窗口,请允许新窗口弹出!(地址栏右侧)", LogType.Error);
return;
}

@ -1,7 +1,7 @@
import { Box3, Vector3 } from "three";
import { app } from "../../ApplicationServices/Application";
import { Draw } from "../../Common/Draw";
import { Log } from "../../Common/Log";
import { Log, LogType } from "../../Common/Log";
import { RoomWallBase } from "../../DatabaseServices/Room/Entity/Wall/RoomWallBase";
import { RoomWallLine } from "../../DatabaseServices/Room/Entity/Wall/RoomWallLine";
import { WallSnapMode } from "../../DatabaseServices/Room/Entity/Wall/WallSnapMode";
@ -141,7 +141,7 @@ export class Command_DrawRectWall implements Command
wall.Thickness = this.WallThickness;
}
else
Log("墙体厚度必须大于1!");
Log("墙体厚度必须大于1!", LogType.Error);
}
}
}

@ -5,7 +5,7 @@ import { arrayLast } from "../../Common/ArrayExt";
import { getCirAngleByChordAndTangent } from "../../Common/CurveUtils";
import { Draw } from "../../Common/Draw";
import { KeyWord } from "../../Common/InputState";
import { Log } from "../../Common/Log";
import { Log, LogType } from "../../Common/Log";
import { Arc } from "../../DatabaseServices/Entity/Arc";
import { Curve } from "../../DatabaseServices/Entity/Curve";
import { Line } from "../../DatabaseServices/Entity/Line";
@ -21,7 +21,7 @@ import { Command } from "../../Editor/CommandMachine";
import { JigUtils } from "../../Editor/JigUtils";
import { GetPointPrompt } from "../../Editor/PromptOptions";
import { PromptStatus } from "../../Editor/PromptResult";
import { AsVector2, AsVector3, equalv3, isParallelTo, SelectNearP, XAxis, ZeroVec } from "../../Geometry/GeUtils";
import { AsVector2, AsVector3, SelectNearP, XAxis, ZeroVec, equalv3, isParallelTo } from "../../Geometry/GeUtils";
import { IntersectOption } from "../../GraphicsSystem/IntersectWith";
import { HotCMD } from "../../Hot/HotCommand";
import { FixDrawWallDir } from "./FixDrawWallDir";
@ -232,7 +232,7 @@ export class Command_DrawWall implements Command
}
}
else
Log("输入的值太小了!");
Log("输入的值太小了!", LogType.Error);
}
}
@ -457,7 +457,7 @@ export class Command_DrawWallInside implements Command
if (d > 1)
this.WallThickness = d;
else
Log("墙体厚度必须大于1!");
Log("墙体厚度必须大于1!", LogType.Error);
}
}
}

@ -4,6 +4,7 @@ import { app } from '../ApplicationServices/Application';
import { ReportError } from '../Common/ErrorMonitoring';
import { FS } from '../Common/FileSystem';
import { FileHistoryUrl } from '../Common/HostUrl';
import { LogType } from '../Common/Log';
import { RequestStatus, uploadLogo } from '../Common/Request';
import { deflate, GetCurrentViewPreViewImage } from '../Common/SerializeMaterial';
import { StoreageKeys } from "../Common/StoreageKeys";
@ -191,7 +192,7 @@ export class Save implements Command
timeout: 10000,
intent: Intent.DANGER,
}, "save_error");
app.Editor.Prompt("保存失败(上传到服务器失败,请检查网络连接是否正常.)!");
app.Editor.Prompt("保存失败(上传到服务器失败,请检查网络连接是否正常.)!", LogType.Error);
}
});
}

@ -1,6 +1,7 @@
import { DirectionalLight } from "three";
import { app } from "../../ApplicationServices/Application";
import { CURRENT_HOST } from "../../Common/HostUrl";
import { LogType } from "../../Common/Log";
import { deflate, GetCurrentViewPreViewImage } from "../../Common/SerializeMaterial";
import { Intent } from "../../Common/Toaster";
import { CADFiler } from "../../DatabaseServices/CADFiler";
@ -121,12 +122,12 @@ export class Command_ShareView implements Command
}
else
{
app.Editor.Prompt(result.err_msg);
app.Editor.Prompt(result.err_msg, LogType.Error);
}
})
.catch((error) =>
{
app.Editor.Prompt(error);
app.Editor.Prompt(error, LogType.Error);
AppToaster.show({
message: "分享失败!" + error,
timeout: 5000,

@ -3,7 +3,7 @@ import * as React from 'react';
import * as ReactDOM from 'react-dom';
import ResizeObserver from 'resize-observer-polyfill';
import { Object3D } from 'three';
import { _LogInjectFunctions } from '../../Common/Log';
import { LogType, _LogInjectFunctions } from '../../Common/Log';
import { ShowObjectsFunctionList } from '../../Common/ShowSelectObjects';
import { IToasterOption, ToasterInjectFunctions, ToasterShowEntityMsgInjectFunctions } from '../../Common/Toaster';
import { isHasTouch } from '../../Common/Utils';
@ -61,9 +61,9 @@ export class ShareViewLayout
});
ro.observe(root);
_LogInjectFunctions.push((message: string) =>
_LogInjectFunctions.push((message: string, type?: LogType, entity?: Entity[]) =>
{
this.app.Editor.Prompt(message);
this.app.Editor.Prompt(message, type, entity);
});
ToasterInjectFunctions.push((option: IToasterOption) =>

@ -1,6 +1,7 @@
import { Vector3 } from 'three';
import { app } from '../ApplicationServices/Application';
import { ConverCircleToPolyline, MergeCurvelist } from '../Common/CurveUtils';
import { LogType } from '../Common/Log';
import { SweepSolid } from '../DatabaseServices/3DSolid/SweepSolid';
import { Arc } from '../DatabaseServices/Entity/Arc';
import { Curve } from '../DatabaseServices/Entity/Curve';
@ -109,7 +110,7 @@ export function GetCloseContour(originContour: Polyline | Circle)
}
if (!originContour.IsClose)
{
app.Editor.Prompt("您选择的多段线没有闭合!");
app.Editor.Prompt("您选择的多段线没有闭合!", LogType.Warning, [originContour]);
return;
}
}

@ -1,5 +1,5 @@
import { app } from "../../ApplicationServices/Application";
import { Log } from "../../Common/Log";
import { Log, LogType } from "../../Common/Log";
import { Entity } from "../../DatabaseServices/Entity/Entity";
import { InitTemplate } from "../../DatabaseServices/Template/TempateUtils";
import { Command } from "../../Editor/CommandMachine";
@ -19,7 +19,7 @@ export class ShowTemplateDesign implements Command
let toasterList = AppToaster.getToasts();
if (toasterList.some(op => op.key === Board_Editor_Key))
{
Log("当前正在编辑模板");
Log("当前正在编辑模板", LogType.Error);
return;
}
}

@ -3,11 +3,11 @@ import { observer } from 'mobx-react';
import * as React from 'react';
import { app } from "../ApplicationServices/Application";
import { appCache } from '../Common/AppCache';
import { ConfigUrls, CURRENT_HOST, TemplateUrls } from "../Common/HostUrl";
import { inflateBase64 } from "../Common/inflate";
import { Log } from "../Common/Log";
import { CURRENT_HOST, ConfigUrls, TemplateUrls } from "../Common/HostUrl";
import { Log, LogType } from "../Common/Log";
import { PostJson, RequestStatus } from "../Common/Request";
import { TemplateIn } from "../Common/SerializeMaterial";
import { inflateBase64 } from "../Common/inflate";
import { EditorOnlineTemplate, GetOnlineTemplate } from "../DatabaseServices/Template/TempateUtils";
import { Command, CommandWrap } from "../Editor/CommandMachine";
import { userConfig } from "../Editor/UserConfig";
@ -27,7 +27,7 @@ export class Command_TemplateSearch implements Command
let url = this.isCheck ? TemplateUrls.check : TemplateUrls.search;
if (this.isCheck && !userConfig.isAdmin)
{
Log("非管理员无法使用");
Log("非管理员无法使用", LogType.Error);
return;
}
app.Editor.ModalManage.RenderModal(TemplateSearchDialog, { url }, { isMax: true });

@ -1,6 +1,7 @@
import { observable } from "mobx";
import { Matrix4, Vector3 } from "three";
import { app } from "../../ApplicationServices/Application";
import { LogType } from "../../Common/Log";
import { Text } from "../../DatabaseServices/Text/Text";
import { Command } from "../../Editor/CommandMachine";
import { JigUtils } from "../../Editor/JigUtils";
@ -109,7 +110,7 @@ export class EditFrame implements Command
{
if (ret.Distance <= 0 || isNaN(ret.Distance))
{
app.Editor.Prompt("请输入为正数的高度!");
app.Editor.Prompt("请输入为正数的高度!", LogType.Error);
}
else
{

@ -3,6 +3,7 @@ import { observable } from "mobx";
import { Matrix4, Vector3 } from "three";
import { app } from "../../ApplicationServices/Application";
import { EBoardKeyList } from "../../Common/BoardKeyList";
import { LogType } from "../../Common/Log";
import { Board } from "../../DatabaseServices/Entity/Board";
import { Text } from "../../DatabaseServices/Text/Text";
import { ViewportEntity } from "../../DatabaseServices/ViewportEntity";
@ -130,7 +131,7 @@ export class EditViewport implements Command
{
if (ret.Distance <= 0 || isNaN(ret.Distance))
{
app.Editor.Prompt("请输入为正数的高度!");
app.Editor.Prompt("请输入为正数的高度!", LogType.Error);
}
else
{

@ -1,7 +1,7 @@
import { Intent } from "@blueprintjs/core";
import { Box2, Box3 } from "three";
import { app } from "../../ApplicationServices/Application";
import { Log } from "../../Common/Log";
import { Log, LogType } from "../../Common/Log";
import { CADFiler } from "../../DatabaseServices/CADFiler";
import { Entity } from "../../DatabaseServices/Entity/Entity";
import { GroupRecord } from "../../DatabaseServices/GroupTableRecord";
@ -75,7 +75,7 @@ export class OneKeyPrint implements Command
if (framesGrounps.size === 0)
{
Log("布局中不存在图框");
Log("布局中不存在图框", LogType.Error);
return;
}

@ -4,6 +4,7 @@ import { observer } from "mobx-react";
import React from "react";
import { app } from "../../ApplicationServices/Application";
import { KeyBoard } from "../../Common/KeyEnum";
import { LogType } from "../../Common/Log";
import { UpdateDraw } from "../../Common/Status";
import { safeEval } from "../../Common/eval";
import { Board } from "../../DatabaseServices/Entity/Board";
@ -149,7 +150,7 @@ export class GroovesModifyModal extends React.Component<BoardProps, ICommonOptio
if (isNaN(val) || val < 0 || (isKnifeRadius && val === 0))
{
e.target.value = "";
app.Editor.Prompt("仅限输入大于 0 数字!");
app.Editor.Prompt("仅限输入大于 0 数字!", LogType.Error);
}
}

@ -2,8 +2,9 @@ import { Intent } from "@blueprintjs/core";
import { observer } from "mobx-react";
import React from "react";
import { app } from "../../ApplicationServices/Application";
import { safeEval } from "../../Common/eval";
import { KeyBoard } from "../../Common/KeyEnum";
import { LogType } from "../../Common/Log";
import { safeEval } from "../../Common/eval";
import { Board } from "../../DatabaseServices/Entity/Board";
import { ExtrudeSolid } from "../../DatabaseServices/Entity/Extrude";
import { AppToaster } from "../../UI/Components/Toaster";
@ -40,7 +41,7 @@ export class InputEl extends React.Component<InputElProp, {}>
if (isNaN(val) || val <= 0)
{
_SetDefaultValue();
app.Editor.Prompt("仅限输入大于 0 的数字!");
app.Editor.Prompt("仅限输入大于 0 的数字!", LogType.Error);
return false;
};
}
@ -49,7 +50,7 @@ export class InputEl extends React.Component<InputElProp, {}>
if (isNaN(val) || val < 0)
{
_SetDefaultValue();
app.Editor.Prompt("仅限输入大于等于 0 的数字!");
app.Editor.Prompt("仅限输入大于等于 0 的数字!", LogType.Error);
return false;
}
}

@ -1,5 +1,6 @@
import { MathUtils } from "three";
import { app } from "../../ApplicationServices/Application";
import { LogType } from "../../Common/Log";
import { Line } from "../../DatabaseServices/Entity/Line";
import { Polyline } from "../../DatabaseServices/Entity/Polyline";
import { Command } from "../../Editor/CommandMachine";
@ -21,14 +22,14 @@ export class Command_TestVPath implements Command
if (anRes.Status !== PromptStatus.OK) return;
if (anRes.Distance <= 0 || anRes.Distance >= 180)
{
app.Editor.Prompt("角度不能小于0或者大于180!");
app.Editor.Prompt("角度不能小于0或者大于180!", LogType.Error);
return;
}
let depthRes = await app.Editor.GetDistance({ Msg: "请输入吃刀深度:", Default: 12 });
if (depthRes.Distance <= 0 || depthRes.Distance >= 50)
{
app.Editor.Prompt("深度不能小于0或者大于50!");
app.Editor.Prompt("深度不能小于0或者大于50!", LogType.Error);
return;
}

@ -2,6 +2,7 @@ import { Box3, Vector3 } from "three";
import { app } from "../../ApplicationServices/Application";
import { arrayRemoveIf } from "../../Common/ArrayExt";
import { EBoardKeyList } from "../../Common/BoardKeyList";
import { LogType } from "../../Common/Log";
import { Board } from "../../DatabaseServices/Entity/Board";
import { ComparePointFnGenerate, equaln, isParallelTo } from "../../Geometry/GeUtils";
import { BoardType, DrillType, FaceDirection, LinesType } from "../../UI/Store/BoardInterface";
@ -566,7 +567,7 @@ export class ParseBoardNameUtil
}
if (curtailNum > allowDist)
{
app.Editor.Prompt(`${promptMsg}的前缩值不得超过${allowDist}`);
app.Editor.Prompt(`${promptMsg}的前缩值不得超过${allowDist}`, LogType.Error);
return;
}

@ -3,15 +3,15 @@ import { Box3, Matrix4, Object3D, Vector3 } from "three";
import { app } from "../../ApplicationServices/Application";
import { EBoardKeyList } from "../../Common/BoardKeyList";
import { GetRectData } from "../../Common/CurveUtils";
import { safeEval } from "../../Common/eval";
import { Buy2To3 } from "../../Common/HostUrl";
import { Log } from "../../Common/Log";
import { Log, LogType } from "../../Common/Log";
import { FixDigits } from "../../Common/Utils";
import { safeEval } from "../../Common/eval";
import { Board } from "../../DatabaseServices/Entity/Board";
import { Polyline } from "../../DatabaseServices/Entity/Polyline";
import { Command } from "../../Editor/CommandMachine";
import { PromptStatus } from "../../Editor/PromptResult";
import { isParallelTo, XAxis, YAxis, ZAxis } from "../../Geometry/GeUtils";
import { XAxis, YAxis, ZAxis, isParallelTo } from "../../Geometry/GeUtils";
import { ClampSpaceParseRay } from "../../Geometry/SpaceParse/ClampSpaceParseRay";
import { ISpaceParse } from "../../Geometry/SpaceParse/ISpaceParse";
import { PointSelectBoards } from "../../Geometry/SpaceParse/PointSelectBoards";
@ -92,7 +92,7 @@ class Rect2BoardTool2
const spaceParse = await this.GetSpaceParse(box);
if (!spaceParse.ParseOK)
{
Log("没有对应的空间");
Log("没有对应的空间", LogType.Warning, [pl]);
continue;
}

@ -3,8 +3,8 @@ import hotkeys from 'hotkeys-js-ext';
import { MathUtils, Matrix4, Object3D, PerspectiveCamera, Vector3 } from 'three';
import { begin, end } from 'xaop';
import { HardwareCuttingReactor } from '../Add-on/BoardCutting/HardwareCuttingReactor';
import { DrillingReactor } from '../Add-on/DrawDrilling/DrillingReactor';
import { DwgDxfImport } from '../Add-on/DXFLoad';
import { DrillingReactor } from '../Add-on/DrawDrilling/DrillingReactor';
import { AppendUserInfo } from '../Add-on/ExportData';
import { ImportJiajuFile } from '../Add-on/JiaJu/Import/JiaJuImport';
import { ImportKJLData } from '../Add-on/KJL/Import/KJLImport';
@ -12,6 +12,7 @@ import { CommandNames } from '../Common/CommandNames';
import { IsDev } from '../Common/Deving';
import { MouseKey } from '../Common/KeyEnum';
import { LoadEquirectangularEnvMap } from '../Common/LoadEquirectangularEnvMap';
import { LogType } from '../Common/Log';
import { ViewDirType } from '../Common/SystemEnum';
import { BoardLinesReactor } from '../DatabaseServices/BoardLinesReactor';
import { CADFiler } from '../DatabaseServices/CADFiler';
@ -22,7 +23,7 @@ import { FontLoader } from '../DatabaseServices/Text/FontLoader';
import { AutoSaveServer } from '../Editor/AutoSave';
import { BoardMoveTool } from '../Editor/BoardMoveTool';
import { CameraControls } from '../Editor/CameraControls';
import { commandMachine, CommandWrap } from '../Editor/CommandMachine';
import { CommandWrap, commandMachine } from '../Editor/CommandMachine';
import { CommandState } from '../Editor/CommandState';
import { Editor } from '../Editor/Editor';
import { Gesture } from '../Editor/Gesture';
@ -221,7 +222,7 @@ export class ApplicationService
end(this.Database.hm, this.Database.hm.UndoEvent, (cmdName: string) =>
{
if (HostApplicationServices.ShowHistoryLog)
this.Editor.Prompt("撤销:" + cmdName);
this.Editor.Prompt("撤销:" + cmdName, LogType.Command);
this.Saved = false;
this.AutoSaveServer.isCached = false;
@ -230,7 +231,7 @@ export class ApplicationService
end(this.Database.hm, this.Database.hm.RedoEvent, (cmdName: string) =>
{
if (HostApplicationServices.ShowHistoryLog)
this.Editor.Prompt("重做:" + cmdName);
this.Editor.Prompt("重做:" + cmdName, LogType.Command);
this.Saved = false;
this.AutoSaveServer.isCached = false;

@ -1,7 +1,5 @@
import { Geom3 } from "@jscad/modeling/src/geometries/types";
import { Box3, Material, Mesh } from "three";
import { FuzzyFactory } from "../csg/core/FuzzyFactory";
import { CSG2Geometry2, Geometry2CSG2 } from "../csg/core/Geometry2CSG";
import { ExtrudeHole } from "../DatabaseServices/3DSolid/ExtrudeHole";
import { SweepSolid } from "../DatabaseServices/3DSolid/SweepSolid";
import { Board } from "../DatabaseServices/Entity/Board";
@ -14,9 +12,11 @@ import { TemplateLatticeRecord } from "../DatabaseServices/Template/ProgramTempa
import { TemplateWineRackRecord } from "../DatabaseServices/Template/ProgramTempate/TemplateWineRackRecord";
import { BoxIsSolid } from "../Geometry/Box";
import { OBB } from "../Geometry/OBB/obb";
import { ColorMaterial } from "./ColorPalette";
import { FuzzyFactory } from "../csg/core/FuzzyFactory";
import { CSG2Geometry2, Geometry2CSG2 } from "../csg/core/Geometry2CSG";
import { CSGIntersect } from "./CSGIntersect";
import { Log } from "./Log";
import { ColorMaterial } from "./ColorPalette";
import { Log, LogType } from "./Log";
import { Sleep } from "./Sleep";
export type Solid3D = ExtrudeSolid | SweepSolid | ExtrudeHole;
@ -159,7 +159,7 @@ export class CheckInterfereTool
let csg2 = this.GetCSG(e2);
if (!csg1 || !csg2)
{
Log("构造CSG错误!");
Log("构造CSG错误!", LogType.Error);
continue;
}

@ -1,3 +1,11 @@
export enum LogType
{
Error = "ERROR",
Warning = "WARNING",
Info = "INFO",
Command = "COMMAND",
All = "ALL",
}
type LogFunction = (message?: any, ...optionalParams: any[]) => void;
@ -9,6 +17,14 @@ export function Log(message?: any, ...optionalParams: any[]): void
f(message, ...optionalParams);
}
export const _LogInjectInteractionFunctions: LogFunction[] = [];
export function InteractionLog(message?: any, ...optionalParams: any[]): void
{
for (let f of _LogInjectInteractionFunctions)
f(message, ...optionalParams);
}
export const LogEnable = {
Display: false
};

@ -2,8 +2,8 @@ import { Object3D } from "three";
import { Entity } from "../DatabaseServices/Entity/Entity";
import { ObjectId } from "../DatabaseServices/ObjectId";
import { equaln } from "../Geometry/GeUtils";
import { safeEval } from "./eval";
import { StoreageKeys } from "./StoreageKeys";
import { safeEval } from "./eval";
//仅数字构成的3位字符串(不以0开头)
export const digitStrReg = /^[^0\D]\d{0,2}$/;
@ -243,3 +243,10 @@ export const isHasTouch = () =>
{
return ('ontouchstart' in document.documentElement);
};
export function isChinese(str: string)
{
const reg = new RegExp(`\^[^\\u4e00-\\u9fa5]+$`);
if (reg.test(str)) return false;
return true;
};

@ -1,13 +1,13 @@
import { Box3, BoxBufferGeometry, BufferGeometry, Float32BufferAttribute, InstancedInterleavedBuffer, InterleavedBufferAttribute, Line as TLine, Line3, LineSegments, Matrix3, Matrix4, Mesh, Object3D, Vector3 } from "three";
import { Box3, BoxBufferGeometry, BufferGeometry, Float32BufferAttribute, InstancedInterleavedBuffer, InterleavedBufferAttribute, Line3, LineSegments, Matrix3, Matrix4, Mesh, Object3D, Line as TLine, 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 { DisposeThreeObj, Object3DRemoveAll } from '../../Common/Dispose';
import { Log } from "../../Common/Log";
import { Log, LogType } from "../../Common/Log";
import { tempMatrix1 } from "../../Common/Matrix4Utils";
import { UpdateDraw } from "../../Common/Status";
import { ObjectSnapMode } from "../../Editor/ObjectSnapMode";
import { equaln, equalv3, isParallelTo, MoveMatrix } from '../../Geometry/GeUtils';
import { MoveMatrix, equaln, equalv3, isParallelTo } from '../../Geometry/GeUtils';
import { SweepGeometry } from '../../Geometry/SweepGeometry';
import { RenderType } from "../../GraphicsSystem/RenderType";
import { Factory } from "../CADFactory";
@ -134,7 +134,7 @@ export class SweepSolid extends Entity
else
this._Contour.ApplyMatrix(toWcsMat4);
}
Log("错误:提供的轮廓没有和路径垂直!");
Log("错误:提供的轮廓没有和路径垂直!", LogType.Error);
}
private _MeshGeometry: SweepGeometry;
private _lineGeo: LineGeometry;
@ -526,7 +526,7 @@ export class SweepSolid extends Entity
if (this._Contour instanceof Spline || this._PathCurve instanceof Spline)
{
this._isErase = true;
Log("放样实体是样条线生成的,自动删除它!");
Log("放样实体是样条线生成的,自动删除它!", LogType.Info);
}
}

@ -1,5 +1,6 @@
import { app, ApplicationService } from "../ApplicationServices/Application";
import { CommandNames } from "../Common/CommandNames";
import { LogType } from "../Common/Log";
import { Intent } from "../Common/Toaster";
import { userConfig } from "../Editor/UserConfig";
import { Production } from "../Production/Product";
@ -78,11 +79,11 @@ export class BoardLinesReactor
if (!BoardIsLong(ent, line))
{
ent.BoardProcessOption.lines = line;
app.Editor.Prompt(`${ent.BoardProcessOption.boardName}超长,自动翻转为${ALL_LINES_NAMES[line]}.`);
app.Editor.Prompt(`${ent.BoardProcessOption.boardName}超长,自动翻转为${ALL_LINES_NAMES[line]}.`, LogType.Warning);
return;
}
}
app.Editor.Prompt(`${ent.BoardProcessOption.boardName}超长,无法自动翻转!长:${ent.Height},宽:${ent.Width}.`);
app.Editor.Prompt(`${ent.BoardProcessOption.boardName}超长,无法自动翻转!长:${ent.Height},宽:${ent.Width}.`, LogType.Warning);
if (ent.BoardProcessOption.lines !== LinesType.CanReversal)
ent.BoardProcessOption.lines = ent.Height > ent.Width ? LinesType.Positive : LinesType.Reverse;
return true;

@ -124,9 +124,9 @@ export class CommandServer
this._CustomCommandMap.clear();
this._CommandHotKeyMap.clear();
//注册自定义(命令和组合键)
for (let cmd of commandList)
{
//注册自定义(命令和组合键){
if (cmd.customize)
this.RegistCustomCommand(cmd.customize, cmd.command);
@ -135,11 +135,8 @@ export class CommandServer
this.RegistHotkey(cmd.systemHotkeys, cmd.command);
else if (cmd.hotkeysCustomize)
this.RegistHotkey(cmd.hotkeysCustomize, cmd.command);
}
//注册默认(命令和组合键)(如果可以的话)
for (let cmd of commandList)
{
//注册默认(命令和组合键)(如果可以的话){
//默认自定义命令
if (!cmd.customize && this.GetCommandCanUseDefaultCustomCmd(cmd))
this.RegistCustomCommand(cmd.defaultCustom, cmd.command);//注册默认自定义命令
@ -149,6 +146,14 @@ export class CommandServer
this.RegistHotkey(cmd.defaultHotkeys, cmd.command);
}
for (let cmd of commandList)
{
if (commandMachine.CommandNameSet.has(cmd.defaultCustom) || commandMachine.CommandNameSet.has(cmd.command) || commandMachine.CommandNameSet.has(cmd.customize))
{
commandMachine.CommandSet.add(cmd);
}
}
hotkeys.setScope("custom");
}
@ -218,6 +223,10 @@ export class CommandServer
this._CustomCommandMap.set(customCmd, cmd);//注册自定义命令
this._CommandCustomMap.set(cmd, customCmd);
if (commandMachine.CommandNameSet.has(cmd))
{
commandMachine.CommandNameSet.delete(cmd);
}
commandMachine.CommandNameSet.add(customCmd);
}

@ -8,7 +8,7 @@ import { ColorMaterial } from "../../Common/ColorPalette";
import { CSGIntersect } from '../../Common/CSGIntersect';
import { equalCurve, PolylineSpliteRect } from "../../Common/CurveUtils";
import { DisposeThreeObj, Object3DRemoveAll } from "../../Common/Dispose";
import { Log } from "../../Common/Log";
import { InteractionLog, Log, LogType } from "../../Common/Log";
import { MakeMirrorMtx, reviseMirrorMatrix, tempMatrix1, TransformVector, Vector2ApplyMatrix4 } from "../../Common/Matrix4Utils";
import { Status, UpdateDraw } from "../../Common/Status";
import { Geometry2CSG2 } from "../../csg/core/Geometry2CSG";
@ -497,7 +497,7 @@ export class ExtrudeSolid extends Entity
this.width = size.x;
this.height = size.y;
if (equaln(size.x, 0) || equaln(size.y, 0))
Log(`注意!!该板件尺寸为0!`);
Log(`注意!!该板件尺寸为0!`, LogType.Warning);
this.isRect = equaln(this.width * this.height, this.ContourCurve.Area, 0.1);
// if (area2 < 0)
@ -697,9 +697,9 @@ export class ExtrudeSolid extends Entity
if (!this.ReadFileIng && this instanceof Board)
{
if (this.Id)
Log(`${this.Name}(${this.Id.Index})被切割成功!`);
InteractionLog([{ msg: `${this.Name}(${this.Id.Index})`, entity: [this] }, { msg: "被切割成功" }], LogType.Info);
else if (this.__OriginalId__)
Log(`${this.Name}(${this.__OriginalId__.Index})关联切割成功更新槽!`);
InteractionLog([{ msg: `${this.Name}(${this.__OriginalId__.Index})`, entity: [this] }, { msg: "关联切割成功更新槽!" }], LogType.Info);
}
return true;
}
@ -1746,7 +1746,7 @@ export class ExtrudeSolid extends Entity
this.__CacheVolume__ !== undefined &&
!equaln(this.__CacheVolume__, this.Volume)
)
Log(`${this.Name}(${id.Index})关联槽已逃离!`);
InteractionLog([{ msg: `${this.Name}(${id.Index})`, entity: [this] }, { msg: "关联槽已逃离!" }], LogType.Warning);
this.__CacheVolume__ = undefined;
this.__CacheSplitExtrudes = [this];
@ -1761,8 +1761,7 @@ export class ExtrudeSolid extends Entity
this.__CacheVolume__ !== undefined &&
!equaln(this.__CacheVolume__, this.Volume)
)
Log(`${this.Name}(${this.Id.Index})关联槽已逃离或者被清除!`);
InteractionLog([{ msg: `${this.Name}(${this.Id.Index})`, entity: [this] }, { msg: "关联槽已逃离或者被清除!" }], LogType.Warning);
this.__CacheSplitExtrudes = [this];
this.__CacheVolume__ = undefined;
}

@ -3,13 +3,14 @@ import { HistoryToaster, OperLogs } from "../Add-on/File/OperLog";
import { app } from "../ApplicationServices/Application";
import { FS } from "../Common/FileSystem";
import { FileUrls, TemplateUrls } from "../Common/HostUrl";
import { inflateBase64 } from "../Common/inflate";
import { LogType } from "../Common/Log";
import { DirectoryId, PostJson, RequestStatus } from "../Common/Request";
import { deflate } from "../Common/SerializeMaterial";
import { Singleton } from "../Common/Singleton";
import { Sleep } from "../Common/Sleep";
import { StoreageKeys } from "../Common/StoreageKeys";
import { GetIndexDBID } from "../Common/Utils";
import { inflateBase64 } from "../Common/inflate";
import { TempEditor } from "../Editor/TempEditor";
import { userConfig } from "../Editor/UserConfig";
import { IndexedDbStore, StoreName } from "../IndexedDb/IndexedDbStore";
@ -149,7 +150,7 @@ export class FileServer extends Singleton
}
catch (error)
{
app.Editor.Prompt("打开图纸失败,可能图纸是由更新的版本创建." + error);
app.Editor.Prompt("打开图纸失败,可能图纸是由更新的版本创建." + error, LogType.Error);
status = false;
}
}

@ -5,7 +5,7 @@ import { IsHinge } from "../../Add-on/HideSelect/HideSelectUtils";
import { app } from "../../ApplicationServices/Application";
import { arrayRemoveOnce } from "../../Common/ArrayExt";
import { TemplateUrls } from "../../Common/HostUrl";
import { Log } from "../../Common/Log";
import { Log, LogType } from "../../Common/Log";
import { PostJson, RequestStatus } from "../../Common/Request";
import { GetEntitysLogo, TemplateIn, TemplateOut, TemplateParamsOut, deflate } from "../../Common/SerializeMaterial";
import { DuplicateRecordCloning } from "../../Common/Status";
@ -867,7 +867,7 @@ function GetFilletData(br: Board, point: Vector3, brParamMap: Map<ExtrudeSolid,
if (isNaN(par))
{
if ((!br.Id || br.Grooves.length === 0) && origin.Modeling2D.length === 0)
Log("点取的点不在圆弧上!");
Log("点取的点不在圆弧上!", LogType.Error);
}
else
{
@ -905,7 +905,7 @@ function GetFilletData(br: Board, point: Vector3, brParamMap: Map<ExtrudeSolid,
return true;
}
else
Log("点取的点不在圆弧上!");
Log("点取的点不在圆弧上!", LogType.Error);
}
}
if (br.Id)
@ -954,7 +954,7 @@ function GetFilletDataByPath2D(br: Board, point: Vector3, brParamMap: Map<Extrud
return true;
}
}
Log("点取的点不在圆弧上!");
Log("点取的点不在圆弧上!", LogType.Error);
return false;
}

@ -1,6 +1,6 @@
import { Box3, MathUtils, Matrix4, Vector3 } from "three";
import { arrayRemoveOnce } from "../../Common/ArrayExt";
import { Log } from "../../Common/Log";
import { Log, LogType } from "../../Common/Log";
import { Intent, Toaster } from "../../Common/Toaster";
import { Box3Ext } from "../../Geometry/Box";
import { ISpaceParse } from "../../Geometry/SpaceParse/ISpaceParse";
@ -358,7 +358,7 @@ export class TemplateRecord extends SymbolTableRecord
}
else
{
Log(`模块:(${this.name})定位错误!`);
Log(`模块:(${this.name})定位错误!`, LogType.Error);
return;//出事故
}
}

@ -1,6 +1,6 @@
import { app } from "../../ApplicationServices/Application";
import { LogType } from "../../Common/Log";
import { DuplicateRecordCloning } from "../../Common/Status";
import { commandMachine } from "../../Editor/CommandMachine";
import { PromptStatus } from "../../Editor/PromptResult";
import { EnableSelectType } from "../../Geometry/SpaceParse/PointSelectSpace";
import { PointSelectSpaceClamp } from "../../Geometry/SpaceParse/PointSelectSpaceClamp";
@ -88,7 +88,7 @@ export class TemplateAttach
if (!selectSpace.ParseOK)
{
app.Editor.Prompt("未能分析出有效空间!");
app.Editor.Prompt("未能分析出有效空间!", LogType.Error);
return;
}
@ -111,7 +111,7 @@ export class TemplateAttach2
if (!selectSpace.ParseOK)
{
app.Editor.Prompt("未能分析出有效空间!");
app.Editor.Prompt("未能分析出有效空间!", LogType.Error);
return;
}
@ -158,7 +158,7 @@ export class TemplateArray
if (!selectSpace.ParseOK)
{
app.Editor.Prompt("未能分析出有效空间!");
app.Editor.Prompt("未能分析出有效空间!", LogType.Error);
return;
}
@ -221,11 +221,6 @@ export class TemplateArray
}
}
commandMachine.RegisterCommand("Attach", new TemplateAttach());
commandMachine.RegisterCommand("Attach2", new TemplateAttach2());
commandMachine.RegisterCommand("TemplateArray", new TemplateArray());
// commandMachine.RegisterCommand("uur", new UpdateTemplateRo());
// commandMachine.RegisterCommand("uuu", new UpdateParam2());
// commandMachine.RegisterCommand("clear", new Clear);

@ -2,10 +2,12 @@ import { Intent } from '@blueprintjs/core';
import { app } from '../ApplicationServices/Application';
import { arrayLast, arrayRemoveOnce } from '../Common/ArrayExt';
import { ReportError } from '../Common/ErrorMonitoring';
import { LogType } from '../Common/Log';
import { CommandServer } from '../DatabaseServices/CommandServer';
import { Entity } from '../DatabaseServices/Entity/Entity';
import { BoardModalType } from '../UI/Components/Board/BoardModalType';
import { ConfigTagCommand } from '../UI/Components/Board/ConfigTagCommand';
import { ICommand } from '../UI/Components/CommandPanel/CommandList';
import { AppToaster } from '../UI/Components/Toaster';
import { CommandState } from './CommandState';
import { JigUtils } from './JigUtils';
@ -31,6 +33,8 @@ class CommandMachine
LastExecCmd: string;//最后执行的命令
private _CommandNameSet = new Set<string>();//所有可以调用的命令列表(包括原始命令和自定义命令,提供给InputHint做感知)
private _CommandSet = new Set<Partial<ICommand>>();//本地命令对象列表
async ExecCommand(cmdName: string)
{
const server = CommandServer.GetInstance();
@ -68,12 +72,12 @@ class CommandMachine
//在透明命令判断完成,避免无法运行透明命令
if (CommandState.CommandIng)
{
app.Editor.Prompt("命令尚未结束,如果是程序错误,请按Ctrl+Alt+E强制结束命令!");
app.Editor.Prompt("命令尚未结束,如果是程序错误,请按Ctrl+Alt+E强制结束命令!", LogType.Warning);
return;
}
if (app.Viewer.IsLookSelect)
{
app.Editor.Prompt("视图已经锁定,无法执行命令!(如果是程序出错,请按F12,在Console那边输入:app.Viewer.IsLookSelect = false");
app.Editor.Prompt("视图已经锁定,无法执行命令!(如果是程序出错,请按F12,在Console那边输入:app.Viewer.IsLookSelect = false", LogType.Warning);
return;
}
@ -91,7 +95,7 @@ class CommandMachine
await this.CommandEnd(abort, cmd.NoHistory);
}
else
app.Editor.Prompt('未知命令!');
app.Editor.Prompt('未知命令!', LogType.Error);
}
//注册原始命令
@ -100,6 +104,9 @@ class CommandMachine
cmdName = cmdName.toUpperCase();
this.CommandMap.set(cmdName, cmd);
this._CommandNameSet.add(cmdName);
if (Object.keys(cmd).includes("tag"))//模块标签
this._CommandSet.add({ command: cmdName });
}
//删除原始命令
@ -120,11 +127,11 @@ class CommandMachine
{
if (CommandState.CommandIng)
{
app.Editor.Prompt(`命令:"${this.LastExecCmd}"正忙! 如果是程序错误,请按下Ctrl+Alt+E结束命令!`);
app.Editor.Prompt(`命令:"${this.LastExecCmd}"正忙! 如果是程序错误,请按下Ctrl+Alt+E结束命令!`, LogType.Warning);
return false;
}
this.LastExecCmd = cmdName;
app.Editor.Prompt(cmdName);
app.Editor.Prompt(cmdName, LogType.Command);
CommandState.CommandIng = true;
if (!noHistory)
app.Database.hm.StartCmd(cmdName);
@ -183,6 +190,11 @@ class CommandMachine
{
return this._CommandNameSet;
}
get CommandSet(): Set<Partial<ICommand>>
{
return this._CommandSet;
}
}
export const commandMachine = new CommandMachine();

@ -29,22 +29,22 @@ import { ChangeColor } from "../Add-on/ChangeColor";
import { ChangeColorByMaterial } from "../Add-on/ChangeColorByBoard/ChangeColorByMaterial";
import { CheckHoles } from "../Add-on/CheckHoles";
import { CheckModeling } from "../Add-on/CheckModeling";
import { Command_ClosePt } from "../Add-on/closetest";
import { Cmd_Freeze, Cmd_UnFreeze } from "../Add-on/Cmd_Freeze";
import { Cmd_UnVisibleInRender, Cmd_VisibleInRender } from "../Add-on/Cmd_VisibleInRender";
import { CombinatAttributeBrush } from "../Add-on/CombinatAttributeBrush";
import { FeedingCommand } from "../Add-on/CommandFeeding";
import { Command_CombineEntity } from "../Add-on/Command_CombineEntity";
import { Command_CommandPanel } from "../Add-on/Command_CommandPanel";
import { Command_Options } from "../Add-on/Command_Option";
import { Command_Purge } from "../Add-on/Command_Purge";
import { Command_SetBRXAxis } from "../Add-on/Command_SetBRXAxis";
import { FeedingCommand } from "../Add-on/CommandFeeding";
import { Command_Conver2Polyline } from "../Add-on/Conver2Polyline";
import { Command_Copy } from "../Add-on/Copy";
import { CopyClip } from "../Add-on/CopyClip";
import { Command_CopyPoint } from "../Add-on/CopyPoint";
import { CustomUcs } from "../Add-on/CostumUCS";
import { Command_CleanCustomNumber, Command_CustomNumber } from "../Add-on/CustomNumber/Command_CustomNumber";
import { Command_DWGDXFImport } from "../Add-on/DXFLoad";
import { DeleteCurve } from "../Add-on/DeleteCurve";
import { Command_Dist } from "../Add-on/Dist";
import { CMD_Divide } from "../Add-on/Divide";
@ -116,7 +116,6 @@ import { DrawWineRack } from "../Add-on/DrawWineRack/DrawWineRack";
import { EditorWineRack } from "../Add-on/DrawWineRack/EditorWineRack";
import { Polyline2Winerack } from "../Add-on/DrawWineRack/Polyline2Winerack";
import { DrawCircle0 } from "../Add-on/DrawZeroCircle";
import { Command_DWGDXFImport } from "../Add-on/DXFLoad";
import { Command_EndTempEditor } from "../Add-on/EndTempEditor";
import { Command_EntitytMoveToZ0 } from "../Add-on/EntityMoveToZ0";
import { Entsel } from "../Add-on/Entsel";
@ -131,27 +130,25 @@ import { Command_ExportView } from "../Add-on/Export2View";
import { Command_ExportData } from "../Add-on/ExportData";
import { Command_ExportSTL } from "../Add-on/Exports/ExportSTL";
import { Command_Extend } from "../Add-on/Extends";
import { Command_FZWL } from "../Add-on/FZWL";
import { Command_OpenHistory } from "../Add-on/File/OpenHistory";
import { OperLogs } from "../Add-on/File/OperLog";
import { CommandFillet } from "../Add-on/Fillet";
import { Command_FindBoardModelingKnife } from "../Add-on/FindBoardModelingKnife";
import { Command_Fix2DPath } from "../Add-on/Fix/Fix2DPath";
import { Command_FZWL } from "../Add-on/FZWL";
import { Command_Group, Command_UnGroup } from "../Add-on/Group";
import { Command_HideSelected, Command_HideUnselected, Command_ShowAll, Command_SwitchDoorOrDrawer, SelectAll, ShowHideSelectPanel } from "../Add-on/HideSelected";
import { Command_Insert } from "../Add-on/Insert";
import { Command_INsTest } from "../Add-on/instest";
import { Command_JiaJuImport } from "../Add-on/JiaJu/Import/JiaJuImport";
import { Command_Join } from "../Add-on/Join";
import { Command_KJLImport } from "../Add-on/KJL/Import/KJLImport";
import { ClearKjlToken, KjlExport } from "../Add-on/KJL/KjlExport";
import { Command_KJLImportConfig } from "../Add-on/KJL/KJLImportConfig/KJLImportConfigTool";
import { ClearKjlToken, KjlExport } from "../Add-on/KJL/KjlExport";
import { DrawLattice } from "../Add-on/LatticeDrawer/DrawLatticeDrawer";
import { EditorLattice } from "../Add-on/LatticeDrawer/EditorLattice";
import { Command_Length } from "../Add-on/Length";
import { Command_Lisp } from "../Add-on/Lisp";
import { DownLoadDConfig, DownloadHoleOption, UpLoadConfig, UploadHoleOption } from "../Add-on/LoadConfig";
import { Fbx } from "../Add-on/loadfbx";
import { LookOverBoardInfos } from "../Add-on/LookOverBoardInfos/LookOverBoardInfos";
import { Command_MatchProp } from "../Add-on/MatchProp";
import { MirrorCommand } from "../Add-on/Mirror";
@ -166,11 +163,10 @@ import { Open } from "../Add-on/Open";
import { Command_OpenCabinet } from "../Add-on/OpenCabinet/OpenCabinet";
import { PasteClip } from "../Add-on/PasteClip";
import { Pedit } from "../Add-on/Pedit";
import { Command_PLTest } from "../Add-on/polytest";
import { Print } from "../Add-on/Print";
import { CMD_Renderer } from "../Add-on/Renderer";
import { Command_RenderModulesState } from "../Add-on/RenderModulesState";
import { ReOpen } from "../Add-on/ReOpen";
import { Command_RenderModulesState } from "../Add-on/RenderModulesState";
import { CMD_Renderer } from "../Add-on/Renderer";
import { Command_ResetCustomCommand } from "../Add-on/ResetCustomCommand";
import { Command_RestoreColor } from "../Add-on/RestoreColor";
import { Command_Reverse } from "../Add-on/Reverse";
@ -191,8 +187,6 @@ import { Command_SendCADFileOnKf } from "../Add-on/SendCADFileOnKF";
import { SetSmoothEdge } from "../Add-on/SetSmoothEdge/SetSmoothEdge";
import { Command_ShareView } from "../Add-on/ShareView/Command_ShareView";
import { SwitchLines } from "../Add-on/ShowLines";
import { Command_GroovesModify } from "../Add-on/showModal/GroovesModify";
import { ShowEditorBBS } from "../Add-on/showModal/ShowModal";
import { Command_ShowProcessingGroupModal } from "../Add-on/ShowProcessingGroupModal";
import { ShowRecycleBin } from "../Add-on/ShowRecycleBin";
import { Stretch } from "../Add-on/Stretch";
@ -211,17 +205,35 @@ import { ShowTemplateDesign } from "../Add-on/Template/ShowTemplateDesign";
import { ShowTopLine } from "../Add-on/Template/ShowTopline";
import { Command_SplitTemplate, Command_SplitTemplateByDir } from "../Add-on/Template/SplitTemplate";
import { Command_TemplateSearch } from "../Add-on/TemplateSearch";
import { Command_ClosePt } from "../Add-on/closetest";
import { Command_INsTest } from "../Add-on/instest";
import { Fbx } from "../Add-on/loadfbx";
import { Command_PLTest } from "../Add-on/polytest";
import { Command_GroovesModify } from "../Add-on/showModal/GroovesModify";
import { ShowEditorBBS } from "../Add-on/showModal/ShowModal";
// import { DrawFloor } from '../Add-on/DrawFloor';
// import { RevTarget, SaveTarget } from '../Add-on/RenderTarget';
import { TestIntersect } from "../Add-on/test/testIntersect";
import { TestFb } from "../Add-on/TestFb";
import { Command_TestPointPickParse } from "../Add-on/TestPointPickParse";
import { Text2Curve } from "../Add-on/Text2Curve";
import { Command_ToggleUI } from "../Add-on/ToggleUI";
import { Command_Trim } from "../Add-on/Trim";
import { Redo, Undo } from "../Add-on/Undo";
import { ViewChange } from "../Add-on/ViewChange";
import { Command_FixView } from "../Add-on/ViewCtrl/FixView";
import { EditFrame } from "../Add-on/ViewortConfig/EditFrame";
import { EditViewport } from "../Add-on/ViewortConfig/EditViewport";
import { OneKeyLayout } from "../Add-on/Viewport/OneKeyLayout";
import { OneKeyPrint } from "../Add-on/Viewport/OneKeyPrint";
import { Command_Wblock } from "../Add-on/Wblock";
import { Command_ZoomObject, ZoomE } from "../Add-on/ZoomE";
import { Command_TestParseEdgeSealDir } from "../Add-on/test/TestParseEdgeSealDir";
import { Command_TestTape } from "../Add-on/test/TestTape";
import { TestIntersect } from "../Add-on/test/testIntersect";
import { Command_UpdateLight } from "../Add-on/testEntity/CMD_UpdateLight";
import { Command_DebugTemplateAssocCount } from "../Add-on/testEntity/DebugShowTemplateAssocEntityCount";
import { Test } from "../Add-on/testEntity/test";
import { Command_TestBoundaryBox } from "../Add-on/testEntity/TestBoundaryBox";
import { Command_TestBox } from "../Add-on/testEntity/TestBox";
import { TestCollision } from "../Add-on/testEntity/testCollision";
import { TestTargeOnCurve } from "../Add-on/testEntity/TestCurve";
import { Command_TestDrawEdgeGeometry } from "../Add-on/testEntity/TestDrawEdgeGeometry";
import { Command_TestLoadFbx } from "../Add-on/testEntity/TestFbx";
@ -231,31 +243,20 @@ import { Command_TestRegionParse } from "../Add-on/testEntity/TestRegionParse";
import { Command_TestSweepMaxLength } from "../Add-on/testEntity/TestSweepMaxLength";
import { Command_DeleteTemplate } from "../Add-on/testEntity/TestTemplateDelete";
import { Command_TestVPath } from "../Add-on/testEntity/TestVPath";
import { TestFb } from "../Add-on/TestFb";
import { Command_TestPointPickParse } from "../Add-on/TestPointPickParse";
import { Text2Curve } from "../Add-on/Text2Curve";
import { Command_ToggleUI } from "../Add-on/ToggleUI";
import { Command_Trim } from "../Add-on/Trim";
import { Test } from "../Add-on/testEntity/test";
import { TestCollision } from "../Add-on/testEntity/testCollision";
import { Command_Curve2Polyline } from "../Add-on/twoD2threeD/Command_Curve2Polyline";
import { Command_Curve2VSBox } from "../Add-on/twoD2threeD/Command_Curve2VSBox";
import { Command_ParseBoardName } from "../Add-on/twoD2threeD/ParseBoardName";
import { Polyline2Board } from "../Add-on/twoD2threeD/Polyline2Board";
import { Rect2Board } from "../Add-on/twoD2threeD/Rect2Board";
import { Redo, Undo } from "../Add-on/Undo";
import { ViewChange } from "../Add-on/ViewChange";
import { Command_FixView } from "../Add-on/ViewCtrl/FixView";
import { EditFrame } from "../Add-on/ViewortConfig/EditFrame";
import { EditViewport } from "../Add-on/ViewortConfig/EditViewport";
import { OneKeyLayout } from "../Add-on/Viewport/OneKeyLayout";
import { OneKeyPrint } from "../Add-on/Viewport/OneKeyPrint";
import { Command_Wblock } from "../Add-on/Wblock";
import { Command_ZoomObject, ZoomE } from "../Add-on/ZoomE";
import { CommandNames } from "../Common/CommandNames";
import { IsTest } from "../Common/Deving";
import { Command_SelectEntity } from "../Common/SelectEntity";
import { Dimension } from "../DatabaseServices/Dimension/Dimension";
import { Board } from "../DatabaseServices/Entity/Board";
import { Curve } from "../DatabaseServices/Entity/Curve";
import { TemplateArray, TemplateAttach, TemplateAttach2 } from "../DatabaseServices/Template/TemplateTest";
import { DbText } from "../DatabaseServices/Text/Text";
import { RenderType } from "../GraphicsSystem/RenderType";
import { Command_TestContainer } from "../Nest/Test/TestContainer";
@ -839,6 +840,11 @@ export function registerCommand()
//在线客服
commandMachine.RegisterCommand(CommandNames.SendCADFileToKF, new Command_SendCADFileOnKf());
//修改注册位置
commandMachine.RegisterCommand("Attach", new TemplateAttach());
commandMachine.RegisterCommand("Attach2", new TemplateAttach2());
commandMachine.RegisterCommand("TemplateArray", new TemplateArray());
}
export async function LimitCommand()

@ -2,7 +2,7 @@ import { app } from "../../ApplicationServices/Application";
import { arraySortByNumber } from "../../Common/ArrayExt";
import { curveLinkGroup } from "../../Common/CurveUtils";
import { KeyWord } from "../../Common/InputState";
import { Log } from "../../Common/Log";
import { Log, LogType } from "../../Common/Log";
import { Singleton } from "../../Common/Singleton";
import { Curve } from "../../DatabaseServices/Entity/Curve";
import { Point } from "../../DatabaseServices/Entity/Point";
@ -69,7 +69,7 @@ export class DBClickPolyline extends Singleton
execStatus = await this.Join();
}
else
Log("无法合并闭合多段线");
Log("无法合并闭合多段线", LogType.Error);
break;
case "E": //编辑顶点

@ -2,6 +2,7 @@ import { MathUtils, Matrix4, Object3D, Vector3 } from 'three';
import * as xaop from 'xaop';
import { ApplicationService } from '../ApplicationServices/Application';
import { InputState } from '../Common/InputState';
import { LogType } from '../Common/Log';
import { Entity } from '../DatabaseServices/Entity/Entity';
import { angle } from '../Geometry/GeUtils';
import { Orbit } from '../Geometry/Orbit';
@ -10,7 +11,7 @@ import CameraStateManage from '../UI/Components/CameraControlButton/CameraState/
import { CommandInputManage } from '../UI/Components/CommandInput/CommandInputManage';
import { MaskManage } from '../UI/Components/Modal/MaskManage';
import { ModalManage } from '../UI/Components/Modal/ModalsManage';
import { CommandStore } from '../UI/Store/CommandStore';
import { CommandStore, MsgInfo } from '../UI/Store/CommandStore';
import { ContextMenuServices } from './ContextMenu';
import { GetDistanceServices } from './GetDistanceServices';
import { GetEntityServices } from './GetEntityServices';
@ -106,9 +107,13 @@ export class Editor
/**
* .
*/
Prompt(msg: string)
Prompt(msg: string, type?: LogType, entity?: Entity[])
{
this.CommandStore.Prompt(msg);
this.CommandStore.Prompt(msg, type, entity);
}
InteractionPrompt(info: MsgInfo[], type?: LogType)
{
this.CommandStore.InteractionPrompt(info, type);
}
get UCSMatrix(): Matrix4
{

@ -3,6 +3,7 @@ import { end } from 'xaop';
import { app } from '../ApplicationServices/Application';
import { InputState, KeyWord } from '../Common/InputState';
import { KeyBoard, MouseKey } from '../Common/KeyEnum';
import { LogType } from '../Common/Log';
import { GetEntity, IsEntity } from '../Common/Utils';
import { IsBetweenA2B } from '../Geometry/GeUtils';
import { CursorMode } from '../GraphicsSystem/Cursor';
@ -198,7 +199,7 @@ export class GetEntityServices implements EditorService
if (!this.prompt.NotNone || res.Status === PromptStatus.OK)
this._Return(this.PickEntity());
else
this._Editor.Prompt("禁止空选择!");
this._Editor.Prompt("禁止空选择!", LogType.Error);
return true;
}
case MouseKey.Right:

@ -9,6 +9,7 @@ import { DisposeThreeObj } from '../Common/Dispose';
import { safeEval } from '../Common/eval';
import { InputState, KeyWord, MenuDividerKWD } from '../Common/InputState';
import { KeyBoard, MouseKey } from '../Common/KeyEnum';
import { LogType } from '../Common/Log';
import { Entity } from '../DatabaseServices/Entity/Entity';
import { BufferGeometryUtils } from '../Geometry/BufferGeometryUtils';
import { isParallelTo } from '../Geometry/GeUtils';
@ -43,7 +44,7 @@ export class GetPointServices implements EditorService
{
if (!this.curPoint)//在动态输入框输入错误时,依旧点击鼠标造成错误
{
app.Editor.Prompt("输入错误!");
app.Editor.Prompt("输入错误!", LogType.Error);
return;
}
this.UpdateCurPointEvent();//触摸的时候会因为没有鼠标移动导致这个位置错误!
@ -255,7 +256,7 @@ export class GetPointServices implements EditorService
}
catch (error)
{
app.Editor.Prompt("动态拾取点回调错误!");
app.Editor.Prompt("动态拾取点回调错误!", LogType.Error);
console.log(error);
}
}));
@ -305,7 +306,7 @@ export class GetPointServices implements EditorService
if (prompt.AllowNone)
this.ReturnNone();
else
app.Editor.Prompt("需要点击一个点或者输入一个点!");
app.Editor.Prompt("需要点击一个点或者输入一个点!", LogType.Error);
return;
}
@ -426,7 +427,7 @@ export class GetPointServices implements EditorService
if (prompt.AllowNone)
this.ReturnNone();
else
app.Editor.Prompt("需要点击一个点或者输入一个点!");
app.Editor.Prompt("需要点击一个点或者输入一个点!", LogType.Error);
return;
}
if (typeof inputData === "string")

@ -3,6 +3,7 @@ import { end } from "xaop";
import { app } from "../ApplicationServices/Application";
import { ColorMaterial } from "../Common/ColorPalette";
import { InputState } from "../Common/InputState";
import { LogType } from "../Common/Log";
import { BufferGeometryUtils } from "../Geometry/BufferGeometryUtils";
import { midPoint } from "../Geometry/GeUtils";
import { PointShapeUtils } from "../Geometry/PointShapeUtils";
@ -94,13 +95,13 @@ export class GetRectPointServices
if (!this.dynPrompt.xDynIpt.IsLock && !this.dynPrompt.yDynIpt.IsLock)
{
app.Editor.Prompt("需要点击一个点或者输入一个点!");
app.Editor.Prompt("需要点击一个点或者输入一个点!", LogType.Error);
return;
}
if (isNaN(this.dynPrompt.Width) || isNaN(this.dynPrompt.Height))
{
app.Editor.Prompt("数值错误!");
app.Editor.Prompt("数值错误!", LogType.Error);
return;
}

@ -2,6 +2,7 @@ import hotkeys from 'hotkeys-js-ext';
import { Object3D } from 'three';
import { end } from 'xaop';
import { InputState } from '../Common/InputState';
import { LogType } from '../Common/Log';
import { Editor } from './Editor';
import { GetEntityPrompt, GetSelectionPrompt } from "./PromptOptions";
import { PromptSsgetResult, PromptStatus } from './PromptResult';
@ -117,7 +118,7 @@ export class SsgetServiecs
this.ReturnOk(true, true);
return;
}
this._Editor.Prompt("禁止空选择!");
this._Editor.Prompt("禁止空选择!", LogType.Error);
break;
}
case PromptStatus.OK:

@ -1,6 +1,6 @@
import { end } from "xaop";
import { Gesture_DrawLayerBoard } from "../Add-on/Gesture/Gesture_DrawLayerBoard";
import { Log } from "../Common/Log";
import { Log, LogType } from "../Common/Log";
import { Gesture } from "./Gesture";
export function RegisterGesture(gt: Gesture)
{
@ -16,7 +16,7 @@ export function RegisterGesture(gt: Gesture)
return true;
}
Log("未注册的手势!");
Log("未注册的手势!", LogType.Error);
};
exec();
});

@ -4,6 +4,7 @@ import { end } from 'xaop';
import { app } from '../ApplicationServices/Application';
import { InputState } from '../Common/InputState';
import { KeyBoard, MouseKey } from '../Common/KeyEnum';
import { LogType } from '../Common/Log';
import { IsBetweenA2B } from '../Geometry/GeUtils';
import { CursorMode } from '../GraphicsSystem/Cursor';
import { IViewer } from '../GraphicsSystem/IView';
@ -219,7 +220,7 @@ export class SelectControls implements EditorService
if (this._Viewer.IsLookSelect === true)
return;
this._Editor.Prompt("取消");
this._Editor.Prompt("取消", LogType.Command);
this.Cancel();
}
}
@ -248,18 +249,18 @@ export class SelectControls implements EditorService
if (!noParseGroup)
groupCount = selectData.SelectGroup(this.Filter);
if (groupCount > 0)
this._Editor.Prompt(`编组${groupCount}个!`);
this._Editor.Prompt(`编组${groupCount}个!`, LogType.Command);
//备份个数
let count = selectData._SelectList.size;
this._Editor.Prompt(`选中${count}个!`);
this._Editor.Prompt(`选中${count}个!`, LogType.Command);
this._SelectSet.AddSelect(selectData);
//计算重复的个数
let count2 = selectData._SelectList.size;
if (count2 !== count)
this._Editor.Prompt(`重复${count - count2}个!`);
this._Editor.Prompt(`重复${count - count2}个!`, LogType.Command);
this.UpdateSelectEvent();
}
@ -267,7 +268,7 @@ export class SelectControls implements EditorService
RemoveSelect(selectData: SelectSetBase)
{
selectData.SelectGroup(this.Filter);
this._Editor.Prompt(`取消选择${selectData._SelectList.size}个.`);
this._Editor.Prompt(`取消选择${selectData._SelectList.size}个.`, LogType.Command);
this._SelectSet.RemoveSelect(selectData);
this.UpdateSelectEvent();
}

@ -2,7 +2,7 @@ import { AmbientLight, Scene } from "three";
import { app } from "../ApplicationServices/Application";
import { HostApplicationServices } from "../ApplicationServices/HostApplicationServices";
import { DisposeThreeObj, Object3DRemoveAll } from "../Common/Dispose";
import { Log } from "../Common/Log";
import { Log, LogType } from "../Common/Log";
import { commandMachine } from "./CommandMachine";
import { CommandState } from "./CommandState";
@ -55,12 +55,12 @@ export class TempEditor
{
if (!this._EditorIng)
{
Log("重复退出编辑模式!");
Log("重复退出编辑模式!", LogType.Error);
return;
}
if (CommandState.CommandIng)
{
Log(`${commandMachine.LastExecCmd}命令执行中!`);
Log(`${commandMachine.LastExecCmd}命令执行中!`, LogType.Error);
return;
}

@ -1,6 +1,7 @@
import { Vector3 } from "three";
import { app } from "../../ApplicationServices/Application";
import { KeyWord } from "../../Common/InputState";
import { LogType } from "../../Common/Log";
import { GetEntity } from "../../Common/Utils";
import { Board } from "../../DatabaseServices/Entity/Board";
import { BoxSolid } from "../../DatabaseServices/Entity/BoxSolid";
@ -185,7 +186,7 @@ export class PointSelectSpace
let ptSelect = new PointSelectBoards(vcs, view, visibleObjects);
if (ptSelect.SelectBoards.length === 0 && !isDynamic)
app.Editor.Prompt("请选择有效的板件,或者周围没有效板件");
app.Editor.Prompt("请选择有效的板件,或者周围没有效板件", LogType.Warning);
else
await this.ParseByPointSelect(ptSelect, isDynamic);

@ -1,6 +1,6 @@
import { EndType, JoinType } from "js-angusj-clipper/web";
import { Box3, Vector3 } from "three";
import { Log } from "../../Common/Log";
import { Log, LogType } from "../../Common/Log";
import { Circle } from "../../DatabaseServices/Entity/Circle";
import { Curve } from "../../DatabaseServices/Entity/Curve";
import { Polyline } from "../../DatabaseServices/Entity/Polyline";
@ -204,7 +204,7 @@ export function Curves2Parts(curves: (Polyline | Circle)[], binPath: Path, KnifR
}
catch (error)
{
Log("曲线转零件失败!");
Log("曲线转零件失败!", LogType.Error);
}
}
return parts;

@ -4,11 +4,11 @@ import { lookOverBoardInfosTool } from "../Add-on/LookOverBoardInfos/LookOverBoa
import { HostApplicationServices } from "../ApplicationServices/HostApplicationServices";
import { EBoardKeyList } from "../Common/BoardKeyList";
import { MergeCurvelist } from "../Common/CurveUtils";
import { Log } from "../Common/Log";
import { ParseExpr, safeEval } from "../Common/eval";
import { InteractionLog, LogType } from "../Common/Log";
import { ShowSelectObjects } from "../Common/ShowSelectObjects";
import { Intent, Toaster } from "../Common/Toaster";
import { FixedNotZero, LINK_FUZZ } from "../Common/Utils";
import { ParseExpr, safeEval } from "../Common/eval";
import { CylinderHole, GangDrillType } from "../DatabaseServices/3DSolid/CylinderHole";
import { ExtrudeHole } from "../DatabaseServices/3DSolid/ExtrudeHole";
import { Hole } from "../DatabaseServices/3DSolid/Hole";
@ -24,7 +24,7 @@ import { HardwareCompositeEntity } from "../DatabaseServices/Hardware/HardwareCo
import { HardwareTopline } from "../DatabaseServices/Hardware/HardwareTopline";
import { Shape } from "../DatabaseServices/Shape";
import { CanDrawHoleFuzz } from "../Geometry/DrillParse/BoardGetFace";
import { IsBetweenA2B, MoveMatrix, XAxis, angleTo, equaln, equalv3, isIntersect2, isParallelTo, isPerpendicularityTo } from "../Geometry/GeUtils";
import { angleTo, equaln, equalv3, IsBetweenA2B, isIntersect2, isParallelTo, isPerpendicularityTo, MoveMatrix, XAxis } from "../Geometry/GeUtils";
import { GetBoardSealingData, GetSealedBoardContour } from "../GraphicsSystem/CalcEdgeSealing";
import { FeedingToolPath, GetModelingFromCustomDrill } from "../GraphicsSystem/ToolPath/FeedingToolPath";
import { EMetalsType, IHardwareOption, IToplineOption } from "../UI/Components/RightPanel/RightPanelInterface";
@ -701,19 +701,19 @@ export namespace Production
if (!(z0 < CanDrawHoleFuzz || z1 > (br.Thickness - CanDrawHoleFuzz)))//禁止在中间挖洞
{
Log(`警告:板:{${br.Name}}的孔嵌在板中间,无法加工,已经跳过!`);
InteractionLog([{ msg: "警告:" }, { msg: `板件${br.Name}`, entity: [br] }, { msg: "的孔嵌在板中间,无法加工,已经跳过!" }], LogType.Warning);
return;
}
if (!(outline.PtInCurve(p)))//在轮廓内
{
Log(`警告:板:{${br.Name}}的孔不在板轮廓内,无法加工,已经跳过!`);
InteractionLog([{ msg: "警告:" }, { msg: `板件${br.Name}`, entity: [br] }, { msg: "的孔不在板轮廓内,无法加工,已经跳过!" }], LogType.Warning);
return;
}
if (groovesOutlines.some(g => g.PtInCurve(p)))//在洞内
{
Log(`警告:板:{${br.Name}}的孔在造型内,无法加工,已经跳过!`);
InteractionLog([{ msg: "警告:" }, { msg: `板件${br.Name}`, entity: [br] }, { msg: "的孔在造型内,无法加工,已经跳过!" }], LogType.Warning);
return;
}
@ -751,7 +751,7 @@ export namespace Production
let pt = outline.IntersectWith(line, 0)[0];
if (!pt)
{
Log(`警告:板:${br.Name}的排钻嵌在板件内部,已经跳过!`);
InteractionLog([{ msg: "警告:" }, { msg: `板件${br.Name}`, entity: [br] }, { msg: "的排钻嵌在板件内部,已经跳过!" }], LogType.Warning);
return;
}
let position = pt.clone().setZ(oldZ);

@ -12,11 +12,11 @@ import { app } from "../../../ApplicationServices/Application";
import { arrayRemove } from "../../../Common/ArrayExt";
import { EBoardKeyList } from "../../../Common/BoardKeyList";
import { CheckObjectType, CheckoutValid } from "../../../Common/CheckoutVaildValue";
import { safeEval } from "../../../Common/eval";
import { FS } from "../../../Common/FileSystem";
import { KeyBoard } from "../../../Common/KeyEnum";
import { Log } from "../../../Common/Log";
import { Log, LogType } from "../../../Common/Log";
import { FixedNotZero } from "../../../Common/Utils";
import { safeEval } from "../../../Common/eval";
import { CylinderHole } from "../../../DatabaseServices/3DSolid/CylinderHole";
import { CommandHistoryRecord } from "../../../DatabaseServices/CommandHistoryRecord";
import { CreateObjectData } from "../../../DatabaseServices/CreateObjectData";
@ -34,7 +34,7 @@ import { SelectSetBase } from "../../../Editor/SelectBase";
import { userConfig } from "../../../Editor/UserConfig";
import { equaln } from "../../../Geometry/GeUtils";
import { IHardwareType } from "../../../Production/Product";
import { bbsEditorStore, TotalTabbarTitlesInfos } from "../../Store/BBSEditorStore";
import { TotalTabbarTitlesInfos, bbsEditorStore } from "../../Store/BBSEditorStore";
import { EFindType } from "../../Store/BoardFindInterface";
import { ComposingType, FaceDirection, LinesType } from "../../Store/BoardInterface";
import { userConfigStore } from "../../Store/UserConfigStore";
@ -547,7 +547,7 @@ export class LookOverBoardInfosModal extends React.Component<LookOverBoardInfosM
}
catch (error)
{
Log("输入的搜索条件错误!");
Log("输入的搜索条件错误!", LogType.Error);
}
}
let res = this.boardDataInArray.slice(1).filter((b) => this.RegxpTest(b.arr.join(''), regexpArr));

@ -7,7 +7,7 @@ import { ExtrudeApplyContour, SelectExtrudeContour, selectOutlinePosition } from
import { app } from "../../../ApplicationServices/Application";
import { CheckObjectType } from "../../../Common/CheckoutVaildValue";
import { ConverCircleToPolyline, curveLinkGroup } from "../../../Common/CurveUtils";
import { Log } from "../../../Common/Log";
import { Log, LogType } from "../../../Common/Log";
import { NormalMatrix } from "../../../Common/Matrix4Utils";
import { FixedNotZero, GetEntity } from "../../../Common/Utils";
import { Contour } from "../../../DatabaseServices/Contour";
@ -25,7 +25,7 @@ import { PromptStatus } from "../../../Editor/PromptResult";
import { SelectBox, SelectType } from "../../../Editor/SelectBox";
import { CreateContours } from "../../../Geometry/CreateContour2";
import { ContourTreeNode } from "../../../Geometry/ExtrudeMeshGeomBuilder/ExtrudeEdgeGeometry2";
import { AsVector2, equaln, isParallelTo, MoveMatrix } from "../../../Geometry/GeUtils";
import { AsVector2, MoveMatrix, equaln, isParallelTo } from "../../../Geometry/GeUtils";
import { BoardConfigOption, BoardProcessOption, FaceDirection, IGrooveOption, IUiOption } from '../../Store/BoardInterface';
import { RightPanelStore } from "../../Store/RightPanelStore/RightPanelStore";
import { RightTabId } from "../RightPanel/RightPanel";
@ -769,7 +769,7 @@ export class BoardConfigModal extends React.Component<BoardConfigProps, {}>{
{
if (color > store.modelingItems.length)
{
Log(`${color}色号超出范围`);
Log(`${color}色号超出范围`, LogType.Warning);
continue;
}
let group = curveLinkGroup(cus) as (Arc | Line)[][];

@ -130,6 +130,7 @@ export class ConfigTagCommand
{
this._CustomTagCommandMap.set(tag.tagName, { cmdName: this._ConfigTagCommandMap.get(tag.type), configName: tag.configName, type: tag.type }); //注册自定义命令
commandMachine.CommandNameSet.add(tag.tagName);
commandMachine.CommandSet.add({command:tag.tagName, chName:tag.configName})
}
}

@ -3,26 +3,57 @@ import { observer } from 'mobx-react';
import * as React from 'react';
import { CommandStore } from "../../Store/CommandStore";
import { InputHint } from "../commandLineInput/InputHint";
import CommandTypeModal from "./CommandTypeModal";
interface Props
{
ShowOutput: (event?: React.MouseEvent<HTMLElement, MouseEvent>) => void;
}
interface IState
{
showCommandTypeModal: boolean;//显示日志信息过滤设置的弹框
}
@observer
export class CommandInput extends React.Component<Props, null>
export class CommandInput extends React.Component<Props, IState>
{
constructor(props)
{
super(props);
}
// componentDidMount(): void
// {
// document.addEventListener("keydown", (e: KeyboardEvent) =>
// {
// this.setState({ showCommandTypeModal: false });
// });
// document.addEventListener("click", (e: React.MouseEvent<HTMLInputElement, MouseEvent>) =>
// {
// console.log("e.target", e.target);
// if (e.target.className.include("command-setting-wrench"))
// {
// this.setState({ showCommandTypeModal: false });
// }
// });
// }
render()
{
let store = CommandStore.GetInstance();
const store = CommandStore.GetInstance();
return (
<div className="command-input-area" style={{ display: "flex" }}>
<div className="command-input-area" style={{ display: "flex" }} >
{store.showCmdModal ? <CommandTypeModal store={store} /> : null}
<div style={{ display: "flex", width: "100%", position: "relative" }}>
<div className="drag-area" data-id="dragArea" />
<Button
icon="wrench"
minimal={true}
small={true}
onClick={() =>
{
store.OnHandleShowCmdModalChange(!store.showCmdModal);
}}
/>
<Button
icon={true ? "maximize" : "minimize"}

@ -0,0 +1,63 @@
import { Checkbox, Icon, IconName, MaybeElement } from "@blueprintjs/core";
import { observer } from "mobx-react";
import React, { useEffect, useRef } from 'react';
import { LogType } from "../../../Common/Log";
import { CommandStore } from "../../Store/CommandStore";
const CommandTypeModal = (props: { store: CommandStore; }) =>
{
const { store } = props;
const wrench = useRef<HTMLDivElement>(null);
useEffect(() =>
{
document.addEventListener("click", ClickHiddenModal, false);
document.addEventListener("keydown", KeyDownHiddenModal, false);
return () =>
{
document.removeEventListener("click", ClickHiddenModal, false);
document.removeEventListener("keydown", KeyDownHiddenModal, false);
};
}, [store.showCmdModal]);
const ClickHiddenModal = (e: MouseEvent) =>
{
const target = e.target as HTMLElement;
if (wrench.current && !wrench.current.contains(target))
store.OnHandleShowCmdModalChange(false);
};
const KeyDownHiddenModal = () =>
{
store.OnHandleShowCmdModalChange(false);
};
const commandTypeList = [
{ label: "全部", type: LogType.All },
{ label: "错误", icon: "error", type: LogType.Error },
{ label: "警告", icon: "warning-sign", type: LogType.Warning },
{ label: "信息", icon: "info-sign", type: LogType.Info },
{ label: "命令", icon: "console", type: LogType.Command },
];
return <div className={"command-setting-wrench"} ref={wrench}>
{
commandTypeList.map((commandType) => (
<Checkbox
checked={store.showCmdTypeList.has(commandType.type)}
onClick={(e) =>
{
store.OnHandleCommandTypeChange(commandType.type);
}}
>
{commandType.type === LogType.All ? null : <Icon icon={commandType.icon as IconName | MaybeElement} style={{ marginRight: "4px" }} className={`command-${commandType.icon}`} />}
<span >{commandType.label}</span>
</Checkbox>
))
}
<div className="command-eject" onClick={() => { store.OnHandleShowCmdModalChange(false); }}> <Icon icon="eject" /></div>
</div>;
};
export default observer(CommandTypeModal);

@ -11,22 +11,23 @@ export class TransparentTerminal extends React.Component<{}, {}>
{
render()
{
const store = CommandStore.GetInstance();
return (
<div
id="TransTerminal"
style={{
height: 0,
position: "relative",
pointerEvents: "none",
display: CommandStore.GetInstance().isTransparentTerminalShow ? "block" : "none"
// pointerEvents: "none",//保证点击实体的按钮可用
display: store.isTransparentTerminalShow ? "block" : "none"
}}
>
<div
id="TerminalTransparent"
className='terminal-output-area-transparent flexCol'
style={{
height: 100,
top: -100,
height: 110,
top: -110,
overflow: "hidden",
position: "absolute",
}}
@ -34,7 +35,14 @@ export class TransparentTerminal extends React.Component<{}, {}>
<div className='terminal-pusher'></div>
<div className='terminal-output'
>
{CommandStore.GetInstance().promptList.slice(-5).map(cmd => <CommandLine key={cmd.key} msg={cmd} />)}
{
store.promptList.slice(-5).map(cmd =>
{
if (store.showCmdTypeList.has(cmd.type))
return <CommandLine key={cmd.key} msg={cmd} />;
return null;
})
}
</div>
</div>

@ -1,11 +1,50 @@
import * as React from 'react';
import { app } from '../../ApplicationServices/Application';
import { CommandMsg } from '../Store/CommandStore';
//每行日志输出 {命令调用或者其他的日志}
export class CommandLine extends React.Component<{ msg: CommandMsg; }, {}>
{
render()
{
return <div className="terminal-commandResult"><span>{this.props.msg.msg}</span></div>;
const { msg } = this.props;
return (
<div className="terminal-commandResult">
<span className={`terminal-${msg.type.toLocaleLowerCase()}`}>
{
msg.genre === "normal" ?
<>
{msg.msg}
{msg.entity && msg.entity.length > 0 ?
<b
className='terminal-control'
onClick={() =>
{
app.Editor.SetSelection(msg.entity);
app.Viewer.ZoomtoEntitys(msg.entity);
}}
>
</b> : null}
</> :
<>
{msg.info && msg.info.map((v) =>
{
if (v.entity && v.entity.length > 0)
return <strong className='strong-message' onClick={() =>
{
app.Editor.SetSelection(v.entity);
app.Viewer.ZoomtoEntitys(v.entity);
}}>
{v.msg}
</strong>;
return <span className="normal-message">{v.msg}</span>;
})}
</>
}
</span>
</div>
);
}
}

@ -15,6 +15,7 @@ export class CommandLineContainer extends React.Component<{}, null>
}
render()
{
const store = CommandStore.GetInstance();
return (
<div
id="TerminalOutputArea"
@ -26,7 +27,14 @@ export class CommandLineContainer extends React.Component<{}, null>
<div className='terminal-output'
ref={el => { this._CommandListContainer = el; }}
>
{CommandStore.GetInstance().promptList.map(cmd => <CommandLine key={cmd.key} msg={cmd} />)}
{
store.promptList.map(cmd =>
{
if (store.showCmdTypeList.has(cmd.type))
return <CommandLine key={cmd.key} msg={cmd} />;
return null;
})
}
</div>
</div>
);

@ -17,6 +17,7 @@ enum TipType
InputNull = 1, //空输入
StrIllegal = 2, //非法字符
IsExist = 4, //重复
Back = 5, // 还原
}
export interface CommandItemProps
@ -26,7 +27,7 @@ export interface CommandItemProps
}
/**
*
* (F1)
* TODO:
*/
@ -68,7 +69,7 @@ export class CommandItem extends React.Component<CommandItemProps, {}>{
app.Editor.ModalManage.Destory();
commandMachine.ExecCommand(command.command);
};
handleOnChange = () =>
handleOnChange = (IsBack = false) =>
{
if (this.isCNInput)
{
@ -76,7 +77,6 @@ export class CommandItem extends React.Component<CommandItemProps, {}>{
return;
}
this.flag = TipType.OK;
let target = this._CmdInputEl;
let value = target.value.trim().toUpperCase();
let selection = target.selectionEnd;
@ -84,6 +84,15 @@ export class CommandItem extends React.Component<CommandItemProps, {}>{
target.value = value;
target.selectionEnd = selection; //大写赋值后光标保持不动
if (IsBack)
{
this.flag = TipType.Back;
return;
}
this.flag = TipType.OK;
if (commandReg.test(value))
{
this.flag |= TipType.StrIllegal;
@ -109,11 +118,13 @@ export class CommandItem extends React.Component<CommandItemProps, {}>{
let cmdServer = CommandServer.GetInstance();
const commandData = this.props.commandData;
if (this.flag === TipType.OK)
if (this.flag === TipType.OK || this.flag === TipType.Back)
{
commandData.customize = this._CmdInputEl.value.toUpperCase();
//自定义
if (commandData.customize === commandData.defaultCustom)
commandData.customize = undefined;
cmdServer.ChangeCustonCommand(commandData);
}
else
@ -150,11 +161,11 @@ export class CommandItem extends React.Component<CommandItemProps, {}>{
outline: "none"
};
let errorMsg = "";
if (this.flag & TipType.InputNull)
if (this.flag === TipType.InputNull)
errorMsg = "命令不能为空!";
if (this.flag & TipType.StrIllegal)
if (this.flag === TipType.StrIllegal)
errorMsg = `命令须为英文字符!`;
if (this.flag & TipType.IsExist)
if (this.flag === TipType.IsExist)
errorMsg = "命令重复!";
const store = this.props;
@ -192,7 +203,7 @@ export class CommandItem extends React.Component<CommandItemProps, {}>{
}}
onFocus={e => e.target.select()}
onClick={(e) => e.stopPropagation()}
onChange={this.handleOnChange}
onChange={() => this.handleOnChange()}
onBlur={this.handleOnBlur}
/>
</Tooltip>
@ -241,7 +252,7 @@ export class CommandItem extends React.Component<CommandItemProps, {}>{
else
this._CmdInputEl.value = this.props.commandData.command;
this.handleOnChange();
this.handleOnChange(true);
this.handleOnBlur();
}}
text="确定" />

@ -29,6 +29,7 @@ export interface ICommand
customize?: string,//自定义命令
readonly time?: string,//使用时间(待定)
readonly onlyHasHotkeys?: boolean,//代码定义的systemHotkeys热键没有命令 /*Ctrl+P Ctrl+Alt+E */
readonly noShowCommand?: boolean,//不展示默认的命令(在下方的命令感知里)
}
const HelpUrlBase = "https://cfcad.cn/help/#/";
@ -1224,6 +1225,7 @@ export const CommandList: ICommand[] = [
link: `#`,
defaultCustom: CommandNames.CameraSnapshootSaveIndex + "-1",
command: CommandNames.CameraSnapshootSaveIndex + "-1",
noShowCommand: true,
defaultHotkeys: HotkeyList.CA1,
type: "视图",
chName: "保存相机状态一",
@ -1234,6 +1236,7 @@ export const CommandList: ICommand[] = [
link: `#`,
defaultCustom: CommandNames.CameraSnapshootSaveIndex + "-2",
command: CommandNames.CameraSnapshootSaveIndex + "-2",
noShowCommand: true,
defaultHotkeys: HotkeyList.CA2,
type: "视图",
chName: "保存相机状态二",
@ -1244,6 +1247,7 @@ export const CommandList: ICommand[] = [
link: `#`,
defaultCustom: CommandNames.CameraSnapshootSaveIndex + "-3",
command: CommandNames.CameraSnapshootSaveIndex + "-3",
noShowCommand: true,
defaultHotkeys: HotkeyList.CA3,
type: "视图",
chName: "保存相机状态三",
@ -1254,6 +1258,7 @@ export const CommandList: ICommand[] = [
link: `#`,
defaultCustom: CommandNames.CameraSnapshootSaveIndex + "-4",
command: CommandNames.CameraSnapshootSaveIndex + "-4",
noShowCommand: true,
defaultHotkeys: HotkeyList.CA4,
type: "视图",
chName: "保存相机状态四",
@ -1264,6 +1269,7 @@ export const CommandList: ICommand[] = [
link: `#`,
defaultCustom: CommandNames.CameraSnapshootSaveIndex + "-5",
command: CommandNames.CameraSnapshootSaveIndex + "-5",
noShowCommand: true,
defaultHotkeys: HotkeyList.CA5,
type: "视图",
chName: "保存相机状态五",
@ -1274,6 +1280,7 @@ export const CommandList: ICommand[] = [
link: `#`,
defaultCustom: CommandNames.CameraSnapshootSaveIndex + "-6",
command: CommandNames.CameraSnapshootSaveIndex + "-6",
noShowCommand: true,
defaultHotkeys: HotkeyList.CA6,
type: "视图",
chName: "保存相机状态六",
@ -1284,6 +1291,7 @@ export const CommandList: ICommand[] = [
link: `#`,
defaultCustom: CommandNames.CameraSnapshootSaveIndex + "-7",
command: CommandNames.CameraSnapshootSaveIndex + "-7",
noShowCommand: true,
defaultHotkeys: HotkeyList.CA7,
type: "视图",
chName: "保存相机状态七",
@ -1294,6 +1302,7 @@ export const CommandList: ICommand[] = [
link: `#`,
defaultCustom: CommandNames.CameraSnapshootSaveIndex + "-8",
command: CommandNames.CameraSnapshootSaveIndex + "-8",
noShowCommand: true,
defaultHotkeys: HotkeyList.CA8,
type: "视图",
chName: "保存相机状态八",
@ -1304,6 +1313,7 @@ export const CommandList: ICommand[] = [
link: `#`,
defaultCustom: CommandNames.CameraSnapshootSaveIndex + "-9",
command: CommandNames.CameraSnapshootSaveIndex + "-9",
noShowCommand: true,
defaultHotkeys: HotkeyList.CA9,
type: "视图",
chName: "保存相机状态九",
@ -1314,6 +1324,7 @@ export const CommandList: ICommand[] = [
link: `#`,
defaultCustom: CommandNames.CameraSnapshootRestore + "-1",
command: CommandNames.CameraSnapshootRestore + "-1",
noShowCommand: true,
defaultHotkeys: HotkeyList.A1,
type: "视图",
chName: "还原相机状态一",
@ -1324,6 +1335,7 @@ export const CommandList: ICommand[] = [
link: `#`,
defaultCustom: CommandNames.CameraSnapshootRestore + "-2",
command: CommandNames.CameraSnapshootRestore + "-2",
noShowCommand: true,
defaultHotkeys: HotkeyList.A2,
type: "视图",
chName: "还原相机状态二",
@ -1334,6 +1346,7 @@ export const CommandList: ICommand[] = [
link: `#`,
defaultCustom: CommandNames.CameraSnapshootRestore + "-3",
command: CommandNames.CameraSnapshootRestore + "-3",
noShowCommand: true,
defaultHotkeys: HotkeyList.A3,
type: "视图",
chName: "还原相机状态三",
@ -1344,6 +1357,7 @@ export const CommandList: ICommand[] = [
link: `#`,
defaultCustom: CommandNames.CameraSnapshootRestore + "-4",
command: CommandNames.CameraSnapshootRestore + "-4",
noShowCommand: true,
defaultHotkeys: HotkeyList.A4,
type: "视图",
chName: "还原相机状态四",
@ -1354,6 +1368,7 @@ export const CommandList: ICommand[] = [
link: `#`,
defaultCustom: CommandNames.CameraSnapshootRestore + "-5",
command: CommandNames.CameraSnapshootRestore + "-5",
noShowCommand: true,
defaultHotkeys: HotkeyList.A5,
type: "视图",
chName: "还原相机状态五",
@ -1364,6 +1379,7 @@ export const CommandList: ICommand[] = [
link: `#`,
defaultCustom: CommandNames.CameraSnapshootRestore + "-6",
command: CommandNames.CameraSnapshootRestore + "-6",
noShowCommand: true,
defaultHotkeys: HotkeyList.A6,
type: "视图",
chName: "还原相机状态六",
@ -1374,6 +1390,7 @@ export const CommandList: ICommand[] = [
link: `#`,
defaultCustom: CommandNames.CameraSnapshootRestore + "-7",
command: CommandNames.CameraSnapshootRestore + "-7",
noShowCommand: true,
defaultHotkeys: HotkeyList.A7,
type: "视图",
chName: "还原相机状态七",
@ -1384,6 +1401,7 @@ export const CommandList: ICommand[] = [
link: `#`,
defaultCustom: CommandNames.CameraSnapshootRestore + "-8",
command: CommandNames.CameraSnapshootRestore + "-8",
noShowCommand: true,
defaultHotkeys: HotkeyList.A8,
type: "视图",
chName: "还原相机状态八",
@ -1394,6 +1412,7 @@ export const CommandList: ICommand[] = [
link: `#`,
defaultCustom: CommandNames.CameraSnapshootRestore + "-9",
command: CommandNames.CameraSnapshootRestore + "-9",
noShowCommand: true,
defaultHotkeys: HotkeyList.A9,
type: "视图",
chName: "还原相机状态九",
@ -2586,6 +2605,7 @@ export const CommandList: ICommand[] = [
icon: IconEnum.ModuleManage,
typeId: "module",
link: `#`,
defaultCustom: CommandNames.Template,
command: CommandNames.Template,
type: "模块",
chName: "模块管理",

@ -7,10 +7,11 @@ import { Color } from "three";
import { app } from "../../../../ApplicationServices/Application";
import { CheckObjectType } from "../../../../Common/CheckoutVaildValue";
import { DataAdapter } from "../../../../Common/DataAdapter";
import { safeEval } from "../../../../Common/eval";
import { KeyBoard } from "../../../../Common/KeyEnum";
import { LogType } from "../../../../Common/Log";
import { AAType, ViewDirType } from "../../../../Common/SystemEnum";
import { FixedNotZero } from "../../../../Common/Utils";
import { safeEval } from "../../../../Common/eval";
import { ICursorConfig } from "../../../../Editor/ICursorConfig";
import { userConfig } from "../../../../Editor/UserConfig";
import { IUiOption } from "../../../Store/BoardInterface";
@ -216,7 +217,7 @@ export class DisplayConfigPanel extends React.Component<{ store: ConfigStore; }>
let val = safeEval(e.target.value);
if (isNaN(val) || val > userConfig.viewSize.maxViewHeight || val < 0.001)
{
app.Editor.Prompt('最x小值仅限于 0.001 ~ 最大值 的数!');
app.Editor.Prompt('最x小值仅限于 0.001 ~ 最大值 的数!', LogType.Error);
e.target.value = userConfig.viewSize.minViewHeight.toString();
this.errorMsg[0] = false;
}
@ -261,7 +262,7 @@ export class DisplayConfigPanel extends React.Component<{ store: ConfigStore; }>
let val = safeEval(e.target.value);
if (isNaN(val) || val < userConfig.viewSize.minViewHeight || val > 3000000)
{
app.Editor.Prompt('最大值仅限于 最小值 ~ 3000000 的数!');
app.Editor.Prompt('最大值仅限于 最小值 ~ 3000000 的数!', LogType.Error);
e.target.value = userConfig.viewSize.maxViewHeight.toString();
this.errorMsg[1] = false;
}
@ -309,7 +310,7 @@ export class DisplayConfigPanel extends React.Component<{ store: ConfigStore; }>
if (val < 0.5 || val > 0.9)
{
e.target.value = userConfig.viewSize.zoomSpeed.toString();
app.Editor.Prompt('缩放速度系数仅限0.5~0.9');
app.Editor.Prompt('缩放速度系数仅限0.5~0.9', LogType.Error);
}
else
{
@ -320,7 +321,7 @@ export class DisplayConfigPanel extends React.Component<{ store: ConfigStore; }>
else
{
e.target.value = userConfig.viewSize.zoomSpeed.toString();
app.Editor.Prompt('缩放速度系数仅限0.5~0.9');
app.Editor.Prompt('缩放速度系数仅限0.5~0.9', LogType.Error);
}
this.errorMsg[2] = false;
}}

@ -3,8 +3,9 @@ import { observable } from "mobx";
import { observer } from "mobx-react";
import * as React from 'react';
import { app } from "../../../../ApplicationServices/Application";
import { safeEval } from "../../../../Common/eval";
import { KeyBoard } from "../../../../Common/KeyEnum";
import { LogType } from "../../../../Common/Log";
import { safeEval } from "../../../../Common/eval";
import { CommandWrap } from "../../../../Editor/CommandMachine";
import { userConfig } from "../../../../Editor/UserConfig";
@ -82,7 +83,7 @@ export class TextConfigPanel extends React.Component<{}>
{
if (val <= 0 || val > 300)
{
app.Editor.Prompt('文字尺寸仅限1-300间的数字!');
app.Editor.Prompt('文字尺寸仅限1-300间的数字!', LogType.Error);
e.target.value = userConfig.textStyleOption.textHight.toString();
}
else
@ -95,7 +96,7 @@ export class TextConfigPanel extends React.Component<{}>
}
else
{
app.Editor.Prompt('文字尺寸仅限1-300间的数字!');
app.Editor.Prompt('文字尺寸仅限1-300间的数字!', LogType.Error);
e.target.value = userConfig.textStyleOption.textHight.toString();
}
}}

@ -7,7 +7,7 @@ import { SendFile } from '../../Add-on/SendCADFileOnKF';
import { app } from '../../ApplicationServices/Application';
import { CommandNames } from '../../Common/CommandNames';
import { SignUrl } from '../../Common/HostUrl';
import { Log } from '../../Common/Log';
import { Log, LogType } from '../../Common/Log';
import { Post, RequestStatus } from '../../Common/Request';
import { Entity } from '../../DatabaseServices/Entity/Entity';
import { DirectionalLight } from '../../DatabaseServices/Lights/DirectionalLight';
@ -238,7 +238,7 @@ export class TopPanel extends React.Component<{ store?: TopPanelStore; }, {}>
if (!CommandState.CommandIng && app.Editor.InputState === 0)
this.props.store.m_FileManageOpen = true;
else
app.Editor.Prompt("图形正在执行命令!");
app.Editor.Prompt("图形正在执行命令!", LogType.Warning);
};
}
@ -256,7 +256,7 @@ export class DownPanel extends React.Component<{ store: DownPanelStore; }, {}>
if (!key) return;
if (key === "isLayout" && (TempEditor.EditorIng || Entity.__ReadFileIng__))
{
Log("有实体正在绘制或者正处于编辑模式下");
Log("有实体正在绘制或者正处于编辑模式下", LogType.Error);
return;
}
if (key === "toggleDrillingReactor")

@ -9,6 +9,7 @@ import { arrayRemoveOnce } from "../../../Common/ArrayExt";
import { EBoardKeyList } from "../../../Common/BoardKeyList";
import { CheckExpr, safeEval } from "../../../Common/eval";
import { KeyBoard } from "../../../Common/KeyEnum";
import { LogType } from "../../../Common/Log";
import { FixedNotZero, isNum, ToFixed } from "../../../Common/Utils";
import { Board } from "../../../DatabaseServices/Entity/Board";
import { Entity } from "../../../DatabaseServices/Entity/Entity";
@ -504,13 +505,13 @@ export class TemplateParamDetail extends React.Component<{}> {
let result = CheckExpr(par.expr as string, paramDefine);
if (result.error !== undefined)//执行出错 反馈error
{
app.Editor.Prompt("表达式求值失败:" + result.error);
app.Editor.Prompt("表达式求值失败:" + result.error, LogType.Error);
return false;
}
else
if (typeof (result.res) !== "number")//不是数字 表达式无效
{
app.Editor.Prompt("无效表达式");
app.Editor.Prompt("无效表达式", LogType.Error);
return false;
}
else

@ -9,6 +9,7 @@ import { R2bReplaceProps } from '../../../Add-on/twoD2threeD/R2bConfigComponent'
import { app } from '../../../ApplicationServices/Application';
import { EBoardKeyList } from '../../../Common/BoardKeyList';
import { TemplateUrls } from '../../../Common/HostUrl';
import { LogType } from '../../../Common/Log';
import { DirectoryId, PostJson, RequestStatus } from '../../../Common/Request';
import { DuplicateRecordCloning } from '../../../Common/Status';
import { StoreageKeys } from '../../../Common/StoreageKeys';
@ -356,7 +357,7 @@ export class TemplateManage extends React.Component<ITemplateManage, {}> {
if (!selectSpace.ParseOK)
{
app.Editor.Prompt("未能分析出有效空间!");
app.Editor.Prompt("未能分析出有效空间!", LogType.Error);
return;
}

@ -6,13 +6,14 @@ import React, { RefObject } from "react";
import { Object3D } from "three";
import { end } from "xaop";
import { app } from "../../../ApplicationServices/Application";
import { safeEval } from "../../../Common/eval";
import { KeyBoard, KeyCode } from "../../../Common/KeyEnum";
import { LogType } from "../../../Common/Log";
import { clamp } from "../../../Common/Utils";
import { safeEval } from "../../../Common/eval";
import { DimStyleKeyCode } from "../../../DatabaseServices/DimStyle/DimstyleKeyCodeEnum";
import { AlignedDimension } from "../../../DatabaseServices/Dimension/AlignedDimension";
import { Dimension } from "../../../DatabaseServices/Dimension/Dimension";
import { DimStyleKeyCode } from "../../../DatabaseServices/DimStyle/DimstyleKeyCodeEnum";
import { commandMachine, CommandWrap } from "../../../Editor/CommandMachine";
import { CommandWrap, commandMachine } from "../../../Editor/CommandMachine";
import { CommandState } from "../../../Editor/CommandState";
import { AppToaster } from "../Toaster";
import { DimParamsPanel } from "./DimParamsPanel";
@ -253,7 +254,7 @@ export class Properties_DimPanel extends React.Component<Properties_DimPanelProp
if (!isNaN(val))
{
if (val <= 0 || val > 999)
app.Editor.Prompt('文字尺寸仅限1-999间的数字!');
app.Editor.Prompt('文字尺寸仅限1-999间的数字!', LogType.Error);
else
{
this._DimTextSize = val;
@ -267,7 +268,7 @@ export class Properties_DimPanel extends React.Component<Properties_DimPanelProp
}
}
else
app.Editor.Prompt('文字尺寸仅限1-999间的数字!');
app.Editor.Prompt('文字尺寸仅限1-999间的数字!', LogType.Error);
}}
/>
</Tooltip>

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save