If toolType

Discussions around the CAM Add-On of QCAD.

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.

Post Reply
Claudiosp
Junior Member
Posts: 21
Joined: Tue Feb 11, 2020 4:17 pm

If toolType

Post by Claudiosp » Fri Jul 29, 2022 4:12 pm

Nee some help this not work

Code: Select all

BIESSE.prototype.writeBlock = function(name) {
    if (toolType===Cam.ToolType.Drill) {
        // Drill
		
		this.toolHeader = [];
		this.firstPointMoveZ = ["[N] [X] [Y-] T[T] VF=[FP] PRF=[Z-] L=G99", ];
		
	}
   // call base class to write the text block:
    GCodeBase.prototype.writeBlock.call(this, name);
};

User avatar
andrew
Site Admin
Posts: 9037
Joined: Fri Mar 30, 2007 6:07 am

Re: If toolType

Post by andrew » Fri Jul 29, 2022 4:22 pm

toolType is not defined in this function. You should also set the text blocks for other tool type, otherwise they will change for the first drill tool and never change back.

Code: Select all

BIESSE.prototype.writeBlock = function(name) {
    // get current tool type:
    var toolType = this.getCurrentToolType();
    if (toolType===Cam.ToolType.Drill) {
        // Drill
		
		this.toolHeader = [];
		this.firstPointMoveZ = ["[N] [X] [Y-] T[T] VF=[FP] PRF=[Z-] L=G99", ];
		
	}
	else {
	   // fill in text blocks for other tools:
	   this.toolHeader = ...
	   this.firstPointMoveZ = ...
	}
   // call base class to write the text block:
    GCodeBase.prototype.writeBlock.call(this, name);
};

Claudiosp
Junior Member
Posts: 21
Joined: Tue Feb 11, 2020 4:17 pm

Re: If toolType

Post by Claudiosp » Fri Jul 29, 2022 5:34 pm

this not work

this.firstPointMoveZ = ["[N] [X] [Y-] T[T] VF=[FP] PRF=[Z-] L=G99", ];
Attachments
Braço Sofá.dxf
(246.2 KiB) Downloaded 274 times
BIESSE.js
(7.96 KiB) Downloaded 269 times

CVH
Premier Member
Posts: 3416
Joined: Wed Sep 27, 2017 4:17 pm

Re: If toolType

Post by CVH » Sat Jul 30, 2022 6:04 am

Claudiosp wrote:
Fri Jul 29, 2022 5:34 pm
this not work

Code: Select all

this.firstPointMoveZ = ["[N] [X] [Y-] T[T] VF=[FP] PRF=[Z-] L=G99", ];
A shot in the dark:
this.firstPointMoveZ is set to an array [...].
A comma separates each member of an array [AAA, BBB, CCC].
Here AAA is a string "[N] [X] [Y-] T[T] VF=[FP] PRF=[Z-] L=G99" and there is no second item.
That would then default to 'Undefined'.

This also occurs in this.fileExtensions, in this.header and in this.contourFooter. :wink:

Things in the output text between square brackets are replaced by their current value, the rest is treated as literal.
e.g. the "L=G99" at the end of this.firstPointMoveZ.

Regards,
CVH

Claudiosp
Junior Member
Posts: 21
Joined: Tue Feb 11, 2020 4:17 pm

Re: If toolType

Post by Claudiosp » Sat Jul 30, 2022 9:53 am

Tks for reply.
I problem i have is when i need use drill this.toolHeader = []; but i create if AGGREGATE10 is this else that i just want remove this.toolHeader = []; when use drill.

CVH
Premier Member
Posts: 3416
Joined: Wed Sep 27, 2017 4:17 pm

Re: If toolType

Post by CVH » Sat Jul 30, 2022 4:37 pm

Claudiosp wrote:
Sat Jul 30, 2022 9:53 am
this.toolHeader = [];
Means that the header for a tool is defined as an empty array ...
... In other words nothing is exported to the G-code as tool header.
From what I can make up of your reply, that would be the case for drilling.

The function BIESSE.prototype.writeBlock is called every time something is being written.
Remark that this function is declared twice In the BIESSE.js of your post above.

You initialy reported that this.firstPointMoveZ doesn't work ....
... Simply because the writeBlock function is overwritten by the second duplicate.

In the second one this.toolHeader is in both cases set to "[N] PAN=1 ST1=\"[T]\" L=PCUA" ...
... and this.firstPointMoveZ does not occur at all.

In the other topic Andrew remarked that you do not move all the code to the BIESSE.prototype.writeBlock ...
... For example, register all your variables in the main class and surely not only once in an if-else clause.


Regards,
CVH

Post Reply

Return to “QCAD/CAM”