From: <adr...@us...> - 2010-09-05 20:07:39
|
Revision: 3771 http://reprap.svn.sourceforge.net/reprap/?rev=3771&view=rev Author: adrian-bowyer Date: 2010-09-05 20:07:33 +0000 (Sun, 05 Sep 2010) Log Message: ----------- More or less working version of the PCB code. Modified Paths: -------------- trunk/software/host/lib/reprap.properties.dist trunk/software/host/src/org/reprap/machines/GCodeRepRap.java trunk/software/host/src/org/reprap/pcb/GerberGCode.java trunk/software/host/src/org/reprap/pcb/PCB.java Modified: trunk/software/host/lib/reprap.properties.dist =================================================================== --- trunk/software/host/lib/reprap.properties.dist 2010-09-04 17:16:32 UTC (rev 3770) +++ trunk/software/host/lib/reprap.properties.dist 2010-09-05 20:07:33 UTC (rev 3771) @@ -1,5 +1,5 @@ -#Fri Jul 16 23:46:58 BST 2010 #RepRap machine parameters. See http://objects.reprap.org/wiki/Java_Software_Preferences_File +#Sun Sep 05 18:13:28 BST 2010 AxisCount=3 BackColourB(0..1)=0.9 BackColourG(0..1)=0.9 @@ -37,13 +37,14 @@ Extruder0_ExtrusionPWM(0..1)=-1 Extruder0_ExtrusionSize(mm)=0.7 Extruder0_ExtrusionSpeed(mm/minute)=3000 -Extruder0_ExtrusionTemp(C)=190 +Extruder0_ExtrusionTemp(C)=205 Extruder0_FastEFeedrate(mm/minute)=18000.0 Extruder0_FastXYFeedrate(mm/minute)=3000.0 Extruder0_InFillMaterialType(name)=PLA-infill Extruder0_IncrementedStart=false Extruder0_InfillOverlap(mm)=0.2 Extruder0_InfillSpeed(0..1)=1 +Extruder0_Lift(mm)=0 Extruder0_LowerFineLayers(0...)=2 Extruder0_MaterialType(name)=PLA Extruder0_MaxAcceleration(mm/minute/minute)=1200000.0 @@ -107,13 +108,14 @@ Extruder1_ExtrusionPWM(0..1)=-1 Extruder1_ExtrusionSize(mm)=0.7 Extruder1_ExtrusionSpeed(mm/minute)=3000 -Extruder1_ExtrusionTemp(C)=190 +Extruder1_ExtrusionTemp(C)=205 Extruder1_FastEFeedrate(mm/minute)=18000.0 Extruder1_FastXYFeedrate(mm/minute)=3000.0 Extruder1_InFillMaterialType(name)=PLA-support Extruder1_IncrementedStart=false Extruder1_InfillOverlap(mm)=0 Extruder1_InfillSpeed(0..1)=1 +Extruder1_Lift(mm)=0 Extruder1_LowerFineLayers(0...)=0 Extruder1_MaterialType(name)=PLA-support Extruder1_MaxAcceleration(mm/minute/minute)=1200000.0 @@ -177,13 +179,14 @@ Extruder2_ExtrusionPWM(0..1)=-1 Extruder2_ExtrusionSize(mm)=0.7 Extruder2_ExtrusionSpeed(mm/minute)=3000 -Extruder2_ExtrusionTemp(C)=190 +Extruder2_ExtrusionTemp(C)=205 Extruder2_FastEFeedrate(mm/minute)=18000.0 Extruder2_FastXYFeedrate(mm/minute)=3000.0 Extruder2_InFillMaterialType(name)=PLA-infill Extruder2_IncrementedStart=false Extruder2_InfillOverlap(mm)=0.2 Extruder2_InfillSpeed(0..1)=1 +Extruder2_Lift(mm)=0 Extruder2_LowerFineLayers(0...)=0 Extruder2_MaterialType(name)=PLA-infill Extruder2_MaxAcceleration(mm/minute/minute)=1200000.0 @@ -231,8 +234,8 @@ Extruder3_ArcShortSides(0..)=1 Extruder3_Beta(K)=550.0 Extruder3_Capacitor(F)=0.000003 -Extruder3_ColourB(0..1)=0.5 -Extruder3_ColourG(0..1)=0.5 +Extruder3_ColourB(0..1)=0.3 +Extruder3_ColourG(0..1)=0.3 Extruder3_ColourR(0..1)=0.3 Extruder3_CoolingPeriod(s)=0.1 Extruder3_EvenHatchDirection(degrees)=45 @@ -246,7 +249,7 @@ Extruder3_ExtrusionLastFoundationWidth(mm)=2 Extruder3_ExtrusionOverRun(mm)=0 Extruder3_ExtrusionPWM(0..1)=-1 -Extruder3_ExtrusionSize(mm)=0.7 +Extruder3_ExtrusionSize(mm)=0.3 Extruder3_ExtrusionSpeed(mm/minute)=3000 Extruder3_ExtrusionTemp(C)=0 Extruder3_FastEFeedrate(mm/minute)=8000.0 @@ -255,12 +258,13 @@ Extruder3_IncrementedStart=false Extruder3_InfillOverlap(mm)=0.2 Extruder3_InfillSpeed(0..1)=1 +Extruder3_Lift(mm)=1 Extruder3_LowerFineLayers(0...)=0 -Extruder3_MaterialType(name)=Paste +Extruder3_MaterialType(name)=PCB-pen Extruder3_MaxAcceleration(mm/minute/minute)=1200000.0 Extruder3_MaxSpeed(0..255)=255 +Extruder3_MiddleStart=true Extruder3_MinimumZClearance(mm)=-1 -Extruder3_MiddleStart=true Extruder3_NozzleClearTime(s)=10 Extruder3_NozzleWaitTime(s)=0 Extruder3_NozzleWipeDatumX(mm)=22.4 @@ -301,7 +305,7 @@ FiveD=true FoundationLayers=0 FrontFactor=0.001 -GCodeUseSerial=false +GCodeUseSerial=true IdleZAxis=true InterLayerCooling=true MachineColourB(0..1)=0.3 @@ -315,7 +319,7 @@ MouseTranslationFactor=50 MouseZoomFactor=50 MovementSpeedZ(0..255)=240 -NumberOfExtruders=3 +NumberOfExtruders=4 PathOptimise=true Port(name)=/dev/ttyUSB0 RadiusFactor=0.7 Modified: trunk/software/host/src/org/reprap/machines/GCodeRepRap.java =================================================================== --- trunk/software/host/src/org/reprap/machines/GCodeRepRap.java 2010-09-04 17:16:32 UTC (rev 3770) +++ trunk/software/host/src/org/reprap/machines/GCodeRepRap.java 2010-09-05 20:07:33 UTC (rev 3771) @@ -657,7 +657,7 @@ super.homeToZeroZ(); } - public double round(double c, double d) + public static double round(double c, double d) { double power = Math.pow(10.0, d); Modified: trunk/software/host/src/org/reprap/pcb/GerberGCode.java =================================================================== --- trunk/software/host/src/org/reprap/pcb/GerberGCode.java 2010-09-04 17:16:32 UTC (rev 3770) +++ trunk/software/host/src/org/reprap/pcb/GerberGCode.java 2010-09-05 20:07:33 UTC (rev 3771) @@ -128,6 +128,7 @@ if(pcb == null) return result; pcb.homogeneous(result.sw(), result.ne(), colour); + lastCoords = new Rr2Point(fixCoords(c)); return result; } @@ -137,6 +138,7 @@ if(pcb == null) return result; pcb.disc(c, curAperture.width*0.5, colour); + lastCoords = new Rr2Point(fixCoords(c)); //octagon(fixCoords(c), curAperture.width); return result; } @@ -230,7 +232,7 @@ { if(Preferences.loadGlobalBool("DisplaySimulation")) { - RrGraphics simulationPlot1 = new RrGraphics("PCB pattern"); + RrGraphics simulationPlot1 = new RrGraphics("PCB from gerber"); // if(currentPolygon != null) // thePattern.add(new RrPolygon(currentPolygon)); simulationPlot1.init(pcb.box(), false, 0); Modified: trunk/software/host/src/org/reprap/pcb/PCB.java =================================================================== --- trunk/software/host/src/org/reprap/pcb/PCB.java 2010-09-04 17:16:32 UTC (rev 3770) +++ trunk/software/host/src/org/reprap/pcb/PCB.java 2010-09-05 20:07:33 UTC (rev 3771) @@ -15,6 +15,7 @@ import org.reprap.Preferences; import org.reprap.geometry.polygons.*; import org.reprap.utilities.RrGraphics; +import org.reprap.utilities.Debug; import org.reprap.comms.GCodeReaderAndWriter; //import java.io.IOException; @@ -23,7 +24,6 @@ GerberGCode gerberGcode; String[] splitline; - boolean debug = false; RrRectangle bigBox; BufferedReader in; String line; @@ -54,14 +54,14 @@ outputGCodes = og; pcbPen = pp; penWidth = pcbPen.getExtrusionSize(); - System.out.println("Gerber RS274X to GCoder Converter for RepRap\n"); + Debug.d("Gerber RS274X to GCoder Converter for RepRap\n"); - System.out.println("Input: " + inputTracksAndPads.getName()); - System.out.println("Output: " + outputGCodes.getName()+"\n"); - System.out.println("Pen Width: " + penWidth + " mm"); - System.out.println("Offset X: " + offsetX + " mm"); - System.out.println("Offset Y: " + offsetY + " mm"); + 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(); @@ -73,7 +73,7 @@ { if(Preferences.loadGlobalBool("DisplaySimulation")) { - RrGraphics simulationPlot2 = new RrGraphics("PCB plotlines"); + RrGraphics simulationPlot2 = new RrGraphics("PCB pen plotlines"); // if(currentPolygon != null) // thePattern.add(new RrPolygon(currentPolygon)); simulationPlot2.init(penPaths.getBox(), false, 0); @@ -86,15 +86,18 @@ writeGCodes(); - System.out.println("GCode file generated succesfully !"); + Debug.d("GCode file generated succesfully !"); } private void raisePen() { + double zf = org.reprap.machines.GCodeRepRap.round(zFeedRate, 1); + double zu = org.reprap.machines.GCodeRepRap.round(pcbPen.getLift(), 1); + double xyf = org.reprap.machines.GCodeRepRap.round(pcbPen.getSlowXYFeedrate(), 1); try { - gcode.queue("G1 F" + zFeedRate + "; Z feedrate"); - gcode.queue("G1 Z" + pcbPen.getLift() + "; Z clearance height"); - gcode.queue("G1 F" + pcbPen.getSlowXYFeedrate() + "; XY feedrate"); + gcode.queue("G1 F" + zf + "; Z feedrate"); + gcode.queue("G1 Z" + zu + "; Z clearance height"); + gcode.queue("G1 F" + xyf + "; XY feedrate"); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); @@ -103,10 +106,13 @@ private void lowerPen() { + double zf = org.reprap.machines.GCodeRepRap.round(zFeedRate, 1); + double zd = org.reprap.machines.GCodeRepRap.round(zDown, 1); + double xyf = org.reprap.machines.GCodeRepRap.round(pcbPen.getSlowXYFeedrate(), 1); try { - gcode.queue("G1 F" + zFeedRate + "; Z feedrate"); - gcode.queue("G1 Z" + zDown + "; Z drawing height"); - gcode.queue("G1 F" + pcbPen.getSlowXYFeedrate() + "; XY feedrate"); + gcode.queue("G1 F" + zf + "; Z feedrate"); + gcode.queue("G1 Z" + zd + "; Z drawing height"); + gcode.queue("G1 F" + xyf + "; XY feedrate"); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); @@ -158,12 +164,22 @@ { if(p.size() <= 0) return; - try { - gcode.queue("G1 X" + p.point(0).x() + " Y" + p.point(0).y() + "; move to polygon start"); + double x, y; + try + { + x = org.reprap.machines.GCodeRepRap.round(p.point(0).x(), 1); + y = org.reprap.machines.GCodeRepRap.round(p.point(0).y(), 1); + gcode.queue("G1 X" + x + " Y" + y + "; move to polygon start"); lowerPen(); for(int i = 1; i < p.size(); i++) - gcode.queue("G1 X" + p.point(i).x() + " Y" + p.point(i).y() + "; draw line"); - gcode.queue("G1 X" + p.point(0).x() + " Y" + p.point(0).y() + "; draw back to polygon start"); + { + x = org.reprap.machines.GCodeRepRap.round(p.point(i).x(), 1); + y = org.reprap.machines.GCodeRepRap.round(p.point(i).y(), 1); + gcode.queue("G1 X" + x + " Y" + y + "; draw line"); + } + x = org.reprap.machines.GCodeRepRap.round(p.point(0).x(), 1); + y = org.reprap.machines.GCodeRepRap.round(p.point(0).y(), 1); + gcode.queue("G1 X" + x + " Y" + y + "; draw back to polygon start"); } catch (Exception e) { e.printStackTrace(); return; @@ -187,7 +203,7 @@ private void createBitmap() { - gerberGcode = new GerberGCode(pcbPen, null, true); //, drawingHeight, freemoveHeight, XYFeedrate, ZFeedrate); + gerberGcode = new GerberGCode(pcbPen, null, true); bigBox = new RrRectangle(); @@ -201,8 +217,8 @@ if(r != null) bigBox = RrRectangle.union(bigBox, r); } - if(debug) - System.out.println("Surrounding reactangle: " + bigBox); + + Debug.d("Surrounding reactangle: " + bigBox); in.close(); in = new BufferedReader(new FileReader(inputTracksAndPads)); @@ -234,7 +250,7 @@ private RrRectangle processLine(String line, boolean drill) { - if(debug) System.out.println(line); + Debug.d(line); boolean drillDef = false; @@ -250,7 +266,7 @@ formatX = line.substring(6, 8); formatY = line.substring(9, 11); - if(debug) System.out.println("Format X: " + formatX + " Format Y: " + formatY); + Debug.d("Format X: " + formatX + " Format Y: " + formatY); } else if(line.startsWith("%ADD")) @@ -266,18 +282,16 @@ apertureType = splitline[0]; apertureSize = splitline[1]; - if(debug) - { - System.out.println("\n\nAparture: " + apertureNum); - System.out.println("Type: " + apertureType); - } + Debug.d("\n\nAparture: " + apertureNum); + Debug.d("Type: " + apertureType); + + if(apertureType.equals("C")) { double s = scale*Double.parseDouble(apertureSize); - gerberGcode.addCircleAperture(Integer.parseInt(apertureNum), s); - if(debug) - System.out.println("Size: " + s + " mm"); + gerberGcode.addCircleAperture(Integer.parseInt(apertureNum), s); + Debug.d("Size: " + s + " mm"); } else if(apertureType.equals("R")) @@ -288,8 +302,7 @@ double y = scale*Double.parseDouble(rectSides[1]); gerberGcode.addRectangleAperture(Integer.parseInt(apertureNum), x, y); - if(debug) - System.out.println("Size: " + x + "x" + y + "mm x mm"); + Debug.d("Size: " + x + "x" + y + "mm x mm"); } else if(apertureType.equals("OC8")) @@ -298,7 +311,7 @@ } else { - System.out.println(" [-] aparture type: " + apertureType + " not supported [" + line+"]\n"); + Debug.e(" [-] aparture type: " + apertureType + " not supported [" + line+"]\n"); //System.exit(-1); } @@ -316,44 +329,38 @@ apertureNum = splitline[0]; apertureSize = splitline[1]; - if(debug) - System.out.println("\n\nDrill: " + apertureNum); + Debug.d("\n\nDrill: " + apertureNum); drillDef = true; double s = scale*Double.parseDouble(apertureSize); gerberGcode.addCircleAperture(Integer.parseInt(apertureNum), s); - if(debug) - System.out.println("Size: " + s + " mm"); + Debug.d("Size: " + s + " mm"); } } else if(line.startsWith("G90")) { gerberGcode.enableAbsolute(); - if(debug) - System.out.println("Absolute coordinates"); + Debug.d("Absolute coordinates"); } else if(line.startsWith("G91")) { gerberGcode.enableRelative(); - if(debug) - System.out.println("Relative coordinates"); + Debug.d("Relative coordinates"); } else if(line.startsWith("G70") || (drill && line.startsWith("M72"))) { scale = 25.4; - if(debug) - System.out.println("Inches"); + Debug.d("Inches"); } else if(line.startsWith("G71")|| (drill && line.startsWith("M71"))) { scale = 1; - if(debug) - System.out.println("Metric"); + Debug.d("Metric"); } else if(line.startsWith("G54")) @@ -361,16 +368,14 @@ if(drill) { gerberGcode.selectAperture(-1); - if(debug) - System.out.println("Drill centre selected."); + Debug.d("Drill centre selected."); } else { int aperture; aperture = Integer.valueOf(line.substring(4, line.length()-1).trim()); gerberGcode.selectAperture(aperture); - if(debug) - System.out.println("Apature: " + aperture + " selected."); + Debug.d("Apature: " + aperture + " selected."); } } @@ -404,8 +409,7 @@ x += offsetX; y += offsetY; - if(debug) - System.out.println(" X: "+x+" Y:"+y+" D:"+d); + Debug.d(" X: "+x+" Y:"+y+" D:"+d); if(d==1) { @@ -428,8 +432,7 @@ if(drill) { gerberGcode.selectAperture(-1); - if(debug) - System.out.println("Drill centre selected."); + Debug.d("Drill centre selected."); } else { int aperture; @@ -437,8 +440,7 @@ aperture = Integer.valueOf(line.substring(1, 3)); gerberGcode.selectAperture(aperture); - if(debug) - System.out.print("Apature: " + aperture + " selected."); + Debug.d("Apature: " + aperture + " selected."); } } return result; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |