@@ -43,8 +43,9 @@ Changelog
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
44
10 May 2022 - V1.0.30 : Change naming convention for first file in multifile output (Sharmstr)
45
45
xx Sep 2022 - V1.0.31 : better laser, with pierce option if cutting
46
+ 06 Dec 2022 - V1.0.32 : fix long comments that were getting extra brackets
46
47
*/
47
- obversion = ' V1.0.31 ' ;
48
+ obversion = ' V1.0.32 ' ;
48
49
description = " OpenBuilds CNC : GRBL/BlackBox" ; // cannot have brackets in comments
49
50
longDescription = description + " : Post" + obversion; // adds description to post library dialog box
50
51
vendor = " OpenBuilds" ;
@@ -440,34 +441,34 @@ function myMachineConfig()
440
441
}
441
442
}
442
443
444
+ // Remove special characters which could confuse GRBL : $, !, ~, ?, (, )
445
+ // In order to make it simple, I replace everything which is not A-Z, 0-9, space, : , .
446
+ // Finally put everything between () as this is the way GRBL & UGCS expect comments
443
447
function formatComment(text)
444
448
{
445
449
return (" (" + filterText(String(text), permittedCommentChars) + " )" );
446
450
}
447
451
448
452
function writeComment(text)
449
453
{
450
- // Remove special characters which could confuse GRBL : $, !, ~, ?, (, )
451
- // In order to make it simple, I replace everything which is not A-Z, 0-9, space, : , .
452
- // Finally put everything between () as this is the way GRBL & UGCS expect comments
453
454
// v20 - split the line so no comment is longer than 70 chars
454
455
if (text.length > 70)
455
456
{
456
457
//text = String(text).replace( /[^a-zA-Z\d :=,.]+/g, " " ); // remove illegal chars
457
- text = formatComment (text);
458
+ text = filterText (text.trim(), permittedCommentChars );
458
459
var bits = text.split(" " ); // get all the words
459
460
var out = '';
460
461
for (i = 0; i < bits.length; i++)
461
462
{
462
- out += bits[i] + " " ;
463
+ out += bits[i] + " " ; // additional space after first line
463
464
if (out.length > 60) // a long word on the end can take us to 80 chars!
464
465
{
465
- writeln(" ( " + out.trim() + " ) " );
466
+ writeln(formatComment( out.trim() ) );
466
467
out = " " ;
467
468
}
468
469
}
469
470
if (out.length > 0)
470
- writeln(" ( " + out.trim() + " ) " );
471
+ writeln(formatComment( out.trim() ) );
471
472
}
472
473
else
473
474
writeln(formatComment(text));
0 commit comments