Unify Vector2 3 and 4 to have upper case field members
This commit is contained in:
parent
2de8368f6e
commit
359784877f
63 changed files with 351 additions and 351 deletions
|
|
@ -137,7 +137,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
|
|||
string medPrecisionLabel = "Medium Precision".Localize();
|
||||
string highPrecisionLabel = "High Precision".Localize();
|
||||
|
||||
double bedRadius = Math.Min(printer.Settings.GetValue<Vector2>(SettingsKey.bed_size).x, printer.Settings.GetValue<Vector2>(SettingsKey.bed_size).y) / 2;
|
||||
double bedRadius = Math.Min(printer.Settings.GetValue<Vector2>(SettingsKey.bed_size).X, printer.Settings.GetValue<Vector2>(SettingsKey.bed_size).Y) / 2;
|
||||
|
||||
double startProbeHeight = printer.Settings.GetValue<double>(SettingsKey.print_leveling_probe_start);
|
||||
for (int i = 0; i < numberOfRadialSamples + 1; i++)
|
||||
|
|
@ -221,7 +221,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
|
|||
{
|
||||
Vector3 outPosition = GetPositionWithZOffset(currentDestination);
|
||||
|
||||
newLine = newLine.Append(String.Format("X{0:0.##} Y{1:0.##} Z{2:0.###}", outPosition.x, outPosition.y, outPosition.z));
|
||||
newLine = newLine.Append(String.Format("X{0:0.##} Y{1:0.##} Z{2:0.###}", outPosition.X, outPosition.Y, outPosition.Z));
|
||||
}
|
||||
|
||||
if (extruderDelta != 0)
|
||||
|
|
@ -245,7 +245,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
|
|||
{
|
||||
Vector2 destinationFromCenter = new Vector2(currentDestination) - BedCenter;
|
||||
|
||||
double angleToPoint = Math.Atan2(destinationFromCenter.y, destinationFromCenter.x);
|
||||
double angleToPoint = Math.Atan2(destinationFromCenter.Y, destinationFromCenter.X);
|
||||
|
||||
if (angleToPoint < 0)
|
||||
{
|
||||
|
|
@ -262,9 +262,9 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
|
|||
|
||||
Plane currentPlane = new Plane(SampledPositions[firstIndex], SampledPositions[lastIndex], SampledPositions[NumberOfRadialSamples]);
|
||||
|
||||
double hitDistance = currentPlane.GetDistanceToIntersection(new Vector3(currentDestination.x, currentDestination.y, 0), Vector3.UnitZ);
|
||||
double hitDistance = currentPlane.GetDistanceToIntersection(new Vector3(currentDestination.X, currentDestination.Y, 0), Vector3.UnitZ);
|
||||
|
||||
currentDestination.z += hitDistance;
|
||||
currentDestination.Z += hitDistance;
|
||||
}
|
||||
|
||||
return currentDestination;
|
||||
|
|
|
|||
|
|
@ -83,12 +83,12 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
|
|||
}
|
||||
|
||||
Vector2 probePosition = new Vector2();
|
||||
if (!double.TryParse(xyData[0], out probePosition.x))
|
||||
if (!double.TryParse(xyData[0], out probePosition.X))
|
||||
{
|
||||
// error
|
||||
return null;
|
||||
}
|
||||
if (!double.TryParse(xyData[1], out probePosition.y))
|
||||
if (!double.TryParse(xyData[1], out probePosition.Y))
|
||||
{
|
||||
// error
|
||||
return null;
|
||||
|
|
@ -118,7 +118,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
|
|||
switch (printerSettings.GetValue<BedShape>(SettingsKey.bed_shape))
|
||||
{
|
||||
case BedShape.Circular:
|
||||
Vector2 firstPosition = new Vector2(printCenter.x, printCenter.y + (bedSize.y / 2) * .5);
|
||||
Vector2 firstPosition = new Vector2(printCenter.X, printCenter.Y + (bedSize.Y / 2) * .5);
|
||||
switch (index)
|
||||
{
|
||||
case 0:
|
||||
|
|
@ -139,13 +139,13 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
|
|||
switch (index)
|
||||
{
|
||||
case 0:
|
||||
return new Vector2(printCenter.x, printCenter.y + (bedSize.y / 2) * .8);
|
||||
return new Vector2(printCenter.X, printCenter.Y + (bedSize.Y / 2) * .8);
|
||||
|
||||
case 1:
|
||||
return new Vector2(printCenter.x - (bedSize.x / 2) * .8, printCenter.y - (bedSize.y / 2) * .8);
|
||||
return new Vector2(printCenter.X - (bedSize.X / 2) * .8, printCenter.Y - (bedSize.Y / 2) * .8);
|
||||
|
||||
case 2:
|
||||
return new Vector2(printCenter.x + (bedSize.x / 2) * .8, printCenter.y - (bedSize.y / 2) * .8);
|
||||
return new Vector2(printCenter.X + (bedSize.X / 2) * .8, printCenter.Y - (bedSize.Y / 2) * .8);
|
||||
|
||||
default:
|
||||
throw new IndexOutOfRangeException();
|
||||
|
|
|
|||
|
|
@ -109,15 +109,15 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
|
|||
switch (xIndex)
|
||||
{
|
||||
case 0:
|
||||
samplePosition.x = printCenter.x - (bedSize.x / 2) * .8;
|
||||
samplePosition.X = printCenter.X - (bedSize.X / 2) * .8;
|
||||
break;
|
||||
|
||||
case 1:
|
||||
samplePosition.x = printCenter.x;
|
||||
samplePosition.X = printCenter.X;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
samplePosition.x = printCenter.x + (bedSize.x / 2) * .8;
|
||||
samplePosition.X = printCenter.X + (bedSize.X / 2) * .8;
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
@ -127,15 +127,15 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
|
|||
switch (yIndex)
|
||||
{
|
||||
case 0:
|
||||
samplePosition.y = printCenter.y - (bedSize.y / 2) * .8;
|
||||
samplePosition.Y = printCenter.Y - (bedSize.Y / 2) * .8;
|
||||
break;
|
||||
|
||||
case 1:
|
||||
samplePosition.y = printCenter.y;
|
||||
samplePosition.Y = printCenter.Y;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
samplePosition.y = printCenter.y + (bedSize.y / 2) * .8;
|
||||
samplePosition.Y = printCenter.Y + (bedSize.Y / 2) * .8;
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
@ -197,7 +197,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
|
|||
string medPrecisionLabel = "Medium Precision".Localize();
|
||||
string highPrecisionLabel = "High Precision".Localize();
|
||||
|
||||
double bedRadius = Math.Min(printerSettings.GetValue<Vector2>(SettingsKey.bed_size).x, printerSettings.GetValue<Vector2>(SettingsKey.bed_size).y) / 2;
|
||||
double bedRadius = Math.Min(printerSettings.GetValue<Vector2>(SettingsKey.bed_size).X, printerSettings.GetValue<Vector2>(SettingsKey.bed_size).Y) / 2;
|
||||
|
||||
double startProbeHeight = printerSettings.GetValue<double>(SettingsKey.print_leveling_probe_start);
|
||||
for (int i = 0; i < probeCount; i++)
|
||||
|
|
@ -292,7 +292,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
|
|||
|
||||
lastDestinationWithLevelingApplied = outPosition;
|
||||
|
||||
newLine = newLine.Append(String.Format("X{0:0.##} Y{1:0.##} Z{2:0.###}", outPosition.x, outPosition.y, outPosition.z));
|
||||
newLine = newLine.Append(String.Format("X{0:0.##} Y{1:0.##} Z{2:0.###}", outPosition.X, outPosition.Y, outPosition.Z));
|
||||
}
|
||||
|
||||
if (extruderDelta != 0)
|
||||
|
|
@ -331,7 +331,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
|
|||
switch (printerSettings.GetValue<BedShape>(SettingsKey.bed_shape))
|
||||
{
|
||||
case BedShape.Circular:
|
||||
Vector2 firstPosition = new Vector2(printCenter.x, printCenter.y + (bedSize.y / 2) * .5);
|
||||
Vector2 firstPosition = new Vector2(printCenter.X, printCenter.Y + (bedSize.Y / 2) * .5);
|
||||
switch (index)
|
||||
{
|
||||
case 0:
|
||||
|
|
@ -352,13 +352,13 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
|
|||
switch (index)
|
||||
{
|
||||
case 0:
|
||||
return new Vector2(printCenter.x, printCenter.y + (bedSize.y / 2) * .8);
|
||||
return new Vector2(printCenter.X, printCenter.Y + (bedSize.Y / 2) * .8);
|
||||
|
||||
case 1:
|
||||
return new Vector2(printCenter.x - (bedSize.x / 2) * .8, printCenter.y - (bedSize.y / 2) * .8);
|
||||
return new Vector2(printCenter.X - (bedSize.X / 2) * .8, printCenter.Y - (bedSize.Y / 2) * .8);
|
||||
|
||||
case 2:
|
||||
return new Vector2(printCenter.x + (bedSize.x / 2) * .8, printCenter.y - (bedSize.y / 2) * .8);
|
||||
return new Vector2(printCenter.X + (bedSize.X / 2) * .8, printCenter.Y - (bedSize.Y / 2) * .8);
|
||||
|
||||
default:
|
||||
throw new IndexOutOfRangeException();
|
||||
|
|
@ -371,7 +371,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
|
|||
int bestIndex = 0;
|
||||
double bestDist = double.PositiveInfinity;
|
||||
|
||||
currentDestination.z = 0;
|
||||
currentDestination.Z = 0;
|
||||
for (int regionIndex = 0; regionIndex < Regions.Count; regionIndex++)
|
||||
{
|
||||
var dist = (Regions[regionIndex].Center - currentDestination).LengthSquared;
|
||||
|
|
@ -406,18 +406,18 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
|
|||
InitializePlanes();
|
||||
}
|
||||
|
||||
var destinationAtZ0 = new Vector3(currentDestination.x, currentDestination.y, 0);
|
||||
var destinationAtZ0 = new Vector3(currentDestination.X, currentDestination.Y, 0);
|
||||
|
||||
// which triangle to check (distance to the centers)
|
||||
if ((LeftBottomCenter - destinationAtZ0).LengthSquared < (RightTopCenter - destinationAtZ0).LengthSquared)
|
||||
{
|
||||
double hitDistance = LeftBottomPlane.GetDistanceToIntersection(destinationAtZ0, Vector3.UnitZ);
|
||||
currentDestination.z += hitDistance;
|
||||
currentDestination.Z += hitDistance;
|
||||
}
|
||||
else
|
||||
{
|
||||
double hitDistance = RightTopPlane.GetDistanceToIntersection(destinationAtZ0, Vector3.UnitZ);
|
||||
currentDestination.z += hitDistance;
|
||||
currentDestination.Z += hitDistance;
|
||||
}
|
||||
|
||||
return currentDestination;
|
||||
|
|
|
|||
|
|
@ -235,8 +235,8 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
|
|||
|
||||
var feedRates = printer.Settings.Helpers.ManualMovementSpeeds();
|
||||
|
||||
printer.Connection.MoveAbsolute(PrinterConnection.Axis.Z, probeStartPosition.z, feedRates.z);
|
||||
printer.Connection.MoveAbsolute(probeStartPosition, feedRates.x);
|
||||
printer.Connection.MoveAbsolute(PrinterConnection.Axis.Z, probeStartPosition.Z, feedRates.Z);
|
||||
printer.Connection.MoveAbsolute(probeStartPosition, feedRates.X);
|
||||
printer.Connection.SendLineToPrinterNow("G30");
|
||||
printer.Connection.ReadLine.RegisterEvent(FinishedProbe, ref unregisterEvents);
|
||||
|
||||
|
|
@ -256,8 +256,8 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
|
|||
printer.Connection.ReadLine.UnregisterEvent(FinishedProbe, ref unregisterEvents);
|
||||
int zStringPos = currentEvent.Data.LastIndexOf("Z:");
|
||||
string zProbeHeight = currentEvent.Data.Substring(zStringPos + 2);
|
||||
probePosition.position = new Vector3(probeStartPosition.x, probeStartPosition.y, double.Parse(zProbeHeight));
|
||||
printer.Connection.MoveAbsolute(probeStartPosition, printer.Settings.Helpers.ManualMovementSpeeds().z);
|
||||
probePosition.position = new Vector3(probeStartPosition.X, probeStartPosition.Y, double.Parse(zProbeHeight));
|
||||
printer.Connection.MoveAbsolute(probeStartPosition, printer.Settings.Helpers.ManualMovementSpeeds().Z);
|
||||
printer.Connection.ReadPosition();
|
||||
|
||||
UiThread.RunOnIdle(() => container.nextButton.OnClick(null));
|
||||
|
|
@ -365,7 +365,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
|
|||
updateUntilClose = (tw) =>
|
||||
{
|
||||
Vector3 destinationPosition = printer.Connection.CurrentDestination;
|
||||
zPosition.Text = "Z: {0:0.00}".FormatWith(destinationPosition.z);
|
||||
zPosition.Text = "Z: {0:0.00}".FormatWith(destinationPosition.Z);
|
||||
UiThread.RunOnIdle(() => updateUntilClose(zPosition), .3);
|
||||
};
|
||||
updateUntilClose(zPosition);
|
||||
|
|
@ -441,13 +441,13 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
|
|||
|
||||
private void zMinusControl_Click(object sender, EventArgs mouseEvent)
|
||||
{
|
||||
printer.Connection.MoveRelative(PrinterConnection.Axis.Z, -moveAmount, printer.Settings.Helpers.ManualMovementSpeeds().z);
|
||||
printer.Connection.MoveRelative(PrinterConnection.Axis.Z, -moveAmount, printer.Settings.Helpers.ManualMovementSpeeds().Z);
|
||||
printer.Connection.ReadPosition();
|
||||
}
|
||||
|
||||
private void zPlusControl_Click(object sender, EventArgs mouseEvent)
|
||||
{
|
||||
printer.Connection.MoveRelative(PrinterConnection.Axis.Z, moveAmount, printer.Settings.Helpers.ManualMovementSpeeds().z);
|
||||
printer.Connection.MoveRelative(PrinterConnection.Axis.Z, moveAmount, printer.Settings.Helpers.ManualMovementSpeeds().Z);
|
||||
printer.Connection.ReadPosition();
|
||||
}
|
||||
}
|
||||
|
|
@ -487,18 +487,18 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
|
|||
double sampleRead = double.MinValue;
|
||||
if (currentEvent.Data.StartsWith("Bed")) // marlin G30 return code (looks like: 'Bed Position X:20 Y:32 Z:.01')
|
||||
{
|
||||
probePositions[probePositionsBeingEditedIndex].position.x = probeStartPosition.x;
|
||||
probePositions[probePositionsBeingEditedIndex].position.y = probeStartPosition.y;
|
||||
probePositions[probePositionsBeingEditedIndex].position.X = probeStartPosition.X;
|
||||
probePositions[probePositionsBeingEditedIndex].position.Y = probeStartPosition.Y;
|
||||
GCodeFile.GetFirstNumberAfter("Z:", currentEvent.Data, ref sampleRead);
|
||||
}
|
||||
else if (currentEvent.Data.StartsWith("Z:")) // smoothie G30 return code (looks like: 'Z:10.01')
|
||||
{
|
||||
probePositions[probePositionsBeingEditedIndex].position.x = probeStartPosition.x;
|
||||
probePositions[probePositionsBeingEditedIndex].position.y = probeStartPosition.y;
|
||||
probePositions[probePositionsBeingEditedIndex].position.X = probeStartPosition.X;
|
||||
probePositions[probePositionsBeingEditedIndex].position.Y = probeStartPosition.Y;
|
||||
// smoothie returns the position relative to the start postion
|
||||
double reportedProbeZ = 0;
|
||||
GCodeFile.GetFirstNumberAfter("Z:", currentEvent.Data, ref reportedProbeZ);
|
||||
sampleRead = probeStartPosition.z - reportedProbeZ;
|
||||
sampleRead = probeStartPosition.Z - reportedProbeZ;
|
||||
}
|
||||
|
||||
if (sampleRead != double.MinValue)
|
||||
|
|
@ -516,7 +516,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
|
|||
samples.RemoveAt(samples.Count - 1);
|
||||
}
|
||||
|
||||
probePositions[probePositionsBeingEditedIndex].position.z = Math.Round(samples.Average(), 2);
|
||||
probePositions[probePositionsBeingEditedIndex].position.Z = Math.Round(samples.Average(), 2);
|
||||
UiThread.RunOnIdle(() => container.nextButton.OnClick(null));
|
||||
}
|
||||
}
|
||||
|
|
@ -554,8 +554,8 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
|
|||
var probeOffset = printer.Settings.GetValue<Vector2>(SettingsKey.z_probe_xy_offset);
|
||||
adjustedProbePosition -= new Vector3(probeOffset);
|
||||
|
||||
printer.Connection.MoveAbsolute(PrinterConnection.Axis.Z, probeStartPosition.z, feedRates.z);
|
||||
printer.Connection.MoveAbsolute(adjustedProbePosition, feedRates.x);
|
||||
printer.Connection.MoveAbsolute(PrinterConnection.Axis.Z, probeStartPosition.Z, feedRates.Z);
|
||||
printer.Connection.MoveAbsolute(adjustedProbePosition, feedRates.X);
|
||||
|
||||
int numberOfSamples = printer.Settings.GetValue<int>(SettingsKey.z_probe_samples);
|
||||
for (int i = 0; i < numberOfSamples; i++)
|
||||
|
|
@ -563,7 +563,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
|
|||
// probe the current position
|
||||
printer.Connection.SendLineToPrinterNow("G30");
|
||||
// raise the probe after each sample
|
||||
printer.Connection.MoveAbsolute(adjustedProbePosition, feedRates.x);
|
||||
printer.Connection.MoveAbsolute(adjustedProbePosition, feedRates.X);
|
||||
}
|
||||
|
||||
container.backButton.Enabled = false;
|
||||
|
|
@ -609,8 +609,8 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
|
|||
|
||||
var feedRates = printer.Settings.Helpers.ManualMovementSpeeds();
|
||||
|
||||
printer.Connection.MoveAbsolute(PrinterConnection.Axis.Z, probeStartPosition.z, feedRates.z);
|
||||
printer.Connection.MoveAbsolute(probeStartPosition, feedRates.x);
|
||||
printer.Connection.MoveAbsolute(PrinterConnection.Axis.Z, probeStartPosition.Z, feedRates.Z);
|
||||
printer.Connection.MoveAbsolute(probeStartPosition, feedRates.X);
|
||||
printer.Connection.ReadPosition();
|
||||
|
||||
container.backButton.Enabled = false;
|
||||
|
|
@ -672,7 +672,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
|
|||
{
|
||||
if (haveDrawn)
|
||||
{
|
||||
printer.Connection.MoveRelative(PrinterConnection.Axis.Z, 2, printer.Settings.Helpers.ManualMovementSpeeds().z);
|
||||
printer.Connection.MoveRelative(PrinterConnection.Axis.Z, 2, printer.Settings.Helpers.ManualMovementSpeeds().Z);
|
||||
}
|
||||
base.PageIsBecomingInactive();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -91,9 +91,9 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
|
|||
{
|
||||
Vector3 position = new Vector3();
|
||||
|
||||
position.x = double.Parse(lines[0 * 3 + i]);
|
||||
position.y = double.Parse(lines[1 * 3 + i]);
|
||||
position.z = double.Parse(lines[2 * 3 + i]);
|
||||
position.X = double.Parse(lines[0 * 3 + i]);
|
||||
position.Y = double.Parse(lines[1 * 3 + i]);
|
||||
position.Z = double.Parse(lines[2 * 3 + i]);
|
||||
|
||||
SampledPositions.Add(position);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue