Skip to content

Commit

Permalink
Outline fix (#2535)
Browse files Browse the repository at this point in the history
* Fix problem with outline when first X coordinate is unknown.
* Replaced link to discussion forum in readme as the old one has been inactivated
  • Loading branch information
breiler authored Jun 3, 2024
1 parent f584b13 commit 99ae4ef
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 16 deletions.
28 changes: 14 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
Universal G-Code Sender is a Java based, cross platform G-Code sender, compatible with [GRBL](https://github.com/gnea/grbl/), [TinyG](https://github.com/synthetos/TinyG), [g2core](https://github.com/synthetos/g2) and [Smoothieware](http://smoothieware.org/).

Webpage: https://universalgcodesender.com/ <br/>
Discussion forum: https://groups.google.com/forum/#!forum/universal-gcode-sender <br/>
Discussion forum: https://github.com/winder/Universal-G-Code-Sender/discussions <br/>
Translations: https://poeditor.com/join/project/2J2hB5I41Z <br/>

Technical details:
Expand All @@ -30,23 +30,23 @@ The next generation, feature packed variant based on the Netbeans Platform.<br>
Unpack and start the program ```bin/ugsplatform```


| Latest release (v2.1.7) | Nightly build |
|:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:--------------|
| [![Windows 64-bit](pictures/os_windows.png) Windows 64-bit](https://github.com/winder/Universal-G-Code-Sender/releases/download/v2.1.7/win64-ugs-platform-app-2.1.7.zip) | [![Windows 64-bit](pictures/os_windows.png) Windows 64-bit](https://github.com/winder/Universal-G-Code-Sender/releases/download/nightly/win64-ugs-platform-app-2.0-SNAPSHOT.zip) |
| [![Mac OSX](pictures/os_mac.png) Mac OSX](https://github.com/winder/Universal-G-Code-Sender/releases/download/v2.1.7/macosx-x64-ugs-platform-app-2.1.7.dmg) | [![Mac OSX](pictures/os_mac.png) Mac OSX](https://github.com/winder/Universal-G-Code-Sender/releases/download/nightly/macosx-x64-ugs-platform-app-2.0-SNAPSHOT.dmg) |
| [![Mac OSX](pictures/os_mac.png) Mac OSX ARM64](https://github.com/winder/Universal-G-Code-Sender/releases/download/v2.1.7/macosx-aarch64-ugs-platform-app-2.1.7.dmg) | [![Mac OSX ARM64](pictures/os_mac.png) Mac OSX ARM64](https://github.com/winder/Universal-G-Code-Sender/releases/download/nightly/macosx-aarch64-ugs-platform-app-2.0-SNAPSHOT.dmg) |
| [![Linux x64](pictures/os_linux.png) Linux 64-bit](https://github.com/winder/Universal-G-Code-Sender/releases/download/v2.1.7/linux-x64-ugs-platform-app-2.1.7.tar.gz) | [![Linux x64](pictures/os_linux.png) Linux 64-bit](https://github.com/winder/Universal-G-Code-Sender/releases/download/nightly/linux-x64-ugs-platform-app-2.0-SNAPSHOT.tar.gz) |
| [![Linux ARM](pictures/os_linux_arm.png) Linux ARM](https://github.com/winder/Universal-G-Code-Sender/releases/download/v2.1.7/linux-arm-ugs-platform-app-2.1.7.tar.gz) | [![Linux ARM](pictures/os_linux_arm.png) Linux ARM](https://github.com/winder/Universal-G-Code-Sender/releases/download/nightly/linux-arm-ugs-platform-app-2.0-SNAPSHOT.tar.gz) |
| [![Linux ARM](pictures/os_linux_arm.png) Linux ARM64](https://github.com/winder/Universal-G-Code-Sender/releases/download/v2.1.7/linux-aarch64-ugs-platform-app-2.1.7.tar.gz) | [![Linux ARM](pictures/os_linux_arm.png) Linux ARM64](https://github.com/winder/Universal-G-Code-Sender/releases/download/nightly/linux-aarch64-ugs-platform-app-2.0-SNAPSHOT.tar.gz) |
| [![Zip](pictures/zip.png) All platforms](https://github.com/winder/Universal-G-Code-Sender/releases/download/v2.1.7/ugs-platform-app-2.1.7.zip) | [![Zip](pictures/zip.png) All platforms](https://github.com/winder/Universal-G-Code-Sender/releases/download/nightly/ugs-platform-app-2.0-SNAPSHOT.zip) |
| Latest release (v2.1.7) | Nightly build |
|:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [![Windows 64-bit](pictures/os_windows.png) Windows 64-bit](https://github.com/winder/Universal-G-Code-Sender/releases/download/v2.1.7/win64-ugs-platform-app-2.1.7.zip) | [![Windows 64-bit](pictures/os_windows.png) Windows 64-bit](https://github.com/winder/Universal-G-Code-Sender/releases/download/nightly/win64-ugs-platform-app-2.0-SNAPSHOT.zip) |
| [![Mac OSX](pictures/os_mac.png) Mac OSX](https://github.com/winder/Universal-G-Code-Sender/releases/download/v2.1.7/macosx-x64-ugs-platform-app-2.1.7.dmg) | [![Mac OSX](pictures/os_mac.png) Mac OSX](https://github.com/winder/Universal-G-Code-Sender/releases/download/nightly/macosx-x64-ugs-platform-app-2.0-SNAPSHOT.dmg) |
| [![Mac OSX](pictures/os_mac.png) Mac OSX ARM64](https://github.com/winder/Universal-G-Code-Sender/releases/download/v2.1.7/macosx-aarch64-ugs-platform-app-2.1.7.dmg) | [![Mac OSX ARM64](pictures/os_mac.png) Mac OSX ARM64](https://github.com/winder/Universal-G-Code-Sender/releases/download/nightly/macosx-aarch64-ugs-platform-app-2.0-SNAPSHOT.dmg) |
| [![Linux x64](pictures/os_linux.png) Linux 64-bit](https://github.com/winder/Universal-G-Code-Sender/releases/download/v2.1.7/linux-x64-ugs-platform-app-2.1.7.tar.gz) | [![Linux x64](pictures/os_linux.png) Linux 64-bit](https://github.com/winder/Universal-G-Code-Sender/releases/download/nightly/linux-x64-ugs-platform-app-2.0-SNAPSHOT.tar.gz) |
| [![Linux ARM](pictures/os_linux_arm.png) Linux ARM](https://github.com/winder/Universal-G-Code-Sender/releases/download/v2.1.7/linux-arm-ugs-platform-app-2.1.7.tar.gz) | [![Linux ARM](pictures/os_linux_arm.png) Linux ARM](https://github.com/winder/Universal-G-Code-Sender/releases/download/nightly/linux-arm-ugs-platform-app-2.0-SNAPSHOT.tar.gz) |
| [![Linux ARM](pictures/os_linux_arm.png) Linux ARM64](https://github.com/winder/Universal-G-Code-Sender/releases/download/v2.1.7/linux-aarch64-ugs-platform-app-2.1.7.tar.gz) | [![Linux ARM](pictures/os_linux_arm.png) Linux ARM64](https://github.com/winder/Universal-G-Code-Sender/releases/download/nightly/linux-aarch64-ugs-platform-app-2.0-SNAPSHOT.tar.gz) |
| [![Zip](pictures/zip.png) All platforms](https://github.com/winder/Universal-G-Code-Sender/releases/download/v2.1.7/ugs-platform-app-2.1.7.zip) | [![Zip](pictures/zip.png) All platforms](https://github.com/winder/Universal-G-Code-Sender/releases/download/nightly/ugs-platform-app-2.0-SNAPSHOT.zip) |

**UGS Classic**<br>
A clean and lightweight variant of UGS (requires [Java](https://java.com/en/download/manual.jsp)). <br>
A clean and lightweight variant of UGS (requires [Java 17](https://adoptium.net/temurin/releases/?package=jre&version=17)). <br>
Unpack and start the program by double clicking the jar file. On some platforms you may need to run the included start script. <br>

| Latest release (v2.1.7) | Nightly build |
|:-----------------------------------------------------------------------------------------------------------------------------------------------|:---------------|
| [![Zip](pictures/zip.png) All platforms](https://github.com/winder/Universal-G-Code-Sender/releases/download/v2.1.7/UniversalGcodeSender.zip) | [![Zip](pictures/zip.png) All platforms](https://github.com/winder/Universal-G-Code-Sender/releases/download/nightly/UniversalGcodeSender.zip) |
| Latest release (v2.1.7) | Nightly build |
|:----------------------------------------------------------------------------------------------------------------------------------------------|:-----------------------------------------------------------------------------------------------------------------------------------------------|
| [![Zip](pictures/zip.png) All platforms](https://github.com/winder/Universal-G-Code-Sender/releases/download/v2.1.7/UniversalGcodeSender.zip) | [![Zip](pictures/zip.png) All platforms](https://github.com/winder/Universal-G-Code-Sender/releases/download/nightly/UniversalGcodeSender.zip) |

## Screenshots

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ private static int findNextOuterPointIndex(List<PartialPosition> points, int sta
private static int findLeftMostPointIndex(List<PartialPosition> points) {
int leftMostPoint = 0;
for (int i = 1; i < points.size(); i++) {
if (points.get(i).getX() < points.get(leftMostPoint).getX()) {
if (points.get(leftMostPoint).getX().isNaN() || points.get(i).getX() < points.get(leftMostPoint).getX()) {
leftMostPoint = i;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ public List<LineSegment> toObjRedux(List<String> gcode, double arcSegmentLength)
lines.clear();

// Save the state
Position start = new Position(gp.getCurrentState().getUnits());
Position start = new Position(Double.NaN, Double.NaN, Double.NaN, gp.getCurrentState().getUnits());
double spindleSpeed = 0;

for (String s : gcode) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,4 +89,19 @@ public void generatingOutlineWithJogFeedRateInInchPerMinute() throws IOException
assertEquals("G21G90G1X25.4Y25.4F25.4", gcodeCommands.get(2).getCommandString());
assertEquals("G21G90G1X0Y25.4F25.4", gcodeCommands.get(3).getCommandString());
}

@Test
public void generatingOutlineWithUnknownStartPoint() throws IOException, GcodeParserException {
BackendAPI backend = CentralLookup.getDefault().lookup(BackendAPI.class);
backend.getSettings().setPreferredUnits(UnitUtils.Units.MM);
backend.getSettings().setJogFeedRate(1);

URL resource = OutlineActionTest.class.getResource("/window.nc");
List<GcodeCommand> gcodeCommands = outlineAction.generateOutlineCommands(new File(resource.getPath()));
assertEquals(gcodeCommands.size(), 4);
assertEquals("G21G90G1X18.175Y39.825F1", gcodeCommands.get(0).getCommandString());
assertEquals("G21G90G1X18.175Y18.175F1", gcodeCommands.get(1).getCommandString());
assertEquals("G21G90G1X31.825Y18.175F1", gcodeCommands.get(2).getCommandString());
assertEquals("G21G90G1X31.825Y39.825F1", gcodeCommands.get(3).getCommandString());
}
}
28 changes: 28 additions & 0 deletions ugs-platform/ugs-platform-ugscore/src/test/resources/window.nc
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
G21
M3 S12000
G90
G1 Z10.000 F228.6
G0 X26.745 Y31.997
G1 Z0.000 F500.0
G1 X26.745 Y34.744 Z-1.000 F500.0
G1 X23.255 Y34.744 F2000.0
G1 X23.255 Y23.255 F2000.0
G1 X26.745 Y23.255 F2000.0
G1 X26.745 Y34.744 F2000.0
G1 X29.285 Y37.285 F2000.0
G1 X20.715 Y37.285 F2000.0
G1 X20.715 Y20.715 F2000.0
G1 X29.285 Y20.715 F2000.0
G1 X29.285 Y37.285 F2000.0
G1 X31.825 Y39.825 F2000.0
G1 X18.175 Y39.825 F2000.0
G1 X18.175 Y18.175 F2000.0
G1 X31.825 Y18.175 F2000.0
G1 X31.825 Y39.825 F2000.0
G0 Z3.810
G21
G90
G0 Z10.000
G0 X0.000 Y0.000
G4 P0.1
M5

0 comments on commit 99ae4ef

Please sign in to comment.