!2936 优化:dtbi备注表头和扩展备注支持中英文的冒号和分号

pull/2950/head
zc 2 months ago committed by ChenX
parent 381d36d852
commit d52921eb63

@ -0,0 +1,13 @@
import { Command } from "../../Editor/CommandMachine";
export class DownloadTemplateTable implements Command
{
async exec()
{
const a = document.createElement('a');
a.href = "https://cfcad.cn/help/UpdateLog/PHOTO/ImportTemplate1.csv";
a.download = "数据绘制模板.csv"; // 指定下载文件名
a.style.display = 'none';
a.click();
}
}

@ -1,5 +1,4 @@
import { Intent } from "@blueprintjs/core";
import React from "react";
import { Matrix4, Vector3 } from "three";
import { app } from "../../ApplicationServices/Application";
import { EBoardKeyList } from "../../Common/BoardKeyList";
@ -54,23 +53,9 @@ export class DrawTemplateByImport implements Command
private keyRes: PromptResult;
async exec()
{
const toasterKey = AppToaster.show({
message:
<>
<a
style={{ textDecoration: 'underline', color: '#2d72d2', fontWeight: "bold" }}
href={"https://cfcad.cn/help/UpdateLog/PHOTO/ImportTemplate1.csv"}
download={"数据绘制模板.csv"}
>.csv</a>
</>
,
timeout: 10000,
});
FS.ChooseFile({
filter: ".csv", multiple: false, callback: async (files: FileList) =>
{
AppToaster.dismiss(toasterKey);
let f = files.item(0);
let reader = new FileReader();
this.keyRes = await app.Editor.GetKeyWords({
@ -188,12 +173,20 @@ export class DrawTemplateByImport implements Command
remarks.push(values[i]);
break;
case "扩展备注":
const pairs = values[i].split(';');
for (const pair of pairs)
let exRemarkStr = values[i];
if (exRemarkStr.includes(''))
exRemarkStr = exRemarkStr.replaceAll('', ';');
const pairs = exRemarkStr.split(";");
for (let pair of pairs)
{
const [rK, rV] = pair.split(':');
if (pair.includes(''))
pair = pair.replaceAll('', ':');
const [rK, rV] = pair.split(":");
rK && rV && extRemarks.push([rK, rV]);
}
break;
case "板材":
case "板材名":
bancai = values[i];
@ -211,7 +204,9 @@ export class DrawTemplateByImport implements Command
lines = linesMap.get(values[i]);
break;
default:
const key = keys[i];
let key = keys[i];
if (key.includes('备注:'))
key = key.replace("备注:", "备注:");
if (key.includes("备注:") && values[i])
extRemarks.push([key.replace("备注:", ""), values[i]]);
break;
@ -367,6 +362,7 @@ export class DrawTemplateByImport implements Command
};
}
});
app.Editor.Prompt('可输入命令下载模板表格: DTT');
}
private handleInfo(en: Entity, info: IList)
{

@ -305,6 +305,7 @@ export enum CommandNames
CuttingFace = "CUTTINGFACE",//切割面
CuttingRectFace = "CUTTINGRECTFACE",//切割矩形面
DrawTempByImport = "DRAWTEMPBYIMPORT",
DownloadTemplateTable = "DOWNLOADTEMPLATETABLE", // 下载模板表格
CheckEdge = "CHECKEDGE",//封边检查
CheckPlaceFace = "CHECKPLACEFACE",//排版面视觉样式显示
ModelGroove = "MODELGROOVE",//造型槽

@ -223,6 +223,7 @@ import { Command_Modeling } from "../Add-on/Command_Modeling";
import { Command_PickUp2DModelCsgs } from "../Add-on/Command_PickUp2DModelCsgs";
import { Command_TemplateGroup } from "../Add-on/Command_TemplateGroup";
import { ApplyModel2ToBoard } from "../Add-on/DrawBoard/ApplyModel2ToBoard";
import { DownloadTemplateTable } from "../Add-on/DrawBoard/DownloadTemplateTable";
import { ParseHandle } from "../Add-on/DrawBoard/ParseHandle";
import { ParseHinge } from "../Add-on/DrawBoard/ParseHinge";
import { Command_BoardInfoDimTool } from "../Add-on/DrawDim/BoardInfoDimTool";
@ -862,6 +863,7 @@ export function registerCommand()
commandMachine.RegisterCommand(CommandNames.CuttingRectFace, new CuttingByRectFace());
commandMachine.RegisterCommand(CommandNames.DrawTempByImport, new DrawTemplateByImport());
commandMachine.RegisterCommand(CommandNames.DownloadTemplateTable, new DownloadTemplateTable());
commandMachine.RegisterCommand(CommandNames.R2B2, new Rect2Board());

@ -2450,6 +2450,15 @@ export const CommandList: ICommand[] = [
chName: "通过导入数据绘制模板",
chDes: "通过导入数据绘制模板",
},
{
typeId: "util",
link: `${HelpUrlBase}Tool/TemplateImport`,
defaultCustom: "DTT",
command: CommandNames.DownloadTemplateTable,
type: "工具",
chName: "下载数据绘制模板表格",
chDes: "下载数据绘制模板表格",
},
{
typeId: "util",
link: `${HelpUrlBase}BoardEditing/SetSmoothEdge`,

Loading…
Cancel
Save