Put the two parts together, added a wipe tower if needed
This commit is contained in:
parent
4c55641c05
commit
f318178a4e
3 changed files with 176 additions and 116 deletions
|
|
@ -40,26 +40,34 @@ namespace MatterHackers.MatterControl.DesignTools
|
||||||
{
|
{
|
||||||
public class XyCalibrationFaceObject3D : Object3D
|
public class XyCalibrationFaceObject3D : Object3D
|
||||||
{
|
{
|
||||||
|
public double NozzleWidth = .4;
|
||||||
|
|
||||||
public XyCalibrationFaceObject3D()
|
public XyCalibrationFaceObject3D()
|
||||||
{
|
{
|
||||||
Name = "Calibration Faces".Localize();
|
Name = "Calibration Faces".Localize();
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum Layout { Horizontal, Vertical }
|
public double BaseHeight { get; set; } = .4;
|
||||||
public Layout Direction { get; set; } = Layout.Horizontal;
|
|
||||||
|
|
||||||
[DisplayName("Material")]
|
[DisplayName("Material")]
|
||||||
public int CalibrationMaterialIndex { get; set; } = 1;
|
public int CalibrationMaterialIndex { get; set; } = 1;
|
||||||
|
|
||||||
public double ChangingHeight { get; set; } = .4;
|
public double ChangingHeight { get; set; } = .4;
|
||||||
public double BaseHeight { get; set; } = .4;
|
public int Layers { get; set; } = 10;
|
||||||
public double Offset { get; set; } = .5;
|
public double Offset { get; set; } = .5;
|
||||||
public double NozzleWidth = .4;
|
public double WipeTowerSize { get; set; } = 10;
|
||||||
|
|
||||||
|
private double TabDepth => NozzleWidth * TabScale * 5;
|
||||||
|
private double TabScale => 3;
|
||||||
|
private double TabWidth => NozzleWidth * TabScale * 3;
|
||||||
|
|
||||||
public static async Task<XyCalibrationFaceObject3D> Create(int calibrationMaterialIndex = 1,
|
public static async Task<XyCalibrationFaceObject3D> Create(int calibrationMaterialIndex = 1,
|
||||||
double baseHeight = 1, double changingHeight = .2, double offset = .5, double nozzleWidth = .4)
|
double baseHeight = 1, double changingHeight = .2, double offset = .5, double nozzleWidth = .4, double wipeTowerSize = 10, int layers = 10)
|
||||||
{
|
{
|
||||||
var item = new XyCalibrationFaceObject3D()
|
var item = new XyCalibrationFaceObject3D()
|
||||||
{
|
{
|
||||||
|
WipeTowerSize = wipeTowerSize,
|
||||||
|
Layers = layers,
|
||||||
CalibrationMaterialIndex = calibrationMaterialIndex,
|
CalibrationMaterialIndex = calibrationMaterialIndex,
|
||||||
BaseHeight = baseHeight,
|
BaseHeight = baseHeight,
|
||||||
ChangingHeight = changingHeight,
|
ChangingHeight = changingHeight,
|
||||||
|
|
@ -97,74 +105,99 @@ namespace MatterHackers.MatterControl.DesignTools
|
||||||
list.Clear();
|
list.Clear();
|
||||||
});
|
});
|
||||||
|
|
||||||
var content = new Object3D();
|
var calibrateX = GetTab(true);
|
||||||
|
this.Children.Add(calibrateX);
|
||||||
var scale = 3.0;
|
var calibrateY = GetTab(false);
|
||||||
var width = NozzleWidth * scale * 3;
|
this.Children.Add(calibrateY);
|
||||||
var depth = NozzleWidth * scale * 5;
|
// add in the corner connecter
|
||||||
var spaceBetween = NozzleWidth * scale;
|
this.Children.Add(new Object3D()
|
||||||
|
|
||||||
var shape = new VertexStorage();
|
|
||||||
shape.MoveTo(0, 0);
|
|
||||||
// left + spaces + blocks + right
|
|
||||||
var baseWidth = (2 * spaceBetween) + (4 * spaceBetween) + (5 * width) + (2 * spaceBetween);
|
|
||||||
shape.LineTo(baseWidth, 0);
|
|
||||||
if (Direction == Layout.Vertical)
|
|
||||||
{
|
{
|
||||||
var origin = new Vector2(baseWidth, depth / 2);
|
Mesh = PlatonicSolids.CreateCube(),
|
||||||
var delta = new Vector2(0, -depth / 2);
|
Matrix = Matrix4X4.CreateTranslation(-1 / 2.0, 1 / 2.0, 1 / 2.0) * Matrix4X4.CreateScale(TabDepth, TabDepth, BaseHeight),
|
||||||
var count = 15;
|
|
||||||
for (int i = 0; i < count; i++)
|
|
||||||
{
|
|
||||||
delta.Rotate(MathHelper.Tau / 2 / count);
|
|
||||||
shape.LineTo(origin + delta);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
shape.LineTo(baseWidth + depth, depth / 2); // a point on the left
|
|
||||||
}
|
|
||||||
shape.LineTo(baseWidth, depth);
|
|
||||||
shape.LineTo(0, depth);
|
|
||||||
|
|
||||||
content.Children.Add(new Object3D()
|
|
||||||
{
|
|
||||||
Mesh = shape.Extrude(BaseHeight),
|
|
||||||
Color = Color.LightBlue
|
Color = Color.LightBlue
|
||||||
});
|
});
|
||||||
|
|
||||||
var position = new Vector2(width / 2 + 2 * spaceBetween, depth / 2 - Offset * 2);
|
if (WipeTowerSize > 0)
|
||||||
var step = new Vector2(spaceBetween + width, Offset);
|
|
||||||
for (int i = 0; i < 5; i++)
|
|
||||||
{
|
{
|
||||||
for (int j = 0; j < 10; j++)
|
// add in the wipe tower
|
||||||
|
this.Children.Add(new Object3D()
|
||||||
{
|
{
|
||||||
var calibrationMaterial = (j % 2 == 0);
|
Mesh = PlatonicSolids.CreateCube(),
|
||||||
var cube = PlatonicSolids.CreateCube();
|
Matrix = Matrix4X4.CreateTranslation(1 / 2.0, 1 / 2.0, 1 / 2.0)
|
||||||
var yOffset = calibrationMaterial ? position.Y : depth / 2;
|
* Matrix4X4.CreateScale(WipeTowerSize, WipeTowerSize, BaseHeight + Layers * ChangingHeight)
|
||||||
var offset = Matrix4X4.CreateTranslation(position.X, yOffset, BaseHeight + .5 * ChangingHeight + j * ChangingHeight);
|
* Matrix4X4.CreateTranslation(TabDepth * 1, TabDepth * 2, 0),
|
||||||
content.Children.Add(new Object3D()
|
OutputType = PrintOutputTypes.WipeTower
|
||||||
{
|
});
|
||||||
Mesh = cube,
|
|
||||||
Color = Color.Yellow,
|
|
||||||
Matrix = Matrix4X4.CreateScale(width, depth, ChangingHeight) * offset,
|
|
||||||
MaterialIndex = calibrationMaterial ? CalibrationMaterialIndex : 0
|
|
||||||
});
|
|
||||||
}
|
|
||||||
position += step;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Direction == Layout.Vertical)
|
|
||||||
{
|
|
||||||
content.Matrix = Matrix4X4.CreateRotationZ(MathHelper.Tau / 4);
|
|
||||||
}
|
|
||||||
|
|
||||||
this.Children.Add(content);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Parent?.Invalidate(new InvalidateArgs(this, InvalidateType.Mesh));
|
Parent?.Invalidate(new InvalidateArgs(this, InvalidateType.Mesh));
|
||||||
return Task.CompletedTask;
|
return Task.CompletedTask;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Object3D GetTab(bool calibrateX)
|
||||||
|
{
|
||||||
|
var content = new Object3D();
|
||||||
|
|
||||||
|
var spaceBetween = NozzleWidth * TabScale;
|
||||||
|
|
||||||
|
var shape = new VertexStorage();
|
||||||
|
shape.MoveTo(0, 0);
|
||||||
|
// left + spaces + blocks + right
|
||||||
|
var baseWidth = (2 * spaceBetween) + (4 * spaceBetween) + (5 * TabWidth) + (2 * spaceBetween);
|
||||||
|
shape.LineTo(baseWidth, 0);
|
||||||
|
if (calibrateX)
|
||||||
|
{
|
||||||
|
var origin = new Vector2(baseWidth, TabDepth / 2);
|
||||||
|
var delta = new Vector2(0, -TabDepth / 2);
|
||||||
|
var count = 15;
|
||||||
|
for (int i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
delta.Rotate(MathHelper.Tau / 2 / count);
|
||||||
|
shape.LineTo(origin + delta);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
shape.LineTo(baseWidth + TabDepth, TabDepth / 2); // a point on the left
|
||||||
|
}
|
||||||
|
shape.LineTo(baseWidth, TabDepth);
|
||||||
|
shape.LineTo(0, TabDepth);
|
||||||
|
|
||||||
|
content.Children.Add(new Object3D()
|
||||||
|
{
|
||||||
|
Mesh = shape.Extrude(BaseHeight),
|
||||||
|
Color = Color.LightBlue
|
||||||
|
});
|
||||||
|
|
||||||
|
var position = new Vector2(TabWidth / 2 + 2 * spaceBetween, TabDepth / 2 - Offset * 2);
|
||||||
|
var step = new Vector2(spaceBetween + TabWidth, Offset);
|
||||||
|
for (int i = 0; i < 5; i++)
|
||||||
|
{
|
||||||
|
for (int j = 0; j < Layers; j++)
|
||||||
|
{
|
||||||
|
var calibrationMaterial = (j % 2 == 0);
|
||||||
|
var cube = PlatonicSolids.CreateCube();
|
||||||
|
var yOffset = calibrationMaterial ? position.Y : TabDepth / 2;
|
||||||
|
var offset = Matrix4X4.CreateTranslation(position.X, yOffset, BaseHeight + .5 * ChangingHeight + j * ChangingHeight);
|
||||||
|
content.Children.Add(new Object3D()
|
||||||
|
{
|
||||||
|
Mesh = cube,
|
||||||
|
Color = Color.Yellow,
|
||||||
|
Matrix = Matrix4X4.CreateScale(TabWidth, TabDepth, ChangingHeight) * offset,
|
||||||
|
MaterialIndex = calibrationMaterial ? CalibrationMaterialIndex : 0
|
||||||
|
});
|
||||||
|
}
|
||||||
|
position += step;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (calibrateX)
|
||||||
|
{
|
||||||
|
content.Matrix = Matrix4X4.CreateRotationZ(MathHelper.Tau / 4) * Matrix4X4.CreateTranslation(0, TabDepth, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
return content;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -45,14 +45,16 @@ namespace MatterHackers.MatterControl.DesignTools
|
||||||
Name = "Calibration Tab".Localize();
|
Name = "Calibration Tab".Localize();
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum Layout { Horizontal, Vertical }
|
|
||||||
public Layout Direction { get; set; } = Layout.Horizontal;
|
|
||||||
|
|
||||||
[DisplayName("Material")]
|
[DisplayName("Material")]
|
||||||
public int CalibrationMaterialIndex { get; set; } = 1;
|
public int CalibrationMaterialIndex { get; set; } = 1;
|
||||||
public double ChangeHeight { get; set; } = .4;
|
public double ChangeHeight { get; set; } = .4;
|
||||||
public double Offset { get; set; } = .5;
|
public double Offset { get; set; } = .5;
|
||||||
public double NozzleWidth = .4;
|
public double NozzleWidth = .4;
|
||||||
|
public double WipeTowerSize { get; set; } = 10;
|
||||||
|
|
||||||
|
private double TabDepth => NozzleWidth * TabScale * 5;
|
||||||
|
private double TabScale => 3;
|
||||||
|
private double TabWidth => NozzleWidth * TabScale * 3;
|
||||||
|
|
||||||
public static async Task<XyCalibrationTabObject3D> Create(int calibrationMaterialIndex = 1,
|
public static async Task<XyCalibrationTabObject3D> Create(int calibrationMaterialIndex = 1,
|
||||||
double changeHeight = .4, double offset = .5, double nozzleWidth = .4)
|
double changeHeight = .4, double offset = .5, double nozzleWidth = .4)
|
||||||
|
|
@ -95,70 +97,95 @@ namespace MatterHackers.MatterControl.DesignTools
|
||||||
list.Clear();
|
list.Clear();
|
||||||
});
|
});
|
||||||
|
|
||||||
var content = new Object3D();
|
var calibrateX = GetTab(true);
|
||||||
|
this.Children.Add(calibrateX);
|
||||||
var scale = 3.0;
|
var calibrateY = GetTab(false);
|
||||||
var width = NozzleWidth * scale * 3;
|
this.Children.Add(calibrateY);
|
||||||
var depth = NozzleWidth * scale * 5;
|
// add in the corner connecter
|
||||||
var spaceBetween = NozzleWidth * scale;
|
this.Children.Add(new Object3D()
|
||||||
|
|
||||||
var shape = new VertexStorage();
|
|
||||||
shape.MoveTo(0, 0);
|
|
||||||
// left + spaces + blocks + right
|
|
||||||
var baseWidth = (2 * spaceBetween) + (4 * spaceBetween) + (5 * width) + (2 * spaceBetween);
|
|
||||||
shape.LineTo(baseWidth, 0);
|
|
||||||
if (Direction == Layout.Vertical)
|
|
||||||
{
|
{
|
||||||
var origin = new Vector2(baseWidth, depth / 2);
|
Mesh = PlatonicSolids.CreateCube(),
|
||||||
var delta = new Vector2(0, -depth / 2);
|
Matrix = Matrix4X4.CreateTranslation(-1 / 2.0, 1 / 2.0, 1 / 2.0) * Matrix4X4.CreateScale(TabDepth, TabDepth, ChangeHeight),
|
||||||
var count = 15;
|
|
||||||
for (int i = 0; i < count; i++)
|
|
||||||
{
|
|
||||||
delta.Rotate(MathHelper.Tau / 2 / count);
|
|
||||||
shape.LineTo(origin + delta);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
shape.LineTo(baseWidth+depth, depth / 2); // a point on the left
|
|
||||||
}
|
|
||||||
shape.LineTo(baseWidth, depth);
|
|
||||||
shape.LineTo(0, depth);
|
|
||||||
|
|
||||||
content.Children.Add(new Object3D()
|
|
||||||
{
|
|
||||||
Mesh = shape.Extrude(ChangeHeight),
|
|
||||||
Color = Color.LightBlue
|
Color = Color.LightBlue
|
||||||
});
|
});
|
||||||
|
|
||||||
var position = new Vector2(width / 2 + 2 * spaceBetween, depth / 2 - Offset * 2);
|
if (WipeTowerSize > 0)
|
||||||
var step = new Vector2(spaceBetween + width, Offset);
|
|
||||||
for (int i=0; i<5; i++)
|
|
||||||
{
|
{
|
||||||
var cube = PlatonicSolids.CreateCube();
|
// add in the wipe tower
|
||||||
content.Children.Add(new Object3D()
|
this.Children.Add(new Object3D()
|
||||||
{
|
{
|
||||||
Mesh = cube,
|
Mesh = PlatonicSolids.CreateCube(),
|
||||||
Color = Color.Yellow,
|
Matrix = Matrix4X4.CreateTranslation(1 / 2.0, 1 / 2.0, 1 / 2.0)
|
||||||
Matrix = Matrix4X4.CreateScale(width, depth, ChangeHeight)
|
* Matrix4X4.CreateScale(WipeTowerSize, WipeTowerSize, ChangeHeight * 2)
|
||||||
// translate by 1.5 as it is a centered cube (.5) plus the base (1) = 1.5
|
* Matrix4X4.CreateTranslation(TabDepth * 1, TabDepth * 2, 0),
|
||||||
* Matrix4X4.CreateTranslation(position.X, position.Y, ChangeHeight * 1.5),
|
OutputType = PrintOutputTypes.WipeTower
|
||||||
MaterialIndex = CalibrationMaterialIndex
|
|
||||||
});
|
});
|
||||||
position += step;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Direction == Layout.Vertical)
|
|
||||||
{
|
|
||||||
content.Matrix = Matrix4X4.CreateRotationZ(MathHelper.Tau / 4);
|
|
||||||
}
|
|
||||||
|
|
||||||
this.Children.Add(content);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Parent?.Invalidate(new InvalidateArgs(this, InvalidateType.Mesh));
|
Parent?.Invalidate(new InvalidateArgs(this, InvalidateType.Mesh));
|
||||||
return Task.CompletedTask;
|
return Task.CompletedTask;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Object3D GetTab(bool calibrateX)
|
||||||
|
{
|
||||||
|
var content = new Object3D();
|
||||||
|
|
||||||
|
var spaceBetween = NozzleWidth * TabScale;
|
||||||
|
|
||||||
|
var shape = new VertexStorage();
|
||||||
|
shape.MoveTo(0, 0);
|
||||||
|
// left + spaces + blocks + right
|
||||||
|
var baseWidth = (2 * spaceBetween) + (4 * spaceBetween) + (5 * TabWidth) + (2 * spaceBetween);
|
||||||
|
shape.LineTo(baseWidth, 0);
|
||||||
|
if (calibrateX)
|
||||||
|
{
|
||||||
|
var origin = new Vector2(baseWidth, TabDepth / 2);
|
||||||
|
var delta = new Vector2(0, -TabDepth / 2);
|
||||||
|
var count = 15;
|
||||||
|
for (int i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
delta.Rotate(MathHelper.Tau / 2 / count);
|
||||||
|
shape.LineTo(origin + delta);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
shape.LineTo(baseWidth + TabDepth, TabDepth / 2); // a point on the left
|
||||||
|
}
|
||||||
|
shape.LineTo(baseWidth, TabDepth);
|
||||||
|
shape.LineTo(0, TabDepth);
|
||||||
|
|
||||||
|
content.Children.Add(new Object3D()
|
||||||
|
{
|
||||||
|
Mesh = shape.Extrude(ChangeHeight),
|
||||||
|
Color = Color.LightBlue
|
||||||
|
});
|
||||||
|
|
||||||
|
var position = new Vector2(TabWidth / 2 + 2 * spaceBetween, TabDepth / 2 - Offset * 2);
|
||||||
|
var step = new Vector2(spaceBetween + TabWidth, Offset);
|
||||||
|
for (int i = 0; i < 5; i++)
|
||||||
|
{
|
||||||
|
var cube = PlatonicSolids.CreateCube();
|
||||||
|
content.Children.Add(new Object3D()
|
||||||
|
{
|
||||||
|
Mesh = cube,
|
||||||
|
Color = Color.Yellow,
|
||||||
|
Matrix = Matrix4X4.CreateScale(TabWidth, TabDepth, ChangeHeight)
|
||||||
|
// translate by 1.5 as it is a centered cube (.5) plus the base (1) = 1.5
|
||||||
|
* Matrix4X4.CreateTranslation(position.X, position.Y, ChangeHeight * 1.5),
|
||||||
|
MaterialIndex = CalibrationMaterialIndex
|
||||||
|
});
|
||||||
|
position += step;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (calibrateX)
|
||||||
|
{
|
||||||
|
content.Matrix = Matrix4X4.CreateRotationZ(MathHelper.Tau / 4) * Matrix4X4.CreateTranslation(0, TabDepth, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
return content;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1 +1 @@
|
||||||
Subproject commit cdb641e4748f8d63602129add739ba0758ae09f9
|
Subproject commit 9d087831b8d0bb88acb6c5170dd623f4e503e1fc
|
||||||
Loading…
Add table
Add a link
Reference in a new issue