修复撤销错误,由于使用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));
dyn.SetPostion(vcs);
dyn.updatePrompt(res.Entity.constructor.name);
dyn.updatePrompt(res.Entity.constructor.name + ",id:" + res.Entity.Id.Index);
}
else
dyn.Visible = false;

@ -87,8 +87,18 @@ export class CommandFillet implements Command
this.ExtendPt(new_cu2 as Line, in_pts[0], arcP2);
}
cu1.CopyFrom(new_cu1);
cu2.CopyFrom(new_cu2);
if (cu1 instanceof Line)
{
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();
}

@ -27,16 +27,6 @@ export class Command_Trim implements Command
//剪刀对象
let kniefCus: Array<Curve> = [];
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)
{
@ -131,22 +121,23 @@ export class Command_Trim implements Command
continue;
}
}
if (cu.constructor.name === lastCu.constructor.name)
{
if (cu instanceof Polyline)
cu.CloseMark = false;
cu.CopyFrom(lastCu);
}
else
{
// if (cu.constructor.name === lastCu.constructor.name)
// {
// if (cu instanceof Polyline)
// cu.CloseMark = false;
// cu.CopyFrom(lastCu);
// }
// else
// {
cu.Erase();
lastCu.ColorIndex = 6;
app.m_Database.ModelSpace.Append(lastCu);
// }
}
}
}
}
app.m_Editor.UpdateScreen();
app.m_Viewer.m_GripScene.Clear();
app.m_Editor.m_SelectCtrl.Cancel();

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

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

@ -37,7 +37,7 @@ export class Line extends Curve
{
let geo = new Geometry();
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)

Loading…
Cancel
Save