Skip to content

Commit

Permalink
Integrate gsSlicerPro extensions into base gsSlicer classes.
Browse files Browse the repository at this point in the history
  • Loading branch information
gregmeess committed Nov 3, 2019
1 parent d1bb463 commit 79823a8
Show file tree
Hide file tree
Showing 9 changed files with 375 additions and 540 deletions.
3 changes: 3 additions & 0 deletions generators/PrintMeshAssembly.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ public class PrintMeshOptions
public bool IsCropRegion = false; // treat as crop region
public bool IsOpen = false; // treat as open mesh (ie do not fill)

public double ClearanceXY = 0;
public double OffsetXY = 0;

public enum OpenPathsModes
{
Embedded = 0, Clipped = 1, Ignored = 2, Default = 10
Expand Down
303 changes: 0 additions & 303 deletions generators/SingleMaterialFFFPrintGenPro.cs

This file was deleted.

43 changes: 43 additions & 0 deletions generators/ThreeAxisPrintGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -717,11 +717,54 @@ protected virtual void fill_bridge_region(GeneralPolygon2d poly, IFillPathSchedu
scheduler.AppendCurveSets(fill_gen.GetFillCurves());
}

protected virtual void fill_bridge_region_decompose(GeneralPolygon2d poly, IFillPathScheduler2d scheduler, PrintLayerData layer_data)
{
poly.Simplify(0.1, 0.01, true);

double minLength = Settings.MaxBridgeWidthMM * 0.75;
double minArea = minLength * minLength;

var polys = PolygonDecomposer.Compute(poly, minArea);

double spacing = Settings.BridgeFillPathSpacingMM();

foreach (Polygon2d polypart in polys)
{

Box2d box = polypart.MinimalBoundingBox(0.00001);
Vector2d axis = (box.Extent.x > box.Extent.y) ? box.AxisY : box.AxisX;
double angle = Math.Atan2(axis.y, axis.x) * MathUtil.Rad2Deg;

GeneralPolygon2d gp = new GeneralPolygon2d(polypart);

ShellsFillPolygon shells_fill = new ShellsFillPolygon(gp);
shells_fill.PathSpacing = Settings.SolidFillPathSpacingMM();
shells_fill.ToolWidth = Settings.Machine.NozzleDiamMM;
shells_fill.Layers = 1;
shells_fill.InsetFromInputPolygonX = 0.25;
shells_fill.ShellType = ShellsFillPolygon.ShellTypes.BridgeShell;
shells_fill.FilterSelfOverlaps = false;
shells_fill.Compute();
scheduler.AppendCurveSets(shells_fill.GetFillCurves());
var fillPolys = shells_fill.InnerPolygons;

double offset = Settings.Machine.NozzleDiamMM * Settings.SolidFillBorderOverlapX;
fillPolys = ClipperUtil.MiterOffset(fillPolys, offset);

foreach (var fp in fillPolys)
{
BridgeLinesFillPolygon fill_gen = new BridgeLinesFillPolygon(fp)
{
InsetFromInputPolygon = false,
PathSpacing = spacing,
ToolWidth = Settings.Machine.NozzleDiamMM,
AngleDeg = angle,
};
fill_gen.Compute();
scheduler.AppendCurveSets(fill_gen.GetFillCurves());
}
}
}

/// <summary>
/// Determine the sparse infill and solid fill regions for a layer, given the input regions that
Expand Down
4 changes: 1 addition & 3 deletions gsSlicer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,8 @@
<Compile Include="compilers\ThreeAxisMillingCompiler.cs" />
<Compile Include="generators\PrintGeneratorDefaults.cs" />
<Compile Include="generators\PrintMeshAssembly.cs" />
<Compile Include="generators\SingleMaterialFFFPrintGenPro.cs" />
<Compile Include="slicing\BaseSlicer.cs" />
<Compile Include="slicing\MeshPlanarMillSlicer.cs" />
<Compile Include="slicing\MeshPlanarSlicerPro.cs" />
<Compile Include="slicing\PlanarSlicePro.cs" />
<Compile Include="sls\GenericPathsAssembler.cs" />
<Compile Include="sls\GenericSLSPrintGenerator.cs" />
<Compile Include="sls\SLSCompiler.cs" />
Expand All @@ -60,6 +57,7 @@
<Compile Include="toolpathing\GroupScheduler2d.cs" />
<Compile Include="toolpathing\LayerShellSelector.cs" />
<Compile Include="toolpathing\PathPostProcessor.cs" />
<Compile Include="utility\PolygonDecomposer.cs" />
<Compile Include="toolpathing\SortingScheduler2d.cs" />
<Compile Include="toolpathing\SparseLinesFillPolygon.cs" />
<Compile Include="toolpathing\SupportPostProcessors.cs" />
Expand Down
Loading

0 comments on commit 79823a8

Please sign in to comment.