|
|
|
@ -44,8 +44,7 @@ export class Command_TestDrawYHData implements Command
|
|
|
|
|
let cus: Curve[] = [];
|
|
|
|
|
part.UserData = cus;
|
|
|
|
|
let state = part.RotatedStates[0];
|
|
|
|
|
let pts = state.Contour.Points.map(p => new Vector3(p.x * 1, p.y * 1));
|
|
|
|
|
let pl = Path2Polyline(pts);
|
|
|
|
|
let pl = Path2Polyline(state.Contour.Points);
|
|
|
|
|
cus.push(pl);
|
|
|
|
|
let ocs = new Matrix4;
|
|
|
|
|
if (state.Rotation !== 0)
|
|
|
|
@ -124,3 +123,49 @@ export class Command_TestDrawYHData implements Command
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 测试工具 使用数据还原优化结果
|
|
|
|
|
*/
|
|
|
|
|
@HotCMD
|
|
|
|
|
export class Command_TestDrawYHData2 implements Command
|
|
|
|
|
{
|
|
|
|
|
async exec()
|
|
|
|
|
{
|
|
|
|
|
//database data 请提供db数据
|
|
|
|
|
let dd = [];
|
|
|
|
|
//place data 请提供place数据
|
|
|
|
|
let pd = [];
|
|
|
|
|
|
|
|
|
|
let df = new NestFiler(dd);
|
|
|
|
|
let pf = new NestFiler(pd);
|
|
|
|
|
let db = new NestDatabase().ReadFile(df);
|
|
|
|
|
|
|
|
|
|
for (let part of db.Parts)
|
|
|
|
|
{
|
|
|
|
|
let state = part.State;
|
|
|
|
|
|
|
|
|
|
let pl = Path2Polyline(state.Contour.Points);
|
|
|
|
|
TestDraw(pl);
|
|
|
|
|
part.UserData = [pl];
|
|
|
|
|
|
|
|
|
|
let ocs = new Matrix4;
|
|
|
|
|
if (state.Rotation !== 0)
|
|
|
|
|
ocs.makeRotationZ(-state.Rotation);
|
|
|
|
|
ocs.setPosition(state.OrigionMinPoint.x, state.OrigionMinPoint.y, 0);
|
|
|
|
|
NestVariant.curveMap.set(pl, ocs);
|
|
|
|
|
|
|
|
|
|
for (let h of part.Holes)
|
|
|
|
|
{
|
|
|
|
|
let pl = Path2Polyline(h.Contour.Points);
|
|
|
|
|
TestDraw(pl);
|
|
|
|
|
part.UserData.push(pl);
|
|
|
|
|
NestVariant.curveMap.set(pl, new Matrix4().setPosition(h.OrigionMinPoint.x, h.OrigionMinPoint.y, 0));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
let inv = new Individual(db.Parts);
|
|
|
|
|
inv.ReadFile(pf);
|
|
|
|
|
Place(inv, db.Parts, db.Bin);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|