Improving suspend and resume rebuild
This commit is contained in:
parent
b911206cb7
commit
ec28305b56
42 changed files with 857 additions and 885 deletions
|
|
@ -37,7 +37,7 @@ using MatterHackers.VectorMath;
|
|||
|
||||
namespace MatterHackers.MatterControl.DesignTools
|
||||
{
|
||||
public class PyramidObject3D : Object3D, IPublicPropertyObject
|
||||
public class PyramidObject3D : Object3D
|
||||
{
|
||||
public PyramidObject3D()
|
||||
{
|
||||
|
|
@ -61,24 +61,25 @@ namespace MatterHackers.MatterControl.DesignTools
|
|||
public override void Rebuild(UndoBuffer undoBuffer)
|
||||
{
|
||||
this.DebugDepth("Rebuild");
|
||||
SuspendRebuild();
|
||||
var aabb = this.GetAxisAlignedBoundingBox();
|
||||
|
||||
var path = new VertexStorage();
|
||||
path.MoveTo(0, 0);
|
||||
path.LineTo(Math.Sqrt(2), 0);
|
||||
path.LineTo(0, Height);
|
||||
|
||||
var mesh = VertexSourceToMesh.Revolve(path, 4);
|
||||
mesh.Transform(Matrix4X4.CreateRotationZ(MathHelper.DegreesToRadians(45)) * Matrix4X4.CreateScale(Width / 2, Depth / 2, 1));
|
||||
Mesh = mesh;
|
||||
|
||||
if (aabb.ZSize > 0)
|
||||
using (RebuildLock())
|
||||
{
|
||||
// If the part was already created and at a height, maintain the height.
|
||||
PlatingHelper.PlaceMeshAtHeight(this, aabb.minXYZ.Z);
|
||||
var aabb = this.GetAxisAlignedBoundingBox();
|
||||
|
||||
var path = new VertexStorage();
|
||||
path.MoveTo(0, 0);
|
||||
path.LineTo(Math.Sqrt(2), 0);
|
||||
path.LineTo(0, Height);
|
||||
|
||||
var mesh = VertexSourceToMesh.Revolve(path, 4);
|
||||
mesh.Transform(Matrix4X4.CreateRotationZ(MathHelper.DegreesToRadians(45)) * Matrix4X4.CreateScale(Width / 2, Depth / 2, 1));
|
||||
Mesh = mesh;
|
||||
|
||||
if (aabb.ZSize > 0)
|
||||
{
|
||||
// If the part was already created and at a height, maintain the height.
|
||||
PlatingHelper.PlaceMeshAtHeight(this, aabb.minXYZ.Z);
|
||||
}
|
||||
}
|
||||
ResumeRebuild();
|
||||
|
||||
Invalidate(new InvalidateArgs(this, InvalidateType.Mesh));
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue