You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: OpenbuildsFusion360PostGrbl.cps
+35-5
Original file line number
Diff line number
Diff line change
@@ -34,8 +34,9 @@ Changelog
34
34
02 Oct 2020 - V1.0.20 : Fix for long comments and new restrictions
35
35
05 Nov 2020 - V1.0.21 : poweron/off for plasma, coolant can be turned on for laser/plasma too
36
36
04 Dec 2020 - V1.0.22 : Add Router11 and dial settings
37
+
16 Jan 2021 - V1.0.23 : Remove endoffile marker '%' from endof output, arcs smaller than toolRadius will be linearized
37
38
*/
38
-
obversion = 'V1.0.22';
39
+
obversion = 'V1.0.23';
39
40
description = "OpenBuilds CNC : GRBL/BlackBox"; // cannot have brackets in comments
40
41
vendor = "OpenBuilds";
41
42
vendorUrl = "https://openbuilds.com";
@@ -80,6 +81,7 @@ properties =
80
81
PowerThrough : 50,
81
82
PowerEtch : 2,
82
83
UseZ : false, // if true then Z will be moved to 0 at beginning and back to 'retract height' at end
84
+
linearizeSmallArcs: false, // arcs with radius < toolRadius have radius errors, linearize instead?
83
85
machineVendor : "OpenBuilds",
84
86
machineModel : "Generic",
85
87
machineControl : "Grbl 1.1 / BlackBox",
@@ -165,11 +167,17 @@ propertyDefinitions = {
165
167
type:"spatial",
166
168
group: 6
167
169
},
170
+
linearizeSmallArcs: {
171
+
title:"Linearize Small Arcs",
172
+
description: "Arcs with radius < toolRadius can have mismatched radii, set this to Yes to linearize them.",
173
+
type:"boolean",
174
+
group: 6
175
+
},
168
176
169
177
_Section5: {title:"--- LASER/PLASMA CUTTING OPTIONS ---", description:"Informational only. Not used for any computation.", type:"string", group: 7},
170
178
PowerVaporise: {title:"Power for Vaporizing", description:"Scary power VAPORIZE power setting, in percent.", group:8, type:"integer"},
171
179
PowerThrough: {title:"Power for Through Cutting", description:"Normal Through cutting power, in percent.", group:8, type:"integer"},
172
-
PowerEtch: {title:"Power for Etching", description:"Just enoguh power to Etch the surface, in percent.", group:8, type:"integer"},
180
+
PowerEtch: {title:"Power for Etching", description:"Just enough power to Etch the surface, in percent.", group:8, type:"integer"},
173
181
UseZ: {title:"Use Z motions at start and end.", description:"Use True if you have a laser on a router with Z motion, or a PLASMA cutter.", group:8, type:"boolean"},
174
182
175
183
_Section6: {
@@ -217,7 +225,7 @@ var feedOutput = createVariable({prefix:"F"}, feedFormat);
217
225
var sOutput = createVariable({prefix:"S", force:false}, rpmFormat);
218
226
var mOutput = createVariable({force:false}, mFormat); // only use for M3/4/5
219
227
220
-
// for arcs, use extra digit (not used anymore from jan 2018)
228
+
// for arcs
221
229
var xaOutput = createVariable({prefix:"X", force:true}, arcFormat);
222
230
var yaOutput = createVariable({prefix:"Y", force:true}, arcFormat);
223
231
var zaOutput = createVariable({prefix:"Z", force:false}, arcFormat);
@@ -250,6 +258,7 @@ var haveRapid = false; // assume no rapid moves
250
258
var powerOn = false; // is the laser power on? used for laser when haveRapid=false
251
259
var retractHeight = 1; // will be set by onParameter and used in onLinear to detect rapids
252
260
var linmove = 1; // linear move mode
261
+
var toolRadius; // for arc linearization
253
262
254
263
functiontoTitleCase(str) {
255
264
// function to reformat a string to 'title case'
@@ -626,6 +635,8 @@ function onSection() {
626
635
var tool = section.getTool();
627
636
var maxfeedrate = section.getMaximumFeedrate();
628
637
638
+
toolRadius = tool.diameter / 2.0;
639
+
629
640
if (!isFirstSection() && properties.generateMultiple && (tool.number != getPreviousSection().getTool().number)) {
writeBlock(gFormat.format(53), gFormat.format(0), zOutput.format(toPreciseUnit(properties.machineHomeZ, MM))); // Retract spindle to Machine Z Home
737
+
726
738
// Insert the Spindle start command
727
739
if (tool.clockwise) {
728
740
s = sOutput.format(tool.spindleRPM);
@@ -890,13 +902,22 @@ function onCircular(clockwise, cx, cy, cz, x, y, z, feed) {
890
902
var start = getCurrentPosition();
891
903
xOutput.reset();
892
904
yOutput.reset();
905
+
906
+
// arcs smaller than bitradius always have significant radius errors, so get radius and linearize them (because we cannot change minimumCircularRadius here)
907
+
// note that larger arcs still have radius errors, but they are a much smaller percentage of the radius
908
+
var rad = Math.sqrt(Math.pow(start.x - cx,2) + Math.pow(start.y - cy, 2));
909
+
if (properties.linearizeSmallArcs && (rad < toolRadius)) {
0 commit comments