Hello Guest it is March 28, 2024, 08:08:03 AM

Author Topic: Mach 4 scaling and keyboard button mapping  (Read 6475 times)

0 Members and 1 Guest are viewing this topic.

Offline smav

*
  •  55 55
    • View Profile
Mach 4 scaling and keyboard button mapping
« on: March 22, 2018, 11:33:02 PM »
I have two issues with mach 4, just upgraded motion control card and up from mach 3.

1) mach 3 had scaling boxes next to the DROs to scale your project up or down and I did see a little bit on a thread where it appears someone added the same to their mach 4 back in 2014. I am by no means a programmer, i just build, import or convert pictures and models to cad drawings to create the toolpath and gcode for and that is about as far as I am interested in programming. So is there a simple/easy way to add the scale feature as was found in the mach 3 that I was running?

2) In regards to keyboard mapping, it appears the mapping feature that can be done in mach 4 under configure>plugins>Keyboard Shortcuts - Newfangled Solutions is pretty limited to the 4 axis movements and can't really assign a key for stop, e-stop, increase/decrease jog, spindle speed and so on. Is there a way to add those functions to the functions column in that table for configuring keyboard inputs?
« Last Edit: March 22, 2018, 11:37:46 PM by smav »
Re: Mach 4 scaling and keyboard button mapping
« Reply #1 on: March 23, 2018, 01:42:24 AM »
Hi,
a DRO calculator is already available. Under Operator Tab check DRO Auto Calc. Click on a DRO and enjoy.

I will have to do a little more thinking to answer your second query.

Craig
'I enjoy sex at 73.....I live at 71 so its not too far to walk.'

Offline smav

*
  •  55 55
    • View Profile
Re: Mach 4 scaling and keyboard button mapping
« Reply #2 on: March 23, 2018, 10:06:43 PM »
ya I kind of figured out that the dro calculator button is basically an on screen numeric key pad but what I want is to add the input DROs for scaling. I have seen a few mach 4 screenshots on one thread where it shows the scale DRO and one guy stated he figured it out and posted his script seen below. However I am no programmer and do not understand where you would place this script. I have played around with the program enough to know how to add stuff and modify my screen but not how to add a function as shown below so it will resize the project like you could do in mach 3 with the scale function. Why wasn't that just incorporated in to mach 4 as it was in mach 3? It should actually be on the program extents tab for easy reference once you re-size a project.

local chkVar3 = ReadReg("iRegs0/xscale");
    if (chk3 ~= chkVar3) then
        chk3 = chkVar3
        if (chkVar3 ~= 1) then
            code = string.format("G51 X%0.4f",tostring(chkVar3));
            scr.SetProperty('droX1', 'Fg Color', 'Red');
       else
            code = string.format("G50");
            scr.SetProperty('droX1', 'Fg Color', 'Green');
        end
        mc.mcCntlGcodeExecute(inst, code);
    end
« Last Edit: March 23, 2018, 10:08:20 PM by smav »
Re: Mach 4 scaling and keyboard button mapping
« Reply #3 on: March 23, 2018, 11:15:11 PM »
Hi,

Quote
Why wasn't that just incorporated in to mach 4 as it was in mach 3?

The reason is because Mach4 is NOT Mach3 and never will be.

For NFS to survive commercially they have to sell and Hobbyist and one off Industrial licence sales just wont do it, there is just not enough income to employ
staff and run a business. That requires OEM sales and lots of them.

OEMs have the clues and expertise to program Mach4 and their machines pretty much anyway they please due to Mach4's flexibility. As a Hobbyist you will
HAVE TO do the same. NFS is not going to waste time and resources because a hobbyist cant or cant be bothered to customize Mach to their liking.

That means for most of us that Mach4 is a distinct learning challenge, some refuse to take up the challenge, some drop out finding it beyond them and some
persevere. I have persevered, to date at least, and still really only scratching the surface but have found immense satisfaction in doing so. Further, among the regulars
on the forum this is a common theme, struggled at the beginning but once you get going really really luv it!

Craig
'I enjoy sex at 73.....I live at 71 so its not too far to walk.'
Re: Mach 4 scaling and keyboard button mapping
« Reply #4 on: March 23, 2018, 11:19:51 PM »
Hi,
as to your second query you may have noted the responses in this thread:

http://www.machsupport.com/forum/index.php/topic,36879.0.html

And Daz has a video of exactly what you require:

https://www.youtube.com/watch?v=yzaf5pT0l50

Craig
'I enjoy sex at 73.....I live at 71 so its not too far to walk.'

Offline smav

*
  •  55 55
    • View Profile
Re: Mach 4 scaling and keyboard button mapping
« Reply #5 on: March 24, 2018, 12:09:51 AM »
thanks that was a great video on assigning keys to functions not listed under the regular keyboard function list.

Offline smav

*
  •  55 55
    • View Profile
Re: Mach 4 scaling and keyboard button mapping
« Reply #6 on: March 24, 2018, 08:11:19 PM »
Does anyone know how to create and install the DROs circled in the attached picture to have the same functionality in mach 4 as they do in mach 3? If so and you are interested let me know what you would charge to modify my mach 4 program so that it has those same buttons and functions

NOTE: Couldn't get picture to insert in to this text box or get it to send as an attachment. I kept getting an error that I have already attached that file, although I have never attached a file to any post, but the buttons I am asking about are the scale DROs next to the axis DROs in mach 3.

« Last Edit: March 24, 2018, 08:18:12 PM by smav »
Re: Mach 4 scaling and keyboard button mapping
« Reply #7 on: March 25, 2018, 12:35:15 AM »
Hi,
use 'Additional Options' to the lower left of the text input box. It wiil allow you to browse to a file to attach.

Note that if the Mach Forum detects that you have already posted a file which will sometimes happen if you bobble a post you will have to rename it to re-post.

The correct way to scale axes is to use G50 and G51. You could make an on screen button which MDIs a G50 which would scale that particular Gcode file or until
a G51.

Another possibility is to change the 'Steps per Unit', this could be done programmatically but I think most would regard it as poor practice. The APIs for such purposes were
intended as configuration aids not as regularly used programmatic tools.
'I enjoy sex at 73.....I live at 71 so its not too far to walk.'

Offline smav

*
  •  55 55
    • View Profile
Re: Mach 4 scaling and keyboard button mapping
« Reply #8 on: March 25, 2018, 05:57:53 PM »
UPDATE--I went back to the mach 3 program and dug around in some of there scripts and oem codes and figured out how they performed the scaling in that. I had to make several modifications to the code that I had found in post under mach 4 from 2014 in order to get that to work. For the most part that code that the user had shared on his post got me in to the ball park but there were some errors and things left out that caused issues.

I have one basic issue at this point and that is figuring out how to get it to only issue the gcode command once instead of getting stuck in a loop or at least I think that is what is occuring. At this time I can resize my image to whatever I want but when I click the enable button, it appears that the gcode starts executing and toggles between line 1 and 2 and the timer starts running. I basically only need to the code to execute when i change the value in the dro and/or click on regen tool path.
« Last Edit: March 25, 2018, 05:59:46 PM by smav »

Offline smav

*
  •  55 55
    • View Profile
Re: Mach 4 scaling and keyboard button mapping
« Reply #9 on: March 25, 2018, 06:29:16 PM »
LAST UPDATE---Figured out the "looping" problem and I can now scale any axis by simply entering the value in to the DRO's and they will scale just like you could do in mach 3. When  I select regen tool path it will resize the picture on the tool path table as well as update the extents.