@@ -41,11 +41,11 @@ Changelog
41
41
12 Nov 2021 - V1.0.28 : Added property group names, fixed default router selection, now uses permittedCommentChars (sharmstr)
42
42
24 Nov 2021 - V1.0.28 : Improved coolant selection, tweaked property groups, tweaked G53 generation, links for help in comments.
43
43
21 Feb 2022 - V1.0.29 : Fix sideeffects of drill operation having rapids even when in noRapid mode by always resetting haveRapid in onSection
44
- 10 May 2022 - V1.0.30 : Change naming convention for first file in multifile output
44
+ 10 May 2022 - V1.0.30 : Change naming convention for first file in multifile output (Sharmstr)
45
45
*/
46
46
obversion = ' V1.0.30' ;
47
47
description = " OpenBuilds CNC : GRBL/BlackBox" ; // cannot have brackets in comments
48
- longDescription = description + " : Post" + obversion; // adds description to post library diaglog box
48
+ longDescription = description + " : Post" + obversion; // adds description to post library dialog box
49
49
vendor = " OpenBuilds" ;
50
50
vendorUrl = " https://openbuilds.com" ;
51
51
model = " GRBL" ;
@@ -317,7 +317,8 @@ function rpm2dial(rpm, op)
317
317
var speeds = [0, 10000, 14000, 18000, 23000, 27000, 32000];
318
318
}
319
319
else
320
- { // this is Makita R0701
320
+ {
321
+ // this is Makita R0701
321
322
var speeds = [0, 10000, 12000, 17000, 22000, 27000, 30000];
322
323
}
323
324
if (rpm < speeds[1])
@@ -400,7 +401,7 @@ function writeBlock()
400
401
401
402
/**
402
403
Thanks to nyccnc.com
403
- Thanks to the Autodesk Knowledge Network for help with this at
404
+ Thanks to the Autodesk Knowledge Network for help with this at
404
405
https://knowledge.autodesk.com/support/hsm/learn-explore/caas/sfdcarticles/sfdcarticles/How-to-use-Manual-NC-options-to-manually-add-code-with-Fusion-360-HSM-CAM.html!
405
406
*/
406
407
function onPassThrough(text)
@@ -771,15 +772,15 @@ function gotoInitial(checkit)
771
772
if (debug) writeComment(" gotoInitial end" );
772
773
}
773
774
774
- // write a G53 Z retract
775
+ // write a G53 Z retract
775
776
function writeZretract ()
776
777
{
777
778
zOutput.reset();
778
779
writeln("(This relies on homing, see https://openbuilds.com/search/127200199/?q=G53+fusion )");
779
780
writeBlock(gFormat.format(53), gMotionModal.format(0), zOutput.format(toPreciseUnit( properties.machineHomeZ, MM))); // Retract spindle to Machine Z Home
780
781
gMotionModal.reset();
781
782
zOutput.reset();
782
- }
783
+ }
783
784
784
785
785
786
function onSection ()
@@ -791,7 +792,7 @@ function onSection()
791
792
var maxfeedrate = section.getMaximumFeedrate();
792
793
if (debug) writeComment("onSection " + sectionId);
793
794
haveRapid = false; // drilling sections will have rapids even when other ops do not
794
-
795
+
795
796
onRadiusCompensation(); // must check every section
796
797
797
798
if (isPlasma)
@@ -923,8 +924,9 @@ function onSection()
923
924
{
924
925
writeZretract();
925
926
}
926
- else if (properties.generateMultiple && (tool.number != getPreviousSection().getTool().number))
927
- writeZretract();
927
+ else
928
+ if (properties.generateMultiple && (tool.number != getPreviousSection().getTool().number))
929
+ writeZretract();
928
930
929
931
gotoInitial(true);
930
932
@@ -1059,7 +1061,7 @@ function onRapid(_x, _y, _z)
1059
1061
1060
1062
function onLinear (_x, _y, _z, feed)
1061
1063
{
1062
- //if (debug) writeComment("onLinear " + haveRapid);
1064
+ //if (debug) writeComment("onLinear " + haveRapid);
1063
1065
if (powerOn || haveRapid) // do not reset if power is off - for laser G0 moves
1064
1066
{
1065
1067
xOutput.reset();
@@ -1275,14 +1277,23 @@ function onClose()
1275
1277
1276
1278
function onTerminate ()
1277
1279
{
1278
- // If we are generating multiple files, then rename first file to add # of #
1279
- // If you dont want to show the log file, then untick "open in Open file in NC editor"
1280
- if (filesToGenerate > 1) {
1281
- var fileIndexFormat = createFormat({ width: 2, zeropad: true, decimals: 0 } );
1282
- var newOutput = FileSystem.replaceExtension(getOutputPath(), fileIndexFormat.format(1 ) + ' of' + filesToGenerate + ' .' + extension);
1283
- FileSystem.moveFile(getOutputPath(), newOutput);
1284
- executeNoWait(newOutput, ' ' , false, ' ' );
1285
- }
1280
+ // If we are generating multiple files, copy first file to add # of #
1281
+ // Then remove first file and recreate with file list - sharmstr
1282
+ if (filesToGenerate > 1)
1283
+ {
1284
+ var outputPath = getOutputPath();
1285
+ var outputFolder = FileSystem.getFolderPath(getOutputPath());
1286
+ var programFilename = FileSystem.getFilename(outputPath);
1287
+ FileSystem.copyFile(outputPath, FileSystem.replaceExtension(outputPath, fileIndexFormat.format(1) + 'of' + filesToGenerate + '.' + extension));
1288
+ FileSystem.remove(outputPath);
1289
+ var file = new TextFile(outputFolder + "\\" + programFilename, true, "ansi");
1290
+ file.writeln("The following gcode files were created: ");
1291
+ for (var i = 0; i < filesToGenerate; ++i)
1292
+ {
1293
+ file.writeln(programName + '.' + fileIndexFormat.format(i + 1) + 'of' + filesToGenerate + '.' + extension);
1294
+ }
1295
+ file .close();
1296
+ }
1286
1297
}
1287
1298
1288
1299
function onCommand (command)
0 commit comments