How to change default values in the CAM Profile Toolpath dialog?

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
Sprung
Junior Member
Posts: 11
Joined: Thu Jun 10, 2021 11:35 am

How to change default values in the CAM Profile Toolpath dialog?

Post by Sprung » Thu Jun 10, 2021 12:00 pm

Hello,
how can i set the preferences in the Cam Profile Toolpath Menu?
thanks
Matura

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

Re: How to set preferences in CAM Profile Toolpath?

Post by andrew » Thu Jun 10, 2021 12:19 pm

Unfortunately, I don't understand your question. Please elaborate, include screenshots, etc., thanks.

Sprung
Junior Member
Posts: 11
Joined: Thu Jun 10, 2021 11:35 am

Re: How to set preferences in CAM Profile Toolpath?

Post by Sprung » Thu Jun 10, 2021 12:53 pm

I want to set i.e. the cutting depth or the side/direction parameters to my requirements when open the Menu. I almost need 2mm cutting depth, preferece is 4mm.

thanks
Matura
Attachments
versionqcad.PNG
versionqcad.PNG (49.25 KiB) Viewed 20608 times
camprofiletoolpath.PNG
camprofiletoolpath.PNG (45.42 KiB) Viewed 20608 times

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

Re: How to change default values in the CAM Profile Toolpath dialog?

Post by andrew » Thu Jun 10, 2021 1:16 pm

Changing the default values is possible, yes.

Please indicate which post processor you are using, so we can assist you efficiently, thanks.

Sprung
Junior Member
Posts: 11
Joined: Thu Jun 10, 2021 11:35 am

Re: How to change default values in the CAM Profile Toolpath dialog?

Post by Sprung » Fri Jun 11, 2021 9:16 am

Hello Andrew,

iam using an adapted Gcodeoffset [mm] postprocessor.

thanks
Matura

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

Re: How to change default values in the CAM Profile Toolpath dialog?

Post by andrew » Tue Jun 15, 2021 12:28 pm

You can override initDialog in your post processor and change the default values, for example:

Code: Select all

GCodeOffsetMM.prototype.initDialog = function(dialog, di, resourceBlock) {
    // adjust profile toolpath dialog:
    if (dialog.objectName==="CamProfileToolpathDialog") {
        // change default cutting depth:
        var leCuttingDepth = dialog.findChild("CamZCuttingDepth");
        leCuttingDepth.setValue(20);

        // change default side:
        var cbSide = dialog.findChild("CamSide");
        cbSide.currentIndex = 0; // 0: none, 1: outside, 2: inside

        // change default direction:
        var cbDirection = dialog.findChild("CamDirection");
        cbDirection.currentIndex = 0; // 0: Left, 1: Right
    }
};
You can find more control widget names in the attached user interface definition file (XML).
Attachments
CamProfileToolpathDialog.ui
(21.78 KiB) Downloaded 569 times

Sprung
Junior Member
Posts: 11
Joined: Thu Jun 10, 2021 11:35 am

Re: How to change default values in the CAM Profile Toolpath dialog?

Post by Sprung » Wed Jun 23, 2021 8:49 am

Hello Andrew,
thanks!
regards
Matura

newyd_cnc
Junior Member
Posts: 21
Joined: Thu Feb 02, 2023 6:06 pm

Re: How to change default values in the CAM Profile Toolpath dialog?

Post by newyd_cnc » Fri Feb 03, 2023 4:50 pm

Hello,

I managed to set the default values for some of the fields in this dialogue window, thank you for sharing the ui file allowing to find the widget names.

I am however unable to modify the combobox items , namely the side/direction comboboxes.

In the solution you provide you suggest the following:
var cbSide = dialog.findChild("CamSide");
cbSide.currentIndex = 0; // 0: none, 1: outside, 2: inside

however, this doesn't seem to work: the combobox stays on its default (0) value whichever value is set in the script overriding.

From the Qt documentation on QComboBox I gathered that we should rather call the member function setCurrentIndex(int index) as currentIndex is just a member variable accessor. I have therefore tried he following:
cbSide.setCurrentIndex(2); // 0: none, 1: outside, 2: inside

in order to set the "inside" option by default. This unfortunately does not work either. Could you provide a hint to why that is or perhaps a solution?
Than you
L.

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

Re: How to change default values in the CAM Profile Toolpath dialog?

Post by CVH » Fri Feb 03, 2023 10:50 pm

Hi,

Both should be valid:
cbSide.currentIndex = 2;
cbSide.setCurrentIndex(2);

We can find a mix of the two methods throughout the QCAD scripts.

The questions remains if:
A) var cbSide = dialog.findChild("CamSide");
Returns a widget ... Maybe the UI file has changed since Jun 2021 ...
If the variable cbSide holds something isn't tested ... :roll:

B) cam.js doesn't override it again.

Regards,
CVH

Daniel4
Junior Member
Posts: 17
Joined: Sat Jan 30, 2021 5:34 pm
Location: Wisconsin

Re: How to change default values in the CAM Profile Toolpath dialog?

Post by Daniel4 » Tue May 02, 2023 5:05 pm

Hello,
Any update on this? I am not able to change offset side via this code inside my .js post processor file, and it looks like that is where this thread stopped...

Code for default values in the Camprofiletoolpath dialog box starts at line 310 in the js file attached...

...
// change default side:
var cbSide = dialog.findChild("CamSide");
cbSide.setCurrentIndex(2); // 0: none, 1: outside, 2: inside
...

Looks like I am having luck with Safe Z, cutting depth, and overcut, so it's a start. :D

Also, I am interested in changing default values in the CamDrillToolpath dialog box, but I don't know where to start.

Windows 11
Qcad version 3.27.8.0


Thank you kindly.
GCD.js
(13.67 KiB) Downloaded 304 times

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

Re: How to change default values in the CAM Profile Toolpath dialog?

Post by CVH » Tue May 02, 2023 6:11 pm

Hi,
I managed to export the CamDrillToolpathDialog a while ago:
https://www.qcad.org/rsforum/viewtopic. ... log#p39032

Indeed this thread stopped with 2 unanswered questions.

Meanwhile I opened a feature request to include a GroupCustom widget in CAM Toolpath dialogs.
https://qcad.org/bugtracker/index.php?d ... sk_id=2418

Regards,
CVH

Daniel4
Junior Member
Posts: 17
Joined: Sat Jan 30, 2021 5:34 pm
Location: Wisconsin

Re: How to change default values in the CAM Profile Toolpath dialog?

Post by Daniel4 » Wed May 03, 2023 5:16 pm

Hello,
thank you for those two links. A custom widget to edit these would be fantastic.
In the mean time, I made a quick AHK script to cycle through all of the fields and throw in some default values.

That file is attached if anyone wants to gander and tweak for their personal preferences. You'll need to change the extension to .AHK and have AHK installed.

Regards,
CamDrillToolpath.txt
(1.74 KiB) Downloaded 320 times

Post Reply

Return to “QCAD/CAM”