From ef0e133a88e58f96fbd701eb4b3f4b3f9381fdb2 Mon Sep 17 00:00:00 2001 From: larsbrubaker Date: Wed, 20 Aug 2014 12:24:55 -0700 Subject: [PATCH 1/4] Put in an HDL printer config --- .../Airwolf 3D/HDL/calibration.ini | 1 + .../PrinterSettings/Airwolf 3D/HDL/config.ini | 126 ++++++++++++++++++ .../Airwolf 3D/HDL/material/BENDLAY.slice | 2 + .../Airwolf 3D/HDL/material/LAYBRICK.slice | 8 ++ .../Airwolf 3D/HDL/material/LAYWOOD.slice | 8 ++ .../Airwolf 3D/HDL/material/PLA 4043D.slice | 9 ++ .../Airwolf 3D/HDL/material/PLA.slice | 9 ++ .../Airwolf 3D/HDL/material/PVA.slice | 3 + .../Airwolf 3D/HDL/material/SOFT PLA.slice | 14 ++ .../Airwolf 3D/HDL/material/T-GLASE.slice | 9 ++ .../Airwolf 3D/HDL/material/TPE.slice | 18 +++ .../PrinterSettings/Airwolf 3D/HDL/setup.ini | 4 + 12 files changed, 211 insertions(+) create mode 100644 StaticData/PrinterSettings/Airwolf 3D/HDL/calibration.ini create mode 100644 StaticData/PrinterSettings/Airwolf 3D/HDL/config.ini create mode 100644 StaticData/PrinterSettings/Airwolf 3D/HDL/material/BENDLAY.slice create mode 100644 StaticData/PrinterSettings/Airwolf 3D/HDL/material/LAYBRICK.slice create mode 100644 StaticData/PrinterSettings/Airwolf 3D/HDL/material/LAYWOOD.slice create mode 100644 StaticData/PrinterSettings/Airwolf 3D/HDL/material/PLA 4043D.slice create mode 100644 StaticData/PrinterSettings/Airwolf 3D/HDL/material/PLA.slice create mode 100644 StaticData/PrinterSettings/Airwolf 3D/HDL/material/PVA.slice create mode 100644 StaticData/PrinterSettings/Airwolf 3D/HDL/material/SOFT PLA.slice create mode 100644 StaticData/PrinterSettings/Airwolf 3D/HDL/material/T-GLASE.slice create mode 100644 StaticData/PrinterSettings/Airwolf 3D/HDL/material/TPE.slice create mode 100644 StaticData/PrinterSettings/Airwolf 3D/HDL/setup.ini diff --git a/StaticData/PrinterSettings/Airwolf 3D/HDL/calibration.ini b/StaticData/PrinterSettings/Airwolf 3D/HDL/calibration.ini new file mode 100644 index 000000000..573c9f0b7 --- /dev/null +++ b/StaticData/PrinterSettings/Airwolf 3D/HDL/calibration.ini @@ -0,0 +1 @@ +Calibration - Circle.stl diff --git a/StaticData/PrinterSettings/Airwolf 3D/HDL/config.ini b/StaticData/PrinterSettings/Airwolf 3D/HDL/config.ini new file mode 100644 index 000000000..85c7208b4 --- /dev/null +++ b/StaticData/PrinterSettings/Airwolf 3D/HDL/config.ini @@ -0,0 +1,126 @@ +avoid_crossing_perimeters = 0 +bed_shape = rectangular +bed_size = 300,200 +bed_temperature = 0 +bottom_solid_layers = 3 +bridge_acceleration = 0 +bridge_fan_speed = 0 +bridge_flow_ratio = 1 +bridge_speed = 20 +brim_width = 0 +build_height = 300 +complete_objects = 0 +cool_extruder_lift = 0 +cooling = 1 +default_acceleration = 0 +disable_fan_first_layers = 2 +end_gcode = M104 S0 ; turn off temperature\nM140 S0\nG28 X0 Y0 ; home X/Y axis\nM84 ; disable motors +external_perimeter_speed = 30 +external_perimeters_first = 0 +extra_perimeters = 1 +extruder_clearance_height = 20 +extruder_clearance_radius = 20 +extruder_offset = 0x0 +extrusion_axis = E +extrusion_multiplier = 1 +extrusion_width = 0 +fan_always_on = 0 +fan_below_layer_time = 60 +filament_diameter = 2.85 +fill_angle = 45 +fill_density = 0.35 +fill_pattern = rectilinear +first_layer_acceleration = 0 +first_layer_bed_temperature = 0 +first_layer_extrusion_width = 200% +first_layer_height = .42 +first_layer_speed = 15 +first_layer_temperature = 240 +g0 = 0 +gap_fill_speed = 30 +gcode_arcs = 0 +gcode_comments = 0 +gcode_flavor = reprap +has_fan = 1 +has_heated_bed = 0 +infill_acceleration = 0 +infill_every_layers = 1 +infill_extruder = 1 +infill_extrusion_width = 0 +infill_first = 0 +infill_only_where_needed = 0 +infill_speed = 30 +layer_gcode = +layer_height = 0.21 +min_extrusion_before_retract = .1 +max_fan_speed = 0 +min_fan_speed = 0 +min_print_speed = 2 +min_skirt_length = 0 +notes = +nozzle_diameter = 0.5 +only_retract_when_crossing_perimeters = 1 +ooze_prevention = 0 +output_filename_format = [input_filename_base].gcode +overhangs = 1 +perimeter_acceleration = 0 +perimeter_extruder = 1 +perimeter_extrusion_width = 0 +perimeter_speed = 30 +perimeters = 1 +post_process = +print_center = 150,100 +raft_layers = 0 +randomize_start = 1 +resolution = 0 +retract_before_travel = 2 +retract_layer_change = 1 +retract_length = 7 +retract_length_tool_change = 10 +retract_lift = 0 +retract_restart_extra = 0 +retract_restart_extra_toolchange = 0 +retract_speed = 50 +skirt_distance = 2 +skirt_height = 1 +skirts = 3 +slowdown_below_layer_time = 15 +small_perimeter_speed = 30 +solid_fill_pattern = rectilinear +solid_infill_below_area = 1 +solid_infill_every_layers = 0 +solid_infill_extrusion_width = 0 +solid_infill_speed = 30 +spiral_vase = 0 +standby_temperature_delta = -5 +start_gcode = G28 ; home all axes\nM117 HD Printing... +start_perimeters_at_concave_points = 0 +start_perimeters_at_non_overhang = 0 +support_material = 0 +support_material_angle = 0 +support_material_create_internal_support = 0 +support_material_enforce_layers = 0 +support_material_extruder = 1 +support_material_extrusion_width = 0 +support_material_interface_extruder = 1 +support_material_interface_layers = 0 +support_material_interface_spacing = 0 +support_material_pattern = rectilinear +support_material_spacing = 2.5 +support_material_speed = 30 +support_material_threshold = 75 +support_material_xy_distance = 0.7 +support_material_z_distance = 0.15 +temperature = 240 +thin_walls = 1 +threads = 2 +toolchange_gcode = +top_infill_extrusion_width = 0 +top_solid_infill_speed = 30 +top_solid_layers = 4 +travel_speed = 100 +use_firmware_retraction = 0 +use_relative_e_distances = 0 +vibration_limit = 0 +wipe = 0 +z_offset = 0 \ No newline at end of file diff --git a/StaticData/PrinterSettings/Airwolf 3D/HDL/material/BENDLAY.slice b/StaticData/PrinterSettings/Airwolf 3D/HDL/material/BENDLAY.slice new file mode 100644 index 000000000..e2fb54366 --- /dev/null +++ b/StaticData/PrinterSettings/Airwolf 3D/HDL/material/BENDLAY.slice @@ -0,0 +1,2 @@ +first_layer_bed_temperature = 80 +bridge_fan_speed = 100 diff --git a/StaticData/PrinterSettings/Airwolf 3D/HDL/material/LAYBRICK.slice b/StaticData/PrinterSettings/Airwolf 3D/HDL/material/LAYBRICK.slice new file mode 100644 index 000000000..2f6cc6296 --- /dev/null +++ b/StaticData/PrinterSettings/Airwolf 3D/HDL/material/LAYBRICK.slice @@ -0,0 +1,8 @@ +temperature = 200 +slowdown_below_layer_time = 1 +min_fan_speed = 100 +max_fan_speed = 100 +first_layer_temperature = 200 +fan_always_on = 1 +disable_fan_first_layers = 1 +bridge_fan_speed = 100 diff --git a/StaticData/PrinterSettings/Airwolf 3D/HDL/material/LAYWOOD.slice b/StaticData/PrinterSettings/Airwolf 3D/HDL/material/LAYWOOD.slice new file mode 100644 index 000000000..2f6cc6296 --- /dev/null +++ b/StaticData/PrinterSettings/Airwolf 3D/HDL/material/LAYWOOD.slice @@ -0,0 +1,8 @@ +temperature = 200 +slowdown_below_layer_time = 1 +min_fan_speed = 100 +max_fan_speed = 100 +first_layer_temperature = 200 +fan_always_on = 1 +disable_fan_first_layers = 1 +bridge_fan_speed = 100 diff --git a/StaticData/PrinterSettings/Airwolf 3D/HDL/material/PLA 4043D.slice b/StaticData/PrinterSettings/Airwolf 3D/HDL/material/PLA 4043D.slice new file mode 100644 index 000000000..5507bcceb --- /dev/null +++ b/StaticData/PrinterSettings/Airwolf 3D/HDL/material/PLA 4043D.slice @@ -0,0 +1,9 @@ +temperature = 210 +support_material_z_distance = 0.27 +slowdown_below_layer_time = 1 +min_fan_speed = 100 +max_fan_speed = 100 +first_layer_temperature = 210 +fan_always_on = 1 +disable_fan_first_layers = 0 +bridge_fan_speed = 100 diff --git a/StaticData/PrinterSettings/Airwolf 3D/HDL/material/PLA.slice b/StaticData/PrinterSettings/Airwolf 3D/HDL/material/PLA.slice new file mode 100644 index 000000000..f10a77af5 --- /dev/null +++ b/StaticData/PrinterSettings/Airwolf 3D/HDL/material/PLA.slice @@ -0,0 +1,9 @@ +temperature = 220 +support_material_z_distance = 0.27 +slowdown_below_layer_time = 1 +min_fan_speed = 100 +max_fan_speed = 100 +first_layer_temperature = 220 +fan_always_on = 1 +disable_fan_first_layers = 0 +bridge_fan_speed = 100 diff --git a/StaticData/PrinterSettings/Airwolf 3D/HDL/material/PVA.slice b/StaticData/PrinterSettings/Airwolf 3D/HDL/material/PVA.slice new file mode 100644 index 000000000..bfcac04d2 --- /dev/null +++ b/StaticData/PrinterSettings/Airwolf 3D/HDL/material/PVA.slice @@ -0,0 +1,3 @@ +temperature = 195 +first_layer_temperature = 200 +bridge_fan_speed = 100 diff --git a/StaticData/PrinterSettings/Airwolf 3D/HDL/material/SOFT PLA.slice b/StaticData/PrinterSettings/Airwolf 3D/HDL/material/SOFT PLA.slice new file mode 100644 index 000000000..e5c768570 --- /dev/null +++ b/StaticData/PrinterSettings/Airwolf 3D/HDL/material/SOFT PLA.slice @@ -0,0 +1,14 @@ +travel_speed = 150 +temperature = 225 +support_material_z_distance = 0.27 +slowdown_below_layer_time = 1 +perimeter_speed = 25 +min_fan_speed = 100 +max_fan_speed = 100 +infill_speed = 25 +first_layer_temperature = 225 +first_layer_speed = 10 +filament_diameter = 2.7 +fan_always_on = 1 +disable_fan_first_layers = 0 +bridge_fan_speed = 100 diff --git a/StaticData/PrinterSettings/Airwolf 3D/HDL/material/T-GLASE.slice b/StaticData/PrinterSettings/Airwolf 3D/HDL/material/T-GLASE.slice new file mode 100644 index 000000000..0048b15d5 --- /dev/null +++ b/StaticData/PrinterSettings/Airwolf 3D/HDL/material/T-GLASE.slice @@ -0,0 +1,9 @@ +temperature = 250 +perimeter_speed = 20 +layer_height = 0.3 +infill_speed = 20 +first_layer_temperature = 250 +first_layer_speed = 10 +fill_density = 0.25 +filament_diameter = 3.3 +bridge_fan_speed = 100 diff --git a/StaticData/PrinterSettings/Airwolf 3D/HDL/material/TPE.slice b/StaticData/PrinterSettings/Airwolf 3D/HDL/material/TPE.slice new file mode 100644 index 000000000..9166c74b2 --- /dev/null +++ b/StaticData/PrinterSettings/Airwolf 3D/HDL/material/TPE.slice @@ -0,0 +1,18 @@ +travel_speed = 150 +temperature = 235 +start_perimeters_at_non_overhang = 1 +start_perimeters_at_concave_points = 1 +slowdown_below_layer_time = 25 +skirts = 5 +retract_length = 9 +retract_before_travel = 1 +perimeter_speed = 20 +min_print_speed = 1 +infill_speed = 20 +first_layer_temperature = 245 +first_layer_speed = 10 +fill_density = 0.25 +filament_diameter = 2.6 +disable_fan_first_layers = 1 +bridge_fan_speed = 100 +avoid_crossing_perimeters = 1 \ No newline at end of file diff --git a/StaticData/PrinterSettings/Airwolf 3D/HDL/setup.ini b/StaticData/PrinterSettings/Airwolf 3D/HDL/setup.ini new file mode 100644 index 000000000..dab72ca1e --- /dev/null +++ b/StaticData/PrinterSettings/Airwolf 3D/HDL/setup.ini @@ -0,0 +1,4 @@ +baud_rate = 250000 +default_material_presets = PLA +default_quality_preset = Balanced +default_macros = Lights On, Lights Off From 89b8f38e35801d7c88dc1b836bad359be03ad50d Mon Sep 17 00:00:00 2001 From: Kevin Pope Date: Wed, 20 Aug 2014 12:57:00 -0700 Subject: [PATCH 2/4] Update R1 material settings. --- StaticData/PrinterSettings/RoBo 3D/R1/material/ABS.slice | 8 ++++---- StaticData/PrinterSettings/RoBo 3D/R1/material/PLA.slice | 6 ++---- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/StaticData/PrinterSettings/RoBo 3D/R1/material/ABS.slice b/StaticData/PrinterSettings/RoBo 3D/R1/material/ABS.slice index 09adb267c..e09ca5a68 100644 --- a/StaticData/PrinterSettings/RoBo 3D/R1/material/ABS.slice +++ b/StaticData/PrinterSettings/RoBo 3D/R1/material/ABS.slice @@ -1,8 +1,8 @@ -bed_temperature = 75 +bed_temperature = 80 disable_fan_first_layers = 0 fan_always_on = 0 -first_layer_bed_temperature = 75 -first_layer_temperature = 225 +first_layer_bed_temperature = 80 +first_layer_temperature = 235 retract_length = 1 -temperature = 225 +temperature = 235 retract_speed = 30 \ No newline at end of file diff --git a/StaticData/PrinterSettings/RoBo 3D/R1/material/PLA.slice b/StaticData/PrinterSettings/RoBo 3D/R1/material/PLA.slice index ff02da075..0e6ff22ce 100644 --- a/StaticData/PrinterSettings/RoBo 3D/R1/material/PLA.slice +++ b/StaticData/PrinterSettings/RoBo 3D/R1/material/PLA.slice @@ -2,8 +2,6 @@ bed_temperature = 50 disable_fan_first_layers = 2 fan_always_on = 1 first_layer_bed_temperature = 55 -first_layer_temperature = 200 +first_layer_temperature = 210 retract_length = 3 -temperature = 200 - -retract_speed = 50 \ No newline at end of file +temperature = 210 \ No newline at end of file From 3731559ff8f436ad970eb347ac4cc1a1d2f223b8 Mon Sep 17 00:00:00 2001 From: gregory-diaz Date: Tue, 26 Aug 2014 18:34:54 -0700 Subject: [PATCH 3/4] uncommented export x3g work --- CustomWidgets/ExportPrintItemWindow.cs | 37 +++++++++++++++----------- StaticData/Translations/Master.txt | 3 +++ 2 files changed, 24 insertions(+), 16 deletions(-) diff --git a/CustomWidgets/ExportPrintItemWindow.cs b/CustomWidgets/ExportPrintItemWindow.cs index 3691057ca..087fef294 100644 --- a/CustomWidgets/ExportPrintItemWindow.cs +++ b/CustomWidgets/ExportPrintItemWindow.cs @@ -123,19 +123,19 @@ namespace MatterHackers.MatterControl middleRowContainer.AddChild(exportToSdCard); } - //if (ActiveSliceSettings.Instance.IsMakerbotGCodeFlavor() && !PrinterConnectionAndCommunication.Instance.PrinterIsPrinting) - //{ - // string exportAsX3GText = "Export as X3G".Localize(); - // Button exportAsX3G = textImageButtonFactory.Generate(exportAsX3GText); - // exportAsX3G.HAnchor = HAnchor.ParentLeft; - // exportAsX3G.Cursor = Cursors.Hand; - // exportAsX3G.Click += new ButtonBase.ButtonEventHandler((object sender, MouseEventArgs e) => - // { - // UiThread.RunOnIdle(ExportX3G_Click); + if (ActiveSliceSettings.Instance.IsMakerbotGCodeFlavor() && !PrinterConnectionAndCommunication.Instance.PrinterIsPrinting) + { + string exportAsX3GText = "Export as X3G".Localize(); + Button exportAsX3G = textImageButtonFactory.Generate(exportAsX3GText); + exportAsX3G.HAnchor = HAnchor.ParentLeft; + exportAsX3G.Cursor = Cursors.Hand; + exportAsX3G.Click += new ButtonBase.ButtonEventHandler((object sender, MouseEventArgs e) => + { + UiThread.RunOnIdle(ExportX3G_Click); - // }); - // middleRowContainer.AddChild(exportAsX3G); - //} + }); + middleRowContainer.AddChild(exportAsX3G); + } } middleRowContainer.AddChild(new VerticalSpacer()); @@ -353,10 +353,15 @@ namespace MatterHackers.MatterControl SlicingQueue.Instance.QueuePartForSlicing(printItemWrapper); printItemWrapper.SlicingDone.RegisterEvent(sliceItem_Done, ref unregisterEvents); - /*ProcessStartInfo exportX3GProcess = new ProcessStartInfo(printItemWrapper.PrintItem.Name); - exportX3GProcess.UseShellExecute = true; - exportX3GProcess.FileName = "C:\\Users\\Matter Hackers 1\\GPX\\gpx-win32-1.3\\gpx-win32-1.3\\gpx.exe"; - Process.Start(exportX3GProcess);*/ + //string gcode = @"C:\Users\Matter Hackers 1\GPX\gpx-win32-1.3\gpx-win32-1.3\TestCode.gcode"; + //Test whether or not path to file is correct + if (File.Exists(printItemWrapper.PrintItem.Name)) + { + string gpxApp = @"C:\Users\Matter Hackers 1\GPX\gpx-win32-1.3\gpx-win32-1.3\gpx.exe"; + string gpxArgs = string.Format("-p -m r2\"{0}\"", printItemWrapper.PrintItem.Name); + Process.Start(gpxApp, gpxArgs); + + } } else if (partIsGCode) { diff --git a/StaticData/Translations/Master.txt b/StaticData/Translations/Master.txt index 76877ce3a..17a7de8a3 100644 --- a/StaticData/Translations/Master.txt +++ b/StaticData/Translations/Master.txt @@ -2547,3 +2547,6 @@ Translated:Speeds English:Extrusion Translated:Extrusion +English:Export as X3G +Translated:Export as X3G + From c02e86441a7e3373917f5359f1e7d7469c1b0866 Mon Sep 17 00:00:00 2001 From: gregory-diaz Date: Wed, 27 Aug 2014 12:02:15 -0700 Subject: [PATCH 4/4] Export X3g Stuff --- CustomWidgets/ExportPrintItemWindow.cs | 112 ++++++++++++++------- PrintQueue/OptionsMenu/QueueOptionsMenu.cs | 3 +- PrintQueue/QueueBottomToolbar.cs | 3 +- SlicerConfiguration/MatterSliceInfo.cs | 8 +- StaticData/Translations/Master.txt | 3 + Utilities/ManifestFileHandler.cs | 3 +- Utilities/ProjectFileHandler.cs | 3 +- 7 files changed, 92 insertions(+), 43 deletions(-) diff --git a/CustomWidgets/ExportPrintItemWindow.cs b/CustomWidgets/ExportPrintItemWindow.cs index 4f0858ba0..9f93d2949 100644 --- a/CustomWidgets/ExportPrintItemWindow.cs +++ b/CustomWidgets/ExportPrintItemWindow.cs @@ -14,6 +14,7 @@ using MatterHackers.MatterControl.CustomWidgets; using MatterHackers.MatterControl.PrintQueue; using MatterHackers.MatterControl.SlicerConfiguration; using MatterHackers.MatterControl.PrinterCommunication; +using MatterHackers.MatterControl.DataStorage; namespace MatterHackers.MatterControl { @@ -22,14 +23,16 @@ namespace MatterHackers.MatterControl CheckBox showInFolderAfterSave; CheckBox applyLeveling; private PrintItemWrapper printItemWrapper; - string pathAndFilenameToSave; + string gcodePathAndFilenameToSave; + string x3gPathAndFilenameToSave; bool partIsGCode = false; + string documentsPath; public ExportPrintItemWindow(PrintItemWrapper printItemWraper) : base(400, 250) { this.printItemWrapper = printItemWraper; - + documentsPath = System.Environment.GetFolderPath (System.Environment.SpecialFolder.Personal); if (Path.GetExtension(printItemWraper.FileLocation).ToUpper() == ".GCODE") { partIsGCode = true; @@ -123,19 +126,19 @@ namespace MatterHackers.MatterControl middleRowContainer.AddChild(exportToSdCard); } - //if (ActiveSliceSettings.Instance.IsMakerbotGCodeFlavor() && !PrinterConnectionAndCommunication.Instance.PrinterIsPrinting) - //{ - // string exportAsX3GText = "Export as X3G".Localize(); - // Button exportAsX3G = textImageButtonFactory.Generate(exportAsX3GText); - // exportAsX3G.HAnchor = HAnchor.ParentLeft; - // exportAsX3G.Cursor = Cursors.Hand; - // exportAsX3G.Click += new ButtonBase.ButtonEventHandler((object sender, MouseEventArgs e) => - // { - // UiThread.RunOnIdle(ExportX3G_Click); - - // }); - // middleRowContainer.AddChild(exportAsX3G); - //} + bool showExportX3GButton = ActiveSliceSettings.Instance.IsMakerbotGCodeFlavor(); + if (showExportX3GButton) + { + string exportAsX3GText = "Export as X3G".Localize(); + Button exportAsX3G = textImageButtonFactory.Generate(exportAsX3GText); + exportAsX3G.HAnchor = HAnchor.ParentLeft; + exportAsX3G.Cursor = Cursors.Hand; + exportAsX3G.Click += new ButtonBase.ButtonEventHandler((object sender, MouseEventArgs e) => + { + UiThread.RunOnIdle(ExportX3G_Click); + }); + middleRowContainer.AddChild(exportAsX3G); + } } middleRowContainer.AddChild(new VerticalSpacer()); @@ -296,7 +299,7 @@ namespace MatterHackers.MatterControl void ExportGCode_Click(object state) { - SaveFileDialogParams saveParams = new SaveFileDialogParams("Export GCode|*.gcode", title: "Export GCode"); + SaveFileDialogParams saveParams = new SaveFileDialogParams("Export GCode|*.gcode", initialDirectory: documentsPath, title: "Export GCode"); saveParams.Title = "MatterControl: Export File"; saveParams.ActionButtonLabel = "Export"; @@ -305,12 +308,12 @@ namespace MatterHackers.MatterControl { streamToSaveTo.Close (); - pathAndFilenameToSave = saveParams.FileName; - string extension = Path.GetExtension(pathAndFilenameToSave); + gcodePathAndFilenameToSave = saveParams.FileName; + string extension = Path.GetExtension(gcodePathAndFilenameToSave); if(extension == "") { - File.Delete(pathAndFilenameToSave); - pathAndFilenameToSave += ".gcode"; + File.Delete(gcodePathAndFilenameToSave); + gcodePathAndFilenameToSave += ".gcode"; } if (Path.GetExtension(printItemWrapper.FileLocation).ToUpper() == ".STL") @@ -322,7 +325,7 @@ namespace MatterHackers.MatterControl else if (partIsGCode) { Close(); - SaveGCodeToNewLocation(printItemWrapper.FileLocation, pathAndFilenameToSave); + SaveGCodeToNewLocation(printItemWrapper.FileLocation, gcodePathAndFilenameToSave); } } } @@ -330,7 +333,7 @@ namespace MatterHackers.MatterControl void ExportX3G_Click(object state) { - SaveFileDialogParams saveParams = new SaveFileDialogParams("Export GCode|*.gcode", title: "Export GCode"); + SaveFileDialogParams saveParams = new SaveFileDialogParams("Export X3G|*.x3g", initialDirectory: documentsPath, title: "Export X3G"); saveParams.Title = "MatterControl: Export File"; saveParams.ActionButtonLabel = "Export"; @@ -339,24 +342,24 @@ namespace MatterHackers.MatterControl { streamToSaveTo.Close (); - pathAndFilenameToSave = saveParams.FileName; - string extension = Path.GetExtension(pathAndFilenameToSave); + x3gPathAndFilenameToSave = saveParams.FileName; + string extension = Path.GetExtension(x3gPathAndFilenameToSave); if(extension == "") { - File.Delete(pathAndFilenameToSave); - pathAndFilenameToSave += ".gcode"; + File.Delete(gcodePathAndFilenameToSave); + x3gPathAndFilenameToSave += ".x3g"; } if (Path.GetExtension(printItemWrapper.FileLocation).ToUpper() == ".STL") { Close(); SlicingQueue.Instance.QueuePartForSlicing(printItemWrapper); - printItemWrapper.SlicingDone.RegisterEvent(x3gItem_Done, ref unregisterEvents); + printItemWrapper.SlicingDone.RegisterEvent(x3gItemSlice_Complete, ref unregisterEvents); } else if (partIsGCode) { Close(); - SaveGCodeToNewLocation(printItemWrapper.FileLocation, pathAndFilenameToSave); + generateX3GfromGcode(printItemWrapper.FileLocation, x3gPathAndFilenameToSave); } } } @@ -446,7 +449,7 @@ namespace MatterHackers.MatterControl void DoExportSTL_Click(object state) { - SaveFileDialogParams saveParams = new SaveFileDialogParams("Save as STL|*.stl"); + SaveFileDialogParams saveParams = new SaveFileDialogParams("Save as STL|*.stl", initialDirectory: documentsPath); saveParams.Title = "MatterControl: Export File"; saveParams.ActionButtonLabel = "Export"; saveParams.FileName = printItemWrapper.Name; @@ -478,15 +481,54 @@ namespace MatterHackers.MatterControl PrintItemWrapper sliceItem = (PrintItemWrapper)sender; printItemWrapper.SlicingDone.UnregisterEvent(sliceItem_Done, ref unregisterEvents); - SaveGCodeToNewLocation(sliceItem.GetGCodePathAndFileName(), pathAndFilenameToSave); + SaveGCodeToNewLocation(sliceItem.GetGCodePathAndFileName(), gcodePathAndFilenameToSave); } - void x3gItem_Done(object sender, EventArgs e) + void x3gItemSlice_Complete(object sender, EventArgs e) { - ProcessStartInfo exportX3GProcess = new ProcessStartInfo(printItemWrapper.PrintItem.Name); - exportX3GProcess.UseShellExecute = true; - exportX3GProcess.FileName = "C:\\Users\\Matter Hackers 1\\GPX\\gpx-win32-1.3\\gpx-win32-1.3\\gpx.exe"; - Process.Start(exportX3GProcess); + PrintItemWrapper sliceItem = (PrintItemWrapper)sender; + printItemWrapper.SlicingDone.UnregisterEvent(x3gItemSlice_Complete, ref unregisterEvents); + if (File.Exists(sliceItem.GetGCodePathAndFileName())) + { + generateX3GfromGcode(sliceItem.GetGCodePathAndFileName(), x3gPathAndFilenameToSave); + } } + + string getGpxExectutablePath() + { + switch (OsInformation.OperatingSystem) + { + case OSType.Windows: + string gpxRelativePath = Path.Combine("..", "gpx.exe"); + if (!File.Exists(gpxRelativePath)) + { + gpxRelativePath = Path.Combine(".", "gpx.exe"); + } + return Path.GetFullPath(gpxRelativePath); + + case OSType.Mac: + return Path.Combine(ApplicationDataStorage.Instance.ApplicationPath, "gpx"); + + case OSType.X11: + return Path.GetFullPath(Path.Combine(".", "gpx.exe")); + + default: + throw new NotImplementedException(); + } + } + + void generateX3GfromGcode(string gcodeInputPath, string x3gOutputPath, string machineType="r2") + { + string gpxExecutablePath = getGpxExectutablePath(); + string gpxArgs = string.Format("-p -m {2} \"{0}\" \"{1}\" ", gcodeInputPath, x3gOutputPath, machineType); + + ProcessStartInfo exportX3GProcess = new ProcessStartInfo(gpxExecutablePath); + exportX3GProcess.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden; + exportX3GProcess.Arguments = gpxArgs; + Process.Start(exportX3GProcess); + ShowFileIfRequested(x3gOutputPath); + + + } } } diff --git a/PrintQueue/OptionsMenu/QueueOptionsMenu.cs b/PrintQueue/OptionsMenu/QueueOptionsMenu.cs index 620686e48..e25a0690c 100644 --- a/PrintQueue/OptionsMenu/QueueOptionsMenu.cs +++ b/PrintQueue/OptionsMenu/QueueOptionsMenu.cs @@ -149,7 +149,8 @@ namespace MatterHackers.MatterControl.PrintQueue List parts = QueueData.Instance.CreateReadOnlyPartList(); if (parts.Count > 0) { - SaveFileDialogParams saveParams = new SaveFileDialogParams("Save Parts Sheet|*.pdf"); + string documentsPath = System.Environment.GetFolderPath (System.Environment.SpecialFolder.Personal); + SaveFileDialogParams saveParams = new SaveFileDialogParams("Save Parts Sheet|*.pdf", initialDirectory: documentsPath); saveParams.ActionButtonLabel = LocalizedString.Get("Save Parts Sheet"); string saveParamsTitleLabel = "MatterControl".Localize(); diff --git a/PrintQueue/QueueBottomToolbar.cs b/PrintQueue/QueueBottomToolbar.cs index ee1a02173..12206258c 100644 --- a/PrintQueue/QueueBottomToolbar.cs +++ b/PrintQueue/QueueBottomToolbar.cs @@ -175,7 +175,8 @@ namespace MatterHackers.MatterControl.PrintQueue { List parts = QueueData.Instance.CreateReadOnlyPartList(); - SaveFileDialogParams saveParams = new SaveFileDialogParams("Save Parts Sheet|*.pdf"); + string documentsPath = System.Environment.GetFolderPath (System.Environment.SpecialFolder.Personal); + SaveFileDialogParams saveParams = new SaveFileDialogParams("Save Parts Sheet|*.pdf", initialDirectory: documentsPath); System.IO.Stream streamToSaveTo = FileDialog.SaveFileDialog(ref saveParams); if (streamToSaveTo != null) diff --git a/SlicerConfiguration/MatterSliceInfo.cs b/SlicerConfiguration/MatterSliceInfo.cs index a38aebdbe..6c22f0901 100644 --- a/SlicerConfiguration/MatterSliceInfo.cs +++ b/SlicerConfiguration/MatterSliceInfo.cs @@ -43,8 +43,8 @@ namespace MatterHackers.MatterControl.SlicerConfiguration protected override string getWindowsPath() { - string materSliceRelativePath = Path.Combine(".", "MatterSlice.exe"); - return Path.GetFullPath(materSliceRelativePath); + string matterSliceRelativePath = Path.Combine(".", "MatterSlice.exe"); + return Path.GetFullPath(matterSliceRelativePath); } protected override string getMacPath() @@ -55,8 +55,8 @@ namespace MatterHackers.MatterControl.SlicerConfiguration protected override string getLinuxPath() { - string materSliceRelativePath = Path.Combine(".", "MatterSlice.exe"); - return Path.GetFullPath(materSliceRelativePath); + string matterSliceRelativePath = Path.Combine(".", "MatterSlice.exe"); + return Path.GetFullPath(matterSliceRelativePath); } diff --git a/StaticData/Translations/Master.txt b/StaticData/Translations/Master.txt index 9e619fc19..6b45bd4ba 100644 --- a/StaticData/Translations/Master.txt +++ b/StaticData/Translations/Master.txt @@ -2561,3 +2561,6 @@ Translated:Lets the bed leveling code know if the printer can support the z axis English:Z Can Be Negative Translated:Z Can Be Negative +English:Export as X3G +Translated:Export as X3G + diff --git a/Utilities/ManifestFileHandler.cs b/Utilities/ManifestFileHandler.cs index a2f9b23ba..df29b6af8 100644 --- a/Utilities/ManifestFileHandler.cs +++ b/Utilities/ManifestFileHandler.cs @@ -113,7 +113,8 @@ namespace MatterHackers.MatterControl public void SaveAs() //Opens Save file dialog and outputs current queue as a project { - SaveFileDialogParams saveParams = new SaveFileDialogParams("Save Project|*.mcp"); + string documentsPath = System.Environment.GetFolderPath (System.Environment.SpecialFolder.Personal); + SaveFileDialogParams saveParams = new SaveFileDialogParams("Save Project|*.mcp", initialDirectory: documentsPath); System.IO.Stream streamToSaveTo = FileDialog.SaveFileDialog(ref saveParams); if (streamToSaveTo != null) diff --git a/Utilities/ProjectFileHandler.cs b/Utilities/ProjectFileHandler.cs index c876648b5..b75f7f103 100644 --- a/Utilities/ProjectFileHandler.cs +++ b/Utilities/ProjectFileHandler.cs @@ -151,7 +151,8 @@ namespace MatterHackers.MatterControl //Opens Save file dialog and outputs current queue as a project public void SaveAs() { - SaveFileDialogParams saveParams = new SaveFileDialogParams("Save Project|*.zip"); + string documentsPath = System.Environment.GetFolderPath (System.Environment.SpecialFolder.Personal); + SaveFileDialogParams saveParams = new SaveFileDialogParams("Save Project|*.zip", initialDirectory: documentsPath); System.IO.Stream streamToSaveTo = FileDialog.SaveFileDialog(ref saveParams); if (streamToSaveTo != null)