From: <adr...@us...> - 2010-09-05 20:41:35
|
Revision: 3773 http://reprap.svn.sourceforge.net/reprap/?rev=3773&view=rev Author: adrian-bowyer Date: 2010-09-05 20:41:28 +0000 (Sun, 05 Sep 2010) Log Message: ----------- Bug whereby the host crashed the first time you ran it if you have no preferences file fixed. Modified Paths: -------------- trunk/software/host/src/org/reprap/Main.java trunk/software/host/src/org/reprap/Preferences.java trunk/software/host/src/org/reprap/machines/MachineFactory.java Modified: trunk/software/host/src/org/reprap/Main.java =================================================================== --- trunk/software/host/src/org/reprap/Main.java 2010-09-05 20:10:08 UTC (rev 3772) +++ trunk/software/host/src/org/reprap/Main.java 2010-09-05 20:41:28 UTC (rev 3773) @@ -96,13 +96,14 @@ FileFilter filter = new ExtensionFileFilter("STL", new String[] { "STL" }); chooser.setFileFilter(filter); + try { printer = MachineFactory.create(); } catch (Exception ex) { - System.err.println("MachineFactory.create() failed.\n" + - ex.toString()); + System.err.println("MachineFactory.create() failed.\n"); + ex.printStackTrace(); } } @@ -728,15 +729,15 @@ Debug.d("Main dispose()"); ftd.killThem(); /// TODO This class should be fixed so it gets the dispose on window close - try { - // Attempt to save screen position if requested - org.reprap.Preferences prefs = org.reprap.Preferences.getGlobalPreferences(); - if (prefs.loadBool("RememberWindowPosition")) { - //prefs.setGlobalBool("MainWindowTop", xxx) - } - } catch (Exception ex) { - - } +// try { +// // Attempt to save screen position if requested +// org.reprap.Preferences prefs = org.reprap.Preferences.getGlobalPreferences(); +// if (prefs.loadBool("RememberWindowPosition")) { +// //prefs.setGlobalBool("MainWindowTop", xxx); +// } +// } catch (Exception ex) { +// +// } System.exit(0); } Modified: trunk/software/host/src/org/reprap/Preferences.java =================================================================== --- trunk/software/host/src/org/reprap/Preferences.java 2010-09-05 20:10:08 UTC (rev 3772) +++ trunk/software/host/src/org/reprap/Preferences.java 2010-09-05 20:41:28 UTC (rev 3773) @@ -91,7 +91,8 @@ URL mainUrl = mainFile.toURI().toURL(); if (fallbackUrl == null && !mainFile.exists()) - throw new IOException("Cannot load RepRap properties file or default "+propsFileDist); + //throw new IOException("Cannot load RepRap properties file or default "+propsFileDist); + Debug.e("Cannot load RepRap properties file or default "+propsFileDist); if (fallbackUrl != null) fallbackPreferences.load(fallbackUrl.openStream()); @@ -106,7 +107,7 @@ // If we don't have a local preferences file copy the default // file into it. mainPreferences.load(fallbackUrl.openStream()); - save(); + save(true); } } @@ -173,7 +174,7 @@ Debug.d("The distribution preferences file and yours match. This is good."); } - public void save() throws FileNotFoundException, IOException { + public void save(boolean startUp) throws FileNotFoundException, IOException { String savePath = new String(System.getProperty("user.home") + File.separatorChar + propsFolder + File.separatorChar); File f = new File(savePath + File.separatorChar + propsFile); @@ -188,7 +189,9 @@ OutputStream output = new FileOutputStream(f); mainPreferences.store(output, "RepRap machine parameters. See http://objects.reprap.org/wiki/Java_Software_Preferences_File"); - org.reprap.Main.gui.getPrinter().refreshPreferences(); + + if(!startUp) + org.reprap.Main.gui.getPrinter().refreshPreferences(); } public String loadString(String name) { @@ -260,7 +263,7 @@ public static void saveGlobal() throws IOException { initIfNeeded(); - globalPrefs.save(); + globalPrefs.save(false); } public static Preferences getGlobalPreferences() throws IOException { Modified: trunk/software/host/src/org/reprap/machines/MachineFactory.java =================================================================== --- trunk/software/host/src/org/reprap/machines/MachineFactory.java 2010-09-05 20:10:08 UTC (rev 3772) +++ trunk/software/host/src/org/reprap/machines/MachineFactory.java 2010-09-05 20:41:28 UTC (rev 3773) @@ -24,7 +24,7 @@ */ static public Printer create() throws Exception { - String machine = Preferences.loadGlobalString("RepRap_Machine"); + String machine = org.reprap.Preferences.loadGlobalString("RepRap_Machine"); // if (machine.compareToIgnoreCase("SNAPRepRap") == 0) // return new SNAPReprap(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <adr...@us...> - 2010-09-07 14:25:38
|
Revision: 3780 http://reprap.svn.sourceforge.net/reprap/?rev=3780&view=rev Author: adrian-bowyer Date: 2010-09-07 14:25:32 +0000 (Tue, 07 Sep 2010) Log Message: ----------- Added ability to decide PCB position on the bed at run time. Modified Paths: -------------- trunk/software/host/src/org/reprap/geometry/polygons/RrRectangle.java trunk/software/host/src/org/reprap/gui/RepRapBuild.java trunk/software/host/src/org/reprap/pcb/PCB.java Modified: trunk/software/host/src/org/reprap/geometry/polygons/RrRectangle.java =================================================================== --- trunk/software/host/src/org/reprap/geometry/polygons/RrRectangle.java 2010-09-06 23:27:18 UTC (rev 3779) +++ trunk/software/host/src/org/reprap/geometry/polygons/RrRectangle.java 2010-09-07 14:25:32 UTC (rev 3780) @@ -220,6 +220,17 @@ } /** + * Move somewhere else + * @param p + * @return + */ + public RrRectangle translate(Rr2Point p) + { + return new RrRectangle(new RrInterval(x.low() + p.x(), x.high() + p.x()), + new RrInterval(y.low() + p.y(), y.high() + p.y())); + } + + /** * @param a */ public void expand(Rr2Point a) Modified: trunk/software/host/src/org/reprap/gui/RepRapBuild.java =================================================================== --- trunk/software/host/src/org/reprap/gui/RepRapBuild.java 2010-09-06 23:27:18 UTC (rev 3779) +++ trunk/software/host/src/org/reprap/gui/RepRapBuild.java 2010-09-07 14:25:32 UTC (rev 3780) @@ -109,6 +109,7 @@ import javax.swing.ButtonGroup; import javax.swing.JButton; import javax.swing.JComponent; +import javax.swing.JDialog; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JTextField; @@ -138,7 +139,7 @@ class MaterialRadioButtons extends JPanel { private static final long serialVersionUID = 1L; private static Attributes att; - private static JFrame frame; + private static JDialog dialog; private static JTextField copies; private static RepRapBuild rrb; private static int stlIndex; @@ -209,7 +210,7 @@ int number = Integer.parseInt(copies.getText().trim()) - 1; STLObject stl = rrb.getSTLs().get(stlIndex); rrb.moreCopies(stl, att, number); - frame.dispose(); + dialog.dispose(); } public static void createAndShowGUI(Attributes a, RepRapBuild r, int index) @@ -218,18 +219,20 @@ rrb = r; stlIndex = index; //Create and set up the window. - frame = new JFrame("Material selector"); - frame.setLocation(500, 400); - frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); + JFrame f = new JFrame(); + dialog = new JDialog(f, "Material selector"); + dialog.setLocation(500, 400); + dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); //Create and set up the content pane. JComponent newContentPane = new MaterialRadioButtons(); newContentPane.setOpaque(true); //content panes must be opaque - frame.setContentPane(newContentPane); + dialog.setContentPane(newContentPane); //Display the window. - frame.pack(); - frame.setVisible(true); + dialog.pack(); + dialog.setModalityType(JDialog.DEFAULT_MODALITY_TYPE); + dialog.setVisible(true); } } Modified: trunk/software/host/src/org/reprap/pcb/PCB.java =================================================================== --- trunk/software/host/src/org/reprap/pcb/PCB.java 2010-09-06 23:27:18 UTC (rev 3779) +++ trunk/software/host/src/org/reprap/pcb/PCB.java 2010-09-07 14:25:32 UTC (rev 3780) @@ -1,15 +1,28 @@ package org.reprap.pcb; +import java.awt.BorderLayout; +import java.awt.GridLayout; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; import java.io.BufferedReader; -import java.io.BufferedWriter; import java.io.FileNotFoundException; import java.io.IOException; import java.io.PrintStream; import java.io.FileReader; -import java.io.FileWriter; import java.io.File; import java.util.Date; import java.text.SimpleDateFormat; + +import javax.swing.BorderFactory; +import javax.swing.JButton; +import javax.swing.JComponent; +import javax.swing.JDialog; +import javax.swing.JFrame; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JTextField; +import javax.swing.SwingConstants; + import org.reprap.Extruder; import org.reprap.Attributes; import org.reprap.Preferences; @@ -20,6 +33,101 @@ //import java.io.IOException; + +class PCBOffsets extends JPanel { + private static final long serialVersionUID = 1L; + private static JDialog dialog; + private static JTextField xo; + private static JTextField yo; + private static double xoff = 10; + private static double yoff = 10; + + private PCBOffsets(RrRectangle rec) + { + super(new BorderLayout()); + JPanel radioPanel; + radioPanel = new JPanel(new GridLayout(0, 1)); + radioPanel.setSize(300,200); + + JLabel jLabel2 = new JLabel(); + radioPanel.add(jLabel2); + jLabel2.setText(" PCB dimensions: " + org.reprap.machines.GCodeRepRap.round(rec.ne().x() - rec.sw().x(), 1) + + "(X) x " + org.reprap.machines.GCodeRepRap.round(rec.ne().y() - rec.sw().y(), 1) + "(Y) mm"); + jLabel2.setHorizontalAlignment(SwingConstants.CENTER); + JLabel jLabel3 = new JLabel(); + radioPanel.add(jLabel3); + jLabel3.setText(" Offsets (X and Y) in mm:"); + jLabel3.setHorizontalAlignment(SwingConstants.CENTER); + xo = new JTextField("10"); + radioPanel.add(xo); + xo.setHorizontalAlignment(SwingConstants.CENTER); + yo = new JTextField("10"); + radioPanel.add(yo); + yo.setHorizontalAlignment(SwingConstants.CENTER); + + + try + { + + JButton okButton = new JButton(); + radioPanel.add(okButton); + okButton.setText("OK"); + okButton.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent evt) { + OKHandler(); + } + }); + + add(radioPanel, BorderLayout.LINE_START); + setBorder(BorderFactory.createEmptyBorder(20,20,20,20)); + + } catch (Exception ex) + { + System.err.println(ex.toString()); + ex.printStackTrace(); + } + } + + public static void OKHandler() + { + xoff = Double.parseDouble(xo.getText().trim()); + yoff = Double.parseDouble(yo.getText().trim()); + dialog.dispose(); + } + + public static void pcbo(RrRectangle rec) + { + //Create and set up the window. + JFrame f = new JFrame(); + dialog = new JDialog(f, "PCB Offsets"); + dialog.setLocation(500, 400); + dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); + + //Create and set up the content pane. + JComponent newContentPane = new PCBOffsets(rec); + newContentPane.setOpaque(true); //content panes must be opaque + dialog.setContentPane(newContentPane); + + //Display the window. + dialog.pack(); + dialog.setModalityType(JDialog.DEFAULT_MODALITY_TYPE); + dialog.setVisible(true); + } + + + + public static double getXoff() + { + return xoff; + } + + public static double getYoff() + { + return yoff; + } + +} + public class PCB { GerberGCode gerberGcode; @@ -35,8 +143,8 @@ double zFeedRate = 50; double zDown = 0; static final double centreWidth = 0.9; - static final double offsetX=10; - static final double offsetY=10; + static double offsetX=0; + static double offsetY=0; File inputTracksAndPads; File inputDrill; File outputGCodes; @@ -60,8 +168,6 @@ Debug.d("Input: " + inputTracksAndPads.getName()); Debug.d("Output: " + outputGCodes.getName()+"\n"); Debug.d("Pen Width: " + penWidth + " mm"); - Debug.d("Offset X: " + offsetX + " mm"); - Debug.d("Offset Y: " + offsetY + " mm"); createBitmap(); @@ -71,7 +177,7 @@ try { - if(Preferences.loadGlobalBool("DisplaySimulation")) + if(Preferences.loadGlobalBool("DisplaySimulation") && penPaths.size() > 0) { RrGraphics simulationPlot2 = new RrGraphics("PCB pen plotlines"); // if(currentPolygon != null) @@ -218,9 +324,15 @@ bigBox = RrRectangle.union(bigBox, r); } - Debug.d("Surrounding reactangle: " + bigBox); in.close(); + PCBOffsets.pcbo(bigBox); + + offsetX = PCBOffsets.getXoff() - bigBox.sw().x(); + offsetY = PCBOffsets.getYoff() - bigBox.sw().y(); + + bigBox = bigBox.translate(new Rr2Point(PCBOffsets.getXoff(), PCBOffsets.getYoff())); + in = new BufferedReader(new FileReader(inputTracksAndPads)); BooleanGrid pattern = new BooleanGrid(RrCSG.nothing(), bigBox, new Attributes(null, null, null, pcbPen.getAppearance())); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <adr...@us...> - 2010-09-09 21:59:23
|
Revision: 3786 http://reprap.svn.sourceforge.net/reprap/?rev=3786&view=rev Author: adrian-bowyer Date: 2010-09-09 21:59:16 +0000 (Thu, 09 Sep 2010) Log Message: ----------- Host code modified to report any endstop errors when the axes are all zeroed in the GUI. Debug has to be enabled to get the message. Modified Paths: -------------- trunk/software/host/src/org/reprap/Printer.java trunk/software/host/src/org/reprap/gui/botConsole/XYZTabPanel.java trunk/software/host/src/org/reprap/machines/GCodeRepRap.java trunk/software/host/src/org/reprap/machines/Simulator.java Modified: trunk/software/host/src/org/reprap/Printer.java =================================================================== --- trunk/software/host/src/org/reprap/Printer.java 2010-09-09 21:53:56 UTC (rev 3785) +++ trunk/software/host/src/org/reprap/Printer.java 2010-09-09 21:59:16 UTC (rev 3786) @@ -257,6 +257,13 @@ public double[] getCoordinates() throws Exception; /** + * Get the zero errors + * @return + * @throws Exception + */ + public double[] getZeroError() throws Exception; + + /** * Tell the printer class it's Z position. Only to be used if * you know what you're doing... * @param z Modified: trunk/software/host/src/org/reprap/gui/botConsole/XYZTabPanel.java =================================================================== --- trunk/software/host/src/org/reprap/gui/botConsole/XYZTabPanel.java 2010-09-09 21:53:56 UTC (rev 3785) +++ trunk/software/host/src/org/reprap/gui/botConsole/XYZTabPanel.java 2010-09-09 21:59:16 UTC (rev 3786) @@ -8,6 +8,7 @@ import java.io.IOException; import org.reprap.Printer; +import org.reprap.utilities.Debug; /** * * @author ensab @@ -17,6 +18,7 @@ private double XYfastSpeed; private double ZfastSpeed; + private boolean firstZero = true; private Printer printer; private static double nudgeSize = 0; private BotConsoleFrame parentBotConsoleFrame = null; @@ -71,6 +73,7 @@ /** Creates new form XYZTabPanel */ public XYZTabPanel() { + firstZero = true; printer = org.reprap.Main.gui.getPrinter(); initComponents(); try @@ -468,18 +471,24 @@ public void homeAll() { + double ze[] = new double[4]; parentBotConsoleFrame.suspendPolling(); try { printer.home(); + if(!firstZero) + ze = printer.getZeroError(); } catch (Exception e) { parentBotConsoleFrame.handleException(e); } + if(!firstZero) + Debug.d("Zero errors (steps). X:" + ze[0] + " Y:" + ze[1] + " Z:" + ze[2]); xStepperPositionJPanel.zeroBox(); yStepperPositionJPanel.zeroBox(); zStepperPositionJPanel.zeroBox(); // xStepperPositionJPanel.homeAxis(); // yStepperPositionJPanel.homeAxis(); // zStepperPositionJPanel.homeAxis(); + firstZero = false; parentBotConsoleFrame.resumePolling(); } Modified: trunk/software/host/src/org/reprap/machines/GCodeRepRap.java =================================================================== --- trunk/software/host/src/org/reprap/machines/GCodeRepRap.java 2010-09-09 21:53:56 UTC (rev 3785) +++ trunk/software/host/src/org/reprap/machines/GCodeRepRap.java 2010-09-09 21:59:16 UTC (rev 3786) @@ -42,7 +42,7 @@ super(); gcode = new GCodeReaderAndWriter(); - + gcode.queue("M110 ; Reset the line numbers"); loadExtruders(); forceSelection = true; @@ -454,9 +454,9 @@ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd:HH-mm-ss"); String myDateString = sdf.format(myDate); gcode.queue("; Created: " + myDateString); + gcode.queue(";#!RECTANGLE: " + lc.getBox()); - gcode.queue(";#!RECTANGLE: " + lc.getBox()); - + gcode.queue("M110 ; Reset the line numbers"); //take us to fun, safe metric land. gcode.queue("G21 ;metric is good!"); @@ -585,6 +585,22 @@ result[3] = gcode.getE(); return result; } + + /** + * Get X, Y, Z and E (if supported) coordinates in an array + * @return + * @throws Exception + */ + public double[] getZeroError() throws Exception + { + gcode.queue("M117; get error coordinates"); + double [] result = new double[4]; + result[0] = gcode.getX(); + result[1] = gcode.getY(); + result[2] = gcode.getZ(); + result[3] = gcode.getE(); + return result; + } /* (non-Javadoc) * @see org.reprap.Printer#homeToZeroX() Modified: trunk/software/host/src/org/reprap/machines/Simulator.java =================================================================== --- trunk/software/host/src/org/reprap/machines/Simulator.java 2010-09-09 21:53:56 UTC (rev 3785) +++ trunk/software/host/src/org/reprap/machines/Simulator.java 2010-09-09 21:59:16 UTC (rev 3786) @@ -95,6 +95,17 @@ return result; } + public double[] getZeroError() throws Exception + { + double [] result = new double[4]; + result[0] = 0; + result[1] = 0; + result[2] = 0; + result[3] = 0; + + return result; + } + public void delay(long millis) {} //TODO: make this work normally. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <adr...@us...> - 2010-10-07 19:50:42
|
Revision: 3823 http://reprap.svn.sourceforge.net/reprap/?rev=3823&view=rev Author: adrian-bowyer Date: 2010-10-07 19:50:34 +0000 (Thu, 07 Oct 2010) Log Message: ----------- Replacing references to System.err.print with Debug.e. Modified Paths: -------------- trunk/software/host/src/org/reprap/Attributes.java trunk/software/host/src/org/reprap/Main.java trunk/software/host/src/org/reprap/Preferences.java trunk/software/host/src/org/reprap/RFO.java trunk/software/host/src/org/reprap/comms/GCodeReaderAndWriter.java trunk/software/host/src/org/reprap/devices/GenericExtruder.java trunk/software/host/src/org/reprap/geometry/LayerRules.java trunk/software/host/src/org/reprap/geometry/polygons/AllSTLsToBuild.java trunk/software/host/src/org/reprap/geometry/polygons/RrCSG.java trunk/software/host/src/org/reprap/geometry/polygons/RrInterval.java trunk/software/host/src/org/reprap/geometry/polygons/RrRectangle.java trunk/software/host/src/org/reprap/gui/Panel3D.java trunk/software/host/src/org/reprap/gui/Preferences.java trunk/software/host/src/org/reprap/gui/RepRapBuild.java trunk/software/host/src/org/reprap/gui/STLObject.java trunk/software/host/src/org/reprap/gui/botConsole/BotConsoleFrame.java trunk/software/host/src/org/reprap/gui/botConsole/StepperPositionJPanel.java trunk/software/host/src/org/reprap/gui/botConsole/XYZTabPanel.java trunk/software/host/src/org/reprap/machines/GCodeRepRap.java trunk/software/host/src/org/reprap/machines/GenericRepRap.java trunk/software/host/src/org/reprap/machines/Simulator.java trunk/software/host/src/org/reprap/pcb/PCB.java trunk/software/host/src/org/reprap/utilities/CodeGenerator.java trunk/software/host/src/org/reprap/utilities/RrGraphics.java Modified: trunk/software/host/src/org/reprap/Attributes.java =================================================================== --- trunk/software/host/src/org/reprap/Attributes.java 2010-10-07 17:01:38 UTC (rev 3822) +++ trunk/software/host/src/org/reprap/Attributes.java 2010-10-07 19:50:34 UTC (rev 3823) @@ -5,6 +5,7 @@ import org.reprap.devices.GenericExtruder; import org.reprap.gui.STLObject; +import org.reprap.utilities.Debug; /** * Small class to hold RepRap attributes that are attached to @@ -102,13 +103,13 @@ Printer p = org.reprap.Main.gui.getPrinter(); if(p == null) { - System.err.println("Attributes.getExtruder(): null printer!"); + Debug.e("Attributes.getExtruder(): null printer!"); return null; } e = p.getExtruder(material); if(e == null) { - System.err.println("Attributes.getExtruder(): null extruder for " + material); + Debug.e("Attributes.getExtruder(): null extruder for " + material); return null; } } Modified: trunk/software/host/src/org/reprap/Main.java =================================================================== --- trunk/software/host/src/org/reprap/Main.java 2010-10-07 17:01:38 UTC (rev 3822) +++ trunk/software/host/src/org/reprap/Main.java 2010-10-07 19:50:34 UTC (rev 3823) @@ -100,7 +100,7 @@ printer = MachineFactory.create(); } catch (Exception ex) { - System.err.println("MachineFactory.create() failed.\n"); + Debug.e("MachineFactory.create() failed.\n"); ex.printStackTrace(); } } @@ -319,7 +319,7 @@ if(printer == null) - System.err.println("Production attempted with null printer."); + Debug.e("Production attempted with null printer."); producer = new Producer(printer, builder); producer.setSegmentPause(segmentPause); producer.setLayerPause(layerPause); Modified: trunk/software/host/src/org/reprap/Preferences.java =================================================================== --- trunk/software/host/src/org/reprap/Preferences.java 2010-10-07 17:01:38 UTC (rev 3822) +++ trunk/software/host/src/org/reprap/Preferences.java 2010-10-07 19:50:34 UTC (rev 3823) @@ -102,7 +102,7 @@ fallbackPreferences = new Properties(); mainPreferences = new Properties(); URL fallbackUrl = ClassLoader.getSystemResource(propsFileDist); - //System.out.println("++++ " + fallbackUrl.toString()); + //Debug.a("++++ " + fallbackUrl.toString()); // Construct URL of user properties file String path = new String(System.getProperty("user.home") + File.separatorChar + @@ -219,7 +219,7 @@ return mainPreferences.getProperty(name); if (fallbackPreferences.containsKey(name)) return fallbackPreferences.getProperty(name); - System.err.println("RepRap preference: " + name + " not found in either preference file."); + Debug.e("RepRap preference: " + name + " not found in either preference file."); return null; } @@ -311,7 +311,7 @@ public static void setGlobalString(String name, String value) throws IOException { initIfNeeded(); - //System.err.println("Setting global " + name + ":" + value); + //Debug.e("Setting global " + name + ":" + value); globalPrefs.setString(name, value); } @@ -327,7 +327,7 @@ */ private void setString(String name, String value) { - //System.err.println("Setting " + name + ":" + value); + //Debug.e("Setting " + name + ":" + value); mainPreferences.setProperty(name, value); } Modified: trunk/software/host/src/org/reprap/RFO.java =================================================================== --- trunk/software/host/src/org/reprap/RFO.java 2010-10-07 17:01:38 UTC (rev 3822) +++ trunk/software/host/src/org/reprap/RFO.java 2010-10-07 19:50:34 UTC (rev 3823) @@ -248,7 +248,7 @@ */ public void startDocument () { - //System.out.println("Start document"); + //Debug.a("Start document"); } @@ -257,7 +257,7 @@ */ public void endDocument () { - //System.out.println("End document"); + //Debug.a("End document"); } @@ -355,7 +355,7 @@ { // for (int i = start; i < start + length; i++) // System.out.print(ch[i]); -// System.out.println(); +// Debug.a(); } } @@ -610,11 +610,11 @@ File f = new File(dirToZip, fileList[i]); FileInputStream fis = new FileInputStream(f); String zEntry = f.getPath(); - //System.out.println("\n" + zEntry); + //Debug.a("\n" + zEntry); int start = zEntry.indexOf(uniqueName); zEntry = zEntry.substring(start + uniqueName.length() + 1, zEntry.length()); - //System.out.println(tempDir); - //System.out.println(zEntry + "\n"); + //Debug.a(tempDir); + //Debug.a(zEntry + "\n"); ZipEntry entry = new ZipEntry(zEntry); rfoFile.putNextEntry(entry); while((bytesIn = fis.read(buffer)) != -1) Modified: trunk/software/host/src/org/reprap/comms/GCodeReaderAndWriter.java =================================================================== --- trunk/software/host/src/org/reprap/comms/GCodeReaderAndWriter.java 2010-10-07 17:01:38 UTC (rev 3822) +++ trunk/software/host/src/org/reprap/comms/GCodeReaderAndWriter.java 2010-10-07 19:50:34 UTC (rev 3823) @@ -200,7 +200,7 @@ portName = Preferences.loadGlobalString("Port(name)"); } catch (Exception ex) { - System.err.println("Cannot load preference Port(name)."); + Debug.e("Cannot load preference Port(name)."); portName = "stdout"; } @@ -231,7 +231,7 @@ paused = true; // while(!bufferEmpty()) // { -// //System.err.println("Waiting for buffer to empty."); +// //Debug.e("Waiting for buffer to empty."); // sleep (131); // } } @@ -294,7 +294,7 @@ // if(bufferThread == null) // { -// System.err.println("GCodeWriter: attempt to write to non-existent buffer."); +// Debug.e("GCodeWriter: attempt to write to non-existent buffer."); // return true; // } @@ -320,7 +320,7 @@ while(paused) { iAmPaused = true; - //System.err.println("Waiting for pause to end."); + //Debug.e("Waiting for pause to end."); sleep(239); } iAmPaused = false; @@ -790,11 +790,11 @@ CommPortIdentifier commId = CommPortIdentifier.getPortIdentifier(portName); port = (SerialPort)commId.open(portName, 30000); } catch (NoSuchPortException e) { - System.err.println("Error opening port: " + portName); + Debug.e("Error opening port: " + portName); return; } catch (PortInUseException e){ - System.err.println("Port '" + portName + "' is already in use."); + Debug.e("Port '" + portName + "' is already in use."); return; } Main.setRepRapPresent(true); @@ -844,7 +844,7 @@ serialInStream = port.getInputStream(); serialOutStream = new PrintStream(writeStream); } catch (IOException e) { - System.err.println("GCodeWriter: Error opening serial port stream."); + Debug.e("GCodeWriter: Error opening serial port stream."); serialInStream = null; serialOutStream = null; return; @@ -883,13 +883,13 @@ return chooser.getSelectedFile().getName(); } catch (FileNotFoundException e) { - System.err.println("Can't read file " + name); + Debug.e("Can't read file " + name); fileInStream = null; return null; } } else { - System.err.println("Can't read file."); + Debug.e("Can't read file."); fileInStream = null; } @@ -943,7 +943,7 @@ { opFileArray = null; opFileIndex = -1; - System.err.println("Can't write to file '" + opFileName); + Debug.e("Can't write to file '" + opFileName); opFileName = null; fileOutStream = null; } @@ -981,7 +981,7 @@ fileOutStream = new PrintStream(fileStream); } catch (Exception e) { - System.err.println("Can't write to file " + opFileArray[opFileIndex]); + Debug.e("Can't write to file " + opFileArray[opFileIndex]); } } @@ -998,7 +998,7 @@ fileOutStream = new PrintStream(fileStream); } catch (Exception e) { - System.err.println("Can't write to file " + opFileArray[opFileIndex]); + Debug.e("Can't write to file " + opFileArray[opFileIndex]); } } @@ -1025,7 +1025,7 @@ fr.close(); } catch (Exception e) { - System.err.println("Error copying file: " + e.toString()); + Debug.e("Error copying file: " + e.toString()); } } @@ -1044,7 +1044,7 @@ fileOutStream = new PrintStream(fileStream); } catch (Exception e) { - System.err.println("Can't write to file " + opFileName + gcodeExtension); + Debug.e("Can't write to file " + opFileName + gcodeExtension); } copyFile(fileOutStream, opFileArray[0]); Modified: trunk/software/host/src/org/reprap/devices/GenericExtruder.java =================================================================== --- trunk/software/host/src/org/reprap/devices/GenericExtruder.java 2010-10-07 17:01:38 UTC (rev 3822) +++ trunk/software/host/src/org/reprap/devices/GenericExtruder.java 2010-10-07 19:50:34 UTC (rev 3823) @@ -475,12 +475,12 @@ materialColour.setMaterial(new Material(col, black, col, black, 101f)); } catch (Exception ex) { - System.err.println("Refresh extruder preferences: " + ex.toString()); + Debug.e("Refresh extruder preferences: " + ex.toString()); } if(printer == null) { - System.err.println("GenericExtruder(): printer is null!"); + Debug.e("GenericExtruder(): printer is null!"); } else { fastXYFeedrate = Math.min(printer.getFastXYFeedrate(), fastXYFeedrate); @@ -731,7 +731,7 @@ return Preferences.loadGlobalDouble(prefName + "ExtrusionSpeed(mm/minute)"); } catch (Exception e) { - System.err.println(e.toString()); + Debug.e(e.toString()); return 200; //Hack } } @@ -743,7 +743,7 @@ return 3000; //Preferences.loadGlobalDouble(prefName + "SeparationSpeed(mm/minute)"); } catch (Exception e) { - System.err.println(e.toString()); + Debug.e(e.toString()); return 200; //Hack } } @@ -1157,7 +1157,7 @@ (float)Preferences.loadGlobalDouble(prefName + "ColourB(0..1)")); } catch (Exception ex) { - System.err.println(ex.toString()); + Debug.e(ex.toString()); } Appearance a = new Appearance(); a.setMaterial(new Material(col, black, col, black, 101f)); Modified: trunk/software/host/src/org/reprap/geometry/LayerRules.java =================================================================== --- trunk/software/host/src/org/reprap/geometry/LayerRules.java 2010-10-07 17:01:38 UTC (rev 3822) +++ trunk/software/host/src/org/reprap/geometry/LayerRules.java 2010-10-07 19:50:34 UTC (rev 3823) @@ -7,6 +7,7 @@ import org.reprap.geometry.polygons.RrRectangle; import org.reprap.geometry.polygons.Rr2Point; import org.reprap.Preferences; +import org.reprap.utilities.Debug; /** * This stores a set of facts about the layer currently being made, and the @@ -154,7 +155,7 @@ if(es[i].getLowerFineLayers() > fineLayers) fineLayers = es[i].getLowerFineLayers(); if(Math.abs(es[i].getExtrusionHeight() - zStep) > Preferences.tiny()) - System.err.println("Not all extruders extrude the same height of filament: " + + Debug.e("Not all extruders extrude the same height of filament: " + zStep + " and " + es[i].getExtrusionHeight()); } } Modified: trunk/software/host/src/org/reprap/geometry/polygons/AllSTLsToBuild.java =================================================================== --- trunk/software/host/src/org/reprap/geometry/polygons/AllSTLsToBuild.java 2010-10-07 17:01:38 UTC (rev 3822) +++ trunk/software/host/src/org/reprap/geometry/polygons/AllSTLsToBuild.java 2010-10-07 19:50:34 UTC (rev 3823) @@ -98,7 +98,7 @@ public LineSegment(Rr2Point p, Rr2Point q, Attributes at) { if(at == null) - System.err.println("LineSegment(): null attributes!"); + Debug.e("LineSegment(): null attributes!"); a = p; b = q; att = at; @@ -1008,7 +1008,7 @@ break; default: - System.err.println("addEdge(): the | function doesn't seem to work..."); + Debug.e("addEdge(): the | function doesn't seem to work..."); } // Work out the intersection line segment (e1 -> e2) between the z plane and the triangle @@ -1052,7 +1052,7 @@ if(g.getVertexCount()%3 != 0) { - System.err.println("addAllEdges(): shape3D with vertices not a multiple of 3!"); + Debug.e("addAllEdges(): shape3D with vertices not a multiple of 3!"); } if(g != null) { Modified: trunk/software/host/src/org/reprap/geometry/polygons/RrCSG.java =================================================================== --- trunk/software/host/src/org/reprap/geometry/polygons/RrCSG.java 2010-10-07 17:01:38 UTC (rev 3822) +++ trunk/software/host/src/org/reprap/geometry/polygons/RrCSG.java 2010-10-07 19:50:34 UTC (rev 3823) @@ -51,6 +51,7 @@ package org.reprap.geometry.polygons; import java.util.ArrayList; +import org.reprap.utilities.Debug; /** * RepRap Constructive Solid Geometry class @@ -192,7 +193,7 @@ public RrCSG(RrCSG c) { if(c == u || c == n) - System.err.println("RrCSG deep copy: copying null or universal set."); + Debug.e("RrCSG deep copy: copying null or universal set."); if(c.hp != null) hp = new RrHalfPlane(c.hp); @@ -262,7 +263,7 @@ break; default: - System.err.println("toString_r(): invalid operator."); + Debug.e("toString_r(): invalid operator."); } return result; } @@ -383,7 +384,7 @@ break; default: - System.err.println("complement(): invalid operator."); + Debug.e("complement(): invalid operator."); return nothing(); } @@ -488,7 +489,7 @@ case 4: return intersection(leafA.complement(), leafB.complement()); case 5: - System.err.println("RrCSG crossCategorise: non-manifold shape (case 0101)!"); + Debug.e("RrCSG crossCategorise: non-manifold shape (case 0101)!"); return union(intersection(leafA, leafB), intersection(leafA.complement(), leafB.complement())); case 6: return leafB.complement(); @@ -499,7 +500,7 @@ case 9: return leafB; case 10: - System.err.println("RrCSG crossCategorise: non-manifold shape (case 1010)!"); + Debug.e("RrCSG crossCategorise: non-manifold shape (case 1010)!"); return union(RrCSG.intersection(leafA.complement(), leafB), intersection(leafA, leafB.complement())); case 11: return union(leafA, leafB); @@ -512,7 +513,7 @@ case 15: return universe(); default: - System.err.println("RrCSG crossCategorise: bitwise | doesn't seem to work..."); + Debug.e("RrCSG crossCategorise: bitwise | doesn't seem to work..."); return this; } } catch (Exception e) @@ -555,7 +556,7 @@ case 7: return universe(); default: - System.err.println("RrCSG crossCategorise: bitwise | doesn't seem to work..."); + Debug.e("RrCSG crossCategorise: bitwise | doesn't seem to work..."); return this; } } @@ -588,7 +589,7 @@ case NULL: case UNIVERSE: - System.err.println("uniqueList_r: null or universe at a leaf."); + Debug.e("uniqueList_r: null or universe at a leaf."); break; case UNION: @@ -598,7 +599,7 @@ break; default: - System.err.println("uniqueList_r: invalid operator."); + Debug.e("uniqueList_r: invalid operator."); } return; @@ -971,7 +972,7 @@ // r = RrCSG.nothing(); // break; // default: -// System.err.println("RrCSG.reg_3(): dud case value: " + caseVal); +// Debug.e("RrCSG.reg_3(): dud case value: " + caseVal); // } // // return r; @@ -1041,7 +1042,7 @@ // result.c2 = c2.c1; // break; // default: -// System.err.println("reg_4() 1: addition doesn't work..."); +// Debug.e("reg_4() 1: addition doesn't work..."); // } // } // } @@ -1105,7 +1106,7 @@ // result = union(c1, c2.c2); // break; // default: -// System.err.println("reg_4() 2: addition doesn't work..."); +// Debug.e("reg_4() 2: addition doesn't work..."); // } // break; // @@ -1117,7 +1118,7 @@ // break; // // default: -// System.err.println("reg_4() 4: addition doesn't work..."); +// Debug.e("reg_4() 4: addition doesn't work..."); // } // } // @@ -1189,7 +1190,7 @@ // break; // // default: -// System.err.println("regularise(): set too complicated."); +// Debug.e("regularise(): set too complicated."); // } // // return result; @@ -1237,7 +1238,7 @@ break; default: - System.err.println("replace_all_same(): invalid operator."); + Debug.e("replace_all_same(): invalid operator."); } } @@ -1268,7 +1269,7 @@ break; default: - System.err.println("simplify_r(): invalid operator."); + Debug.e("simplify_r(): invalid operator."); } } @@ -1351,7 +1352,7 @@ break; default: - System.err.println("offset(): invalid operator."); + Debug.e("offset(): invalid operator."); result = nothing(); } return result; @@ -1398,7 +1399,7 @@ return r2; default: - System.err.println("leaf(Rr2Point): invalid operator."); + Debug.e("leaf(Rr2Point): invalid operator."); result = nothing(); } return result; @@ -1438,7 +1439,7 @@ break; default: - System.err.println("RrCSG.value(): dud operator."); + Debug.e("RrCSG.value(): dud operator."); } return result; } @@ -1472,7 +1473,7 @@ // case INTERSECTION: // // default: -// System.err.println("value(Rr2Point): non-leaf operator."); +// Debug.e("value(Rr2Point): non-leaf operator."); // } // return result; // } @@ -1509,7 +1510,7 @@ break; default: - System.err.println("value(RrBox): invalid operator."); + Debug.e("value(RrBox): invalid operator."); result = new RrInterval(); } @@ -1530,7 +1531,7 @@ case LEAF: RrInterval i = hp.value(b); if (i.empty()) - System.err.println("RrCSG.prune(RrBox): empty interval!"); + Debug.e("RrCSG.prune(RrBox): empty interval!"); else if(i.neg()) result = universe(); else if (i.pos()) @@ -1550,7 +1551,7 @@ break; default: - System.err.println("RrCSG.prune(RrBox): dud op value!"); + Debug.e("RrCSG.prune(RrBox): dud op value!"); } return result; Modified: trunk/software/host/src/org/reprap/geometry/polygons/RrInterval.java =================================================================== --- trunk/software/host/src/org/reprap/geometry/polygons/RrInterval.java 2010-10-07 17:01:38 UTC (rev 3822) +++ trunk/software/host/src/org/reprap/geometry/polygons/RrInterval.java 2010-10-07 19:50:34 UTC (rev 3823) @@ -55,6 +55,8 @@ package org.reprap.geometry.polygons; +import org.reprap.utilities.Debug; + /** * Real 1D intervals */ @@ -190,7 +192,7 @@ public static RrInterval add(RrInterval a, RrInterval b) { if(a.empty || b.empty) - System.err.println("add(...): adding empty interval(s)."); + Debug.e("RrInterval.add(...): adding empty interval(s)."); return new RrInterval(a.low + b.low, a.high + b.high); } @@ -202,7 +204,7 @@ public static RrInterval add(RrInterval a, double b) { if(a.empty) - System.err.println("add(...): adding an empty interval."); + Debug.e("RrInterval.add(...): adding an empty interval."); return new RrInterval(a.low + b, a.high + b); } @@ -226,7 +228,7 @@ public static RrInterval sub(RrInterval a, RrInterval b) { if(a.empty || b.empty) - System.err.println("difference(...): subtracting empty interval(s)."); + Debug.e("RrInterval.sub(...): subtracting empty interval(s)."); return new RrInterval(a.low - b.high, a.high - b.low); } @@ -238,7 +240,7 @@ public static RrInterval sub(RrInterval a, double b) { if(a.empty) - System.err.println("difference(...): subtracting an empty interval."); + Debug.e("RrInterval.sub(...): subtracting an empty interval."); return new RrInterval(a.low - b, a.high - b); } @@ -250,7 +252,7 @@ public static RrInterval sub(double b, RrInterval a) { if(a.empty) - System.err.println("difference(...): subtracting an empty interval."); + Debug.e("RrInterval.sub(...): subtracting an empty interval."); return new RrInterval(b - a.high, b - a.low); } @@ -263,7 +265,7 @@ public static RrInterval mul(RrInterval a, RrInterval b) { if(a.empty || b.empty) - System.err.println("multiply(...): multiplying empty intervals."); + Debug.e("RrInterval.mul(...): multiplying empty intervals."); double d = a.low*b.low; RrInterval r = new RrInterval(d, d); r.expand(a.low*b.high); @@ -280,7 +282,7 @@ public static RrInterval mul(RrInterval a, double f) { if(a.empty) - System.err.println("multiply(...): multiplying an empty interval."); + Debug.e("RrInterval.mul(...): multiplying an empty interval."); if(f > 0) return new RrInterval(a.low*f, a.high*f); else Modified: trunk/software/host/src/org/reprap/geometry/polygons/RrRectangle.java =================================================================== --- trunk/software/host/src/org/reprap/geometry/polygons/RrRectangle.java 2010-10-07 17:01:38 UTC (rev 3822) +++ trunk/software/host/src/org/reprap/geometry/polygons/RrRectangle.java 2010-10-07 19:50:34 UTC (rev 3823) @@ -46,7 +46,7 @@ ===================================================================== - RrBox: 2D rectangles + RrRectangle: 2D rectangles First version 20 May 2005 This version: 1 May 2006 (Now in CVS - no more comments here) @@ -55,6 +55,8 @@ package org.reprap.geometry.polygons; +import org.reprap.utilities.Debug; + /** * A 2D box is an X and a Y interval */ @@ -127,7 +129,7 @@ // * For when we need one that has just something in // * @param a // */ -// public RrBox(double a) +// public RrRectangle(double a) // { // x = new RrInterval(0, a); // y = new RrInterval(0, a); @@ -374,7 +376,7 @@ return Rr2Point.dSquared(p, sw()); default: - System.err.println("RrBox.dSquared(): dud value from point_relative()!"); + Debug.e("RrRectangle.dSquared(): dud value from point_relative()!"); } return Math.min(d1, d2); Modified: trunk/software/host/src/org/reprap/gui/Panel3D.java =================================================================== --- trunk/software/host/src/org/reprap/gui/Panel3D.java 2010-10-07 17:01:38 UTC (rev 3822) +++ trunk/software/host/src/org/reprap/gui/Panel3D.java 2010-10-07 19:50:34 UTC (rev 3823) @@ -33,6 +33,8 @@ import com.sun.j3d.audioengines.javasound.JavaSoundMixer; +import org.reprap.utilities.Debug; + abstract public class Panel3D extends JPanel { private static final long serialVersionUID = 1L; //------------------------------------------------------------- @@ -152,7 +154,7 @@ (float)Preferences.loadGlobalDouble("UnselectedColourB(0..1)")); } catch (Exception ex) { - System.err.println("Refresh Panel3D preferences: " + ex.toString()); + Debug.e("Refresh Panel3D preferences: " + ex.toString()); } // End of stuff from the preferences file @@ -218,7 +220,7 @@ File file = new File(System.getProperty("user.dir")); return file.toURI().toURL(); } catch (Exception e) { - System.err.println("getWorkingDirectory( ): can't get user dir."); + Debug.e("getWorkingDirectory( ): can't get user dir."); } //return getCodeBase( ); @@ -323,7 +325,7 @@ JavaSoundMixer javaSoundMixer = new JavaSoundMixer(pe); if (javaSoundMixer == null) - System.err.println("create of audiodevice failed"); + Debug.e("create of audiodevice failed"); return javaSoundMixer; } @@ -533,8 +535,7 @@ // stlURL = u.toExternalForm();//u.getFile(); //// System.out.println(stlPath + " : " + stlURL); // } catch (Exception e) { -// System.err -// .println("createSceneBranchGroup(): Exception finding working directory: " +// Debug.e("createSceneBranchGroup(): Exception finding working directory: " // + codebase.toExternalForm()); // e.printStackTrace(); // } Modified: trunk/software/host/src/org/reprap/gui/Preferences.java =================================================================== --- trunk/software/host/src/org/reprap/gui/Preferences.java 2010-10-07 17:01:38 UTC (rev 3822) +++ trunk/software/host/src/org/reprap/gui/Preferences.java 2010-10-07 19:50:34 UTC (rev 3823) @@ -24,6 +24,8 @@ import java.awt.event.ActionEvent; import java.awt.event.ActionListener; +import org.reprap.utilities.Debug; + /** * This reads in the preferences file and constructs a set of menus from it to allow entries * to be edited. @@ -125,7 +127,7 @@ { String s = globalValues[i].getText(); if(category(s) != globalCats[i]) - System.err.println("Dud format for " + globals[i].getText() + ": " + s); + Debug.e("Preferences window: Dud format for " + globals[i].getText() + ": " + s); else saveString(globals[i].getText(), s); } @@ -139,7 +141,7 @@ { String s = evals[i].getText(); if(category(s) != cats[i]) - System.err.println("Dud format for " + enames[i].getText() + ": " + s); + Debug.e("Preferences window: Dud format for " + enames[i].getText() + ": " + s); else saveString(enames[i].getText(), s); } @@ -172,7 +174,7 @@ globalCats = categorise(globalValues); }catch (Exception ex) { - System.err.println("Preferences window: Can't load the globals!"); + Debug.e("Preferences window: Can't load the globals!"); ex.printStackTrace(); } @@ -182,7 +184,7 @@ extruderCount = Integer.parseInt(loadString("NumberOfExtruders")); } catch (Exception ex) { - System.err.println("Preferences window: Can't load the extruder count!"); + Debug.e("Preferences window: Can't load the extruder count!"); ex.printStackTrace(); } @@ -202,7 +204,7 @@ } }catch (Exception ex) { - System.err.println("Preferences window: Can't load extruder(s)!"); + Debug.e("Preferences window: Can't load extruder(s)!"); ex.printStackTrace(); } @@ -312,7 +314,7 @@ String configPath = org.reprap.Preferences.getProbsFolderPath() + configName; if((new File(configPath)).exists()) { - System.out.println("loading config " + configName); + Debug.a("loading config " + configName); org.reprap.Preferences.loadConfig(configName); updatePreferencesValues(); @@ -339,7 +341,7 @@ if(!configFileObj.exists()) { configfileList.addItem(configfileList.getSelectedItem()); - System.out.println("loading config " + configName); + Debug.a("loading config " + configName); org.reprap.Preferences.loadConfig(configName); updatePreferencesValues(); Modified: trunk/software/host/src/org/reprap/gui/RepRapBuild.java =================================================================== --- trunk/software/host/src/org/reprap/gui/RepRapBuild.java 2010-10-07 17:01:38 UTC (rev 3822) +++ trunk/software/host/src/org/reprap/gui/RepRapBuild.java 2010-10-07 19:50:34 UTC (rev 3823) @@ -128,6 +128,7 @@ import org.reprap.RFO; import org.reprap.Preferences; import org.reprap.geometry.polygons.AllSTLsToBuild; +import org.reprap.utilities.Debug; /** * Little class to put up a radiobutton menu so you can set @@ -199,7 +200,7 @@ } catch (Exception ex) { - System.err.println(ex.toString()); + Debug.e(ex.toString()); ex.printStackTrace(); } } Modified: trunk/software/host/src/org/reprap/gui/STLObject.java =================================================================== --- trunk/software/host/src/org/reprap/gui/STLObject.java 2010-10-07 17:01:38 UTC (rev 3822) +++ trunk/software/host/src/org/reprap/gui/STLObject.java 2010-10-07 19:50:34 UTC (rev 3823) @@ -83,6 +83,7 @@ import org.j3d.renderer.java3d.loaders.STLLoader; import org.reprap.Attributes; import org.reprap.Preferences; +import org.reprap.utilities.Debug; /** * Class for holding a group (maybe just 1) of 3D objects for RepRap to make. @@ -295,7 +296,7 @@ } catch ( Exception e ) { - System.err.println("loadSingelSTL(): Exception loading STL file from: " + Debug.e("loadSingelSTL(): Exception loading STL file from: " + location); e.printStackTrace(); } @@ -445,7 +446,7 @@ //restoreAppearance(); } else - System.err.println("applyOffset(): no bounding box or child."); + Debug.e("applyOffset(): no bounding box or child."); return result; } @@ -711,7 +712,7 @@ if(att != null) setAppearance_r(b, att.getAppearance()); else - System.err.println("restoreAppearance(): no Attributes!"); + Debug.e("restoreAppearance(): no Attributes!"); } } } Modified: trunk/software/host/src/org/reprap/gui/botConsole/BotConsoleFrame.java =================================================================== --- trunk/software/host/src/org/reprap/gui/botConsole/BotConsoleFrame.java 2010-10-07 17:01:38 UTC (rev 3822) +++ trunk/software/host/src/org/reprap/gui/botConsole/BotConsoleFrame.java 2010-10-07 19:50:34 UTC (rev 3823) @@ -13,6 +13,7 @@ package org.reprap.gui.botConsole; import org.reprap.Preferences; +import org.reprap.utilities.Debug; import javax.swing.JOptionPane; @@ -42,7 +43,7 @@ checkPrefs(); } catch (Exception e) { - System.err.println("Failure trying to initialise comms in botConsole: " + e); + Debug.e("Failure trying to initialise comms in botConsole: " + e); JOptionPane.showMessageDialog(null, e.getMessage()); return; } @@ -273,7 +274,7 @@ { if(i >= 0 && i < bcf.extruderPanels.length) return bcf.extruderPanels[i]; - System.err.println("getGenericExtruderTabPanel - extruder out of range: " + i); + Debug.e("getGenericExtruderTabPanel - extruder out of range: " + i); return bcf.extruderPanels[0]; } Modified: trunk/software/host/src/org/reprap/gui/botConsole/StepperPositionJPanel.java =================================================================== --- trunk/software/host/src/org/reprap/gui/botConsole/StepperPositionJPanel.java 2010-10-07 17:01:38 UTC (rev 3822) +++ trunk/software/host/src/org/reprap/gui/botConsole/StepperPositionJPanel.java 2010-10-07 19:50:34 UTC (rev 3823) @@ -5,10 +5,13 @@ */ package org.reprap.gui.botConsole; + import java.io.IOException; import javax.swing.JOptionPane; import org.reprap.Preferences; import org.reprap.Printer; +import org.reprap.utilities.Debug; + //import org.reprap.AxisMotor; //import org.reprap.comms.Communicator; //import org.reprap.comms.snap.SNAPAddress; @@ -64,7 +67,7 @@ default: axis = "X"; //motor = printer.getXMotor(); - System.err.println("StepperPanel - dud axis id:" + motorID); + Debug.e("StepperPanel - dud axis id:" + motorID); } // if(!motor.isAvailable()) @@ -138,7 +141,7 @@ printer.homeToZeroZ(); break; default: - System.err.println("StepperPositionPanel - homeReset. Dud motor id: " + motorID); + Debug.e("StepperPositionPanel - homeReset. Dud motor id: " + motorID); } //motor.homeReset(getSpeedFromFeed(currentSpeed)); zeroBox(); @@ -205,7 +208,7 @@ z = p; break; default: - System.err.println("moveToTarget() Dud motor id: " + motorID); + Debug.e("moveToTarget() Dud motor id: " + motorID); } printer.singleMove(x, y, z, currentSpeed); //printer.moveTo(x, y, z, currentSpeed, false, false); @@ -421,7 +424,7 @@ // pos = printer.getZ(); // break; // default: -// System.err.println("store() Dud motor id: " + motorID); +// Debug.e("store() Dud motor id: " + motorID); // } // try // { Modified: trunk/software/host/src/org/reprap/gui/botConsole/XYZTabPanel.java =================================================================== --- trunk/software/host/src/org/reprap/gui/botConsole/XYZTabPanel.java 2010-10-07 17:01:38 UTC (rev 3822) +++ trunk/software/host/src/org/reprap/gui/botConsole/XYZTabPanel.java 2010-10-07 19:50:34 UTC (rev 3823) @@ -81,7 +81,7 @@ xStepperPositionJPanel.postSetUp(1); yStepperPositionJPanel.postSetUp(2); zStepperPositionJPanel.postSetUp(3); - } catch (Exception ex) {System.err.println(ex.toString());} + } catch (Exception ex) {Debug.e(ex.toString());} setMotorSpeeds(); setNudgeSize(Double.parseDouble(nudgeSizeRB1.getText())); agitate = false; Modified: trunk/software/host/src/org/reprap/machines/GCodeRepRap.java =================================================================== --- trunk/software/host/src/org/reprap/machines/GCodeRepRap.java 2010-10-07 17:01:38 UTC (rev 3822) +++ trunk/software/host/src/org/reprap/machines/GCodeRepRap.java 2010-10-07 19:50:34 UTC (rev 3823) @@ -91,7 +91,7 @@ if(xyFeedrate < feedrate) { - System.err.println("GCodeRepRap().qXYMove: feedrate (" + feedrate + ") exceeds maximum (" + xyFeedrate + ")."); + Debug.e("GCodeRepRap().qXYMove: feedrate (" + feedrate + ") exceeds maximum (" + xyFeedrate + ")."); feedrate = xyFeedrate; } @@ -146,7 +146,7 @@ if(zFeedrate < feedrate) { - System.err.println("GCodeRepRap().qZMove: feedrate (" + feedrate + ") exceeds maximum (" + zFeedrate + ")."); + Debug.e("GCodeRepRap().qZMove: feedrate (" + feedrate + ") exceeds maximum (" + zFeedrate + ")."); feedrate = zFeedrate; } @@ -214,7 +214,7 @@ boolean xyMove = dx!= 0 || dy != 0; if(zMove && xyMove) - System.err.println("GcodeRepRap.moveTo(): attempt to move in X|Y and Z simultaneously: (x, y, z) = (" + x + ", " + y + ", " + z + ")"); + Debug.e("GcodeRepRap.moveTo(): attempt to move in X|Y and Z simultaneously: (x, y, z) = (" + x + ", " + y + ", " + z + ")"); double zFeedrate = round(getMaxFeedrateZ(), 1); @@ -269,7 +269,7 @@ boolean xyMove = dx != 0 || dy != 0; if(zMove && xyMove) - System.err.println("GcodeRepRap.singleMove(): attempt to move in X|Y and Z simultaneously: (x, y, z) = (" + x + ", " + y + ", " + z + ")"); + Debug.e("GcodeRepRap.singleMove(): attempt to move in X|Y and Z simultaneously: (x, y, z) = (" + x + ", " + y + ", " + z + ")"); try { @@ -306,7 +306,7 @@ break; default: - System.err.println("GCodeRepRap.singleMove(): dud VelocityProfile XY flat value."); + Debug.e("GCodeRepRap.singleMove(): dud VelocityProfile XY flat value."); } } @@ -338,12 +338,12 @@ break; default: - System.err.println("GCodeRepRap.singleMove(): dud VelocityProfile Z flat value."); + Debug.e("GCodeRepRap.singleMove(): dud VelocityProfile Z flat value."); } } } catch (Exception e) { - System.err.println(e.toString()); + Debug.e(e.toString()); } } Modified: trunk/software/host/src/org/reprap/machines/GenericRepRap.java =================================================================== --- trunk/software/host/src/org/reprap/machines/GenericRepRap.java 2010-10-07 17:01:38 UTC (rev 3822) +++ trunk/software/host/src/org/reprap/machines/GenericRepRap.java 2010-10-07 19:50:34 UTC (rev 3823) @@ -302,7 +302,7 @@ } catch (Exception ex) { - System.err.println("Refresh Reprap preferences: " + ex.toString()); + Debug.e("Refresh Reprap preferences: " + ex.toString()); } for(int i = 0; i < extruders.length; i++) @@ -365,7 +365,7 @@ if(materialIndex < 0 || materialIndex >= extruders.length) { - System.err.println("Selected material (" + materialIndex + ") is out of range."); + Debug.e("Selected material (" + materialIndex + ") is out of range."); extruder = 0; } else extruder = materialIndex; @@ -396,7 +396,7 @@ return; } } - System.err.println("selectExtruder() - extruder not found for: " + att.getMaterial()); + Debug.e("selectExtruder() - extruder not found for: " + att.getMaterial()); } /** @@ -655,7 +655,7 @@ moveTo(x, y, z, feedrate, false, false); } catch (Exception e) { - System.err.println(e.toString()); + Debug.e(e.toString()); } } @@ -665,11 +665,11 @@ */ // public void printTo(double x, double y, double z, boolean turnOff) throws ReprapException, IOException // { -// System.err.println("printing"); +// Debug.e("printing"); // if (previewer != null) // previewer.addSegment(currentX, currentY, currentZ, x, y, z); // else -// System.err.println("previewer null!"); +// Debug.e("previewer null!"); // // if (isCancelled()) // return; Modified: trunk/software/host/src/org/reprap/machines/Simulator.java =================================================================== --- trunk/software/host/src/org/reprap/machines/Simulator.java 2010-10-07 17:01:38 UTC (rev 3822) +++ trunk/software/host/src/org/reprap/machines/Simulator.java 2010-10-07 19:50:34 UTC (rev 3823) @@ -5,6 +5,7 @@ import org.reprap.Extruder; //import org.reprap.devices.NullStepperMotor; import org.reprap.devices.NullExtruder; +import org.reprap.utilities.Debug; /** * @@ -149,7 +150,7 @@ */ public String loadGCodeFileForMaking() { - System.err.println("Simulator: attempt to load GCode file."); + Debug.e("Simulator: attempt to load GCode file."); //super.loadGCodeFileForMaking(); return null; } @@ -160,7 +161,7 @@ */ public String setGCodeFileForOutput(String fileRoot) { - System.err.println("Simulator: cannot generate GCode file."); + Debug.e("Simulator: cannot generate GCode file."); return null; } Modified: trunk/software/host/src/org/reprap/pcb/PCB.java =================================================================== --- trunk/software/host/src/org/reprap/pcb/PCB.java 2010-10-07 17:01:38 UTC (rev 3822) +++ trunk/software/host/src/org/reprap/pcb/PCB.java 2010-10-07 19:50:34 UTC (rev 3823) @@ -83,7 +83,7 @@ } catch (Exception ex) { - System.err.println(ex.toString()); + Debug.e(ex.toString()); ex.printStackTrace(); } } Modified: trunk/software/host/src/org/reprap/utilities/CodeGenerator.java =================================================================== --- trunk/software/host/src/org/reprap/utilities/CodeGenerator.java 2010-10-07 17:01:38 UTC (rev 3822) +++ trunk/software/host/src/org/reprap/utilities/CodeGenerator.java 2010-10-07 19:50:34 UTC (rev 3823) @@ -61,7 +61,7 @@ String n; public Variable(String s) { init = false; n = s;} - public boolean value() { if(!init) System.err.println("Variable undefined!"); return bv; } + public boolean value() { if(!init) Debug.e("Variable undefined!"); return bv; } public boolean isSet() { return init; } public void set(boolean b) { bv = b; init = true;} public String name() { return n; } @@ -70,7 +70,7 @@ public Variable(Variable v) { if(!v.init) - System.err.println("Variable(Variable v): input Variable undefined!"); + Debug.e("Variable(Variable v): input Variable undefined!"); bv = v.bv; init = v.init; n = new String(v.n); @@ -194,7 +194,7 @@ break; default: - System.err.println("BooleanExpression(...): variable number not 3 or 4!"); + Debug.e("BooleanExpression(...): variable number not 3 or 4!"); } } @@ -233,7 +233,7 @@ { leafCount = -1; if(!op.diadic()) - System.err.println("BooleanExpression(a, b): leaf operator or NOT!"); + Debug.e("BooleanExpression(a, b): leaf operator or NOT!"); leafOp = op; leaf = null; @@ -251,7 +251,7 @@ { leafCount = -1; if(op != Bop.NOT) - System.err.println("BooleanExpression(..., NOT): op not NOT!"); + Debug.e("BooleanExpression(..., NOT): op not NOT!"); leafOp = op; leaf = null; @@ -333,7 +333,7 @@ if(v == variables[i]) return i; } - System.err.println("getIndex(): variable not found!"); + Debug.e("getIndex(): variable not found!"); return -1; } @@ -379,7 +379,7 @@ return r ^ c2.value(); default: - System.err.println("generateValue_r: dud operator!"); + Debug.e("generateValue_r: dud operator!"); } return false; } @@ -420,11 +420,11 @@ return r; case XOR: - System.err.println("toJava(): got to an XOR..."); + Debug.e("toJava(): got to an XOR..."); break; default: - System.err.println("toJava(): dud operator"); + Debug.e("toJava(): dud operator"); } return r; @@ -632,7 +632,7 @@ if(rows.size() > 0) { if(!TableRow.sameOrder(newOne.all(), rows.get(0).all())) - System.err.println("FunctionTable.addRow() - variable lists different!"); + Debug.e("FunctionTable.addRow() - variable lists different!"); } rows.add(newOne); @@ -648,12 +648,12 @@ leng *= 2; if(leng != rows.size()) - System.err.println("FunctionTable.tableCheck() - incorrect entry count: " + rows.size() + + Debug.e("FunctionTable.tableCheck() - incorrect entry count: " + rows.size() + "(should be " + leng + ")"); Collections.sort(rows, new TableRow()); for(int i = 1; i < rows.size(); i++) if(rows.get(i-1).number() == rows.get(i).number()) - System.err.println("FunctionTable.tableDone() - identical rows: " + rows.get(i-1).toString() + + Debug.e("FunctionTable.tableDone() - identical rows: " + rows.get(i-1).toString() + rows.get(i).toString()); } @@ -784,7 +784,7 @@ static List<BooleanExpression> generateAllPairs(BooleanExpression[] b2) { if(b2.length != 2) - System.err.println("generateAllPairs: array not of length 2: " + b2.length); + Debug.e("generateAllPairs: array not of length 2: " + b2.length); List<BooleanExpression> bel2 = new ArrayList<BooleanExpression>(); @@ -858,7 +858,7 @@ static BooleanExpression findEqualTwo(FunctionTable f, Variable[] v) { if(v.length != 2) - System.err.println("findEqualTwo: array not of length 2: " + v.length); + Debug.e("findEqualTwo: array not of length 2: " + v.length); BooleanExpression[] b2 = new BooleanExpression[2]; b2[0] = new BooleanExpression(v[0]); b2[1] = new BooleanExpression(v[1]); @@ -879,7 +879,7 @@ static BooleanExpression findEqualThree(FunctionTable f, Variable[] v) { if(v.length != 3) - System.err.println("findEqualThree: array not of length 3: " + v.length); + Debug.e("findEqualThree: array not of length 3: " + v.length); BooleanExpression[] b3 = new BooleanExpression[3]; b3[0] = new BooleanExpression(v[0]); b3[1] = new BooleanExpression(v[1]); Modified: trunk/software/host/src/org/reprap/utilities/RrGraphics.java =================================================================== --- trunk/software/host/src/org/reprap/utilities/RrGraphics.java 2010-10-07 17:01:38 UTC (rev 3822) +++ trunk/software/host/src/org/reprap/utilities/RrGraphics.java 2010-10-07 19:50:34 UTC (rev 3823) @@ -446,7 +446,7 @@ return; if(p.getAttributes().getAppearance() == null) { - System.err.println("RrGraphics: polygon with size > 0 has null appearance."); + Debug.e("RrGraphics: polygon with size > 0 has null appearance."); return; } @@ -470,7 +470,7 @@ { if(b.attribute().getAppearance() == null) { - System.err.println("RrGraphics: booleanGrid has null appearance."); + Debug.e("RrGraphics: booleanGrid has null appearance."); return; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <adr...@us...> - 2010-10-15 22:25:23
|
Revision: 3836 http://reprap.svn.sourceforge.net/reprap/?rev=3836&view=rev Author: adrian-bowyer Date: 2010-10-15 22:25:17 +0000 (Fri, 15 Oct 2010) Log Message: ----------- Host software updated to report Jonathan's firmware configuration string when Debug is switched on. Modified Paths: -------------- trunk/software/host/src/org/reprap/comms/GCodeReaderAndWriter.java trunk/software/host/src/org/reprap/machines/GCodeRepRap.java Modified: trunk/software/host/src/org/reprap/comms/GCodeReaderAndWriter.java =================================================================== --- trunk/software/host/src/org/reprap/comms/GCodeReaderAndWriter.java 2010-10-14 08:41:04 UTC (rev 3835) +++ trunk/software/host/src/org/reprap/comms/GCodeReaderAndWriter.java 2010-10-15 22:25:17 UTC (rev 3836) @@ -39,6 +39,7 @@ private double bTemp; private double x, y, z, e; private RrGraphics simulationPlot = null; + private String lastResp; /** * Stop sending a file (if we are). */ @@ -195,6 +196,7 @@ // responseAvailable = false; // response = "0000"; opFileIndex = -1; + lastResp = ""; try { portName = Preferences.loadGlobalString("Port(name)"); @@ -676,6 +678,11 @@ } return e; } + + public String lastResponse() + { + return lastResp; + } /** @@ -748,6 +755,7 @@ if(!goAgain) { Debug.c("Response: " + resp); + lastResp = resp.substring(2); return result; } } else Modified: trunk/software/host/src/org/reprap/machines/GCodeRepRap.java =================================================================== --- trunk/software/host/src/org/reprap/machines/GCodeRepRap.java 2010-10-14 08:41:04 UTC (rev 3835) +++ trunk/software/host/src/org/reprap/machines/GCodeRepRap.java 2010-10-15 22:25:17 UTC (rev 3836) @@ -43,6 +43,8 @@ gcode = new GCodeReaderAndWriter(); gcode.queue("M110 ; Reset the line numbers"); + gcode.queue("M115 ; Get the firmware version numbers etc"); + Debug.d("Firmware configuration string: " + gcode.lastResponse()); loadExtruders(); forceSelection = true; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <adr...@us...> - 2010-10-17 15:29:32
|
Revision: 3838 http://reprap.svn.sourceforge.net/reprap/?rev=3838&view=rev Author: adrian-bowyer Date: 2010-10-17 15:29:25 +0000 (Sun, 17 Oct 2010) Log Message: ----------- Fixed (I hope) the foundation-laying bug (it wasn't...). Tested, but not exhaustively. Modified Paths: -------------- trunk/software/host/src/org/reprap/Main.java trunk/software/host/src/org/reprap/comms/GCodeReaderAndWriter.java trunk/software/host/src/org/reprap/geometry/EstimationProducer.java trunk/software/host/src/org/reprap/geometry/LayerProducer.java trunk/software/host/src/org/reprap/geometry/LayerRules.java trunk/software/host/src/org/reprap/geometry/Producer.java trunk/software/host/src/org/reprap/geometry/polygons/AllSTLsToBuild.java trunk/software/host/src/org/reprap/utilities/RrGraphics.java Modified: trunk/software/host/src/org/reprap/Main.java =================================================================== --- trunk/software/host/src/org/reprap/Main.java 2010-10-17 09:56:45 UTC (rev 3837) +++ trunk/software/host/src/org/reprap/Main.java 2010-10-17 15:29:25 UTC (rev 3838) @@ -21,6 +21,7 @@ import javax.swing.JMenuBar; import javax.swing.JMenuItem; import javax.swing.JOptionPane; +import javax.swing.JPanel; import javax.swing.JPopupMenu; import javax.swing.JSplitPane; import javax.swing.KeyStroke; @@ -118,9 +119,9 @@ - JMenu viewMenu = new JMenu("View"); - viewMenu.setMnemonic(KeyEvent.VK_V); - menubar.add(viewMenu); +// JMenu viewMenu = new JMenu("View"); +// viewMenu.setMnemonic(KeyEvent.VK_V); +// menubar.add(viewMenu); @@ -178,13 +179,13 @@ manipMenu.add(reorder); - JMenuItem deleteSTLW = new JMenuItem("Delete selected object", KeyEvent.VK_W); - deleteSTLW.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_W, ActionEvent.CTRL_MASK)); - deleteSTLW.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent arg0) { - onDelete(); - }}); - manipMenu.add(deleteSTLW); +// JMenuItem deleteSTLW = new JMenuItem("Delete selected object", KeyEvent.VK_W); +// deleteSTLW.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_W, ActionEvent.CTRL_MASK)); +// deleteSTLW.addActionListener(new ActionListener() { +// public void actionPerformed(ActionEvent arg0) { +// onDelete(); +// }}); +// manipMenu.add(deleteSTLW); JMenuItem deleteSTL = new JMenuItem("Delete selected object", KeyEvent.VK_DELETE); deleteSTL.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0)); @@ -198,22 +199,22 @@ produceProduceB = new JMenuItem("Start build...", KeyEvent.VK_B); - produceProduceB.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_B, ActionEvent.CTRL_MASK)); - produceProduceB.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent arg0) { - onProduceB(); - }}); - //produceMenu.add(produceProduceB); +// produceProduceB.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_B, ActionEvent.CTRL_MASK)); +// produceProduceB.addActionListener(new ActionListener() { +// public void actionPerformed(ActionEvent arg0) { +// onProduceB(); +// }}); +// produceMenu.add(produceProduceB); cancelMenuItem = new JMenuItem("Cancel", KeyEvent.VK_P); cancelMenuItem.setEnabled(false); - cancelMenuItem.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent arg0) { - if(producer != null) - producer.setCancelled(true); - }}); - - +// cancelMenuItem.addActionListener(new ActionListener() { +// public void actionPerformed(ActionEvent arg0) { +// if(producer != null) +// producer.setCancelled(true); +// }}); +// +// segmentPause = new JCheckBoxMenuItem("Pause before segment"); Modified: trunk/software/host/src/org/reprap/comms/GCodeReaderAndWriter.java =================================================================== --- trunk/software/host/src/org/reprap/comms/GCodeReaderAndWriter.java 2010-10-17 09:56:45 UTC (rev 3837) +++ trunk/software/host/src/org/reprap/comms/GCodeReaderAndWriter.java 2010-10-17 15:29:25 UTC (rev 3838) @@ -40,6 +40,7 @@ private double x, y, z, e; private RrGraphics simulationPlot = null; private String lastResp; + private boolean nonRunningWarn; /** * Stop sending a file (if we are). */ @@ -189,6 +190,7 @@ ringLines = new long[buflen]; head = 0; tail = 0; + nonRunningWarn = true; lineNumber = 0; //threadLock = false; exhaustBuffer = false; @@ -504,7 +506,9 @@ if(serialOutStream == null) { - Debug.d("bufferQueue: attempt to queue: " + cmd + " to a non-running output buffer."); + if(nonRunningWarn) + Debug.d("bufferQueue: attempt to queue: " + cmd + " to a non-running output buffer. Further attempts will not be reported."); + nonRunningWarn = false; return; } if(retries > 3) @@ -798,7 +802,7 @@ CommPortIdentifier commId = CommPortIdentifier.getPortIdentifier(portName); port = (SerialPort)commId.open(portName, 30000); } catch (NoSuchPortException e) { - Debug.e("Error opening port: " + portName); + Debug.d("Can't open port: " + portName + " - no RepRap attached."); return; } catch (PortInUseException e){ Modified: trunk/software/host/src/org/reprap/geometry/EstimationProducer.java =================================================================== --- trunk/software/host/src/org/reprap/geometry/EstimationProducer.java 2010-10-17 09:56:45 UTC (rev 3837) +++ trunk/software/host/src/org/reprap/geometry/EstimationProducer.java 2010-10-17 15:29:25 UTC (rev 3838) @@ -1,27 +1,27 @@ -package org.reprap.geometry; - -import org.reprap.geometry.Producer; -import org.reprap.gui.RepRapBuild; -import org.reprap.machines.Simulator; - -/** - * A specialisation of Producer that doesn't preview anything - * and always uses the virtual printer. This is useful to - * determine in advance the resource requirements (time and materials) - * to produce an assembly. - */ -public class EstimationProducer extends Producer { - - /** - * @param builder - * @throws Exception - */ - public EstimationProducer(RepRapBuild builder) throws Exception { - super(null, builder); - - layerRules.setPrinter(new Simulator()); - //reprap = new NullCartesianMachine(); - - } - -} +//package org.reprap.geometry; +// +//import org.reprap.geometry.Producer; +//import org.reprap.gui.RepRapBuild; +//import org.reprap.machines.Simulator; +// +///** +// * A specialisation of Producer that doesn't preview anything +// * and always uses the virtual printer. This is useful to +// * determine in advance the resource requirements (time and materials) +// * to produce an assembly. +// */ +//public class EstimationProducer extends Producer { +// +// /** +// * @param builder +// * @throws Exception +// */ +//// public EstimationProducer(RepRapBuild builder) throws Exception { +//// super(null, builder); +//// +//// layerRules.setPrinter(new Simulator()); +//// //reprap = new NullCartesianMachine(); +// +// } +// +//} Modified: trunk/software/host/src/org/reprap/geometry/LayerProducer.java =================================================================== --- trunk/software/host/src/org/reprap/geometry/LayerProducer.java 2010-10-17 09:56:45 UTC (rev 3837) +++ trunk/software/host/src/org/reprap/geometry/LayerProducer.java 2010-10-17 15:29:25 UTC (rev 3838) @@ -5,12 +5,12 @@ */ package org.reprap.geometry; -import java.io.IOException; +//import java.io.IOException; import org.reprap.Printer; import org.reprap.Attributes; import org.reprap.Preferences; -import org.reprap.ReprapException; +//import org.reprap.ReprapException; //import org.reprap.devices.pseudo.LinePrinter; import org.reprap.geometry.polygons.Rr2Point; //import org.reprap.geometry.polygons.RrCSGPolygonList; Modified: trunk/software/host/src/org/reprap/geometry/LayerRules.java =================================================================== --- trunk/software/host/src/org/reprap/geometry/LayerRules.java 2010-10-17 09:56:45 UTC (rev 3837) +++ trunk/software/host/src/org/reprap/geometry/LayerRules.java 2010-10-17 15:29:25 UTC (rev 3838) @@ -119,8 +119,7 @@ { printer = p; - bBox = bb; - + bBox = new RrRectangle(bb); notStartedYet = true; topDown = printer.getTopDown(); @@ -166,7 +165,7 @@ public RrRectangle getBox() { - return bBox; + return new RrRectangle(bBox); // Something horrible happens to return by reference here; hence copy... } public boolean getTopDown() { return topDown; } @@ -239,9 +238,9 @@ if(getMachineLayer() < getFoundationLayers()) { - if(getMachineLayer() == getFoundationLayers() - 2) - angle = e.getEvenHatchDirection(); - else +// if(getMachineLayer() == getFoundationLayers() - 2) +// angle = e.getEvenHatchDirection(); +// else angle = e.getOddHatchDirection(); } else { Modified: trunk/software/host/src/org/reprap/geometry/Producer.java =================================================================== --- trunk/software/host/src/org/reprap/geometry/Producer.java 2010-10-17 09:56:45 UTC (rev 3837) +++ trunk/software/host/src/org/reprap/geometry/Producer.java 2010-10-17 15:29:25 UTC (rev 3838) @@ -3,11 +3,16 @@ import javax.swing.JCheckBoxMenuItem; import org.reprap.Preferences; import org.reprap.Printer; +import org.reprap.Extruder; +import org.reprap.Attributes; import org.reprap.geometry.polygons.Rr2Point; import org.reprap.geometry.polygons.RrRectangle; import org.reprap.geometry.polygons.AllSTLsToBuild; import org.reprap.geometry.polygons.RrPolygonList; import org.reprap.geometry.polygons.RrPolygon; +import org.reprap.geometry.polygons.RrCSG; +import org.reprap.geometry.polygons.BooleanGrid; +import org.reprap.geometry.polygons.BooleanGridList; import org.reprap.gui.RepRapBuild; import org.reprap.utilities.Debug; import org.reprap.utilities.RrGraphics; @@ -44,10 +49,9 @@ allSTLs = bld.getSTLs(); - //stlc = new STLSlice(astl.things()); - RrRectangle gp = allSTLs.ObjectPlanRectangle(); - + gp = new RrRectangle(new Rr2Point(gp.x().low() - 6, gp.y().low() - 6), + new Rr2Point(gp.x().high() + 6, gp.y().high() + 6)); if(Preferences.simulate()) { simulationPlot = new RrGraphics("RepRap building simulation"); @@ -135,10 +139,10 @@ public void produce() throws Exception { - RrRectangle gp = layerRules.getBox(); +// RrRectangle gp = layerRules.getBox(); - gp = new RrRectangle(new Rr2Point(gp.x().low() - 6, gp.y().low() - 6), - new Rr2Point(gp.x().high() + 6, gp.y().high() + 6)); +// gp = new RrRectangle(new Rr2Point(gp.x().low() - 6, gp.y().low() - 6), +// new Rr2Point(gp.x().high() + 6, gp.y().high() + 6)); layerRules.getPrinter().startRun(layerRules); @@ -148,26 +152,26 @@ else { if(layerRules.getTopDown()) - produceAdditiveTopDown(gp); + produceAdditiveTopDown(); else Debug.e("Producer.produce(): bottom-up builds no longer supported."); //produceAdditiveGroundUp(gp); } } - //FIXME: so I work with BooleanGrids private void fillFoundationRectangle(Printer reprap, RrRectangle gp) throws Exception { -// RrCSG rect = RrCSG.RrCSGFromBox(gp); -// gp = gp.scale(1.1); -// Extruder e = reprap.getExtruder(); -// RrCSGPolygon rcp = new RrCSGPolygon(rect, gp, new Attributes(e.getMaterial(), null, null, -// e.getAppearance())); -// rcp.divide(Preferences.tiny(), 1.01); -// RrPolygonList h = rcp.hatch(layerRules.getHatchDirection(e), layerRules.getHatchWidth(e)); -// LayerProducer lp = new LayerProducer(h, layerRules, simulationPlot); -// lp.plot(); -// reprap.getExtruder().stopExtruding(); + RrPolygonList shield = new RrPolygonList(); + Extruder e = reprap.getExtruder(); + Attributes fa = new Attributes(e.getMaterial(), null, null, e.getAppearance()); +// if(Preferences.loadGlobalBool("Shield")) // Should the foundation have a shield, or not? +// shield.add(allSTLs.shieldPolygon(fa)); + RrCSG rect = RrCSG.RrCSGFromBox(gp); + BooleanGrid bg = new BooleanGrid(rect, gp.scale(1.1), fa); + RrPolygonList h[] = {shield, bg.hatch(layerRules.getHatchDirection(e), layerRules.getHatchWidth(e), bg.attribute())}; + LayerProducer lp = new LayerProducer(h, layerRules, simulationPlot); + lp.plot(); + reprap.getExtruder().stopExtruding(); //reprap.setFeedrate(reprap.getFastFeedrateXY()); } @@ -227,81 +231,12 @@ } } -// /** -// * @throws Exception -// */ -// private void produceAdditiveGroundUp(RrRectangle gp) throws Exception -// { -// bld.mouseToWorld(); -// -// Printer reprap = layerRules.getPrinter(); -// -// layFoundationGroundUp(gp); -// -// reprap.setSeparating(true); -// -// while(layerRules.getMachineLayer() < layerRules.getMachineLayerMax()) -// { -// -// if (reprap.isCancelled()) -// break; -// waitWhilePaused(); -// -// Debug.d("Commencing layer at " + layerRules.getMachineZ()); -// -// reprap.startingLayer(layerRules); -// -// // Change Z height -// //reprap.singleMove(reprap.getX(), reprap.getY(), layerRules.getMachineZ(), reprap.getFastFeedrateZ()); -// -// reprap.waitWhileBufferNotEmpty(); -// reprap.slowBuffer(); -// -// BooleanGridList slice; -// -// RrPolygonList allPolygons[] = new RrPolygonList[reprap.getExtruders().length]; -// for(int extruder = 0; extruder < reprap.getExtruders().length; extruder++) -// allPolygons[extruder] = new RrPolygonList(); -// -// for(int i = 0; i < allSTLs.size(); i++) -// { -// slice = allSTLs.slice(i, layerRules.getModelZ() + layerRules.getZStep()*0.5, -// reprap.getExtruders()); -// -// if(slice.size() > 0) -// { -// RrPolygonList fills = slice.computeInfill(layerRules); -// RrPolygonList borders = slice.computeOutlines(layerRules, fills); -// for(int pol = 0; pol < borders.size(); pol++) -// { -// RrPolygon p = borders.polygon(pol); -// allPolygons[p.getAttributes().getExtruder().getID()].add(p); -// } -// for(int pol = 0; pol < fills.size(); pol++) -// { -// RrPolygon p = fills.polygon(pol); -// allPolygons[p.getAttributes().getExtruder().getID()].add(p); -// } -// } -// } -// reprap.finishedLayer(layerRules); -// reprap.betweenLayers(layerRules); -// layer = null; -// slice = null; -// //slice.destroy(); -// allSTLs.destroyLayer(); -// -// layerRules.step(reprap.getExtruder()); -// reprap.setSeparating(false); -// } -// -// reprap.terminate(); -// } + /** * @throws Exception */ - private void produceAdditiveTopDown(RrRectangle gp) throws Exception + private void produceAdditiveTopDown() throws Exception { bld.mouseToWorld(); @@ -321,9 +256,9 @@ totalPhysicalExtruders++; if(thisExtruder - lastExtruder != 1) { - Debug.d("Producer.produceAdditiveTopDown(): Physical extruders out of sequence: " + + Debug.e("Producer.produceAdditiveTopDown(): Physical extruders out of sequence: " + lastExtruder + " then " + thisExtruder); - Debug.d("(Physical extruder addresses should be sequential (or equal) starting at 0.)"); + Debug.e("(Physical extruder addresses should be sequential (or equal) starting at 0.)"); } lastExtruder = thisExtruder; } @@ -362,6 +297,7 @@ { RrPolygonList fills = allSTLs.computeInfill(stl, layerRules); //, startNearHere); RrPolygonList borders = allSTLs.computeOutlines(stl, layerRules, fills, shield); + shield = false; RrPolygonList support = allSTLs.computeSupport(stl, layerRules); borders = borders.nearEnds(startNearHere, false, -1); if(borders.size() > 0) @@ -383,19 +319,19 @@ } for(int pol = 0; pol < borders.size(); pol++) { - shield = false; + //shield = false; RrPolygon p = borders.polygon(pol); allPolygons[p.getAttributes().getExtruder().getPhysicalExtruderNumber()].add(p); } for(int pol = 0; pol < fills.size(); pol++) { - shield = false; + //shield = false; RrPolygon p = fills.polygon(pol); allPolygons[p.getAttributes().getExtruder().getPhysicalExtruderNumber()].add(p); } for(int pol = 0; pol < support.size(); pol++) { - shield = false; + //shield = false; RrPolygon p = support.polygon(pol); allPolygons[p.getAttributes().getExtruder().getPhysicalExtruderNumber()].add(p); } @@ -424,7 +360,7 @@ } - layFoundationTopDown(gp); + layFoundationTopDown(layerRules.getBox()); reprap.terminate(); } Modified: trunk/software/host/src/org/reprap/geometry/polygons/AllSTLsToBuild.java =================================================================== --- trunk/software/host/src/org/reprap/geometry/polygons/AllSTLsToBuild.java 2010-10-17 09:56:45 UTC (rev 3837) +++ trunk/software/host/src/org/reprap/geometry/polygons/AllSTLsToBuild.java 2010-10-17 15:29:25 UTC (rev 3838) @@ -594,7 +594,7 @@ return result; } - Debug.d("STLSlice.getNextPolygon(): exhausted edge list!"); + Debug.d("AllSTLsToBuild.getNextPolygon(): exhausted edge list!"); return result; } @@ -773,6 +773,26 @@ } /** + * Compute the polygon to lay down for the machine to wipe its node on. + * @param a + * @return + */ + public RrPolygon shieldPolygon(Attributes a) + { + RrRectangle rr = ObjectPlanRectangle(); + Rr2Point corner = Rr2Point.add(rr.sw(), new Rr2Point(-3, -3)); + RrPolygon ell = new RrPolygon(a, false); + ell.add(corner); + ell.add(Rr2Point.add(corner, new Rr2Point(0, 10))); + ell.add(Rr2Point.add(corner, new Rr2Point(-2, 10))); + ell.add(Rr2Point.add(corner, new Rr2Point(-2, -2))); + ell.add(Rr2Point.add(corner, new Rr2Point(20, -2))); + ell.add(Rr2Point.add(corner, new Rr2Point(20, 0))); + ell.add(corner); + return ell; + } + + /** * Compute the outline polygons for this set of patterns. * @param layerConditions * @param hatchedPolygons @@ -813,19 +833,7 @@ try { if(shield && Preferences.loadGlobalBool("Shield")) - { - RrRectangle rr = layerConditions.getBox(); - Rr2Point corner = Rr2Point.add(rr.sw(), new Rr2Point(-3, -3)); - RrPolygon ell = new RrPolygon(borderPolygons.polygon(0).getAttributes(), false); - ell.add(corner); - ell.add(Rr2Point.add(corner, new Rr2Point(0, 10))); - ell.add(Rr2Point.add(corner, new Rr2Point(-2, 10))); - ell.add(Rr2Point.add(corner, new Rr2Point(-2, -2))); - ell.add(Rr2Point.add(corner, new Rr2Point(20, -2))); - ell.add(Rr2Point.add(corner, new Rr2Point(20, 0))); - ell.add(corner); - borderPolygons.add(0, ell); - } + borderPolygons.add(0, shieldPolygon(borderPolygons.polygon(0).getAttributes())); } catch (Exception ex) {} } Modified: trunk/software/host/src/org/reprap/utilities/RrGraphics.java =================================================================== --- trunk/software/host/src/org/reprap/utilities/RrGraphics.java 2010-10-17 09:56:45 UTC (rev 3837) +++ trunk/software/host/src/org/reprap/utilities/RrGraphics.java 2010-10-17 15:29:25 UTC (rev 3838) @@ -102,7 +102,7 @@ /** * Pixels */ - private final int frame = 800; + private final int frame = 600; /** * This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <adr...@us...> - 2010-11-20 17:06:18
|
Revision: 3893 http://reprap.svn.sourceforge.net/reprap/?rev=3893&view=rev Author: adrian-bowyer Date: 2010-11-20 17:06:12 +0000 (Sat, 20 Nov 2010) Log Message: ----------- Raise Z parameter added to moveToPurge() function, so you can choose whether to lift a bit, or not. Modified Paths: -------------- trunk/software/host/src/org/reprap/Printer.java trunk/software/host/src/org/reprap/devices/GCodeExtruder.java trunk/software/host/src/org/reprap/devices/GenericExtruder.java trunk/software/host/src/org/reprap/machines/GCodeRepRap.java trunk/software/host/src/org/reprap/machines/GenericRepRap.java trunk/software/host/src/org/reprap/machines/Simulator.java Modified: trunk/software/host/src/org/reprap/Printer.java =================================================================== --- trunk/software/host/src/org/reprap/Printer.java 2010-11-18 19:11:20 UTC (rev 3892) +++ trunk/software/host/src/org/reprap/Printer.java 2010-11-20 17:06:12 UTC (rev 3893) @@ -217,7 +217,7 @@ * Move to the purge point * */ - public void moveToPurge(); + public void moveToPurge(boolean raiseZ); /** * @param previewer Modified: trunk/software/host/src/org/reprap/devices/GCodeExtruder.java =================================================================== --- trunk/software/host/src/org/reprap/devices/GCodeExtruder.java 2010-11-18 19:11:20 UTC (rev 3892) +++ trunk/software/host/src/org/reprap/devices/GCodeExtruder.java 2010-11-20 17:06:12 UTC (rev 3893) @@ -34,28 +34,7 @@ //} } - /** - * Purge the extruder - */ - public void purge(boolean homeZ) throws Exception - { - if(purgeTime <= 0) - return; - getPrinter().moveToPurge(); - try - { - if(homeZ) - getPrinter().homeToZeroZ(); - heatOn(true); - setExtrusion(getFastXYFeedrate(), false); - getPrinter().machineWait(purgeTime, false); - setExtrusion(0, false); - } catch (Exception e) - {} - getPrinter().printEndReverse(); - //getPrinter().home(); - zeroExtrudedLength(); - } + public void setTemperature(double temperature, boolean wait) throws Exception { Modified: trunk/software/host/src/org/reprap/devices/GenericExtruder.java =================================================================== --- trunk/software/host/src/org/reprap/devices/GenericExtruder.java 2010-11-18 19:11:20 UTC (rev 3892) +++ trunk/software/host/src/org/reprap/devices/GenericExtruder.java 2010-11-20 17:06:12 UTC (rev 3893) @@ -1338,6 +1338,29 @@ return purgeTime; } + /** + * Purge the extruder + */ + public void purge(boolean homeZ) throws Exception + { + getPrinter().moveToPurge(!homeZ); + try + { + if(homeZ) + getPrinter().homeToZeroZ(); + heatOn(true); + if(purgeTime > 0) + { + setExtrusion(getFastXYFeedrate(), false); + getPrinter().machineWait(purgeTime, false); + setExtrusion(0, false); + getPrinter().printEndReverse(); + zeroExtrudedLength(); + } + } catch (Exception e) + {} + } + /** * If this is true, plot outlines from the middle of their infilling hatch to reduce dribble at * their starts and ends. If false, plot the outline as the outline. Modified: trunk/software/host/src/org/reprap/machines/GCodeRepRap.java =================================================================== --- trunk/software/host/src/org/reprap/machines/GCodeRepRap.java 2010-11-18 19:11:20 UTC (rev 3892) +++ trunk/software/host/src/org/reprap/machines/GCodeRepRap.java 2010-11-20 17:06:12 UTC (rev 3893) @@ -417,15 +417,6 @@ /** - * Go to the purge point - */ - public void moveToPurge() - { - singleMove(currentX, currentY, currentZ + 1, getFastFeedrateZ()); - singleMove(dumpX, dumpY, currentZ, getExtruder().getFastXYFeedrate()); - } - - /** * Go to the finish point */ public void moveToFinish() Modified: trunk/software/host/src/org/reprap/machines/GenericRepRap.java =================================================================== --- trunk/software/host/src/org/reprap/machines/GenericRepRap.java 2010-11-18 19:11:20 UTC (rev 3892) +++ trunk/software/host/src/org/reprap/machines/GenericRepRap.java 2010-11-20 17:06:12 UTC (rev 3893) @@ -323,15 +323,27 @@ selectExtruder(0); getExtruder().zeroExtrudedLength(); - Debug.d("Homing machine"); - home(); + Debug.d("Homing machine in X and Y"); + homeToZeroX(); + homeToZeroY(); //Debug.d("Setting temperature"); //getExtruder().heatOn(true); + // Move to the purge point, home Z and purge the extruder getExtruder().purge(true); } + /** + * Go to the purge point + */ + public void moveToPurge(boolean raiseZ) + { + if(raiseZ) + singleMove(currentX, currentY, currentZ + 1, getFastFeedrateZ()); + singleMove(dumpX, dumpY, currentZ, getExtruder().getFastXYFeedrate()); + } + /* (non-Javadoc) * @see org.reprap.Printer#calibrate() */ Modified: trunk/software/host/src/org/reprap/machines/Simulator.java =================================================================== --- trunk/software/host/src/org/reprap/machines/Simulator.java 2010-11-18 19:11:20 UTC (rev 3892) +++ trunk/software/host/src/org/reprap/machines/Simulator.java 2010-11-20 17:06:12 UTC (rev 3893) @@ -54,13 +54,6 @@ } - /** - * Go to the purge point - */ - public void moveToPurge() - { - singleMove(dumpX, dumpY, currentZ, getExtruder().getFastXYFeedrate()); - } public void waitTillNotBusy() throws IOException {} public void finishedLayer(int layerNumber) throws Exception {} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bu...@us...> - 2010-11-21 04:55:27
|
Revision: 3895 http://reprap.svn.sourceforge.net/reprap/?rev=3895&view=rev Author: buzz Date: 2010-11-21 04:55:21 +0000 (Sun, 21 Nov 2010) Log Message: ----------- Added support for non-fatal messages and line-continuations from the Firmware, which are useful when debugging which cant always follow the current protocol. The "comment" format is C++ like, with double slashes at the start of the line meaning "ignore to end of line". // this is a comment I also added support for breaking up mesages across multiple lines while pretending that you didn't. Adding a single backslash character immediately before an EOL will cause the host to pretend that that EOL didn't exist, and keep reading from the next line. This commit is the Host implementation. Previous commit was the Firmware implementation. Modified Paths: -------------- trunk/software/host/src/org/reprap/comms/GCodeReaderAndWriter.java trunk/software/host/src/org/reprap/machines/GCodeRepRap.java Modified: trunk/software/host/src/org/reprap/comms/GCodeReaderAndWriter.java =================================================================== --- trunk/software/host/src/org/reprap/comms/GCodeReaderAndWriter.java 2010-11-21 04:53:17 UTC (rev 3894) +++ trunk/software/host/src/org/reprap/comms/GCodeReaderAndWriter.java 2010-11-21 04:55:21 UTC (rev 3895) @@ -734,6 +734,17 @@ { result = shutDown; Debug.e("GCodeWriter.waitForResponse(): RepRap hard fault! RepRap said: " + resp); + + } else if (resp.startsWith("//")) // immediate DEBUG "comment" from the firmware ( like C++ ) + { + Debug.d("GCodeWriter.waitForResponse(): " + resp); + resp = ""; + goAgain = true; + } else if (resp.endsWith("\\")) // lines ending in a single backslash are considered "continued" to the next line, like "C" + { + // Debug.d("GCodeWriter.waitForResponse(): " + resp); + // resp = ""; don't clear the previuos response... + goAgain = true; // but do "go again" } else if (resp.startsWith("rs")) // Re-send request? { lns = resp.substring(3); Modified: trunk/software/host/src/org/reprap/machines/GCodeRepRap.java =================================================================== --- trunk/software/host/src/org/reprap/machines/GCodeRepRap.java 2010-11-21 04:53:17 UTC (rev 3894) +++ trunk/software/host/src/org/reprap/machines/GCodeRepRap.java 2010-11-21 04:55:21 UTC (rev 3895) @@ -44,7 +44,9 @@ gcode = new GCodeReaderAndWriter(); gcode.queue("M110 ; Reset the line numbers"); gcode.queue("M115 ; Get the firmware version numbers etc"); - Debug.d("Firmware configuration string: " + gcode.lastResponse()); + String FirmwareConfig = gcode.lastResponse(); + FirmwareConfig = FirmwareConfig.replace('\\','\n'); //make it easier to read for humans if it has "continuations" + Debug.d("Firmware configuration string: " + FirmwareConfig); loadExtruders(); forceSelection = true; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <adr...@us...> - 2010-12-07 12:17:04
|
Revision: 3916 http://reprap.svn.sourceforge.net/reprap/?rev=3916&view=rev Author: adrian-bowyer Date: 2010-12-07 12:16:58 +0000 (Tue, 07 Dec 2010) Log Message: ----------- David Johnson's fix for the rxtx problem included (a 1s delay after setting the baud rate). Sending of M115 at the start switched off for now - causes things to hang. Modified Paths: -------------- trunk/software/host/src/org/reprap/comms/GCodeReaderAndWriter.java trunk/software/host/src/org/reprap/machines/GCodeRepRap.java Modified: trunk/software/host/src/org/reprap/comms/GCodeReaderAndWriter.java =================================================================== --- trunk/software/host/src/org/reprap/comms/GCodeReaderAndWriter.java 2010-12-07 02:11:32 UTC (rev 3915) +++ trunk/software/host/src/org/reprap/comms/GCodeReaderAndWriter.java 2010-12-07 12:16:58 UTC (rev 3916) @@ -845,14 +845,10 @@ Debug.d("An unsupported comms operation was encountered.\n" + e.toString()); return; } + + // Wait for baud rate change to take effect + try {Thread.sleep(1000);} catch (Exception e) {} -/* - port.setSerialPortParams(baudRate, - SerialPort.DATABITS_8, - SerialPort.STOPBITS_1, - SerialPort.PARITY_NONE); -*/ - // End of workround try { port.setFlowControlMode(SerialPort.FLOWCONTROL_NONE); Modified: trunk/software/host/src/org/reprap/machines/GCodeRepRap.java =================================================================== --- trunk/software/host/src/org/reprap/machines/GCodeRepRap.java 2010-12-07 02:11:32 UTC (rev 3915) +++ trunk/software/host/src/org/reprap/machines/GCodeRepRap.java 2010-12-07 12:16:58 UTC (rev 3916) @@ -43,10 +43,10 @@ gcode = new GCodeReaderAndWriter(); gcode.queue("M110 ; Reset the line numbers"); - gcode.queue("M115 ; Get the firmware version numbers etc"); - String FirmwareConfig = gcode.lastResponse(); - FirmwareConfig = FirmwareConfig.replace('\\','\n'); //make it easier to read for humans if it has "continuations" - Debug.d("Firmware configuration string: " + FirmwareConfig); + //gcode.queue("M115 ; Get the firmware version numbers etc"); + //String FirmwareConfig = gcode.lastResponse(); + //FirmwareConfig = FirmwareConfig.replace('\\','\n'); //make it easier to read for humans if it has "continuations" + //Debug.d("Firmware configuration string: " + FirmwareConfig); loadExtruders(); forceSelection = true; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <adr...@us...> - 2011-01-24 22:14:17
|
Revision: 4012 http://reprap.svn.sourceforge.net/reprap/?rev=4012&view=rev Author: adrian-bowyer Date: 2011-01-24 22:14:11 +0000 (Mon, 24 Jan 2011) Log Message: ----------- Fixed (I hope) bug whereby extruder valve values affected things even if a valve is not in use (i.e. ValvePulseTime < 0). Modified Paths: -------------- trunk/software/host/src/org/reprap/Printer.java trunk/software/host/src/org/reprap/comms/GCodeReaderAndWriter.java trunk/software/host/src/org/reprap/devices/GenericExtruder.java trunk/software/host/src/org/reprap/machines/GenericRepRap.java Modified: trunk/software/host/src/org/reprap/Printer.java =================================================================== --- trunk/software/host/src/org/reprap/Printer.java 2011-01-24 04:25:48 UTC (rev 4011) +++ trunk/software/host/src/org/reprap/Printer.java 2011-01-24 22:14:11 UTC (rev 4012) @@ -451,25 +451,25 @@ // */ // public int convertFeedrateToSpeedZ(double feedrate); +// /** +// * The X discretisation +// * @return +// */ +// public double getXStepsPerMM(); +// +// /** +// * The Y discretisation +// * @return +// */ +// public double getYStepsPerMM(); +// +// /** +// * The Z discretisation +// * @return +// */ +// public double getZStepsPerMM(); +// /** - * The X discretisation - * @return - */ - public double getXStepsPerMM(); - - /** - * The Y discretisation - * @return - */ - public double getYStepsPerMM(); - - /** - * The Z discretisation - * @return - */ - public double getZStepsPerMM(); - - /** * If we are using an output buffer, it's a good idea to wait till * it's empty between layers before computing the next one. */ Modified: trunk/software/host/src/org/reprap/comms/GCodeReaderAndWriter.java =================================================================== --- trunk/software/host/src/org/reprap/comms/GCodeReaderAndWriter.java 2011-01-24 04:25:48 UTC (rev 4011) +++ trunk/software/host/src/org/reprap/comms/GCodeReaderAndWriter.java 2011-01-24 22:14:11 UTC (rev 4012) @@ -12,6 +12,7 @@ import java.io.FileReader; import java.io.OutputStream; import java.io.PrintStream; +import java.util.Date; import gnu.io.CommPortIdentifier; import gnu.io.NoSuchPortException; @@ -706,9 +707,32 @@ String lns; resetReceived(); boolean goAgain; + Date timer = new Date(); + long startWait = timer.getTime(); + long timeNow; + long increment = 2000; + long longWait = 10*60*1000; // 10 mins... for(;;) { + timeNow = timer.getTime() - startWait; + if(timeNow > increment) + { + Debug.d("GCodeReaderAndWriter().waitForResponse(): waited for " + timeNow/1000 + " seconds."); + increment = 2*increment; + } + + if(timeNow > longWait) + { + Debug.e("GCodeReaderAndWriter().waitForResponse(): waited for " + timeNow/1000 + " seconds."); + try { + queue("M0 ;shut RepRap down"); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + try { i = serialInStream.read(); Modified: trunk/software/host/src/org/reprap/devices/GenericExtruder.java =================================================================== --- trunk/software/host/src/org/reprap/devices/GenericExtruder.java 2011-01-24 04:25:48 UTC (rev 4011) +++ trunk/software/host/src/org/reprap/devices/GenericExtruder.java 2011-01-24 22:14:11 UTC (rev 4012) @@ -1011,6 +1011,8 @@ */ public double getValveDelayForLayer() { + if(valvePulseTime < 0) + return 0; return valveDelayForLayer; } @@ -1021,6 +1023,8 @@ */ public double getValveDelayForPolygon() { + if(valvePulseTime < 0) + return 0; return valveDelayForPolygon; } @@ -1038,6 +1042,8 @@ */ public double getValveOverRun() { + if(valvePulseTime < 0) + return 0; return valveOverRun; } Modified: trunk/software/host/src/org/reprap/machines/GenericRepRap.java =================================================================== --- trunk/software/host/src/org/reprap/machines/GenericRepRap.java 2011-01-24 04:25:48 UTC (rev 4011) +++ trunk/software/host/src/org/reprap/machines/GenericRepRap.java 2011-01-24 22:14:11 UTC (rev 4012) @@ -411,54 +411,54 @@ Debug.e("selectExtruder() - extruder not found for: " + att.getMaterial()); } - /** - * FIXME: Why don't these use round()? - AB. - * @param n - * @return - */ - protected int convertToStepX(double n) { - return (int)((n + getExtruder().getOffsetX()) * scaleX); - } - - /** - * @param n - * @return - */ - protected int convertToStepY(double n) { - return (int)((n + getExtruder().getOffsetY()) * scaleY); - } - - /** - * @param n - * @return - */ - protected int convertToStepZ(double n) { - return (int)((n + getExtruder().getOffsetZ()) * scaleZ); - } - - /** - * @param n - * @return - */ - protected double convertToPositionX(int n) { - return n / scaleX - getExtruder().getOffsetX(); - } - - /** - * @param n - * @return - */ - protected double convertToPositionY(int n) { - return n / scaleY - getExtruder().getOffsetY(); - } - - /** - * @param n - * @return - */ - protected double convertToPositionZ(int n) { - return n / scaleZ - getExtruder().getOffsetZ(); - } +// /** +// * FIXME: Why don't these use round()? - AB. +// * @param n +// * @return +// */ +// protected int convertToStepX(double n) { +// return (int)((n + getExtruder().getOffsetX()) * scaleX); +// } +// +// /** +// * @param n +// * @return +// */ +// protected int convertToStepY(double n) { +// return (int)((n + getExtruder().getOffsetY()) * scaleY); +// } +// +// /** +// * @param n +// * @return +// */ +// protected int convertToStepZ(double n) { +// return (int)((n + getExtruder().getOffsetZ()) * scaleZ); +// } +// +// /** +// * @param n +// * @return +// */ +// protected double convertToPositionX(int n) { +// return n / scaleX - getExtruder().getOffsetX(); +// } +// +// /** +// * @param n +// * @return +// */ +// protected double convertToPositionY(int n) { +// return n / scaleY - getExtruder().getOffsetY(); +// } +// +// /** +// * @param n +// * @return +// */ +// protected double convertToPositionZ(int n) { +// return n / scaleZ - getExtruder().getOffsetZ(); +// } /* (non-Javadoc) * @see org.reprap.Printer#getX() @@ -1118,67 +1118,67 @@ return foundationLayers; } - //TODO: MAKE THIS WORK! - // Works for me! - AB - public int convertFeedrateToSpeedXY(double feedrate) - { - //Debug.d("feedrate: " + feedrate); - - //pretty straightforward - double stepsPerMinute = feedrate * scaleX; - //Debug.d("steps/min: " + stepsPerMinute); - - //ticks per minute divided by the steps we need to take. - double ticksBetweenSteps = 60000000.0 / (256.0 * stepsPerMinute); - //Debug.d("ticks between steps: " + ticksBetweenSteps); - - int picTimer = 256 - (int)Math.round(ticksBetweenSteps); - //Debug.d("pic timer: " + picTimer); - - //bounds checking. - picTimer = Math.min(255, picTimer); - picTimer = Math.max(0, picTimer); - - return picTimer; - } - +// //TODO: MAKE THIS WORK! +// // Works for me! - AB +// public int convertFeedrateToSpeedXY(double feedrate) +// { +// //Debug.d("feedrate: " + feedrate); +// +// //pretty straightforward +// double stepsPerMinute = feedrate * scaleX; +// //Debug.d("steps/min: " + stepsPerMinute); +// +// //ticks per minute divided by the steps we need to take. +// double ticksBetweenSteps = 60000000.0 / (256.0 * stepsPerMinute); +// //Debug.d("ticks between steps: " + ticksBetweenSteps); +// +// int picTimer = 256 - (int)Math.round(ticksBetweenSteps); +// //Debug.d("pic timer: " + picTimer); +// +// //bounds checking. +// picTimer = Math.min(255, picTimer); +// picTimer = Math.max(0, picTimer); +// +// return picTimer; +// } +// +// +// //TODO: MAKE THIS WORK! +// public int convertFeedrateToSpeedZ(double feedrate) +// { +// //pretty straightforward +// double stepsPerMinute = feedrate * scaleZ; +// +// //ticks per minute divided by the steps we need to take. +//// long ticksBetweenSteps = Math.round(60000000 / 256 / stepsPerMinute); +//// int picTimer = (256 - (int)ticksBetweenSteps); +// double ticksBetweenSteps = 60000000.0 / (256.0 * stepsPerMinute); +// //Debug.d("ticks between steps: " + ticksBetweenSteps); +// +// //System.out.println("Z ticksBetweenSteps = " + ticksBetweenSteps); +// +// int picTimer = 256 - (int)Math.round(ticksBetweenSteps); +// +// //bounds checking. +// picTimer = Math.min(255, picTimer); +// picTimer = Math.max(0, picTimer); +// +// return picTimer; +// } +// +// public double getXStepsPerMM() +// { +// return scaleX; +// } +// public double getYStepsPerMM() +// { +// return scaleY; +// } +// public double getZStepsPerMM() +// { +// return scaleZ; +// } - //TODO: MAKE THIS WORK! - public int convertFeedrateToSpeedZ(double feedrate) - { - //pretty straightforward - double stepsPerMinute = feedrate * scaleZ; - - //ticks per minute divided by the steps we need to take. -// long ticksBetweenSteps = Math.round(60000000 / 256 / stepsPerMinute); -// int picTimer = (256 - (int)ticksBetweenSteps); - double ticksBetweenSteps = 60000000.0 / (256.0 * stepsPerMinute); - //Debug.d("ticks between steps: " + ticksBetweenSteps); - - //System.out.println("Z ticksBetweenSteps = " + ticksBetweenSteps); - - int picTimer = 256 - (int)Math.round(ticksBetweenSteps); - - //bounds checking. - picTimer = Math.min(255, picTimer); - picTimer = Math.max(0, picTimer); - - return picTimer; - } - - public double getXStepsPerMM() - { - return scaleX; - } - public double getYStepsPerMM() - { - return scaleY; - } - public double getZStepsPerMM() - { - return scaleZ; - } - /** * Load an STL file to be made. * @return the name of the file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Rhy...@us...> - 2011-01-25 16:01:26
|
Revision: 4014 http://reprap.svn.sourceforge.net/reprap/?rev=4014&view=rev Author: Rhys-Jones Date: 2011-01-25 16:01:19 +0000 (Tue, 25 Jan 2011) Log Message: ----------- Host now produces 3 Fine Layers of infill Modified Paths: -------------- trunk/software/host/src/org/reprap/devices/GenericExtruder.java trunk/software/host/src/org/reprap/geometry/polygons/AllSTLsToBuild.java Modified: trunk/software/host/src/org/reprap/devices/GenericExtruder.java =================================================================== --- trunk/software/host/src/org/reprap/devices/GenericExtruder.java 2011-01-24 23:58:37 UTC (rev 4013) +++ trunk/software/host/src/org/reprap/devices/GenericExtruder.java 2011-01-25 16:01:19 UTC (rev 4014) @@ -412,8 +412,8 @@ extrusionSize = Preferences.loadGlobalDouble(prefName + "ExtrusionSize(mm)"); extrusionHeight = Preferences.loadGlobalDouble(prefName + "ExtrusionHeight(mm)"); extrusionInfillWidth = Preferences.loadGlobalDouble(prefName + "ExtrusionInfillWidth(mm)"); - lowerFineLayers = 2; //Preferences.loadGlobalInt(prefName + "LowerFineLayers(0...)"); - upperFineLayers = 2; //Preferences.loadGlobalInt(prefName + "UpperFineLayers(0...)"); + lowerFineLayers = 3; //Preferences.loadGlobalInt(prefName + "LowerFineLayers(0...)"); + upperFineLayers = 3; //Preferences.loadGlobalInt(prefName + "UpperFineLayers(0...)"); extrusionBroadWidth = Preferences.loadGlobalDouble(prefName + "ExtrusionBroadWidth(mm)"); coolingPeriod = Preferences.loadGlobalDouble(prefName + "CoolingPeriod(s)"); fastXYFeedrate = Preferences.loadGlobalDouble(prefName + "FastXYFeedrate(mm/minute)"); Modified: trunk/software/host/src/org/reprap/geometry/polygons/AllSTLsToBuild.java =================================================================== --- trunk/software/host/src/org/reprap/geometry/polygons/AllSTLsToBuild.java 2011-01-24 23:58:37 UTC (rev 4013) +++ trunk/software/host/src/org/reprap/geometry/polygons/AllSTLsToBuild.java 2011-01-25 16:01:19 UTC (rev 4014) @@ -735,8 +735,10 @@ BooleanGridList adjacentSlices = slice(stl, layer+1, layerConditions); adjacentSlices = BooleanGridList.intersections(slice(stl, layer+2, layerConditions), adjacentSlices); + adjacentSlices = BooleanGridList.intersections(slice(stl, layer+3, layerConditions), adjacentSlices); adjacentSlices = BooleanGridList.intersections(slice(stl, layer-1, layerConditions), adjacentSlices); adjacentSlices = BooleanGridList.intersections(slice(stl, layer-2, layerConditions), adjacentSlices); + adjacentSlices = BooleanGridList.intersections(slice(stl, layer-3, layerConditions), adjacentSlices); BooleanGridList insides = null; // The insides are the bits that aren't surface. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <adr...@us...> - 2011-03-22 14:39:29
|
Revision: 4062 http://reprap.svn.sourceforge.net/reprap/?rev=4062&view=rev Author: adrian-bowyer Date: 2011-03-22 14:39:23 +0000 (Tue, 22 Mar 2011) Log Message: ----------- Getting extruder lift working properly. W.I.P.... Modified Paths: -------------- trunk/software/host/src/org/reprap/geometry/LayerProducer.java trunk/software/host/src/org/reprap/machines/GCodeRepRap.java Modified: trunk/software/host/src/org/reprap/geometry/LayerProducer.java =================================================================== --- trunk/software/host/src/org/reprap/geometry/LayerProducer.java 2011-03-21 15:00:11 UTC (rev 4061) +++ trunk/software/host/src/org/reprap/geometry/LayerProducer.java 2011-03-22 14:39:23 UTC (rev 4062) @@ -556,7 +556,7 @@ // If getMinLiftedZ() is negative, never lift the head - Boolean lift = att.getExtruder().getMinLiftedZ() >= 0; + Boolean lift = att.getExtruder().getMinLiftedZ() >= 0 || att.getExtruder().getLift() > 0; if(acc) p.setSpeeds(att.getExtruder().getSlowXYFeedrate(), p.isClosed()?outlineFeedrate:infillFeedrate, Modified: trunk/software/host/src/org/reprap/machines/GCodeRepRap.java =================================================================== --- trunk/software/host/src/org/reprap/machines/GCodeRepRap.java 2011-03-21 15:00:11 UTC (rev 4061) +++ trunk/software/host/src/org/reprap/machines/GCodeRepRap.java 2011-03-22 14:39:23 UTC (rev 4062) @@ -222,7 +222,7 @@ double zFeedrate = round(getMaxFeedrateZ(), 1); - double liftIncrement = extruders[extruder].getExtrusionHeight()/2; + double liftIncrement = extruders[extruder].getLift(); //extruders[extruder].getExtrusionHeight()/2; double liftedZ = round(currentZ + liftIncrement, 4); //go up first? This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <adr...@us...> - 2011-03-22 18:50:27
|
Revision: 4063 http://reprap.svn.sourceforge.net/reprap/?rev=4063&view=rev Author: adrian-bowyer Date: 2011-03-22 18:50:21 +0000 (Tue, 22 Mar 2011) Log Message: ----------- Working on getting nozzle lifts going properly. Modified Paths: -------------- trunk/software/host/src/org/reprap/devices/GenericExtruder.java trunk/software/host/src/org/reprap/geometry/LayerProducer.java trunk/software/host/src/org/reprap/gui/botConsole/GenericExtruderTabPanel.java Modified: trunk/software/host/src/org/reprap/devices/GenericExtruder.java =================================================================== --- trunk/software/host/src/org/reprap/devices/GenericExtruder.java 2011-03-22 14:39:23 UTC (rev 4062) +++ trunk/software/host/src/org/reprap/devices/GenericExtruder.java 2011-03-22 18:50:21 UTC (rev 4063) @@ -379,7 +379,7 @@ } /** - * Allow otthers to set our extrude length so that all logical extruders + * Allow others to set our extrude length so that all logical extruders * talking to one physical extruder can use the same length instance. * @param e */ Modified: trunk/software/host/src/org/reprap/geometry/LayerProducer.java =================================================================== --- trunk/software/host/src/org/reprap/geometry/LayerProducer.java 2011-03-22 14:39:23 UTC (rev 4062) +++ trunk/software/host/src/org/reprap/geometry/LayerProducer.java 2011-03-22 18:50:21 UTC (rev 4063) @@ -99,48 +99,11 @@ */ private boolean paused = false; - /** - * The shape of the object built so far under the current layer - */ - //private BranchGroup lowerShell = null; - /** - * The polygons to infill - */ - //private RrPolygonList hatchedPolygons = null; - private RrPolygonList allPolygons[]; /** - * The polygons to outline - */ - //private RrPolygonList borderPolygons = null; - - /** - * Boolean Grid representation of the polygons as input - */ - //private BooleanGridList boolGrdSlice = null; - - /** - * CSG representation of the polygons offset by the width of - * the extruders - */ - //RrCSGPolygonList offBorder = null; - - /** - * CSG representation of the polygons offset by the factor of the - * width of the extruders needed to lay down internal cross-hatching - */ - //BooleanGridList offHatch = null; - - /** - * Counters use so that each material is plotted completely before - * moving on to the next. - */ - //private int commonBorder, commonHatch; - - /** * The clue is in the name... */ private double currentFeedrate; @@ -149,9 +112,8 @@ * Record the end of each polygon as a clue where to start next */ private Rr2Point startNearHere = null; + - //private boolean shellSet = false; - /** * Flag to prevent cyclic graphs going round forever */ @@ -166,30 +128,6 @@ return; beingDestroyed = true; - // Keep the lower shell - the graphics system is using it - - //lowerShell = null; - - // Keep the printer; that's needed for the next layer - - //printer = null; - -// if(hatchedPolygons != null) -// hatchedPolygons.destroy(); -// hatchedPolygons = null; -// -// if(borderPolygons != null) -// borderPolygons.destroy(); -// borderPolygons = null; -// -// //if(boolGrdSlice != null) -// // boolGrdSlice.destroy(); -// boolGrdSlice = null; -// -// //if(offHatch != null) -// //offHatch.destroy(); -// offHatch = null; - if(startNearHere != null) startNearHere.destroy(); startNearHere = null; @@ -197,63 +135,8 @@ beingDestroyed = false; } - /** - * Destroy just me - */ -// protected void finalize() throws Throwable -// { -// // Keep the lower shell - the graphics system is using it -// -// //lowerShell = null; -// -// // Keep the printer; that's needed for the next layer -// -// //printer = null; -// -//// hatchedPolygons = null; -//// borderPolygons = null; -//// boolGrdSlice = null; -//// offHatch = null; -// allPolygons = null; -// startNearHere = null; -// super.finalize(); -// } /** - * Set up a layer consisting of a single material in a single pre-computed list. - * Used for creating foundations. - * @param pols - * @param lc - * @param simPlot - * @throws Exception - */ -// public LayerProducer(RrPolygonList pols, LayerRules lc, RrGraphics simPlot) throws Exception -// { -// layerConditions = lc; -// startNearHere = null; //new Rr2Point(0, 0); -// //lowerShell = null; -// //shellSet = false; -// simulationPlot = simPlot; -// -// boolGrdSlice = null; -// -// borderPolygons = null; -// -// hatchedPolygons = pols; -// -// -// if(simulationPlot != null) -// { -// if(!simulationPlot.isInitialised()) -// simulationPlot.init(lc.getBox(), false); -// else -// simulationPlot.cleanPolygons(); -// } -// -// } -// - - /** * Set up a normal layer * @param boolGrdSliceols * @param ls @@ -261,55 +144,14 @@ * @param simPlot * @throws Exception */ - //public LayerProducer(BooleanGridList bgPols, LayerRules lc, RrGraphics simPlot) throws Exception public LayerProducer(RrPolygonList ap[], LayerRules lc, RrGraphics simPlot) throws Exception { layerConditions = lc; startNearHere = null; - //lowerShell = ls; - //shellSet = false; simulationPlot = simPlot; allPolygons = ap; - //boolGrdSlice = bgPols; - - // The next two are experimental for the moment... - - //inFillCalculations(); - //supportCalculations(); - - //offHatch = boolGrdSlice.offset(layerConditions, false); - -// if(layerConditions.getLayingSupport()) -// { -// borderPolygons = null; -// offHatch = offHatch.union(lc.getPrinter().getExtruders()); -// } else -// { -// BooleanGridList offBorder = boolGrdSlice.offset(layerConditions, true); -// borderPolygons = offBorder.borders(); -// } -// -// hatchedPolygons = offHatch.hatch(layerConditions); -// -// -// if(borderPolygons != null && borderPolygons.size() > 0) -// { -// borderPolygons.middleStarts(hatchedPolygons, layerConditions); -// if(Preferences.loadGlobalBool("Shield")) -// { -// RrRectangle rr = lc.getBox(); -// Rr2Point corner = Rr2Point.add(rr.sw(), new Rr2Point(-3, -3)); -// RrPolygon ell = new RrPolygon(borderPolygons.polygon(0).getAttributes(), false); -// ell.add(corner); -// ell.add(Rr2Point.add(corner, new Rr2Point(-2, 10))); -// ell.add(Rr2Point.add(corner, new Rr2Point(-2, -2))); -// ell.add(Rr2Point.add(corner, new Rr2Point(20, -2))); -// borderPolygons.add(0, ell); -// } -// } - if(simulationPlot != null) { if(!simulationPlot.isInitialised()) @@ -512,13 +354,11 @@ double outlineFeedrate = att.getExtruder().getOutlineFeedrate(); double infillFeedrate = att.getExtruder().getInfillFeedrate(); - boolean acc = att.getExtruder().getMaxAcceleration() > 0; //Preferences.loadGlobalBool("Accelerating"); - - //int leng = p.size(); + boolean acc = att.getExtruder().getMaxAcceleration() > 0; if(p.size() <= 1) { - startNearHere = null; + //startNearHere = null; return; } @@ -534,7 +374,7 @@ } if (plotDist<Preferences.machineResolution()*0.5) { Debug.d("Rejected line with "+p.size()+" points, length: "+plotDist); - startNearHere = null; + //startNearHere = null; return; } @@ -542,21 +382,13 @@ printer.forceNextExtruder(); printer.selectExtruder(att); -// Don't do these with mid-point starting -// if(p.isClosed() && att.getExtruder().incrementedStart()) -// p = p.incrementedStart(layerConditions); -// else if(p.isClosed() && att.getExtruder().randomStart()) -// p = p.randomStart(); - - //int stopExtruding = p.size() + 10; - //int stopValve = stopExtruding; - if (printer.isCancelled()) return; // If getMinLiftedZ() is negative, never lift the head - Boolean lift = att.getExtruder().getMinLiftedZ() >= 0 || att.getExtruder().getLift() > 0; + double liftZ = att.getExtruder().getLift(); + Boolean lift = att.getExtruder().getMinLiftedZ() >= 0 || liftZ > 0; if(acc) p.setSpeeds(att.getExtruder().getSlowXYFeedrate(), p.isClosed()?outlineFeedrate:infillFeedrate, @@ -569,18 +401,17 @@ p.backStepExtrude(extrudeBackLength); p.backStepValve(valveBackLength); -// -// if(extrudeBackLength > 0 && acc) -// stopExtruding = p.findBackPoint(extrudeBackLength); -// -// if(valveBackLength <= 0) -// stopValve = Integer.MAX_VALUE; -// else if(acc) -// stopValve = p.findBackPoint(valveBackLength); - + + double currentZ = printer.getZ(); + if(liftZ > 0) + printer.singleMove(printer.getX(), printer.getY(), currentZ + liftZ, printer.getFastFeedrateZ()); + currentFeedrate = att.getExtruder().getFastXYFeedrate(); singleMove(p.point(0)); + if(liftZ > 0) + printer.singleMove(printer.getX(), printer.getY(), currentZ, printer.getFastFeedrateZ()); + if(acc) currentFeedrate = p.speed(0); else @@ -603,57 +434,29 @@ boolean valveOff = false; boolean oldexoff; -// if(p.isClosed()) -// { -// for(int j = 1; j <= p.size(); j++) -// { -// int i = j%p.size(); -// Rr2Point next = p.point((j+1)%p.size()); -// -// if (printer.isCancelled()) -// { -// printer.stopMotor(); -// singleMove(posNow()); -// move(posNow(), posNow(), lift, true, true); -// return; -// } -// if(acc) -// currentFeedrate = p.speed(i); -// -// oldexoff = extrudeOff; -// extrudeOff = j > stopExtruding || j == p.size(); -// valveOff = j > stopValve || j == p.size(); -// -// plot(p.point(i), next, extrudeOff, valveOff); -// if(oldexoff ^ extrudeOff) -// printer.printEndReverse(); -// } -// } else - -// { - for(int i = 1; i < p.size(); i++) + for(int i = 1; i < p.size(); i++) + { + Rr2Point next = p.point((i+1)%p.size()); + + if (printer.isCancelled()) { - Rr2Point next = p.point((i+1)%p.size()); - - if (printer.isCancelled()) - { - printer.stopMotor(); - singleMove(posNow()); - move(posNow(), posNow(), lift, lift, true); - return; - } - - if(acc) - currentFeedrate = p.speed(i); - - oldexoff = extrudeOff; - extrudeOff = (i > p.extrudeEnd() && extrudeBackLength > 0) || i == p.size()-1; - valveOff = (i > p.valveEnd() && valveBackLength > 0) || i == p.size()-1; - plot(p.point(i), next, extrudeOff, valveOff); - if(oldexoff ^ extrudeOff) - printer.printEndReverse(); + printer.stopMotor(); + singleMove(posNow()); + move(posNow(), posNow(), lift, lift, true); + return; } -// } + + if(acc) + currentFeedrate = p.speed(i); + + oldexoff = extrudeOff; + extrudeOff = (i > p.extrudeEnd() && extrudeBackLength > 0) || i == p.size()-1; + valveOff = (i > p.valveEnd() && valveBackLength > 0) || i == p.size()-1; + plot(p.point(i), next, extrudeOff, valveOff); + if(oldexoff ^ extrudeOff) + printer.printEndReverse(); + } + if(p.isClosed()) move(p.point(0), p.point(0), false, false, true); @@ -674,62 +477,7 @@ } } - - - -// private int plotOneMaterial(RrPolygonList polygons, int i, boolean firstOneInLayer) -// throws ReprapException, IOException -// { -// String material = polygons.polygon(i).getAttributes().getMaterial(); -// -// while(i < polygons.size() && polygons.polygon(i).getAttributes().getMaterial().equals(material)) -// { -// if (layerConditions.getPrinter().isCancelled()) -// return i; -// plot(polygons.polygon(i), firstOneInLayer); -// firstOneInLayer = false; -// i++; -// } -// return i; -// } - -// private boolean nextCommon(int ib, int ih) -// { -// if(borderPolygons == null || hatchedPolygons == null) -// return false; -// -// commonBorder = ib; -// commonHatch = ih; -// -// if(borderPolygons.size() <= 0) -// { -// commonHatch = hatchedPolygons.size(); -// return false; -// } -// -// -// if(hatchedPolygons.size() <= 0) -// { -// commonBorder = borderPolygons.size(); -// return false; -// } -// -// for(int jb = ib; jb < borderPolygons.size(); jb++) -// { -// for(int jh = ih; jh < hatchedPolygons.size(); jh++) -// { -// if(borderPolygons.polygon(ib).getAttributes().getMaterial().equals( -// hatchedPolygons.polygon(ih).getAttributes().getMaterial())) -// { -// commonBorder = jb; -// commonHatch = jh; -// return true; -// } -// } -// } -// return false; -// } - + /** * Master plot function - draw everything. Supress border and/or hatch by * setting borderPolygons and/or hatchedPolygons null @@ -737,8 +485,6 @@ */ public void plot() throws Exception { - //int ib, jb, ih, jh; - boolean firstOneInLayer = true; for(int i = 0; i < allPolygons.length; i++) @@ -751,72 +497,6 @@ firstOneInLayer = false; } } - -// //borderPolygons = borderPolygons.filterShorts(Preferences.machineResolution()*2); -// //hatchedPolygons = hatchedPolygons.filterShorts(Preferences.machineResolution()*2); -// -// ib = 0; -// ih = 0; -// -// Printer printer = layerConditions.getPrinter(); -// -// while(nextCommon(ib, ih)) -// { -// for(jb = ib; jb < commonBorder; jb++) -// { -// if (printer.isCancelled()) -// break; -// plot(borderPolygons.polygon(jb), firstOneInLayer); -// firstOneInLayer = false; -// } -// ib = commonBorder; -// -// for(jh = ih; jh < commonHatch; jh++) -// { -// if (printer.isCancelled()) -// break; -// plot(hatchedPolygons.polygon(jh), firstOneInLayer); -// firstOneInLayer = false; -// } -// ih = commonHatch; -// -// firstOneInLayer = true; -// borderPolygons = borderPolygons.nearEnds(startNearHere); -// -// ib = plotOneMaterial(borderPolygons, ib, firstOneInLayer); -// firstOneInLayer = false; -// hatchedPolygons = hatchedPolygons.nearEnds(startNearHere); -// ih = plotOneMaterial(hatchedPolygons, ih, firstOneInLayer); -// } -// -// firstOneInLayer = true; // Not sure about this - AB -// -// if(borderPolygons != null) -// { -// for(jb = ib; jb < borderPolygons.size(); jb++) -// { -// if (printer.isCancelled()) -// break; -// plot(borderPolygons.polygon(jb), firstOneInLayer); -// firstOneInLayer = false; -// } -// } -// -// if(hatchedPolygons != null) -// { -// for(jh = ih; jh < hatchedPolygons.size(); jh++) -// { -// if (printer.isCancelled()) -// break; -// plot(hatchedPolygons.polygon(jh), firstOneInLayer); -// firstOneInLayer = false; -// } -// } -//// if(!shellSet) -//// { -//// printer.setLowerShell(lowerShell); -//// shellSet = true; -//// } } } Modified: trunk/software/host/src/org/reprap/gui/botConsole/GenericExtruderTabPanel.java =================================================================== --- trunk/software/host/src/org/reprap/gui/botConsole/GenericExtruderTabPanel.java 2011-03-22 14:39:23 UTC (rev 4062) +++ trunk/software/host/src/org/reprap/gui/botConsole/GenericExtruderTabPanel.java 2011-03-22 18:50:21 UTC (rev 4063) @@ -495,6 +495,15 @@ }//GEN-LAST:event_heatButtonActionPerformed +private void setExtruderSpeed() { + try { + extruder.setExtrusion(extruding?Double.parseDouble(motorSpeedField.getText()):0, motorReverseCheck.isSelected()); + } catch (Exception ex) { + JOptionPane.showMessageDialog(null, "Extruder exception: " + ex); + ex.printStackTrace(); + } +} + private boolean extruding = false; private void extrudeButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_extrudeButtonActionPerformed @@ -593,14 +602,7 @@ BotConsoleFrame.getXYZTabPanel().getPrinter().getDumpY(), z); }//GEN-LAST:event_moveToSwapPointAction -private void setExtruderSpeed() { - try { - extruder.setExtrusion(extruding?Double.parseDouble(motorSpeedField.getText()):0, motorReverseCheck.isSelected()); - } catch (Exception ex) { - JOptionPane.showMessageDialog(null, "Extruder exception: " + ex); - ex.printStackTrace(); - } -} + public double getExtruderSpeed() { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <adr...@us...> - 2011-03-22 23:21:30
|
Revision: 4064 http://reprap.svn.sourceforge.net/reprap/?rev=4064&view=rev Author: adrian-bowyer Date: 2011-03-22 23:21:23 +0000 (Tue, 22 Mar 2011) Log Message: ----------- Nozzle lifts going properly. (Maybe...) Modified Paths: -------------- trunk/software/host/src/org/reprap/geometry/Producer.java trunk/software/host/src/org/reprap/machines/GenericRepRap.java Modified: trunk/software/host/src/org/reprap/geometry/Producer.java =================================================================== --- trunk/software/host/src/org/reprap/geometry/Producer.java 2011-03-22 18:50:21 UTC (rev 4063) +++ trunk/software/host/src/org/reprap/geometry/Producer.java 2011-03-22 23:21:23 UTC (rev 4064) @@ -338,7 +338,6 @@ } } - LayerProducer lp = new LayerProducer(allPolygons, layerRules, simulationPlot); layerRules.setFirstAndLast(allPolygons); @@ -352,10 +351,7 @@ reprap.setTop(reprap.getX(), reprap.getY(), reprap.getZ()); firstTimeRound = false; } - //layer = null; - //slice = null; - - //slice.finalize(); + allSTLs.destroyLayer(); layerRules.step(reprap.getExtruder()); Modified: trunk/software/host/src/org/reprap/machines/GenericRepRap.java =================================================================== --- trunk/software/host/src/org/reprap/machines/GenericRepRap.java 2011-03-22 18:50:21 UTC (rev 4063) +++ trunk/software/host/src/org/reprap/machines/GenericRepRap.java 2011-03-22 23:21:23 UTC (rev 4064) @@ -905,8 +905,18 @@ // The startup procedure has already done that if(lc.getMachineLayer() > 0 && Preferences.loadGlobalBool("InterLayerCooling")) + { + double liftZ = -1; + for(int i = 0; i < extruders.length; i++) + if(extruders[i].getLift() > liftZ) + liftZ = extruders[i].getLift(); + double currentZ = getZ(); + if(liftZ > 0) + singleMove(getX(), getY(), currentZ + liftZ, getFastFeedrateZ()); homeToZeroXYE(); - else + if(liftZ > 0) + singleMove(getX(), getY(), currentZ, getFastFeedrateZ()); + } else { int extruderNow = extruder; for(int i = 0; i < extruders.length; i++) @@ -1089,95 +1099,12 @@ statusWindow.setCancelled(isCancelled); } - /** - * @return the X stepper - */ -// public GenericStepperMotor getXMotor() -// { -// return motorX; -// } -// -// /** -// * @return the Y stepper -// */ -// public GenericStepperMotor getYMotor() -// { -// return motorY; -// } -// -// /** -// * @return the Z stepper -// */ -// public GenericStepperMotor getZMotor() -// { -// return motorZ; -// } public int getFoundationLayers() { return foundationLayers; } -// //TODO: MAKE THIS WORK! -// // Works for me! - AB -// public int convertFeedrateToSpeedXY(double feedrate) -// { -// //Debug.d("feedrate: " + feedrate); -// -// //pretty straightforward -// double stepsPerMinute = feedrate * scaleX; -// //Debug.d("steps/min: " + stepsPerMinute); -// -// //ticks per minute divided by the steps we need to take. -// double ticksBetweenSteps = 60000000.0 / (256.0 * stepsPerMinute); -// //Debug.d("ticks between steps: " + ticksBetweenSteps); -// -// int picTimer = 256 - (int)Math.round(ticksBetweenSteps); -// //Debug.d("pic timer: " + picTimer); -// -// //bounds checking. -// picTimer = Math.min(255, picTimer); -// picTimer = Math.max(0, picTimer); -// -// return picTimer; -// } -// -// -// //TODO: MAKE THIS WORK! -// public int convertFeedrateToSpeedZ(double feedrate) -// { -// //pretty straightforward -// double stepsPerMinute = feedrate * scaleZ; -// -// //ticks per minute divided by the steps we need to take. -//// long ticksBetweenSteps = Math.round(60000000 / 256 / stepsPerMinute); -//// int picTimer = (256 - (int)ticksBetweenSteps); -// double ticksBetweenSteps = 60000000.0 / (256.0 * stepsPerMinute); -// //Debug.d("ticks between steps: " + ticksBetweenSteps); -// -// //System.out.println("Z ticksBetweenSteps = " + ticksBetweenSteps); -// -// int picTimer = 256 - (int)Math.round(ticksBetweenSteps); -// -// //bounds checking. -// picTimer = Math.min(255, picTimer); -// picTimer = Math.max(0, picTimer); -// -// return picTimer; -// } -// -// public double getXStepsPerMM() -// { -// return scaleX; -// } -// public double getYStepsPerMM() -// { -// return scaleY; -// } -// public double getZStepsPerMM() -// { -// return scaleZ; -// } /** * Load an STL file to be made. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <adr...@us...> - 2011-03-30 14:23:00
|
Revision: 4071 http://reprap.svn.sourceforge.net/reprap/?rev=4071&view=rev Author: adrian-bowyer Date: 2011-03-30 14:22:52 +0000 (Wed, 30 Mar 2011) Log Message: ----------- More improved construction of unsupported bridges (experimental...). Plus an attributes class for polygons (as yet unused). Extruders have unique attributes attached, which are for an entire material. But a polygon may need internally-generated supplementary info (one day). Modified Paths: -------------- trunk/software/host/src/org/reprap/Extruder.java trunk/software/host/src/org/reprap/devices/GenericExtruder.java trunk/software/host/src/org/reprap/geometry/LayerProducer.java trunk/software/host/src/org/reprap/geometry/polygons/AllSTLsToBuild.java trunk/software/host/src/org/reprap/geometry/polygons/RrPolygon.java trunk/software/host/src/org/reprap/geometry/polygons/RrPolygonList.java Modified: trunk/software/host/src/org/reprap/Extruder.java =================================================================== --- trunk/software/host/src/org/reprap/Extruder.java 2011-03-25 00:54:35 UTC (rev 4070) +++ trunk/software/host/src/org/reprap/Extruder.java 2011-03-30 14:22:52 UTC (rev 4071) @@ -587,5 +587,19 @@ * @return */ public double getOddHatchDirection(); + /** + * Get the extrude ratio + * @return + */ + public double getExtrudeRatio(); + + + /** + * Set the extrude ratio. Only to be used if you know what you + * are doing. It's a good idea to set it back when you've finished... + * @param er + */ + public void setExtrudeRatio(double er); + } Modified: trunk/software/host/src/org/reprap/devices/GenericExtruder.java =================================================================== --- trunk/software/host/src/org/reprap/devices/GenericExtruder.java 2011-03-25 00:54:35 UTC (rev 4070) +++ trunk/software/host/src/org/reprap/devices/GenericExtruder.java 2011-03-30 14:22:52 UTC (rev 4071) @@ -1279,6 +1279,25 @@ return 0; return extrudeRatio*distance; } + + /** + * Get the extrude ratio + * @return + */ + public double getExtrudeRatio() + { + return extrudeRatio; + } + + /** + * Set the extrude ratio. Only to be used if you know what you + * are doing. It's a good idea to set it back when you've finished... + * @param er + */ + public void setExtrudeRatio(double er) + { + extrudeRatio = er; + } /** * Find out if we're working in 5D Modified: trunk/software/host/src/org/reprap/geometry/LayerProducer.java =================================================================== --- trunk/software/host/src/org/reprap/geometry/LayerProducer.java 2011-03-25 00:54:35 UTC (rev 4070) +++ trunk/software/host/src/org/reprap/geometry/LayerProducer.java 2011-03-30 14:22:52 UTC (rev 4071) @@ -15,6 +15,7 @@ import org.reprap.geometry.polygons.Rr2Point; //import org.reprap.geometry.polygons.RrCSGPolygonList; import org.reprap.geometry.polygons.RrPolygon; +import org.reprap.geometry.polygons.PolygonAttributes; import org.reprap.geometry.polygons.RrPolygonList; import org.reprap.geometry.polygons.RrRectangle; import org.reprap.utilities.Debug; @@ -350,6 +351,7 @@ private void plot(RrPolygon p, boolean firstOneInLayer) throws Exception { Attributes att = p.getAttributes(); + PolygonAttributes pAtt = p.getPolygonAttribute(); Printer printer = layerConditions.getPrinter(); double outlineFeedrate = att.getExtruder().getOutlineFeedrate(); double infillFeedrate = att.getExtruder().getInfillFeedrate(); @@ -434,6 +436,11 @@ boolean valveOff = false; boolean oldexoff; + double oldFeedFactor = att.getExtruder().getExtrudeRatio(); + + if(pAtt != null) + att.getExtruder().setExtrudeRatio(oldFeedFactor*pAtt.getBridgeThin()); + for(int i = 1; i < p.size(); i++) { Rr2Point next = p.point((i+1)%p.size()); @@ -457,7 +464,10 @@ printer.printEndReverse(); } + // Restore sanity + att.getExtruder().setExtrudeRatio(oldFeedFactor); + if(p.isClosed()) move(p.point(0), p.point(0), false, false, true); Modified: trunk/software/host/src/org/reprap/geometry/polygons/AllSTLsToBuild.java =================================================================== --- trunk/software/host/src/org/reprap/geometry/polygons/AllSTLsToBuild.java 2011-03-25 00:54:35 UTC (rev 4070) +++ trunk/software/host/src/org/reprap/geometry/polygons/AllSTLsToBuild.java 2011-03-30 14:22:52 UTC (rev 4071) @@ -3,6 +3,7 @@ import java.util.List; import java.util.ArrayList; import org.reprap.geometry.LayerRules; +import org.reprap.geometry.polygons.PolygonAttributes; import org.reprap.gui.STLObject; import org.reprap.Attributes; import org.reprap.Extruder; @@ -802,57 +803,69 @@ Rr2Point cen2 = land2.findCentroid(); if(cen2 == null) { - Debug.e("AllSTLsToBuild.bridges(): Second land found with no centroid!"); - return result; - } - - // Wipe this land from the land pattern - - land2.offset(0.5); // Slight hack... - landPattern = BooleanGrid.difference(landPattern, land2); - - // (Roughly) what direction does the bridge go in? - - Rr2Point centroidDirection = Rr2Point.sub(cen2, cen1).norm(); - Rr2Point bridgeDirection = centroidDirection; - - // Fine the edge of the bridge that is nearest parallel to that, and use that as the fill direction - - double spMax = Double.NEGATIVE_INFINITY; - double sp; - RrPolygonList bridgeOutline = bridge.allPerimiters(bridge.attribute()); - for(int pol = 0; pol < bridgeOutline.size(); pol++) + Debug.d("AllSTLsToBuild.bridges(): Second land found with no centroid!"); + + // No second land implies a ring of support - just infill it. + + result.add(bridge.hatch(layerConditions.getHatchDirection(bridge.attribute().getExtruder()), + bridge.attribute().getExtruder().getExtrusionInfillWidth(), + bridge.attribute())); + } else { - RrPolygon polygon = bridgeOutline.polygon(i); - double tooSmall = polygon.meanEdge(); - for(int vertex1 = 0; vertex1 < polygon.size(); vertex1++) + + // Wipe this land from the land pattern + + land2.offset(0.5); // Slight hack... + landPattern = BooleanGrid.difference(landPattern, land2); + + // (Roughly) what direction does the bridge go in? + + Rr2Point centroidDirection = Rr2Point.sub(cen2, cen1).norm(); + Rr2Point bridgeDirection = centroidDirection; + + // Fine the edge of the bridge that is nearest parallel to that, and use that as the fill direction + + double spMax = Double.NEGATIVE_INFINITY; + double sp; + RrPolygonList bridgeOutline = bridge.allPerimiters(bridge.attribute()); + for(int pol = 0; pol < bridgeOutline.size(); pol++) { - int vertex2 = vertex1+1; - if(vertex2 >= polygon.size()) // We know the polygon must be closed... - vertex2 = 0; - Rr2Point edge = Rr2Point.sub(polygon.point(vertex2), polygon.point(vertex1)); - if(edge.mod() > tooSmall) + RrPolygon polygon = bridgeOutline.polygon(i); + double tooSmall = polygon.meanEdge(); + for(int vertex1 = 0; vertex1 < polygon.size(); vertex1++) { - if((sp = Math.abs(Rr2Point.mul(edge, centroidDirection))) > spMax) + int vertex2 = vertex1+1; + if(vertex2 >= polygon.size()) // We know the polygon must be closed... + vertex2 = 0; + Rr2Point edge = Rr2Point.sub(polygon.point(vertex2), polygon.point(vertex1)); + if(edge.mod() > tooSmall) { - spMax = sp; - bridgeDirection = edge; + if((sp = Math.abs(Rr2Point.mul(edge, centroidDirection))) > spMax) + { + spMax = sp; + bridgeDirection = edge; + } } } } + + // Build the bridge + + result.add(bridge.hatch(new RrHalfPlane(new Rr2Point(0,0), bridgeDirection), + bridge.attribute().getExtruder().getExtrusionInfillWidth(), + bridge.attribute())); + + // We shouldn't need to remove the bridge from the bridge patterns; no other lands should + // intersect it. } - - // Build the bridge - - result.add(bridge.hatch(new RrHalfPlane(new Rr2Point(0,0), bridgeDirection), - bridge.attribute().getExtruder().getExtrusionInfillWidth(), - bridge.attribute())); - - // We shouldn't need to remove the bridge from the bridge patterns; no other lands should - // intersect it. } } +// PolygonAttributes pa = new PolygonAttributes(); +// pa.setBridgeThin(0.5); // Test value - needs to be an extruder parameter +// for(int i = 0; i < result.size(); i++) +// result.polygon(i).setPolygonAttribute(pa); + return result; } Modified: trunk/software/host/src/org/reprap/geometry/polygons/RrPolygon.java =================================================================== --- trunk/software/host/src/org/reprap/geometry/polygons/RrPolygon.java 2011-03-25 00:54:35 UTC (rev 4070) +++ trunk/software/host/src/org/reprap/geometry/polygons/RrPolygon.java 2011-03-30 14:22:52 UTC (rev 4071) @@ -76,6 +76,7 @@ import org.reprap.Preferences; import org.reprap.Extruder; import org.reprap.geometry.LayerRules; +import org.reprap.geometry.polygons.PolygonAttributes; import org.reprap.machines.VelocityProfile; import org.reprap.utilities.Debug; @@ -109,6 +110,9 @@ */ private Attributes att = null; + + private PolygonAttributes pa = null; + /** * The minimum enclosing X-Y box round the polygon */ @@ -132,51 +136,39 @@ /** * Destroy me and all that I point to */ - public void destroy() - { - if(beingDestroyed) // Prevent infinite loop - return; - beingDestroyed = true; - - if(speeds != null) - { - for(int i = 0; i < size(); i++) - speeds.set(i, null); - } - speeds = null; - - if(points != null) - { - for(int i = 0; i < size(); i++) - { - points.get(i).destroy(); - points.set(i, null); - } - } - points = null; - - if(box != null) - box.destroy(); - box = null; - - // Don't destroy the attribute - that may still be needed - - //if(att != null) - // att.destroy(); - att = null; - beingDestroyed = false; - } - - /** - * Destroy just me - */ -// protected void finalize() throws Throwable +// public void destroy() // { +// if(beingDestroyed) // Prevent infinite loop +// return; +// beingDestroyed = true; +// +// if(speeds != null) +// { +// for(int i = 0; i < size(); i++) +// speeds.set(i, null); +// } +// speeds = null; +// +// if(points != null) +// { +// for(int i = 0; i < size(); i++) +// { +// points.get(i).destroy(); +// points.set(i, null); +// } +// } // points = null; -// speeds = null; +// +// if(box != null) +// box.destroy(); +// box = null; +// +// // Don't destroy the attribute - that may still be needed +// +// //if(att != null) +// // att.destroy(); // att = null; -// box = null; -// super.finalize(); +// beingDestroyed = false; // } @@ -194,6 +186,7 @@ closed = c; extrudeEnd = -1; valveEnd = -1; + pa = null; } /** @@ -208,6 +201,15 @@ } /** + * Get the polygon attribute (may be null) + * @return + */ + public PolygonAttributes getPolygonAttribute() + { + return pa; + } + + /** * Get the speed * @param i * @return i-th point object of polygon @@ -288,7 +290,8 @@ } /** - * Deep copy - NB: attributes _not_ deep copied + * Deep copy - NB: Attributes _not_ deep copied, but + * PolygonAttribute are. * @param p */ public RrPolygon(RrPolygon p) @@ -305,9 +308,22 @@ closed = p.closed; extrudeEnd = p.extrudeEnd; valveEnd = p.valveEnd; + if(p.pa != null) + pa = new PolygonAttributes(p.pa); + else + pa = null; } /** + * Set the polygon attribute + * @return + */ + public void setPolygonAttribute(PolygonAttributes p) + { + pa = p; + } + + /** * Add a new point to the polygon * @param p * @param f Modified: trunk/software/host/src/org/reprap/geometry/polygons/RrPolygonList.java =================================================================== --- trunk/software/host/src/org/reprap/geometry/polygons/RrPolygonList.java 2011-03-25 00:54:35 UTC (rev 4070) +++ trunk/software/host/src/org/reprap/geometry/polygons/RrPolygonList.java 2011-03-30 14:22:52 UTC (rev 4071) @@ -455,39 +455,31 @@ */ private boolean beingDestroyed = false; - /** - * Destroy me and all that I point to - */ - public void destroy() - { - if(beingDestroyed) // Prevent infinite loop - return; - beingDestroyed = true; - if(polygons != null) - { - for(int i = 0; i < size(); i++) - { - polygons.get(i).destroy(); - polygons.set(i,null); - } - polygons = null; - } - if(box != null) - box.destroy(); - box = null; - beingDestroyed = false; - } - - /** - * Destroy just me - */ -// protected void finalize() throws Throwable +// /** +// * Destroy me and all that I point to +// */ +// public void destroy() // { -// polygons = null; +// if(beingDestroyed) // Prevent infinite loop +// return; +// beingDestroyed = true; +// if(polygons != null) +// { +// for(int i = 0; i < size(); i++) +// { +// polygons.get(i).destroy(); +// polygons.set(i,null); +// } +// polygons = null; +// } +// if(box != null) +// box.destroy(); // box = null; -// super.finalize(); +// beingDestroyed = false; // } + + /** * Empty constructor */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <adr...@us...> - 2011-05-11 10:08:00
|
Revision: 4128 http://reprap.svn.sourceforge.net/reprap/?rev=4128&view=rev Author: adrian-bowyer Date: 2011-05-11 10:07:53 +0000 (Wed, 11 May 2011) Log Message: ----------- Implementation of Rhys's idea to join up polygons whose ends nearly match (within 2*filament-thickness). It also joins closed polygons which have any pair of points closer too. Tested, but experimental. Probably works best if you turn Middle Starts off for all extruders. Modified Paths: -------------- trunk/software/host/src/org/reprap/geometry/Producer.java trunk/software/host/src/org/reprap/geometry/polygons/RrPolygon.java trunk/software/host/src/org/reprap/geometry/polygons/RrPolygonList.java trunk/software/host/src/org/reprap/machines/GCodeRepRap.java Modified: trunk/software/host/src/org/reprap/geometry/Producer.java =================================================================== --- trunk/software/host/src/org/reprap/geometry/Producer.java 2011-05-09 08:46:20 UTC (rev 4127) +++ trunk/software/host/src/org/reprap/geometry/Producer.java 2011-05-11 10:07:53 UTC (rev 4128) @@ -265,6 +265,7 @@ } RrPolygonList allPolygons[] = new RrPolygonList[totalPhysicalExtruders]; + RrPolygonList tempPolygons[] = new RrPolygonList[totalPhysicalExtruders]; boolean firstTimeRound = true; @@ -300,7 +301,9 @@ fills = fills.cullShorts(); shield = false; RrPolygonList support = allSTLs.computeSupport(stl, layerRules); - borders = borders.nearEnds(startNearHere, false, -1); + /* + borders = borders.nearEnds(startNearHere, false, -1); + if(borders.size() > 0) { RrPolygon last = borders.polygon(borders.size() - 1); @@ -318,24 +321,43 @@ RrPolygon last = support.polygon(support.size() - 1); startNearHere = last.point(last.size() - 1); } + */ + for(int physicalExtruder = 0; physicalExtruder < allPolygons.length; physicalExtruder++) + tempPolygons[physicalExtruder] = new RrPolygonList(); for(int pol = 0; pol < borders.size(); pol++) { //shield = false; RrPolygon p = borders.polygon(pol); - allPolygons[p.getAttributes().getExtruder().getPhysicalExtruderNumber()].add(p); + tempPolygons[p.getAttributes().getExtruder().getPhysicalExtruderNumber()].add(p); } for(int pol = 0; pol < fills.size(); pol++) { //shield = false; RrPolygon p = fills.polygon(pol); - allPolygons[p.getAttributes().getExtruder().getPhysicalExtruderNumber()].add(p); + tempPolygons[p.getAttributes().getExtruder().getPhysicalExtruderNumber()].add(p); } for(int pol = 0; pol < support.size(); pol++) { //shield = false; RrPolygon p = support.polygon(pol); - allPolygons[p.getAttributes().getExtruder().getPhysicalExtruderNumber()].add(p); + tempPolygons[p.getAttributes().getExtruder().getPhysicalExtruderNumber()].add(p); } + for(int physicalExtruder = 0; physicalExtruder < allPolygons.length; physicalExtruder++) + { + if(tempPolygons[physicalExtruder].size() > 0) + { + double linkUp = tempPolygons[physicalExtruder].polygon(0).getAttributes().getExtruder().getExtrusionSize(); + linkUp = (4*linkUp*linkUp); + tempPolygons[physicalExtruder].radicalReOrder(linkUp); + tempPolygons[physicalExtruder] = tempPolygons[physicalExtruder].nearEnds(startNearHere, false, -1); + if(tempPolygons[physicalExtruder].size() > 0) + { + RrPolygon last = tempPolygons[physicalExtruder].polygon(tempPolygons[physicalExtruder].size() - 1); + startNearHere = last.point(last.size() - 1); + } + allPolygons[physicalExtruder].add(tempPolygons[physicalExtruder]); + } + } } Modified: trunk/software/host/src/org/reprap/geometry/polygons/RrPolygon.java =================================================================== --- trunk/software/host/src/org/reprap/geometry/polygons/RrPolygon.java 2011-05-09 08:46:20 UTC (rev 4127) +++ trunk/software/host/src/org/reprap/geometry/polygons/RrPolygon.java 2011-05-11 10:07:53 UTC (rev 4128) @@ -129,49 +129,23 @@ private int extrudeEnd; /** + * The squared distance from the end of the polygon of the extrude end + */ + private double extrudeEndDistance2; + + /** * The index of the last point at which the valve (if any) is open. */ private int valveEnd; /** - * Destroy me and all that I point to + * The squared distance from the end of the polygon of the valve end */ -// public void destroy() -// { -// if(beingDestroyed) // Prevent infinite loop -// return; -// beingDestroyed = true; -// -// if(speeds != null) -// { -// for(int i = 0; i < size(); i++) -// speeds.set(i, null); -// } -// speeds = null; -// -// if(points != null) -// { -// for(int i = 0; i < size(); i++) -// { -// points.get(i).destroy(); -// points.set(i, null); -// } -// } -// points = null; -// -// if(box != null) -// box.destroy(); -// box = null; -// -// // Don't destroy the attribute - that may still be needed -// -// //if(att != null) -// // att.destroy(); -// att = null; -// beingDestroyed = false; -// } + private double valveEndDistance2; + + /** * Make an empty polygon */ @@ -186,10 +160,28 @@ closed = c; extrudeEnd = -1; valveEnd = -1; + extrudeEndDistance2 = 0; + valveEndDistance2 = 0; pa = null; } /** + * Set the polygon as closed + */ + public void setClosed() + { + closed = true; + } + + /** + * Set the polygon not closed + */ + public void setOpen() + { + closed = false; + } + + /** * Get the data * @param i * @return i-th point object of polygon @@ -257,6 +249,31 @@ } /** + * Something has been done to the polygon that may require its + * extrude and valve endings to be updated + */ + private void updateExtrudeValveEnd() + { + if(extrudeEnd >= 0) + { + if(extrudeEndDistance2 <= 0) + { + extrudeEnd = -1; + extrudeEndDistance2 = 0; + return; + } + double d2 = 0; + System.out.println("Updating e..."); + } + if(valveEnd >= 0) + { + System.out.println("Updating v..."); + } + // if speeds are set, interpolate + } + + + /** * What's the last point to plot to? * @return */ @@ -308,6 +325,8 @@ closed = p.closed; extrudeEnd = p.extrudeEnd; valveEnd = p.valveEnd; + extrudeEndDistance2 = p.extrudeEndDistance2; + valveEndDistance2 = p.valveEndDistance2; if(p.pa != null) pa = new PolygonAttributes(p.pa); else @@ -334,6 +353,7 @@ Debug.e("Rr2Point.add(): adding a point to a polygon with its speeds set."); points.add(new Rr2Point(p)); box.expand(p); + updateExtrudeValveEnd(); } /** @@ -345,12 +365,20 @@ { if(speeds != null) Debug.e("Rr2Point.add(): adding a point to a polygon with its speeds set."); + points.add(i, new Rr2Point(p)); box.expand(p); + boolean update = false; if(i <= extrudeEnd) extrudeEnd++; + else + update = true; if(i <= valveEnd) valveEnd++; + else + update = true; + if(update) + updateExtrudeValveEnd(); } /** @@ -364,6 +392,7 @@ Debug.e("Rr2Point.set(): adding a point to a polygon with its speeds set."); points.set(i, new Rr2Point(p)); box.expand(p); // Note if the old point was on the convex hull, and the new one is within, box will be too big after this + updateExtrudeValveEnd(); } /** @@ -375,14 +404,24 @@ public void add(int i, Rr2Point p, double s) { if(speeds == null) + { Debug.e("Rr2Point.add(): adding a point and a speed to a polygon without its speeds set."); + return; + } points.add(i, new Rr2Point(p)); speeds.add(i, s); box.expand(p); + boolean update = false; if(i <= extrudeEnd) extrudeEnd++; + else + update = true; if(i <= valveEnd) valveEnd++; + else + update = true; + if(update) + updateExtrudeValveEnd(); } /** @@ -398,6 +437,7 @@ points.set(i, new Rr2Point(p)); speeds.set(i, s); box.expand(p); // Note if the old point was on the convex hull, and the new one is within, box will be too big after this + updateExtrudeValveEnd(); } /** @@ -421,18 +461,20 @@ * Eet the last point to plot to * @param d */ - public void setExtrudeEnd(int d) + public void setExtrudeEnd(int d, double d2) { extrudeEnd = d; + extrudeEndDistance2 = d2; } /** * Eet the last point to valve-open to * @param d */ - public void setValveEnd(int d) + public void setValveEnd(int d, double d2) { valveEnd = d; + valveEndDistance2 = d2; } /** @@ -471,13 +513,8 @@ if(extrudeEnd >= 0 || valveEnd >= 0) Debug.e("Rr2Point.add(): adding a polygon to another polygon with its extrude or valve ending set."); for(int i = 0; i < p.size(); i++) - { - if(i == p.extrudeEnd) - extrudeEnd = size(); - if(i == p.valveEnd) - valveEnd = size(); points.add(new Rr2Point(p.point(i))); - } + box.expand(p.box); if(speeds == null) { @@ -494,6 +531,7 @@ { speeds.add(new Double(p.speed(i))); } + updateExtrudeValveEnd(); } /** @@ -511,30 +549,17 @@ { Debug.e("Rr2Point.add(): attempt to add a polygon to another polygon when one has speeds and the other doesn't."); return; - } - if(k <= extrudeEnd || k <= valveEnd) - Debug.e("Rr2Point.add(): adding a polygon to another polygon with its extrude or valve ending set."); - int de = -1; - int dv = -1; - if (extrudeEnd >= 0) - de = extrudeEnd + p.size(); - if (valveEnd >= 0) - dv = valveEnd + p.size(); + } for(int i = 0; i < p.size(); i++) { - if(i == p.extrudeEnd) - extrudeEnd = size(); - if(i == p.valveEnd) - valveEnd = size(); if(speeds != null) add(k, new Rr2Point(p.point(i)), p.speed(i)); else points.add(k, new Rr2Point(p.point(i))); k++; } - extrudeEnd = Math.max(extrudeEnd, de); - valveEnd = Math.max(valveEnd, dv); box.expand(p.box); + updateExtrudeValveEnd(); } /** @@ -585,8 +610,6 @@ */ public RrPolygon negate() { - if(extrudeEnd >= 0 || valveEnd >= 0) - Debug.e("Rr2Point.negate(): negating a polygon with its extrude or valve ending set."); RrPolygon result = new RrPolygon(att, closed); for(int i = size() - 1; i >= 0; i--) { @@ -598,6 +621,9 @@ { result.setSpeed(i, speed(i)); } + result.setExtrudeEnd(extrudeEnd, extrudeEndDistance2); + result.setValveEnd(valveEnd, valveEndDistance2); + result.updateExtrudeValveEnd(); return result; } @@ -606,8 +632,6 @@ */ public RrPolygon randomStart() { - if(extrudeEnd >= 0 || valveEnd >= 0) - Debug.e("Rr2Point.randomStart(: randomizing a polygon with its extrude or valve ending set."); return newStart(rangen.nextInt(size())); } @@ -618,8 +642,7 @@ { if(!isClosed()) Debug.e("RrPolygon.newStart(i): reordering an open polygon!"); - if(extrudeEnd >= 0 || valveEnd >= 0) - Debug.e("Rr2Point.newStart(i): reordering a polygon with its extrude or valve ending set."); + if(i < 0 || i >= size()) { Debug.e("RrPolygon.newStart(i): dud index: " + i); @@ -635,7 +658,9 @@ if(i >= size()) i = 0; } - + result.setExtrudeEnd(extrudeEnd, extrudeEndDistance2); + result.setValveEnd(valveEnd, valveEndDistance2); + result.updateExtrudeValveEnd(); return result; } @@ -646,8 +671,6 @@ { if(size() == 0 || lc.getModelLayer() < 0) return this; - if(extrudeEnd >= 0 || valveEnd >= 0) - Debug.e("Rr2Point.incrementedStart(): incrementing a polygon with its extrude or valve ending set."); int i = lc.getModelLayer() % size(); return newStart(i); } @@ -690,8 +713,7 @@ { if(!p.isClosed()) Debug.e("RrPolygon.nearestVertexReorder(): called for non-closed polygon."); - if(extrudeEnd >= 0 || p.extrudeEnd >= 0 || valveEnd >= 0 || p.valveEnd >= 0) - Debug.e("Rr2Point.nearestVertexReorderMerge(): merging polygons with a extrude or valve ending set."); + double d = Double.POSITIVE_INFINITY; int myPoint = -1; int itsPoint = -1; @@ -711,6 +733,7 @@ RrPolygon ro = p.newStart(itsPoint); ro.add(0, point(myPoint)); add(myPoint, ro); + updateExtrudeValveEnd(); return true; } else return false; @@ -809,7 +832,7 @@ /** * Backtrack a given distance, inserting a new point there and set extrudeEnd to it. - * If drawEnd is already set, backtrack from that. + * If extrudeEnd is already set, backtrack from that. * @param distance to backtrack * @return index of the inserted point */ @@ -822,9 +845,15 @@ int start, last; if(extrudeEnd >= 0) + { start = extrudeEnd; - else - start = size() - 1; + extrudeEndDistance2 = Math.sqrt(extrudeEndDistance2) + d; + extrudeEndDistance2 *= extrudeEndDistance2; + } else + { + start = size() - 1; + extrudeEndDistance2 = d*d; + } if(!isClosed() && extrudeEnd < 0) start--; @@ -872,7 +901,7 @@ /** * Backtrack a given distance, inserting a new point there and set valveEnd to it. - * If drawEnd is already set, backtrack from that. + * If valveEnd is already set, backtrack from that. * @param distance to backtrack * @return index of the inserted point */ @@ -885,9 +914,15 @@ int start, last; if(valveEnd >= 0) + { start = valveEnd; - else - start = size() - 1; + valveEndDistance2 = Math.sqrt(valveEndDistance2) + d; + valveEndDistance2 *= valveEndDistance2; + } else + { + start = size() - 1; + valveEndDistance2 = d*d; + } if(!isClosed() && valveEnd < 0) start--; Modified: trunk/software/host/src/org/reprap/geometry/polygons/RrPolygonList.java =================================================================== --- trunk/software/host/src/org/reprap/geometry/polygons/RrPolygonList.java 2011-05-09 08:46:20 UTC (rev 4127) +++ trunk/software/host/src/org/reprap/geometry/polygons/RrPolygonList.java 2011-05-11 10:07:53 UTC (rev 4128) @@ -703,7 +703,7 @@ * This is a heuristic - it does not do a full travelling salesman... * This deals with both open and closed polygons, but it only allows closed ones to * be re-ordered if reOrder is true. If any point on a closed polygon is closer to - * any point on any other than linkUp, the two polygons are merged at their closest + * any point on any other than sqrt(linkUp), the two polygons are merged at their closest * points. This is suppressed by setting linkUp negative. * * @param startNearHere @@ -841,6 +841,174 @@ } /** + * Take all the polygons in a list, both open and closed, and reorder them such that + * accessible points on any that have a squared distance less than linkUp to accessible + * points on any others are joined to form single polygons. + * + * For an open polygon the accessible points are just its ends. For a closed polygon + * all its points are accessible. + * + * This is a fairly radical remove in-air movement strategy. + * + * All the polygons in the list must be plotted with the same physical extruder (otherwise + * it would be nonsense to join them). It is the calling function's responsibility to + * make sure this is the case. + * + * @param linkUp + */ + public void radicalReOrder(double linkUp) + { + if(size() < 2) + return; + + // First check that we all have the same physical extruder + + int physicalExtruder = polygon(0).getAttributes().getExtruder().getPhysicalExtruderNumber(); + for(int i = 1; i < size(); i++) + if(polygon(i).getAttributes().getExtruder().getPhysicalExtruderNumber() != physicalExtruder) + { + Debug.e("RrPolygonList.radicalReOrder(): more than one physical extruder needed by the list!"); + return; + } + + // Now go through the polygons pairwise + + for(int i = 0; i < size() - 1; i++) + { + RrPolygon myPolygon = polygon(i); + for(int j = i+1; j < size(); j++) + { + double d = Double.POSITIVE_INFINITY; + double d2; + int myPoint = -1; + int itsPoint = -1; + int myTempPoint, itsTempPoint; + boolean reverseMe, reverseIt; + RrPolygon itsPolygon = polygon(j); + + // Swap the odd half of the asymmetric cases so they're all the same + + if(!myPolygon.isClosed() && itsPolygon.isClosed()) + { + polygons.set(i, itsPolygon); + polygons.set(j, myPolygon); + myPolygon = polygon(i); + itsPolygon = polygon(j); + } + + // Three possibilities ... + + if(!myPolygon.isClosed() && !itsPolygon.isClosed()) + { + // ... both open + // Just compare the four ends + + reverseMe = true; + reverseIt = false; + d = Rr2Point.dSquared(myPolygon.point(0), itsPolygon.point(0)); + + d2 = Rr2Point.dSquared(myPolygon.point(myPolygon.size() - 1), itsPolygon.point(0)); + if(d2 < d) + { + reverseMe = false; + reverseIt = false; + d = d2; + } + + d2 = Rr2Point.dSquared(myPolygon.point(0), itsPolygon.point(itsPolygon.size() - 1)); + if(d2 < d) + { + reverseMe = true; + reverseIt = true; + d = d2; + } + + d2 = Rr2Point.dSquared(myPolygon.point(myPolygon.size() - 1), itsPolygon.point(itsPolygon.size() - 1)); + if(d2 < d) + { + reverseMe = false; + reverseIt = true; + d = d2; + } + + if(d < linkUp) + { + if(reverseMe) + myPolygon = myPolygon.negate(); + if(reverseIt) + itsPolygon = itsPolygon.negate(); + myPolygon.add(itsPolygon); + polygons.set(i, myPolygon); + polygons.remove(j); + } + + } else if(myPolygon.isClosed() && !itsPolygon.isClosed()) + { + // ... I'm closed; it's open + // Compare all my points with its two ends + + reverseIt = false; + myPoint = myPolygon.nearestVertex(itsPolygon.point(0)); + d = Rr2Point.dSquared(myPolygon.point(myPoint), itsPolygon.point(0)); + myTempPoint = myPolygon.nearestVertex(itsPolygon.point(itsPolygon.size() - 1)); + d2 = Rr2Point.dSquared(myPolygon.point(myTempPoint), itsPolygon.point(itsPolygon.size() -1 )); + if(d2 < d) + { + myPoint = myTempPoint; + reverseIt = true; + d = d2; + } + + if(d < linkUp) + { + myPolygon = myPolygon.newStart(myPoint); + myPolygon.add(myPolygon.point(0)); // Make sure the first half really is closed + if(reverseIt) + itsPolygon = itsPolygon.negate(); + myPolygon.add(itsPolygon); + myPolygon.setOpen(); // We were closed, but we must now be open + polygons.set(i, myPolygon); + polygons.remove(j); + } + + } else if(myPolygon.isClosed() && itsPolygon.isClosed()) + { + // ... both closed + // Compare all my points with all its points + + for(int k = 0; k < itsPolygon.size(); k++) + { + myTempPoint = myPolygon.nearestVertex(itsPolygon.point(k)); + d2 = Rr2Point.dSquared(myPolygon.point(myTempPoint), itsPolygon.point(k)); + if(d2 < d) + { + myPoint = myTempPoint; + itsPoint = k; + d = d2; + } + } + + if(d < linkUp) + { + myPolygon = myPolygon.newStart(myPoint); + myPolygon.add(myPolygon.point(0)); // Make sure we come back to the start + itsPolygon = itsPolygon.newStart(itsPoint); + myPolygon.add(itsPolygon); + myPolygon.setOpen(); // We were closed, but we must now be open + polygons.set(i, myPolygon); + polygons.remove(j); + } + + } else + { + // ... Horrible impossibility + Debug.e("RrPolygonList.radicalReOrder(): Polygons are neither closed nor open!"); + } + } + } + } + + /** * Remove polygon pol from the list, replacing it with two polygons, the * first being pol's vertices from 0 to st inclusive, and the second being * pol's vertices from en to its end inclusive. It is permissible for @@ -884,11 +1052,13 @@ * Search a polygon list to find the nearest point on all the polygons within it * to the point p. If omit is non-negative, ignore that polygon in the search. * + * Only polygons with the same physical extruder are compared. + * * @param p * @param omit * @return */ - private PolPoint ppSearch(Rr2Point p, int omit) + private PolPoint ppSearch(Rr2Point p, int omit, int physicalExtruder) { double d = Double.POSITIVE_INFINITY; PolPoint result = null; @@ -901,28 +1071,31 @@ if(i != omit) { RrPolygon pgon = polygon(i); - int n = pgon.nearestVertex(p); - double d2 = Rr2Point.dSquared(p, pgon.point(n)); - if(d2 < d) + if(physicalExtruder == pgon.getAttributes().getExtruder().getPhysicalExtruderNumber()) { - if(result == null) - result = new PolPoint(n, i, pgon, d2); - else - result.set(n, i, pgon, d2); - d = d2; + int n = pgon.nearestVertex(p); + double d2 = Rr2Point.dSquared(p, pgon.point(n)); + if(d2 < d) + { + if(result == null) + result = new PolPoint(n, i, pgon, d2); + else + result.set(n, i, pgon, d2); + d = d2; + } } } } if(result == null) - Debug.e("RrPolygonList.ppSearch(): no point found!"); + Debug.d("RrPolygonList.ppSearch(): no point found!"); return result; } /** - * This assumes that the RrPolygonList for which it is called is all the outline + * This assumes that the RrPolygonList for which it is called is all the closed outline * polygons, and that hatching is their infill hatch. It goes through the outlines * and the hatch modifying both so that that outlines actually start and end half-way * along a hatch line (that half of the hatch line being deleted). When the outlines @@ -931,6 +1104,8 @@ * The outline polygons are re-ordered before the start so that their first point is * the most extreme one in the current hatch direction. * + * Only hatches and outlines whose physical extruders match are altered. + * * @param hatching * @param lc */ @@ -948,7 +1123,7 @@ outline = outline.newStart(outline.maximalVertex(l)); Rr2Point start = outline.point(0); - PolPoint pp = hatching.ppSearch(start, -1); + PolPoint pp = hatching.ppSearch(start, -1, outline.getAttributes().getExtruder().getPhysicalExtruderNumber()); boolean failed = true; if(pp != null) { @@ -972,7 +1147,7 @@ if(slice.membership(pq1) & slice.membership(pq2) & slice.membership(pq3)) { outline.add(start); - outline.setExtrudeEnd(outline.size() - 1); + outline.setExtrudeEnd(-1, 0); if(en >= st) { Modified: trunk/software/host/src/org/reprap/machines/GCodeRepRap.java =================================================================== --- trunk/software/host/src/org/reprap/machines/GCodeRepRap.java 2011-05-09 08:46:20 UTC (rev 4127) +++ trunk/software/host/src/org/reprap/machines/GCodeRepRap.java 2011-05-11 10:07:53 UTC (rev 4128) @@ -95,7 +95,7 @@ if(xyFeedrate < feedrate) { - Debug.e("GCodeRepRap().qXYMove: feedrate (" + feedrate + ") exceeds maximum (" + xyFeedrate + ")."); + Debug.d("GCodeRepRap().qXYMove: feedrate (" + feedrate + ") exceeds maximum (" + xyFeedrate + ")."); feedrate = xyFeedrate; } @@ -150,7 +150,7 @@ if(zFeedrate < feedrate) { - Debug.e("GCodeRepRap().qZMove: feedrate (" + feedrate + ") exceeds maximum (" + zFeedrate + ")."); + Debug.d("GCodeRepRap().qZMove: feedrate (" + feedrate + ") exceeds maximum (" + zFeedrate + ")."); feedrate = zFeedrate; } @@ -218,7 +218,7 @@ boolean xyMove = dx!= 0 || dy != 0; if(zMove && xyMove) - Debug.e("GcodeRepRap.moveTo(): attempt to move in X|Y and Z simultaneously: (x, y, z) = (" + x + ", " + y + ", " + z + ")"); + Debug.d("GcodeRepRap.moveTo(): attempt to move in X|Y and Z simultaneously: (x, y, z) = (" + x + ", " + y + ", " + z + ")"); double zFeedrate = round(getMaxFeedrateZ(), 1); @@ -232,12 +232,20 @@ qFeedrate(feedrate); } - if(xyMove) - qXYMove(x, y, feedrate); + if(dz > 0) + { + if(zMove) + qZMove(z, feedrate); + if(xyMove) + qXYMove(x, y, feedrate); + } else + { + if(xyMove) + qXYMove(x, y, feedrate); + if(zMove) + qZMove(z, feedrate); + } - if(zMove) - qZMove(z, feedrate); - if(endUp && !startUp) { qZMove(liftedZ, zFeedrate); @@ -273,7 +281,7 @@ boolean xyMove = dx != 0 || dy != 0; if(zMove && xyMove) - Debug.e("GcodeRepRap.singleMove(): attempt to move in X|Y and Z simultaneously: (x, y, z) = (" + x + ", " + y + ", " + z + ")"); + Debug.d("GcodeRepRap.singleMove(): attempt to move in X|Y and Z simultaneously: (x, y, z) = (" + x + ", " + y + ", " + z + ")"); try { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |