Making Bake and Remove work for array

This commit is contained in:
LarsBrubaker 2018-02-17 08:57:56 -08:00
parent 247bf009f7
commit 4e126ef3a6
3 changed files with 59 additions and 8 deletions

View file

@ -42,11 +42,19 @@ namespace MatterHackers.MatterControl.DesignTools.Operations
}
public override string ActiveEditor => "PublicPropertyEditor";
public override bool CanBake => true;
public override bool CanRemove => true;
public int Count { get; set; } = 3;
public Vector3 Offset { get; set; } = new Vector3(30, 0, 0);
public double Rotate { get; set; } = 0;
public double Scale { get; set; } = 1;
public bool RotatePart { get; set; } = true;
public double Scale { get; set; } = 1;
public bool ScaleOffset { get; set; } = true;
public void Rebuild()
@ -80,6 +88,18 @@ namespace MatterHackers.MatterControl.DesignTools.Operations
}
});
}
public override void Remove()
{
this.Children.Modify(list =>
{
IObject3D firstChild = list.First();
list.Clear();
list.Add(firstChild);
});
base.Remove();
}
}
public class DirectionAxis

View file

@ -42,6 +42,8 @@ namespace MatterHackers.MatterControl.DesignTools.Operations
}
public override string ActiveEditor => "PublicPropertyEditor";
public override bool CanBake => true;
public override bool CanRemove => true;
public int Count { get; set; } = 3;
public DirectionVector Direction { get; set; } = new DirectionVector { Normal = new Vector3(1, 0, 0) };
public double Distance { get; set; } = 30;
@ -63,5 +65,17 @@ namespace MatterHackers.MatterControl.DesignTools.Operations
}
});
}
public override void Remove()
{
this.Children.Modify(list =>
{
IObject3D firstChild = list.First();
list.Clear();
list.Add(firstChild);
});
base.Remove();
}
}
}

View file

@ -43,22 +43,27 @@ namespace MatterHackers.MatterControl.DesignTools.Operations
}
public override string ActiveEditor => "PublicPropertyEditor";
public int Count { get; set; } = 3;
// make this public when within angle works
private double Angle { get; set; } = 360;
[DisplayName("Rotate About")]
public DirectionAxis Axis { get; set; } = new DirectionAxis() { Origin = Vector3.NegativeInfinity, Normal = Vector3.UnitZ };
public override bool CanBake => true;
public override bool CanRemove => true;
public int Count { get; set; } = 3;
[DisplayName("Rotate Part")]
[Description("Rotate the part to the same angle as the array.")]
public bool RotatePart { get; set; } = true;
// make this public when within angle works
private double Angle { get; set; } = 360;
// make this public when it works
[DisplayName("Keep Within Angle")]
[Description("Keep the entire extents of the part within the angle described.")]
private bool KeepInAngle { get; set; } = false;
[DisplayName("Rotate Part")]
[Description("Rotate the part to the same angle as the array.")]
public bool RotatePart { get; set; } = true;
public void Rebuild()
{
if (Axis.Origin.X == double.NegativeInfinity)
@ -93,5 +98,17 @@ namespace MatterHackers.MatterControl.DesignTools.Operations
});
this.Invalidate();
}
public override void Remove()
{
this.Children.Modify(list =>
{
IObject3D firstChild = list.First();
list.Clear();
list.Add(firstChild);
});
base.Remove();
}
}
}