Skip to content
This repository was archived by the owner on Jan 29, 2018. It is now read-only.

Commit f6f6909

Browse files
wip
1 parent b58f10c commit f6f6909

File tree

2 files changed

+19
-9
lines changed

2 files changed

+19
-9
lines changed

i/dxf/gcode/three2gcode.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,13 @@ console.log('RapidSpeed', rapidSpeed);
5858
var isLaserOn = false;
5959
var isAtClearanceHeight = false;
6060
var isFeedrateSpecifiedAlready = false;
61+
subj_paths = [];
6162
console.log(txtGrp);
6263
txtGrp.traverse( function(child) {
6364
if (child.type == "Line") {
6465
// let's create gcode for all points in line
6566
for (i = 0; i < child.geometry.vertices.length; i++) {
67+
6668
var localPt = child.geometry.vertices[i];
6769
var worldPt = grp.localToWorld(localPt.clone());
6870
if (i == 0) {
@@ -80,6 +82,8 @@ console.log('RapidSpeed', rapidSpeed);
8082
g += "G0 X" + worldPt.x.toFixed(3) +
8183
" Y" + worldPt.y.toFixed(3) + " F" + rapidSpeed + "\n";
8284

85+
86+
//subj_paths.push(worldPt.x.toFixed(3) +',' + worldPt.y.toFixed(3));
8387
// if milling move back to depth cut
8488
if (options.mode == "mill") {
8589
var halfDistance = (options.millclearanceheight - options.milldepthcut) / 2;
@@ -131,6 +135,7 @@ console.log('RapidSpeed', rapidSpeed);
131135
g += " X" + worldPt.x.toFixed(3);
132136
g += " Y" + worldPt.y.toFixed(3);
133137
g += " S" + options.lasersvalue + "\n";
138+
subj_paths.push(worldPt.x.toFixed(3) +',' + worldPt.y.toFixed(3));
134139

135140

136141
}
@@ -155,10 +160,15 @@ console.log('RapidSpeed', rapidSpeed);
155160
g += "G0 Z" + options.millclearanceheight + "\n";
156161
isAtClearanceHeight = true;
157162
}
163+
//subj_path2 = getInflatedPath(subj_paths, 3, 3);
164+
console.log('Subj Path', subj_path2);
165+
158166
}
159167
});
160168

161169
console.log("generated gcode. length:", g.length);
170+
//subj_paths = ClipperLib.Clipper.SimplifyPolygons(subj_paths, ClipperLib.PolyFillType.pftEvenOdd);
171+
console.log('Subj Path', subj_paths);
162172
//console.log("gcode:", g);
163173
// $('#' + this.id + " .gcode").val(g).prop('disabled', false);
164174
// $('#' + this.id + " .btn-sendgcodetows").prop('disabled', false);

i/main.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1438,23 +1438,23 @@ $(document).ready(function() {
14381438
drawEntity(i, dxf2.entities[i]);
14391439
};
14401440

1441-
// Make a copy to show, because we need the original copy, untranslated, for the gcodewriter parsing
1442-
showDxf = dxfObject.clone();
14431441

14441442
// Make the 'geometry' object disappear
14451443
for (i=0; i<dxfObject.children.length; i++) {
1446-
dxfObject.children[i].material.color.setHex(0x00ff00);
1447-
dxfObject.children[i].material.opacity = 0;
1444+
dxfObject.children[i].material.color.setHex(0x000000);
1445+
dxfObject.children[i].material.opacity = 0.3;
14481446
}
14491447

14501448
// Sadly removing it from the scene makes gcode circles end up at 0,0 since localToWorld needs it in the scene
14511449
scene.add(dxfObject);
14521450

1453-
// And display the showpiece, translated to virtual 0,0
1454-
showDxf = dxfObject.clone();
1455-
showDxf.translateX(laserxmax /2 * -1);
1456-
showDxf.translateY(laserymax /2 * -1);
1457-
scene.add(showDxf);
1451+
// // Make a copy to show, because we need the original copy, untranslated, for the gcodewriter parsing
1452+
// showDxf = dxfObject.clone();
1453+
// // And display the showpiece, translated to virtual 0,0
1454+
// showDxf = dxfObject.clone();
1455+
// showDxf.translateX(laserxmax /2 * -1);
1456+
// showDxf.translateY(laserymax /2 * -1);
1457+
// scene.add(showDxf);
14581458

14591459
Array.prototype.unique = function()
14601460
{

0 commit comments

Comments
 (0)