Skip to content

Commit

Permalink
Merge pull request gradientspace#6 from SutroMachine/origin-user-setting
Browse files Browse the repository at this point in the history
Make the position of the build plate origin a user-accessible setting.
  • Loading branch information
rms80 authored Apr 24, 2019
2 parents 401fa25 + ee3ce4c commit 5c0b518
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 1 deletion.
4 changes: 4 additions & 0 deletions assemblers/BaseDepositionAssembler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,10 @@ public BaseDepositionAssembler(GCodeBuilder useBuilder, FFFMachineInfo machineIn
extruderA = 0;
currentFeed = 0;

Vector2d originRepositioning = new Vector2d(machineInfo.BedOriginFactorX, machineInfo.BedOriginFactorY);
Vector2d bedSize = new Vector2d(machineInfo.BedSizeXMM, machineInfo.BedSizeYMM);
PositionShift = originRepositioning*bedSize;

MinExtrudeStepDistance = machineInfo.MinPointSpacingMM;
}

Expand Down
1 change: 0 additions & 1 deletion assemblers/RepRapAssembler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ void AppendHeader_StandardRepRap() {

HomeSequenceF(Builder);

PositionShift = 0.5 * new Vector2d(Settings.Machine.BedSizeXMM, Settings.Machine.BedSizeYMM);
currentPos = Vector3d.Zero;

HeaderCustomizerF(HeaderState.BeforePrime, Builder);
Expand Down
16 changes: 16 additions & 0 deletions settings/AdditiveSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,20 @@ public abstract class MachineInfo
public double BedSizeYMM = 100;
public double MaxHeightMM = 100;

// These factors define the output coordinate system

// BedOriginFactorX:
// 0 : the origin is at the left of the build plate
// 0.5 : the origin is at the middle of the build plate
// 1 : the origin is at the right of the build plate

// BedOriginFactorY:
// 0 : the origin is at the front of the build plate
// 0.5 : the origin is at the middle of the build plate
// 1 : the origin is at the back of the build plate

public double BedOriginFactorX = 0;
public double BedOriginFactorY = 0;

public abstract T CloneAs<T>() where T : class;
protected virtual void CopyFieldsTo(MachineInfo to)
Expand Down Expand Up @@ -126,6 +140,8 @@ protected virtual void CopyFieldsTo(FFFMachineInfo to)
to.BedSizeXMM = this.BedSizeXMM;
to.BedSizeYMM = this.BedSizeYMM;
to.MaxHeightMM = this.MaxHeightMM;
to.BedOriginFactorX = this.BedOriginFactorX;
to.BedOriginFactorY = this.BedOriginFactorY;
}
}

Expand Down
3 changes: 3 additions & 0 deletions settings/RepRapSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ void configure_unknown()
Machine.Class = MachineClass.PlasticFFFPrinter;
Machine.BedSizeXMM = 80;
Machine.BedSizeYMM = 80;
Machine.BedOriginFactorX = 0.5;
Machine.BedOriginFactorY = 0.5;

Machine.MaxHeightMM = 55;
Machine.NozzleDiamMM = 0.4;
Machine.FilamentDiamMM = 1.75;
Expand Down

0 comments on commit 5c0b518

Please sign in to comment.