glowforge.cps post processor is broken with new JS engine (Array.slice is not a function)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
To reproduce:
- In Preferences, turn on "Use Upgraded Post Engine" under Preview Features
- Create a setup, cutting operation using a laser tool, and post-process it with the Glowforge post found in Fusion 360 library
Expected: successful creating of SVG (this works with "Use Upgraded Post Engine" turned off)
Actual: After a(n irrelevant) warning that the post may be unsafe, it fails with an error. The log contains:
Information: Configuration: Glowforge
Information: Vendor: Glowforge
Information: Posting intermediate data to '/Users/chris/Documents/Fusion 360/NC Programs/1001.svg'
Error: Failed to post process. See below for details.
...
Start time: Thu Jan 4 03:26:34 2024
Post processor engine: 5.69.0
Configuration path: /Users/chris/Library/Application Support/Autodesk/Autodesk Fusion 360/V7A9LSHM9NQ7/W.login/M/D20200426291109101/CAMPosts/glowforge 2.cps
Include paths: /Users/chris/Library/Application Support/Autodesk/Autodesk Fusion 360/V7A9LSHM9NQ7/W.login/M/D20200426291109101/CAMPosts
Configuration modification date: Thu Jan 4 03:26:02 2024
Output path: /Users/chris/Documents/Fusion 360/NC Programs/1001.svg
Checksum of intermediate NC data: 44504dede98a2d9b846d46eb7718a5a7
Checksum of configuration: ac8aa26b863719894b0bd3e4f646313c
Vendor url: https://www.glowforge.com
Legal: Copyright (C) 2015-2021 by Autodesk, Inc.
Generated by: Fusion 360 CAM 2.0.17954
...
###############################################################################
Error: Array.slice is not a function
Error at line: 226 (glowforge 2.cps)
Error in operation: '2D Profile1'
Failed while processing onCircular() for record 285.
###############################################################################
Error: Failed to invoke function 'onCircular'.
Error: Failed to invoke 'onCircular' in the post configuration.
Error: Failed to execute configuration.
Stop time: Thu Jan 4 03:26:34 2024
Post processing failed.
The important part is on line 20, "Array.slice is not a function". This JavaScript function has been deprecated for years, and it appears that it was finally removed in the new post engine. The code will need to be updated.
Me programmer, so I found the following to work. The problem is at line 226 in the file:
var activePathElements = [];
function addPathElement() {
var args = Array.slice(arguments, 0);
// don't allow moves after a rapid or similar move
Delete the offending line and change the function signature to use a rest parameter as follows:
var activePathElements = [];
function addPathElement(...args) {
// don't allow moves after a rapid or similar move
Unfortunately, this is NOT backwards compatible with the old engine, so depending on how you want to proceed, you might choose a different fix (there's some hackier way to call slice from the prototype that I don't care to think about).
I did not inspect any of the other posts to see if they use Array.slice as well. I wouldn't be surprised if this isn't the only one that's broken by this change.