Hi I need some help
I need make a condicion IF on post
if toolname===AGGREGATE10
[N] PAN=[NUMBERTOOL] UT=1 XIN=[START_X] YIN=[START_Y-] TID=1 XFI=[END_X] YFI=[ENDY-] PRF=[-Z-] VT=[FP] VF=[F] INV=0 USC=0 RES=1 Z=PRK L=G102
ELSE
NORMAL CODE
Condition
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.
Re: Condition
Do you already have a post processor and are you trying to add this to it? If so, please attach. Or are you starting from scratch? Thanks.
Re: Condition
Thanks.
Is it the text block this.contourHeader that would be adjusted, depending on the tool?
In general, you would change the contents of that text block, depending on the tool before the text block is written to the file:
Is it the text block this.contourHeader that would be adjusted, depending on the tool?
In general, you would change the contents of that text block, depending on the tool before the text block is written to the file:
Code: Select all
BIESSE.prototype.writeBlock = function(name) {
if (this.getCurrentToolName()==="AGGREGATE10") {
// tool is AGGREGATE10
this.contourHeader = [ "[N] PAN=..." ];
}
else {
// tool is not AGGREGATE10
this.contourHeader = [ "[N] PAN=1 ..." ];
}
// call base class to write the text block:
GCodeBase.prototype.writeBlock.call(this, name);
};
Re: Condition
I have problem on tool correction
When is AGGREGATE10 IS SAW need tool compensation without G41/G42
And old BUG when I change tool direction I need close QCAD and Open again for do correct NC.
I use last Version o QCAD
BIESSE.prototype = new GCodeBase();
BIESSE.prototype.writeBlock = function(name) {
if (this.getCurrentToolName()==="AGGREGATE10") {
// tool is AGGREGATE10
this.registerVariable("xStartPosition", "X1", true, "", "DEFAULT", "DEFAULT");
this.registerVariable("yStartPosition", "Y1", true, "", "DEFAULT", "DEFAULT");
this.registerVariable("zStartPosition", "Z1", true, "", "DEFAULT", "DEFAULT");
this.registerVariable("xPosition", "X", false, "", "DEFAULT", "DEFAULT");
this.registerVariable("yPosition", "Y", false, "", "DEFAULT", "DEFAULT");
this.registerVariable("zPosition", "Z", false, "", "DEFAULT", "DEFAULT");
this.outputOffsetPath = true;
this.contourHeader = [ "[N] PAN=1 ST1=\"[T]\" L=PCUA",
"[N] PAN=1 UT=1 XIN=[X1] YIN=[Y1-] TID=1 XFI=[X] YFI=[Y-] PRF=[Z-] VT=[FP] VF=[F] INV=0 USC=0 RES=1 Z=PRK L=G102" ];
this.zPassFirstHeader = [];
this.zPassHeader = [];
this.firstLinearMove = [];
this.linearMove = [];
this.footer = ["%"];
this.contourFooter =[];
this.linearMoveCompensationLeft = [];
this.linearMoveCompensationRight = [];
this.linearMoveCompensationOff = [];
}
else {
// tool is not AGGREGATE10
this.outputOffsetPath = false;
this.contourHeader = [ "[N] PAN=1 ST1=\"[T]\" L=PCUA" ];
this.zPassFirstHeader = [ "[N] [X1] [Y1-] Z=PRK TP=1 PRF=[Z1-] F=[F] VF=[FP] G40 L=PON TRZ=0 M55"];
this.zPassHeader = [ "[N] [X1] [Y1-] Z=PRK TP=1 PRF=[Z-] F=[F] VF=[FP] G40 L=PON TRZ=0 M55 "];
this.firstLinearMove = [ "[N] G1 [X] [Y-]"];
this.linearMove = [ "[N] G1 [X] [Y-]"];
this.footer = [
"[N] G0 L=POFF",
"%"
];
this.contourFooter = ["[N] L=POFF",];
this.linearMoveCompensationLeft = [ "[N] G42 G69 [X] [Y-] G1 "];
this.linearMoveCompensationRight = ["[N] G41 G69 [X] [Y-] G1 "];
this.linearMoveCompensationOff = [
"[N] G40 [X] [Y-] G1 ",
"[N] L=PSU",
];
}
// call base class to write the text block:
GCodeBase.prototype.writeBlock.call(this, name);
};
When is AGGREGATE10 IS SAW need tool compensation without G41/G42
And old BUG when I change tool direction I need close QCAD and Open again for do correct NC.
I use last Version o QCAD
BIESSE.prototype = new GCodeBase();
BIESSE.prototype.writeBlock = function(name) {
if (this.getCurrentToolName()==="AGGREGATE10") {
// tool is AGGREGATE10
this.registerVariable("xStartPosition", "X1", true, "", "DEFAULT", "DEFAULT");
this.registerVariable("yStartPosition", "Y1", true, "", "DEFAULT", "DEFAULT");
this.registerVariable("zStartPosition", "Z1", true, "", "DEFAULT", "DEFAULT");
this.registerVariable("xPosition", "X", false, "", "DEFAULT", "DEFAULT");
this.registerVariable("yPosition", "Y", false, "", "DEFAULT", "DEFAULT");
this.registerVariable("zPosition", "Z", false, "", "DEFAULT", "DEFAULT");
this.outputOffsetPath = true;
this.contourHeader = [ "[N] PAN=1 ST1=\"[T]\" L=PCUA",
"[N] PAN=1 UT=1 XIN=[X1] YIN=[Y1-] TID=1 XFI=[X] YFI=[Y-] PRF=[Z-] VT=[FP] VF=[F] INV=0 USC=0 RES=1 Z=PRK L=G102" ];
this.zPassFirstHeader = [];
this.zPassHeader = [];
this.firstLinearMove = [];
this.linearMove = [];
this.footer = ["%"];
this.contourFooter =[];
this.linearMoveCompensationLeft = [];
this.linearMoveCompensationRight = [];
this.linearMoveCompensationOff = [];
}
else {
// tool is not AGGREGATE10
this.outputOffsetPath = false;
this.contourHeader = [ "[N] PAN=1 ST1=\"[T]\" L=PCUA" ];
this.zPassFirstHeader = [ "[N] [X1] [Y1-] Z=PRK TP=1 PRF=[Z1-] F=[F] VF=[FP] G40 L=PON TRZ=0 M55"];
this.zPassHeader = [ "[N] [X1] [Y1-] Z=PRK TP=1 PRF=[Z-] F=[F] VF=[FP] G40 L=PON TRZ=0 M55 "];
this.firstLinearMove = [ "[N] G1 [X] [Y-]"];
this.linearMove = [ "[N] G1 [X] [Y-]"];
this.footer = [
"[N] G0 L=POFF",
"%"
];
this.contourFooter = ["[N] L=POFF",];
this.linearMoveCompensationLeft = [ "[N] G42 G69 [X] [Y-] G1 "];
this.linearMoveCompensationRight = ["[N] G41 G69 [X] [Y-] G1 "];
this.linearMoveCompensationOff = [
"[N] G40 [X] [Y-] G1 ",
"[N] L=PSU",
];
}
// call base class to write the text block:
GCodeBase.prototype.writeBlock.call(this, name);
};
Re: Condition
You moved all the code from the constructor into writeBlock. This is not the idea (please see post above). writeBlock should only change the text blocks you want to change and call the base class to write the text block.
Re: Condition
I do this because they repete some code.
Show me how do this
Show me how do this
Code: Select all
BIESSE.prototype = new GCodeBase();
BIESSE.prototype.writeBlock = function(name) {
if (this.getCurrentToolName()==="AGGREGATE10") {
// tool is AGGREGATE10
this.registerVariable("xStartPosition", "X1", true, "", "DEFAULT", "DEFAULT");
this.registerVariable("yStartPosition", "Y1", true, "", "DEFAULT", "DEFAULT");
this.registerVariable("zStartPosition", "Z1", true, "", "DEFAULT", "DEFAULT");
this.registerVariable("xPosition", "X", false, "", "DEFAULT", "DEFAULT");
this.registerVariable("yPosition", "Y", false, "", "DEFAULT", "DEFAULT");
this.registerVariable("zPosition", "Z", false, "", "DEFAULT", "DEFAULT");
this.outputOffsetPath = true;
this.contourHeader = [ "[N] PAN=1 ST1=\"[T]\" L=PCUA",
"[N] PAN=1 UT=1 XIN=[X1] YIN=[Y1-] TID=1 XFI=[X] YFI=[Y-] PRF=[Z-] VT=[FP] VF=[F] INV=0 USC=0 RES=1 Z=PRK L=G102" ];
this.zPassFirstHeader = [];
this.zPassHeader = [];
this.firstLinearMove = [];
this.linearMove = [];
this.footer = ["%"];
this.contourFooter =[];
this.linearMoveCompensationLeft = [];
this.linearMoveCompensationRight = [];
this.linearMoveCompensationOff = [];
}
else {
// tool is not AGGREGATE10
this.outputOffsetPath = false;
this.contourHeader = [ "[N] PAN=1 ST1=\"[T]\" L=PCUA" ];
this.zPassFirstHeader = [ "[N] [X1] [Y1-] Z=PRK TP=1 PRF=[Z1-] F=[F] VF=[FP] G40 L=PON TRZ=0 M55"];
this.zPassHeader = [ "[N] [X1] [Y1-] Z=PRK TP=1 PRF=[Z-] F=[F] VF=[FP] G40 L=PON TRZ=0 M55 "];
this.firstLinearMove = [ "[N] G1 [X] [Y-]"];
this.linearMove = [ "[N] G1 [X] [Y-]"];
this.footer = [
"[N] G0 L=POFF",
"%"
];
this.contourFooter = ["[N] L=POFF",];
this.linearMoveCompensationLeft = [ "[N] G42 G69 [X] [Y-] G1 "];
this.linearMoveCompensationRight = ["[N] G41 G69 [X] [Y-] G1 "];
this.linearMoveCompensationOff = [
"[N] G40 [X] [Y-] G1 ",
"[N] L=PSU",
];
}
// call base class to write the text block:
GCodeBase.prototype.writeBlock.call(this, name);
};