Skip to content

Commit

Permalink
[MI-1507]: fixed laser mode visualization to show burned path
Browse files Browse the repository at this point in the history
  • Loading branch information
sophiabeluli committed Aug 5, 2024
1 parent dd28f7f commit f485f7a
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/app/widgets/Visualizer/GCodeVisualizer.js
Original file line number Diff line number Diff line change
Expand Up @@ -207,16 +207,23 @@ class GCodeVisualizer {
const workpiece = this.group.children[0];
const colorAttr = workpiece.geometry.getAttribute('color');
const offsetIndex = v1 * 4;
const opacity = this.isLaser ? 1 : 0.3;
const opacity = 0.3;
// grey
const runColor = new THREE.Color(this.theme.get(CUTTING_PART));
const greyArray = [...runColor.toArray(), opacity];
// yellow
const yellowColor = new THREE.Color(this.theme.get(PLANNED_PART));
const yellowArray = [...yellowColor.toArray(), 1];
// color arrays
const runColorArray = Array.from({ length: (v2 - v1) }, () => greyArray).flat(); // grey, a couple movements before where our bit currently is
let runColorArray = Array.from({ length: (v2 - v1) }, () => greyArray).flat(); // grey, a couple movements before where our bit currently is
const bufferColorArray = Array.from({ length: (this.plannedV1 - this.frames[v2FrameIndex + 1]) }, () => yellowArray).flat(); // yellow, everything in between run lines and last planned line
// changes for laser mode
if (this.isLaser) {
// add original color on top so you can see the parts the laser has finished
for (let i = 0; i < runColorArray.length; i++) {
runColorArray[i] += this.colors[offsetIndex + i];
}
}

let isOverflowing = false;
let lengthLeft = null;
Expand Down

0 comments on commit f485f7a

Please sign in to comment.