diff options
author | adrian-bowyer <adrian-bowyer@cb376a5e-1013-0410-a455-b6b1f9ac8223> | 2010-02-18 23:17:36 +0000 |
---|---|---|
committer | adrian-bowyer <adrian-bowyer@cb376a5e-1013-0410-a455-b6b1f9ac8223> | 2010-02-18 23:17:36 +0000 |
commit | 55648ab782d8dc4fcf9382a52a6768f26fecf632 (patch) | |
tree | 7ee1bb318d0a1cd82b643ccc49b5822c8ea12321 | |
parent | c5b909fa0e6cffa2a9c87f531510c35108bb5e52 (diff) | |
download | reprap-backup-55648ab782d8dc4fcf9382a52a6768f26fecf632.tar.gz reprap-backup-55648ab782d8dc4fcf9382a52a6768f26fecf632.zip |
Support calculations seem to be working. Tested quite a bit. The new reprap.properties.dist file contains quite good settings for using PLA to support itself.
git-svn-id: https://reprap.svn.sourceforge.net/svnroot/reprap@3513 cb376a5e-1013-0410-a455-b6b1f9ac8223
4 files changed, 115 insertions, 117 deletions
diff --git a/trunk/reprap/host/lib/reprap.properties.dist b/trunk/reprap/host/lib/reprap.properties.dist index 07673156..beae0733 100644 --- a/trunk/reprap/host/lib/reprap.properties.dist +++ b/trunk/reprap/host/lib/reprap.properties.dist @@ -1,5 +1,5 @@ #RepRap machine parameters. See http://objects.reprap.org/wiki/Java_Software_Preferences_File -#Mon Jan 25 23:53:16 GMT 2010 +#Thu Feb 18 23:12:22 GMT 2010 AxisCount=3 BackColourB(0..1)=0.9 BackColourG(0..1)=0.9 @@ -10,10 +10,8 @@ BoundFactor=3.0 CommsDebug=false Debug=false DisplaySimulation=false -DumpX(mm)=120 +DumpX(mm)=130 DumpY(mm)=5 -FinishX(mm)=10 -FinishY(mm)=190 Extruder0_Address=0 Extruder0_AngleSpeedFactor(0..1)=0.5 Extruder0_AngleSpeedLength(mm)=-1 @@ -94,13 +92,13 @@ Extruder1_ColourG(0..1)=0.6 Extruder1_ColourR(0..1)=0.9 Extruder1_CoolingPeriod(s)=0.1 Extruder1_EvenHatchDirection(degrees)=45 -Extruder1_ExtrudeRatio(0..)=1 +Extruder1_ExtrudeRatio(0..)=0.6 Extruder1_ExtrusionBroadWidth(mm)=2.0 Extruder1_ExtrusionDelayForLayer(ms)=600 Extruder1_ExtrusionDelayForPolygon(ms)=500 Extruder1_ExtrusionFoundationWidth(mm)=2 Extruder1_ExtrusionHeight(mm)=0.3 -Extruder1_ExtrusionInfillWidth(mm)=1.0 +Extruder1_ExtrusionInfillWidth(mm)=2.5 Extruder1_ExtrusionLastFoundationWidth(mm)=1 Extruder1_ExtrusionOverRun(mm)=3 Extruder1_ExtrusionPWM(0..1)=-1 @@ -168,7 +166,7 @@ Extruder2_ExtrusionDelayForLayer(ms)=600 Extruder2_ExtrusionDelayForPolygon(ms)=500 Extruder2_ExtrusionFoundationWidth(mm)=2 Extruder2_ExtrusionHeight(mm)=0.3 -Extruder2_ExtrusionInfillWidth(mm)=2 +Extruder2_ExtrusionInfillWidth(mm)=1.5 Extruder2_ExtrusionLastFoundationWidth(mm)=2 Extruder2_ExtrusionOverRun(mm)=0 Extruder2_ExtrusionPWM(0..1)=-1 @@ -226,31 +224,32 @@ Extruder3_ArcCompensationFactor(0..)=8 Extruder3_ArcShortSides(0..)=1 Extruder3_Beta(K)=550.0 Extruder3_Capacitor(F)=0.000003 -Extruder3_ColourB(0..1)=0.4 +Extruder3_ColourB(0..1)=0.5 Extruder3_ColourG(0..1)=0.5 -Extruder3_ColourR(0..1)=0.6 +Extruder3_ColourR(0..1)=0.3 Extruder3_CoolingPeriod(s)=0.1 -Extruder3_EvenHatchDirection(degrees)=-45 -Extruder3_ExtrudeRatio(0..)=-1.0 -Extruder3_ExtrusionBroadWidth(mm)=2.0 -Extruder3_ExtrusionDelayForLayer(ms)=300 -Extruder3_ExtrusionDelayForPolygon(ms)=200 +Extruder3_EvenHatchDirection(degrees)=45 +Extruder3_ExtrudeRatio(0..)=1 +Extruder3_ExtrusionBroadWidth(mm)=6 +Extruder3_ExtrusionDelayForLayer(ms)=600 +Extruder3_ExtrusionDelayForPolygon(ms)=500 Extruder3_ExtrusionFoundationWidth(mm)=2 -Extruder3_ExtrusionHeight(mm)=0.4 -Extruder3_ExtrusionInfillWidth(mm)=0.5 +Extruder3_ExtrusionHeight(mm)=0.3 +Extruder3_ExtrusionInfillWidth(mm)=1.5 Extruder3_ExtrusionLastFoundationWidth(mm)=2 -Extruder3_ExtrusionOverRun(mm)=-1 +Extruder3_ExtrusionOverRun(mm)=0 +Extruder3_ExtrusionPWM(0..1)=-1 Extruder3_ExtrusionSize(mm)=0.7 -Extruder3_ExtrusionSpeed(mm/minute)=-1 +Extruder3_ExtrusionSpeed(mm/minute)=3000 Extruder3_ExtrusionTemp(C)=0 Extruder3_FastXYFeedrate(mm/minute)=3000.0 Extruder3_InFillMaterialType(name)=null -Extruder3_IncrementedStart=true +Extruder3_IncrementedStart=false Extruder3_InfillOverlap(mm)=0.2 Extruder3_InfillSpeed(0..1)=1 -Extruder3_LowerFineLayers(0...)=2 +Extruder3_LowerFineLayers(0...)=0 Extruder3_MaterialType(name)=Paste -Extruder3_MaxAcceleration(mm/minute/minute)=-1 +Extruder3_MaxAcceleration(mm/minute/minute)=1200000.0 Extruder3_MaxSpeed(0..255)=255 Extruder3_MinimumZClearance(mm)=-1 Extruder3_NozzleClearTime(s)=10 @@ -262,34 +261,38 @@ Extruder3_NozzleWipeFreq=1 Extruder3_NozzleWipeStrokeX(mm)=0 Extruder3_NozzleWipeStrokeY(mm)=10 Extruder3_NumberOfShells(0..N)=1 -Extruder3_OddHatchDirection(degrees)=45 +Extruder3_OddHatchDirection(degrees)=-45 Extruder3_OffsetX(mm)=0 Extruder3_OffsetY(mm)=0 Extruder3_OffsetZ(mm)=0 Extruder3_OutlineSpeed(0..1)=0.9 Extruder3_PauseBetweenSegments=false +Extruder3_Purge(ms)=10000 Extruder3_RandomStart=false -Extruder3_Reverse(ms)=0 +Extruder3_Reverse(ms)=400 Extruder3_Rz(ohms)=4837 Extruder3_SeparationFraction(0..1)=0.8 -Extruder3_SeparationSpeed(mm/minute)=3000 +Extruder3_SeparationOutlineSpeed(0..1)=1 +Extruder3_SeparationSpeed(mm/minute)=2500 Extruder3_ShortLength(mm)=-1 Extruder3_ShortSpeed(0..1)=1 Extruder3_SlowXYFeedrate(mm/minute)=1500.0 Extruder3_SupportMaterialType(name)=null -Extruder3_UpperFineLayers(0...)=2 +Extruder3_UpperFineLayers(0...)=0 Extruder3_ValveDelayForLayer(ms)=200 Extruder3_ValveDelayForPolygon(ms)=200 -Extruder3_ValveOverRun(mm)=-1 +Extruder3_ValveOverRun(mm)=2 Extruder3_ValvePulseTime(ms)=500 Extruder3_hb(C)=20 Extruder3_hm(C/pwr)=0.86 Extruder3_t0(0..255)=0 FastSpeed(-1..255)=240 +FinishX(mm)=10 +FinishY(mm)=190 FiveD=true FoundationLayers=0 FrontFactor=0.001 -GCodeUseSerial=true +GCodeUseSerial=false IdleZAxis=true InterLayerCooling=true MachineColourB(0..1)=0.3 @@ -304,7 +307,7 @@ MouseTranslationFactor=50 MouseZoomFactor=50 MovementSpeedZ(0..255)=240 NumberOfExtruders=3 -PathOptimise=false +PathOptimise=true Port(name)=/dev/ttyUSB0 RadiusFactor=0.7 RememberWindowPosition=false diff --git a/trunk/reprap/host/src/org/reprap/geometry/LayerRules.java b/trunk/reprap/host/src/org/reprap/geometry/LayerRules.java index 9049026b..2db81109 100644 --- a/trunk/reprap/host/src/org/reprap/geometry/LayerRules.java +++ b/trunk/reprap/host/src/org/reprap/geometry/LayerRules.java @@ -161,14 +161,8 @@ public class LayerRules } } - //layerRecord = new RrCSGPolygonList[fineLayers+1]; recordNumber = new int[fineLayers+1]; layerPointer = 0; -// for(int i = 0; i < layerRecord.length; i++) -// { -// layerRecord[i] = null; -// recordNumber[i] = -1; -// } } public RrRectangle getBox() @@ -176,42 +170,20 @@ public class LayerRules return bBox; } -// public void recordThisLayer(RrCSGPolygonList pl) -// { -// //if(layerRecord[layerPointer] != null) -// // layerRecord[layerPointer].destroy(); -// layerRecord[layerPointer] = pl; -// recordNumber[layerPointer] = machineLayer; -// layerPointer++; -// if(layerPointer >= layerRecord.length) -// layerPointer = 0; -// } - - /** - * Return the layer i above where we are - * @param i - * @return - */ -// public RrCSGPolygonList getLayerAbove(int i) -// { -// int lp = layerPointer - i; -// if(lp < 0) -// return layerRecord[layerRecord.length + lp]; -// else -// return layerRecord[lp]; -// } - public boolean getTopDown() { return topDown; } public void setPrinter(Printer p) { printer = p; } public Printer getPrinter() { return printer; } - //public void setModelZ(double mz) { modelZ = mz; } public double getModelZ() { return modelZ; } + public double getModelZ(int layer) + { + return zStep*layer; + } + public double getMachineZ() { return machineZ; } - //private void setModelLayer(int ml) { modelLayer = ml; } public int getModelLayer() { return modelLayer; } public int getModelLayerMax() { return modelLayerMax; } @@ -300,27 +272,7 @@ public class LayerRules public double getHatchWidth(Extruder e) { if(getMachineLayer() < getFoundationLayers()) - { - //if(getMachineLayer() == getFoundationLayers() - 2) - //return e.getExtrusionFoundationWidth()*0.5; - - return e.getExtrusionFoundationWidth(); - } - - -// String inFillName = e.getBroadInfillMaterial(); -// -// // If this stuff's infill is not called "null"... -// -// if(!inFillName.contentEquals("null")) -// { -// if(modelLayer+1 > e.getLowerFineLayers() && modelLayer+1 <= modelLayerMax - e.getUpperFineLayers()) -// { -// Extruder inFillExtruder = printer.getExtruders()[GenericExtruder.getNumberFromMaterial(inFillName)]; -// return inFillExtruder.getExtrusionInfillWidth(); -// } -// } return e.getExtrusionInfillWidth(); } @@ -389,21 +341,10 @@ public class LayerRules } addToStep = 0; stepMachine(e); - -// // modelLayer < 0 when we're building foundations -// if(modelLayer < 0) -// { -// modelLayer = 0; -// modelZ = 0; -// } } public void setFractionDone() { -// double f = machineZ/machineZMax; -// if(topDown) -// f = 1 - f; - // Set -ve to force the system to query the layer rules org.reprap.gui.botConsole.BotConsoleFrame.getBotConsoleFrame().setFractionDone(-1); diff --git a/trunk/reprap/host/src/org/reprap/geometry/polygons/AllSTLsToBuild.java b/trunk/reprap/host/src/org/reprap/geometry/polygons/AllSTLsToBuild.java index 67e09699..08b2b162 100644 --- a/trunk/reprap/host/src/org/reprap/geometry/polygons/AllSTLsToBuild.java +++ b/trunk/reprap/host/src/org/reprap/geometry/polygons/AllSTLsToBuild.java @@ -546,7 +546,7 @@ public class AllSTLsToBuild // from doesn't matter. int layer = layerConditions.getMachineLayer(); - BooleanGridList thisLayer = slice(stl, layerConditions); + BooleanGridList thisLayer = slice(stl, layerConditions.getModelLayer(), layerConditions); BooleanGrid unionOfThisLayer; Attributes a; @@ -567,36 +567,37 @@ public class AllSTLsToBuild BooleanGridList allThis = new BooleanGridList(); allThis.add(unionOfThisLayer); - allThis = allThis.offset(layerConditions, true, -1); + allThis = allThis.offset(layerConditions, true, -3); // -3 is a bit of a hack... if(allThis.size() > 0) unionOfThisLayer = allThis.get(0); else unionOfThisLayer = BooleanGrid.nullBooleanGrid(); - // Now we subtract the union of this layer from all the stuff requiring support in the layer above. + // Get the layer above and union it with this layer. That's what needs + // support on the next layer down. BooleanGridList previousSupport = cache.getSupport(layer+1, stl); + cache.setSupport(BooleanGridList.unions(previousSupport, thisLayer), layer, stl); + + // Now we subtract the union of this layer from all the stuff requiring support in the layer above. BooleanGridList support = new BooleanGridList(); + if(previousSupport != null) { for(int i = 0; i < previousSupport.size(); i++) { BooleanGrid above = previousSupport.get(i); a = above.attribute(); - if(!a.getExtruder().getSupportMaterial().equalsIgnoreCase("null")) + if(a.getExtruder().getSupportExtruder() != null) support.add(BooleanGrid.difference(above, unionOfThisLayer, a)); } + support = support.unionDuplicates(); } - // Copy the support material as we are about to change its attributes - // to that of the support for each of its components, and we want - // the original material in the cache. - - BooleanGridList toCache = new BooleanGridList(support); - toCache = BooleanGridList.unions(toCache, thisLayer); - cache.setSupport(toCache, layer, stl); + // Now force the attributes of the support pattern to be the support extruders + // for all the materials in it. for(int i = 0; i < support.size(); i++) { @@ -609,6 +610,7 @@ public class AllSTLsToBuild support.get(i).forceAttribute(new Attributes(e.getMaterial(), null, null, e.getAppearance())); } + // Finally compute the support hatch. return support.hatch(layerConditions, false, null); } @@ -629,13 +631,15 @@ public class AllSTLsToBuild // Where are we and what does the current slice look like? int layer = layerConditions.getMachineLayer(); - BooleanGridList slice = slice(stl, layerConditions); + BooleanGridList slice = slice(stl, layerConditions.getModelLayer(), layerConditions); // If we are solid but the slices around us weren't, we need some fine infill as // we are (at least partly) surface - BooleanGridList previousSlices = cache.getSlice(layer+1, stl); - previousSlices = BooleanGridList.intersections(cache.getSlice(layer+2, stl), previousSlices); + BooleanGridList adjacentSlices = slice(stl, layer+1, layerConditions); + adjacentSlices = BooleanGridList.intersections(slice(stl, layer+2, layerConditions), adjacentSlices); + adjacentSlices = BooleanGridList.intersections(slice(stl, layer-1, layerConditions), adjacentSlices); + adjacentSlices = BooleanGridList.intersections(slice(stl, layer-2, layerConditions), adjacentSlices); BooleanGridList insides = null; // The insides are the bits that aren't surface. @@ -644,10 +648,10 @@ public class AllSTLsToBuild // ensure that they go a little way into the inside infill. BooleanGridList outsides = slice; - if(previousSlices != null && layerConditions.getModelLayer() > 1) + if(adjacentSlices != null && layerConditions.getModelLayer() > 1) { - insides = BooleanGridList.intersections(slice, previousSlices); - outsides = BooleanGridList.differences(slice, previousSlices); + insides = BooleanGridList.intersections(slice, adjacentSlices); + outsides = BooleanGridList.differences(slice, adjacentSlices); outsides = outsides.offset(layerConditions, false, -1); outsides = BooleanGridList.intersections(outsides, slice); } @@ -688,7 +692,7 @@ public class AllSTLsToBuild // The shapes to outline. - BooleanGridList slice = slice(stl, layerConditions); + BooleanGridList slice = slice(stl, layerConditions.getModelLayer(), layerConditions); RrPolygonList borderPolygons; @@ -741,7 +745,7 @@ public class AllSTLsToBuild * @param extruders * @return */ - private BooleanGridList slice(int stl, LayerRules layerRules) + private BooleanGridList slice(int stl, int layer, LayerRules layerRules) { if(!frozen) { @@ -749,9 +753,11 @@ public class AllSTLsToBuild freeze(); } + if(layer < 0) + return new BooleanGridList(); + // Is the result in the cache? If so, just use that. - int layer = layerRules.getMachineLayer(); BooleanGridList result = cache.getSlice(layer, stl); if(result != null) return result; @@ -765,7 +771,7 @@ public class AllSTLsToBuild // Probably... - double z = layerRules.getModelZ() + layerRules.getZStep()*0.5; + double z = layerRules.getModelZ(layer) + layerRules.getZStep()*0.5; Extruder[] extruders = layerRules.getPrinter().getExtruders(); result = new BooleanGridList(); RrCSG csgp = null; diff --git a/trunk/reprap/host/src/org/reprap/geometry/polygons/BooleanGridList.java b/trunk/reprap/host/src/org/reprap/geometry/polygons/BooleanGridList.java index 5f1dadf0..e565e3cb 100644 --- a/trunk/reprap/host/src/org/reprap/geometry/polygons/BooleanGridList.java +++ b/trunk/reprap/host/src/org/reprap/geometry/polygons/BooleanGridList.java @@ -206,6 +206,49 @@ public class BooleanGridList return result; } + /** + * Run through the list, unioning entries in it that share the same material so that + * the result has just one entry per material. + */ + public BooleanGridList unionDuplicates() + { + BooleanGridList result = new BooleanGridList(); + + if(size() <= 0) + return result; + + if(size() == 1) + return this; + + boolean[] usedUp = new boolean[size()]; + for(int i = 0; i < usedUp.length; i++) + usedUp[i] = false; + + for(int i = 0; i < size() - 1; i++) + { + if(!usedUp[i]) + { + BooleanGrid union = get(i); + int iExId = union.attribute().getExtruder().getID(); + for(int j = i+1; j < size(); j++) + { + if(!usedUp[j]) + { + BooleanGrid jg = get(j); + if(iExId == jg.attribute().getExtruder().getID()) + { + union = BooleanGrid.union(union, jg); + usedUp[j] = true; + } + } + } + result.add(union); + } + } + + return result; + } + /** * Return a list of unions between the entries in a and b. @@ -220,6 +263,8 @@ public class BooleanGridList { BooleanGridList result = new BooleanGridList(); + if(a == b) + return a; if(a == null) return b; if(a.size() <= 0) @@ -255,7 +300,7 @@ public class BooleanGridList if(!bMatched[i]) result.add(b.get(i)); - return result; + return result.unionDuplicates(); } /** @@ -270,7 +315,8 @@ public class BooleanGridList public static BooleanGridList intersections(BooleanGridList a, BooleanGridList b) { BooleanGridList result = new BooleanGridList(); - + if(a == b) + return a; if(a == null || b == null) return result; if(a.size() <= 0 || b.size() <= 0) @@ -288,7 +334,7 @@ public class BooleanGridList } } } - return result; + return result.unionDuplicates(); } @@ -305,6 +351,8 @@ public class BooleanGridList { BooleanGridList result = new BooleanGridList(); + if(a == b) + return result; if(a == null) return result; if(a.size() <= 0) @@ -331,7 +379,7 @@ public class BooleanGridList result.add(abg); } - return result; + return result.unionDuplicates(); } |