Skip to content

Commit

Permalink
Better StartPoint.
Browse files Browse the repository at this point in the history
Instead of going to Z(firstlayerheight) anf then XY, go to first skirt XY and Z(firstlayerheight).

Change this directory "c:\MyProgramme\Slic3r_PostProcessing\" in post-build-events to your needs.
  • Loading branch information
Gilbert Fürer committed Apr 12, 2017
1 parent b556ded commit 857f14c
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 0 deletions.
Binary file modified .vs/Slic3rPostProcessing/v14/.suo
Binary file not shown.
36 changes: 36 additions & 0 deletions Slic3rPostProcessing/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;

namespace Slic3rPostProcessing
{
Expand Down Expand Up @@ -48,6 +49,9 @@ private static int Main(string[] args)
int insertedPerimeterSegment = 0;
bool StartGCode = false;
bool EndGCode = false;
bool StartPoint = false;
bool FirstLine = false;
string FirstLayer = null;

for (int i = 0; i < lines.Count; i++)
{
Expand Down Expand Up @@ -82,6 +86,38 @@ private static int Main(string[] args)
lines[i] = line.Replace(" ; move to first support material interface point", null);
}

if (!StartPoint | !FirstLine)
{
if (FirstLayer == null)
{
Match match0 = Regex.Match(line, @"^([gG]1)\s([zZ](-?(0|[1-9]\d*)(\.\d+)?))\s([fF](-?(0|[1-9]\d*)(\.\d+)?))(.*)$", RegexOptions.IgnoreCase);

// Here we check the Match instance.
if (match0.Success)
{
FirstLayer = match0.Groups[2].Value;
Console.WriteLine("First Layer Height: " + FirstLayer + " mm");
lines.RemoveAt(i);
i -= 1;
FirstLine = true;
continue;
}
}

if (FirstLayer != null)
{
Match match1 = Regex.Match(line, @"^([gG]1)\s([xX]-?(0|[1-9]\d*)(\.\d+)?)\s([yY]-?(0|[1-9]\d*)(\.\d+)?)\s([fF]-?(0|[1-9]\d*)(\.\d+)?)\s((; move to first)\s(\w+).*(point))$", RegexOptions.IgnoreCase);
// Here we check the Match instance.
if (match1.Success)
{
lines[i] = line.Replace(match1.Groups[8].Value, FirstLayer + " " + match1.Groups[8].Value);
Console.WriteLine("Start Point: " + lines[i]);
StartPoint = true;
continue;
}
}
}

if (line.Contains("; skirt"))
{
// RESET counter
Expand Down
5 changes: 5 additions & 0 deletions Slic3rPostProcessing/Slic3rPostProcessing.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@
<None Include="app.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>if "$(ConfigurationName)" == "Release" xcopy "$(TargetPath)" "c:\MyProgramme\Slic3r_PostProcessing\" /r /y /c /v /q

</PostBuildEvent>
</PropertyGroup>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
Expand Down

0 comments on commit 857f14c

Please sign in to comment.