|
|
|
@ -1,4 +1,5 @@
|
|
|
|
|
import { ExtendsBoardThickness } from "../../../Add-on/DrawBoard/BuildBoardTool";
|
|
|
|
|
import { CuttingProtrudingPart } from "../../../Add-on/DrawBoard/CuttingProtrudingPart";
|
|
|
|
|
import { EBoardKeyList } from "../../../Common/BoardKeyList";
|
|
|
|
|
import { ISpaceParse } from "../../../Geometry/SpaceParse/ISpaceParse";
|
|
|
|
|
import { BoardProcessOption } from "../../../UI/Store/OptionInterface/BoardProcessOption";
|
|
|
|
@ -22,6 +23,11 @@ export class TemplateBoardRecord extends TemplateRecord
|
|
|
|
|
|
|
|
|
|
@AutoRecord DrawBoardCount = 1;
|
|
|
|
|
|
|
|
|
|
//空间分析缺口切割需要的板件
|
|
|
|
|
protected IntersectSpaceEntitys: Set<Entity>;
|
|
|
|
|
//空间分析缺口切割需要原板件排钻信息
|
|
|
|
|
protected IntersectHighDrill: string[];
|
|
|
|
|
|
|
|
|
|
protected _option: BoardConfigOption;
|
|
|
|
|
// InitBaseParams()
|
|
|
|
|
// {
|
|
|
|
@ -80,7 +86,23 @@ export class TemplateBoardRecord extends TemplateRecord
|
|
|
|
|
this.UseBoardProcessOption = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//记录按缺口切割前的板轮廓
|
|
|
|
|
const OldContour = nbrs[0].ContourCurve.Clone();
|
|
|
|
|
//是否是被缺口切割
|
|
|
|
|
const IsIntersectSpaceEntitys = !!this.IntersectSpaceEntitys?.size;
|
|
|
|
|
|
|
|
|
|
if (IsIntersectSpaceEntitys)
|
|
|
|
|
{
|
|
|
|
|
if (!this.IntersectHighDrill?.length)
|
|
|
|
|
this.IntersectHighDrill = nbrs[0].BoardProcessOption.highDrill;
|
|
|
|
|
nbrs = CuttingProtrudingPart(this.IntersectSpaceEntitys, nbrs);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//继承refBr的BoardProcessOption/IsChaiDan/RelevanceMeats属性
|
|
|
|
|
let refBr: Board;
|
|
|
|
|
//记录生成的异型缺口板高级排钻列表
|
|
|
|
|
const HighDrill: string[] = [];
|
|
|
|
|
|
|
|
|
|
if (this.Objects.length > 0)
|
|
|
|
|
refBr = this.Objects[0].Object as Board;
|
|
|
|
|
|
|
|
|
@ -89,11 +111,18 @@ export class TemplateBoardRecord extends TemplateRecord
|
|
|
|
|
|
|
|
|
|
for (let i = 0; i < nbrs.length; i++)
|
|
|
|
|
{
|
|
|
|
|
let br: Board;
|
|
|
|
|
|
|
|
|
|
if (i < this.Objects.length)
|
|
|
|
|
{
|
|
|
|
|
let br = this.Objects[i].Object as Board;
|
|
|
|
|
br = this.Objects[i].Object as Board;
|
|
|
|
|
if (i >= this.DrawBoardCount)
|
|
|
|
|
br.Erase(false);
|
|
|
|
|
|
|
|
|
|
//缺口切割旧板 使用切割后的的轮廓信息
|
|
|
|
|
if (IsIntersectSpaceEntitys)
|
|
|
|
|
br.ContourCurve = nbrs[i].ContourCurve.Clone();
|
|
|
|
|
|
|
|
|
|
br.Position = nbrs[i].Position;
|
|
|
|
|
br.Width = nbrs[i].Width;
|
|
|
|
|
br.Height = nbrs[i].Height;
|
|
|
|
@ -101,16 +130,21 @@ export class TemplateBoardRecord extends TemplateRecord
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
let br = nbrs[i];
|
|
|
|
|
br = nbrs[i];
|
|
|
|
|
|
|
|
|
|
if (refBr)
|
|
|
|
|
{
|
|
|
|
|
//新生成的缺口切割板 不使用原有的轮廓信息
|
|
|
|
|
if (!IsIntersectSpaceEntitys)
|
|
|
|
|
br.ContourCurve = refBr.ContourCurve.Clone();
|
|
|
|
|
|
|
|
|
|
br.BoardProcessOption = refBr.BoardProcessOption;
|
|
|
|
|
br.IsChaiDan = refBr.IsChaiDan;
|
|
|
|
|
br.RelevanceMeats = refBr.RelevanceMeats;
|
|
|
|
|
}
|
|
|
|
|
this._db.ModelSpace.Append(nbrs[i]);
|
|
|
|
|
this.Objects.push(nbrs[i].Id);
|
|
|
|
|
|
|
|
|
|
this._db.ModelSpace.Append(br);
|
|
|
|
|
this.Objects.push(br.Id);
|
|
|
|
|
|
|
|
|
|
//新创建的板 关联切割
|
|
|
|
|
for (let meat of br.RelevanceMeats)
|
|
|
|
@ -120,7 +154,30 @@ export class TemplateBoardRecord extends TemplateRecord
|
|
|
|
|
meatBr.RelevanceKnifs.push(br.objectId);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//缺口生成的异型板 分析排钻
|
|
|
|
|
if (IsIntersectSpaceEntitys && !br.IsRect)
|
|
|
|
|
{
|
|
|
|
|
if (!HighDrill.length)
|
|
|
|
|
{
|
|
|
|
|
let indexMap: number[] = [];
|
|
|
|
|
let newContour = br.ContourCurve;
|
|
|
|
|
for (let i = 0; i < newContour.EndParam; i++)
|
|
|
|
|
{
|
|
|
|
|
let p = newContour.GetPointAtParam(i + 0.5);
|
|
|
|
|
let cp = OldContour.GetClosestPointTo(p, false);
|
|
|
|
|
let cparam = OldContour.GetParamAtPoint2(cp);
|
|
|
|
|
indexMap.push(Math.floor(cparam));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (let index of indexMap)
|
|
|
|
|
HighDrill.push(this.IntersectHighDrill[index]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
br.BoardProcessOption.highDrill = HighDrill;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.DrawBoardCount = nbrs.length;
|
|
|
|
|
|
|
|
|
|
//保持SpaceCS
|
|
|
|
|