mirror of https://gitee.com/cf-fz/WebCAD.git
parent
bd43717005
commit
0fb795581c
@ -0,0 +1,24 @@
|
|||||||
|
import { Command } from "../../Editor/CommandMachine";
|
||||||
|
import { app } from "../../ApplicationServices/Application";
|
||||||
|
import { Board } from "../../DatabaseServices/Board";
|
||||||
|
import { PromptStatus } from "../../Editor/PromptResult";
|
||||||
|
|
||||||
|
export class DeleteDrill implements Command
|
||||||
|
{
|
||||||
|
async exec()
|
||||||
|
{
|
||||||
|
let brRes = await app.m_Editor.GetSelection({
|
||||||
|
Msg: "选择板件",
|
||||||
|
Filter: { filterTypes: [Board] }
|
||||||
|
});
|
||||||
|
|
||||||
|
if (brRes.Status !== PromptStatus.OK) return;
|
||||||
|
|
||||||
|
let brs = brRes.SelectSet.SelectEntityList as Board[];
|
||||||
|
|
||||||
|
for (let br of brs)
|
||||||
|
{
|
||||||
|
br.ClearAllDrill();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,56 @@
|
|||||||
|
import { IndexedDbStore, StoreName } from "../IndexedDb/IndexedDbStore";
|
||||||
|
import { BoardModalType } from "../UI/Components/Board/BoardModal";
|
||||||
|
import { Command } from "../Editor/CommandMachine";
|
||||||
|
import { FileSystem } from "../Common/FileSystem";
|
||||||
|
import { HotCMD } from "../Hot/HotCommand";
|
||||||
|
|
||||||
|
@HotCMD
|
||||||
|
export class DownLoadDrillConfig implements Command
|
||||||
|
{
|
||||||
|
async exec()
|
||||||
|
{
|
||||||
|
let dbstore = await IndexedDbStore.CADStore();
|
||||||
|
let configs = await dbstore.Get(StoreName.ConfigData, BoardModalType.Dr);
|
||||||
|
if (configs)
|
||||||
|
{
|
||||||
|
let data = {};
|
||||||
|
for (let [k, v] of configs)
|
||||||
|
{
|
||||||
|
let obj = {};
|
||||||
|
for (let [k1, v1] of v.ruleMap)
|
||||||
|
{
|
||||||
|
obj[k1] = v1;
|
||||||
|
}
|
||||||
|
data[k] = { ruleMap: obj };
|
||||||
|
}
|
||||||
|
FileSystem.writeFile("drillconfig.json", JSON.stringify(data));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
export class UpLoadDrillConfig implements Command
|
||||||
|
{
|
||||||
|
async exec()
|
||||||
|
{
|
||||||
|
let dbstore = await IndexedDbStore.CADStore();
|
||||||
|
FileSystem.chooseFile(async files =>
|
||||||
|
{
|
||||||
|
if (files.length === 1)
|
||||||
|
{
|
||||||
|
let f = files[0];
|
||||||
|
let fileData = JSON.parse(await FileSystem.readFileAsText(f));
|
||||||
|
let config = new Map();
|
||||||
|
for (let key in fileData)
|
||||||
|
{
|
||||||
|
let v = fileData[key];
|
||||||
|
let rule = new Map();
|
||||||
|
for (let k1 in v.ruleMap)
|
||||||
|
{
|
||||||
|
rule.set(k1, v.ruleMap[k1]);
|
||||||
|
}
|
||||||
|
config.set(key, { ruleMap: rule });
|
||||||
|
}
|
||||||
|
await dbstore.Put(StoreName.ConfigData, BoardModalType.Dr, config);
|
||||||
|
}
|
||||||
|
}, ".json", false);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in new issue