jamby
1
Hi
I use a number of headers in my gcode
this.header = [
“%”,
“( CREATED WITH QCAD-CAM )”,
“( FILE PATH: [FILEPATH])”,
“( FILE NAME: [FILENAME])”,
“( DATE/TIME: [DATE_TIME])”,
“( CUTTER NUM: [T])”,
“( CUTTER DIA: [TD])”,
“( CUTTER NOTES: [PROGRAM_NAME])”,
“[N] G20 G17 G40 G49 G80 G90 G94”,
“[N] G64 P0.001” // tighten tolerance
];
Is there one that will write the filepath and filename for the dxf file that is generating the gcode?
Thanks
Jim
andrew
2
No, I will add those to the next release of GCodeBase.
For now, you can register your own variables:
In the constructor:
// register additional variables:
this.registerVariable("inputFileName", "INFILENAME", true, "", 0);
this.registerVariable("inputFilePath", "INFILEPATH", true, "", 0);
Add a function writeFile:
MyPostPRocessor.prototype.writeFile = function(fileName) {
// initialize additional variables:
this.inputFilePath = this.cadDocument.getFileName();
this.inputFileName = new QFileInfo(this.inputFilePath).fileName();
return GCodeBase.prototype.writeFile.call(this, fileName);
};
This gives you [INFILENAME] and [INFILEPATH].
jamby
3
Sorry Andrew
But as always I am having trouble getting this to work.
LxcncIn.js (2.64 KB)
GCodeBase.js (7.6 KB)
Maybe you could take a look?
Thanks
Jim
andrew
4
You have two implementations of LxcncIn.prototype.writeFile. The second one will overwrite the first one:
// define writeFile:
LxcncIn.prototype.writeFile = function(fileName) { ... };
// define writeFile again, with different contents, overwriting the first one:
LxcncIn.prototype.writeFile = function(fileName) { ... };
You’ll have to combine the contents to get only one writeFile:
LxcncIn.prototype.writeFile = function(fileName) {
// init date / time variable:
var today = new Date();
this.dateTime = formatDate(today, "dd/MMM/yyyy hh:mm:ss");
// initialize additional variables:
this.inputFilePath = this.cadDocument.getFileName();
this.inputFileName = new QFileInfo(this.inputFilePath).fileName();
GCodeIN.prototype.writeFile.call(this, fileName);
};
jamby
5
Andrew
I still have a error somewhere?
Version: 3.18.1.0 (3.18.1)
Internet: QCAD.org
Build Date: Oct 4 2017
Revision: 24e23aa
Qt Version: 5.8.0
Architecture: x86_64
Compiler: gcc 4.8.1
PostP-test.ngc (417 Bytes)
LxcncIn.js (2.52 KB)
Thanks
Jim
jamby
6
Andrew
And the error is the operator. If you don’t save the file with a name before compiling the gcode you won’t get a name in the INFILENAME value.
Its working fine now…
Thanks again
Jim