!1902 修复:应用二维刀路时,未能够提供正确的坐标系

pull/1888/MERGE
ChenX 2 years ago
parent 70e7ccf5aa
commit 06538fb759

@ -0,0 +1,30 @@
import { app } from "../../ApplicationServices/Application";
import { Board } from "../../DatabaseServices/Entity/Board";
import { Command } from "../../Editor/CommandMachine";
import { PromptStatus } from "../../Editor/PromptResult";
import { Polyline } from "../../ueapi";
export class Command_Fix2DPath implements Command
{
async exec()
{
let ssRes = await app.Editor.GetSelection({ Filter: { filterTypes: [Board] } });
if (ssRes.Status !== PromptStatus.OK) return;
let ents = ssRes.SelectSet.SelectEntityList as Board[];
for (let br of ents)
{
let ms = br.Modeling2D;
for (let m of ms)
{
let cus = m.path.Explode();
let color = m.path.ColorIndex;
m.path = new Polyline;
m.path.ColorIndex = color;
for (let c of cus)
m.path.Join(c, true, 1e-4);
}
br.Modeling2D = ms;
}
}
}

@ -128,6 +128,7 @@ 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_SwitchDoor, SelectAll, ShowHideSelectPanel } from "../Add-on/HideSelected";
@ -728,6 +729,8 @@ export function registerCommand()
commandMachine.RegisterCommand(CommandNames.R2B2, new Rect2Board());
commandMachine.RegisterCommand(CommandNames.FixIntSelfContour, new FixIntersectSelfContour());
commandMachine.RegisterCommand("fix2dpath", new Command_Fix2DPath());
commandMachine.RegisterCommand(CommandNames.ParseHinge, new ParseHinge());
commandMachine.RegisterCommand(CommandNames.ZhengWen, new SetBoardLines(0));
commandMachine.RegisterCommand(CommandNames.FanWen, new SetBoardLines(1));

@ -519,6 +519,8 @@ export class BoardConfigModal extends React.Component<BoardConfigProps, {}>{
}, "zx");
return;
};
//应用二维刀路
private ChangeModeling2 = async () =>
{
await app.Editor.ModalManage.EndExecingCmd();
@ -569,7 +571,13 @@ export class BoardConfigModal extends React.Component<BoardConfigProps, {}>{
if (g[0] instanceof Circle)
path = ConverCircleToPolyline(g[0] as Circle);
else
path = Polyline.Combine(g);
{
// path = Polyline.Combine(g); 弃用的原因是因为直线提供的坐标系不和曲线坐标系一致 可能Z轴反了
path = new Polyline;
path.OCS = contour.OCSNoClone;
for (let c of g)
path.Join(c, true, 1e-3);
}
if (path)
{
path.ColorIndex = c.ColorIndex;
@ -648,6 +656,8 @@ export class BoardConfigModal extends React.Component<BoardConfigProps, {}>{
br.GrooveCheckAllAutoSplit();
}
};
//应用二维刀路
private AddModeling2 = (contourMap: Map<number, Polyline[]>, applyMatrix: Matrix4) =>
{
if (contourMap.size > 0)

Loading…
Cancel
Save