Skip to content

Commit 8422267

Browse files
authored
Merge pull request #5010 from larsbrubaker/master
main
2 parents 61b38ff + 2fe2d54 commit 8422267

File tree

8 files changed

+54
-12
lines changed

8 files changed

+54
-12
lines changed

MatterControlLib/CustomWidgets/ExportPrintItemPage.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public class ExportPrintItemPage : DialogPage
5353
public ExportPrintItemPage(IEnumerable<ILibraryItem> libraryItems, bool centerOnBed, PrinterConfig printer)
5454
{
5555
this.WindowTitle = "Export File".Localize();
56-
var exportWholeBed = libraryItems.First().Name == printer.Bed.Scene.Name;
56+
var exportWholeBed = libraryItems.First().Name == printer?.Bed.Scene.Name;
5757
if (exportWholeBed)
5858
{
5959
this.HeaderText = "Export bed to".Localize() + ":";

MatterControlLib/DesignTools/Operations/MirrorObject3D_2.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,8 @@ public override Task Rebuild()
9797

9898
transformedMesh.ReverseFaces();
9999

100+
transformedMesh.CalculateNormals();
101+
100102
var newMesh = new Object3D()
101103
{
102104
Mesh = transformedMesh

MatterControlLib/PartPreviewWindow/View3D/PrinterBar/PrintPopupMenu.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ public PrintPopupMenu(PrinterConfig printer, ThemeConfig theme)
223223
},
224224
Icon = StaticData.Instance.LoadIcon("cube_export.png", 16, 16, theme.InvertIcons),
225225
ButtonEnabled = exportPlugin.Enabled,
226-
ButtonName = "Export Gcode Button",
226+
ButtonName = "Export GCode Button",
227227
ButtonAction = (widget) =>
228228
{
229229
this.CloseMenu();
Binary file not shown.
Binary file not shown.

Submodules/agg-sharp

Tests/MatterControl.AutomationTests/ExportItemWindowTests.cs

Lines changed: 48 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,26 +42,66 @@ await MatterControlUtilities.RunTest(testRunner =>
4242
.ClickByName("Export Menu Item")
4343
.WaitForName("Export Item Window");
4444

45+
string gcodeOutputPath = MatterControlUtilities.PathToExportGcodeFolder;
46+
Directory.CreateDirectory(gcodeOutputPath);
47+
string fullPathToGcodeFile = Path.Combine(gcodeOutputPath, "Batman");
48+
4549
testRunner.ClickByName("Machine File (G-Code) Button")
4650
.ClickByName("Export Button")
47-
.Delay();
48-
49-
string gcodeOutputPath = MatterControlUtilities.PathToExportGcodeFolder;
51+
.Delay()
52+
.Type(fullPathToGcodeFile)
53+
.Type("{Enter}")
54+
.WaitFor(() => File.Exists(fullPathToGcodeFile + ".gcode"), 10);
5055

51-
Directory.CreateDirectory(gcodeOutputPath);
56+
Assert.IsTrue(File.Exists(fullPathToGcodeFile + ".gcode"), "Exported file not found");
5257

53-
string fullPathToGcodeFile = Path.Combine(gcodeOutputPath, "Batman");
54-
testRunner.Type(fullPathToGcodeFile);
55-
testRunner.Type("{Enter}");
58+
// add an item to the bed
59+
fullPathToGcodeFile = Path.Combine(gcodeOutputPath, "Cube");
60+
testRunner.AddItemToBedplate()
61+
.ClickByName("PrintPopupMenu")
62+
.ClickByName("Export GCode Button")
63+
.Type(fullPathToGcodeFile)
64+
.Type("{Enter}");
5665

5766
testRunner.WaitFor(() => File.Exists(fullPathToGcodeFile + ".gcode"), 10);
58-
5967
Assert.IsTrue(File.Exists(fullPathToGcodeFile + ".gcode"), "Exported file not found");
6068

6169
return Task.FromResult(0);
6270
});
6371
}
6472

73+
[Test]
74+
public async Task ExportDesignTabAsSTL()
75+
{
76+
await MatterControlUtilities.RunTest(testRunner =>
77+
{
78+
testRunner.WaitForFirstDraw();
79+
80+
// save from design tab
81+
var gcodeOutputPath = MatterControlUtilities.PathToExportGcodeFolder;
82+
var fullPathToGcodeFile = Path.Combine(gcodeOutputPath, "Cube2");
83+
Directory.CreateDirectory(gcodeOutputPath);
84+
testRunner.EnsureWelcomePageClosed()
85+
.ClickByName("Create New")
86+
.AddItemToBedplate()
87+
.ClickByName("Bed Options Menu")
88+
.ClickByName("Export Menu Item")
89+
.WaitForName("Export Item Window");
90+
91+
testRunner.ClickByName("STL File Button")
92+
.ClickByName("Export Button")
93+
.Delay()
94+
.Type(fullPathToGcodeFile)
95+
.Type("{Enter}")
96+
.WaitFor(() => File.Exists(fullPathToGcodeFile + ".stl"), 10);
97+
98+
testRunner.WaitFor(() => File.Exists(fullPathToGcodeFile + ".stl"), 10);
99+
Assert.IsTrue(File.Exists(fullPathToGcodeFile + ".stl"), "Exported file not found");
100+
101+
return Task.FromResult(0);
102+
});
103+
}
104+
65105
[Test]
66106
public async Task ExportStreamG92HandlingTest()
67107
{

Tests/MatterControl.Tests/MatterControl/MatterControlUtilities.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1060,7 +1060,7 @@ public static AutomationRunner ExportPrintAndLoadGCode(this AutomationRunner tes
10601060
.OpenPrintPopupMenu();
10611061
}
10621062

1063-
testRunner.ClickByName("Export Gcode Button");
1063+
testRunner.ClickByName("Export GCode Button");
10641064

10651065
// wait for the export to finish
10661066
throw new NotImplementedException();

0 commit comments

Comments
 (0)