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
[Solved]dxf file name in gcode
Moderator: andrew
Forum rules
Always indicate your operating system and QCAD version.
Indicate the post processor used.
Attach drawing files and screenshots.
Post one question per topic.
Always indicate your operating system and QCAD version.
Indicate the post processor used.
Attach drawing files and screenshots.
Post one question per topic.
[Solved]dxf file name in gcode
Last edited by jamby on Thu Nov 07, 2019 5:56 pm, edited 1 time in total.
Re: dxf file name in gcode
No, I will add those to the next release of GCodeBase.
For now, you can register your own variables:
In the constructor:
Add a function writeFile:
This gives you [INFILENAME] and [INFILEPATH].
For now, you can register your own variables:
In the constructor:
Code: Select all
// register additional variables:
this.registerVariable("inputFileName", "INFILENAME", true, "", 0);
this.registerVariable("inputFilePath", "INFILEPATH", true, "", 0);
Code: Select all
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);
};
Re: dxf file name in gcode
Sorry Andrew
But as always I am having trouble getting this to work.
Maybe you could take a look?
Thanks
Jim
But as always I am having trouble getting this to work.
Maybe you could take a look?
Thanks
Jim
Re: dxf file name in gcode
You have two implementations of LxcncIn.prototype.writeFile. The second one will overwrite the first one:
You'll have to combine the contents to get only one writeFile:
Code: Select all
// define writeFile:
LxcncIn.prototype.writeFile = function(fileName) { ... };
// define writeFile again, with different contents, overwriting the first one:
LxcncIn.prototype.writeFile = function(fileName) { ... };
Code: Select all
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);
};
Re: dxf file name in gcode
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
Thanks
Jim
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
Thanks
Jim
Re: dxf file name in gcode
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
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