Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Got Fill? Even seems to do the right thing adding bridges and capping…
… local maxima.
- Loading branch information
Showing
6 changed files
with
208 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,58 @@ | |||
// Extruder Class | |||
import java.lang.Math; | |||
|
|||
class Extruder { | |||
int ToolNum; | |||
Material Filament; | |||
float ZThick; | |||
float Diameter; | |||
float FlowRate; | |||
|
|||
Extruder() { | |||
ToolNum=0; | |||
Filament=new Material("ABS"); | |||
Diameter=0.6; | |||
ZThick=0.37; | |||
} | |||
|
|||
Extruder(int anInt) { | |||
ToolNum=anInt; | |||
Filament=new Material("ABS"); | |||
Diameter=0.6; | |||
ZThick=0.37; | |||
} | |||
|
|||
Extruder(int anInt, String aString) { | |||
ToolNum=anInt; | |||
Filament=new Material(aString); | |||
Diameter=0.6; | |||
ZThick=0.37; | |||
} | |||
|
|||
void setDiameter(float aFloat) { | |||
Diameter=aFloat; | |||
if(ZThick>Diameter) { | |||
println("Z thickness greater than extruded diameter. Setting Z thickness to half diameter."); | |||
ZThick=Diameter/2; | |||
} | |||
} | |||
|
|||
void setZThick(float aFloat) { | |||
if(aFloat<Diameter) { | |||
ZThick=aFloat; | |||
} else { | |||
println("Z thickness greater than extruded diameter. Setting Z thickness to half diameter."); | |||
ZThick=Diameter/2; | |||
} | |||
} | |||
|
|||
void setFlowRate(float aFloat) { | |||
FlowRate=aFloat; | |||
} | |||
|
|||
float calcWallWidth() { | |||
float freespace_area=PI*pow(Diameter/2,2); | |||
return(freespace_area/ZThick); | |||
} | |||
} | |||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,101 @@ | |||
// Fill Generation | |||
import java.awt.geom.Rectangle2D; | |||
|
|||
class Fill { | |||
|
|||
boolean debugFlag; | |||
int Width; | |||
int Height; | |||
Extruder ExtruderProperties; | |||
float SparseFillDensity; | |||
float RotateFillAngle; | |||
SSArea SparseFill; | |||
SSArea BridgeFill; | |||
|
|||
Fill(boolean bFlag, int iWidth, int iHeight, float fillDensity) { | |||
RotateFillAngle=45.0; | |||
debugFlag=bFlag; | |||
Width=iWidth; | |||
Height=iHeight; | |||
if(fillDensity<0 || fillDensity>1.0) { | |||
println("Sparse Fill Density out of 0 to 1.0 range. Setting to 0.5"); | |||
SparseFillDensity=0.5; | |||
} else { | |||
SparseFillDensity=fillDensity; | |||
} | |||
ExtruderProperties = new Extruder(); | |||
SparseFill = new SSArea(); | |||
SparseFill.setGridScale(0.01); | |||
float wallWidth=ExtruderProperties.calcWallWidth(); | |||
for(float dx=0;dx<Width; dx+=2*wallWidth/fillDensity) { | |||
Rectangle2D thisRect=new Rectangle2D.Float(dx,0,wallWidth/fillDensity,Height); | |||
Area thisRectArea=new Area(thisRect); | |||
AffineTransform centerAreaTransform = new AffineTransform(); | |||
centerAreaTransform.setToTranslation(-Width/2,-Height/2); | |||
thisRectArea.transform(centerAreaTransform); | |||
SparseFill.add(thisRectArea); | |||
} | |||
BridgeFill = new SSArea(); | |||
BridgeFill.setGridScale(0.01); | |||
for(float dx=0;dx<Width; dx+=2*wallWidth) { | |||
Rectangle2D thisRect=new Rectangle2D.Float(dx,0,wallWidth,Height); | |||
Area thisRectArea=new Area(thisRect); | |||
AffineTransform centerAreaTransform = new AffineTransform(); | |||
centerAreaTransform.setToTranslation(-Width/2,-Height/2); | |||
thisRectArea.transform(centerAreaTransform); | |||
BridgeFill.add(thisRectArea); | |||
} | |||
} | |||
|
|||
ArrayList GenerateFill(ArrayList SliceList) { | |||
ArrayList FillAreaList = new ArrayList(); | |||
float wallWidth=ExtruderProperties.calcWallWidth(); | |||
for(int LayerNum=0; LayerNum<SliceList.size();LayerNum++) { | |||
SSArea thisArea = (SSArea) SliceList.get(LayerNum); | |||
// Shell area to subtract off slice. | |||
SSArea thisShell = new SSArea(); | |||
thisShell.setGridScale(thisArea.getGridScale()); | |||
thisShell.add(thisArea); | |||
thisShell.makeShell(wallWidth); | |||
// Fill mask area | |||
SSArea thisFill = new SSArea(); | |||
thisFill.setGridScale(thisArea.getGridScale()); | |||
thisFill.add(thisArea); | |||
thisFill.subtract(thisShell); | |||
// Identify bridge areas for special treatment. | |||
SSArea thisBridge = new SSArea(); | |||
thisBridge.setGridScale(thisFill.getGridScale()); | |||
thisBridge.add(thisFill); | |||
AffineTransform rotateFill = new AffineTransform(); | |||
rotateFill.setToRotation(2*PI*RotateFillAngle/360.0); | |||
BridgeFill.transform(rotateFill); | |||
SparseFill.transform(rotateFill); | |||
if(LayerNum==0 || LayerNum==SliceList.size()-1) { | |||
// Bottom and Top layer special case. | |||
thisFill.intersect(BridgeFill); | |||
} else { | |||
SSArea prevArea = (SSArea) SliceList.get(LayerNum-1); | |||
thisBridge.subtract(prevArea); | |||
// Identify cap areas for special treatment. | |||
SSArea nextArea = (SSArea) SliceList.get(LayerNum+1); | |||
SSArea thisCap = new SSArea(); | |||
thisCap.setGridScale(thisFill.getGridScale()); | |||
thisCap.add(thisArea); | |||
thisCap.subtract(nextArea); | |||
thisBridge.add(thisCap); | |||
if(!thisBridge.isEmpty()) { | |||
thisFill.subtract(thisBridge); | |||
thisBridge.intersect(BridgeFill); | |||
thisFill.intersect(SparseFill); | |||
thisFill.add(thisBridge); | |||
} else { | |||
thisFill.intersect(SparseFill); | |||
} | |||
} | |||
// Subtract bridge areas from fill mask | |||
FillAreaList.add(LayerNum,thisFill); | |||
} | |||
return(FillAreaList); | |||
} | |||
} | |||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,27 @@ | |||
// Material Class | |||
|
|||
class Material { | |||
String TypeName; | |||
float MeltTemp; | |||
float ExtrudeTemp; | |||
|
|||
Material(String aString) { | |||
if(aString == "ABS") { | |||
TypeName=aString; | |||
MeltTemp=100.0; | |||
ExtrudeTemp=220.0; | |||
} else { | |||
TypeName=aString; | |||
MeltTemp=0; | |||
ExtrudeTemp=0; | |||
} | |||
} | |||
|
|||
void setMeltTemp(float aFloat) { | |||
MeltTemp=aFloat; | |||
} | |||
void setExtrudeTemp(float aFloat) { | |||
ExtrudeTemp=aFloat; | |||
} | |||
|
|||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters