修复撤销错误,由于使用clone 和copyfrom 导致的id关联错误的问题.

pull/690040/MERGE
ChenX 7 years ago
parent 63995fcebf
commit 09a15d828c

@ -23,7 +23,7 @@ export class Entsel implements Command
vcs.add(new Vector3(0, -20, 0)); vcs.add(new Vector3(0, -20, 0));
dyn.SetPostion(vcs); dyn.SetPostion(vcs);
dyn.updatePrompt(res.Entity.constructor.name); dyn.updatePrompt(res.Entity.constructor.name + ",id:" + res.Entity.Id.Index);
} }
else else
dyn.Visible = false; dyn.Visible = false;

@ -87,8 +87,18 @@ export class CommandFillet implements Command
this.ExtendPt(new_cu2 as Line, in_pts[0], arcP2); this.ExtendPt(new_cu2 as Line, in_pts[0], arcP2);
} }
cu1.CopyFrom(new_cu1); if (cu1 instanceof Line)
cu2.CopyFrom(new_cu2); {
cu1.StartPoint = new_cu1.StartPoint;
cu1.EndPoint = new_cu1.EndPoint;
}
if (cu2 instanceof Line)
{
cu2.StartPoint = new_cu2.StartPoint;
cu2.EndPoint = new_cu2.EndPoint;
}
// cu1.CopyFrom(new_cu1);
// cu2.CopyFrom(new_cu2);
app.m_Editor.UpdateScreen(); app.m_Editor.UpdateScreen();
} }

@ -27,16 +27,6 @@ export class Command_Trim implements Command
//剪刀对象 //剪刀对象
let kniefCus: Array<Curve> = []; let kniefCus: Array<Curve> = [];
fillerCus(knifeSsRes.SelectSet, kniefCus); fillerCus(knifeSsRes.SelectSet, kniefCus);
// if (kniefCus.length === 0)
// {
// for (let en of app.m_Database.ModelSpace.objectCol)
// {
// if (en instanceof Curve)
// {
// kniefCus.push(en);
// }
// }
// }
while (true) while (true)
{ {
@ -131,20 +121,21 @@ export class Command_Trim implements Command
continue; continue;
} }
} }
if (cu.constructor.name === lastCu.constructor.name) // if (cu.constructor.name === lastCu.constructor.name)
{ // {
if (cu instanceof Polyline) // if (cu instanceof Polyline)
cu.CloseMark = false; // cu.CloseMark = false;
cu.CopyFrom(lastCu); // cu.CopyFrom(lastCu);
} // }
else // else
{ // {
cu.Erase(); cu.Erase();
app.m_Database.ModelSpace.Append(lastCu);
} lastCu.ColorIndex = 6;
app.m_Database.ModelSpace.Append(lastCu);
// }
} }
} }
} }
app.m_Editor.UpdateScreen(); app.m_Editor.UpdateScreen();

@ -116,19 +116,19 @@ export abstract class CADObject
{ {
let file = new CADFile(); let file = new CADFile();
file.WriteObject(this); file.WriteObject(this);
let newObject = file.ReadObject(this._db); let newObject = file.ReadObject(undefined);
newObject.objectId = undefined; newObject.objectId = undefined;
newObject._db = undefined; newObject._db = undefined;
return newObject; return newObject;
} }
//从一个实体拷贝数据,实体类型必须相同. // //从一个实体拷贝数据,实体类型必须相同.
CopyFrom(obj: CADObject) // CopyFrom(obj: CADObject)
{ // {
this.WriteAllObjectRecord(); // this.WriteAllObjectRecord();
let f = new CADFile(); // let f = new CADFile();
obj.WriteFile(f); // obj.WriteFile(f);
this.ReadFile(f); // this.ReadFile(f);
} // }
//-------------------------File End------------------------- //-------------------------File End-------------------------

@ -235,11 +235,11 @@ export class Entity extends CADObject
this.Update(); this.Update();
} }
CopyFrom(obj: CADObject) // CopyFrom(obj: CADObject)
{ // {
super.CopyFrom(obj); // super.CopyFrom(obj);
this.Update(); // this.Update();
} // }
//#endregion //#endregion
} }

@ -37,7 +37,7 @@ export class Line extends Curve
{ {
let geo = new Geometry(); let geo = new Geometry();
geo.vertices.push(this.StartPoint, this.EndPoint); geo.vertices.push(this.StartPoint, this.EndPoint);
return new THREE.Line(geo, ColorMaterial.GetLineMaterial(this.m_Color)); return new THREE.Line(geo, ColorMaterial.GetLineMaterial(this.ColorIndex));
} }
UpdateDrawObject(type: RenderType, en: Object3D) UpdateDrawObject(type: RenderType, en: Object3D)

Loading…
Cancel
Save