I am a newbie to the world of CNC. I currently struggle to spell CNC. I am trying to learn the software and one question is: How can I create new macros so I can press a key on the computer for it to go to a predetermined location? Or, how can I create a macro to re-home the CNC spindle to various locations of my choosing depending on where I would like it to be?
Thank you in advance for any help you are willing to give me.
@EVH5150 I’ve moved your question to the gSende question category for greater exposure.
As you have homing switches, a macro to move from machine zero to a specific spot on the bed is quite simple. I assume that you have a means of ensuring the the material is in the same place each time??
Here is where I display my CNC ignorance and probably become the worst person ever. As I am trying to create a macro in G-Sender I keep asking this question. Once you home your CNC to zero (where ever that is on your machine), what is the reason that there is not a button to click to add a preset for the macro in regard to the location on the board? In the recording software we can save presets and recall them, on a simply calculator you can press M+, and in a browser you can bookmark a page. It seems that with G54 - G59 (and probably more locations) you could find your location relative to zero and press something that will add a preset location to the part of the board your spindle is in location relative to zero.
In my case, I am short and I have a 4’x8’ work bench and when my machine homes it goes to the right rear corner of the board. This makes changing bits extremely difficult. I look like a monkey swinging from a jungle gym. Not a pretty sight. My goal is to bring the spindle front and center of the machine so I can easily change the bit.
Here is where I have a huge blind spot and I do expect to find out what an idiot I am.
To Zero the workspace you won’t need a macro, just use a probe or click the Zero X, Y, Z or All button and it will zero the current workspace to the probes or machines position. Shortcuts are already available for them in the Settings, macros are also set up as shortcuts in the same location.
If you’re still curious, here’s an example of a macro that basically does the same as the Zero All button.
Macro - Zero All
;//////////////////////
;// SET WORKSPACE ZERO
;//////////////////////
;// POP UP TO CONFIRM SETTING CHANGE
M0; ZERO ALL CURRENT WORKSPACE COORDINATES? ____________________________________________________________________________________ CLICK TO CONTINUE.
;// GET CURRENT WORKSPACE
%WCS = modal.wcs
;// GET P NUMBER FROM WCS
%WCSP = (WCS == "G54") ? "P1" : (WCS == "G55") ? "P2" : (WCS == "G56") ? "P3" : (WCS == "G57") ? "P4" : (WCS == "G58") ? "P5" : (WCS == "G59") ? "P6" : "WORKSPACE ERROR"
;// SET CURRENT WORKSPACE ZERO TO CURRENT POSITION
G10 L20 [WCSP] X0 Y0 Z0
;// PRINT LOCATION TO TO CONSOLE
([WCS] ZERO SET TO: X:[mposx], Y:[mposy], Z:[mposz])
This next macro is very similar to the Go XY0 button, which will go to the current workspace zero position. You can set the macro up to move the machine to whatever workspace coordinates you like just by changing the X#Y# values. The following two macros are written assuming a homing cycle has been completed.
Macro - Move to workspace XY zero
;//////////////////////////
;// GOTO WORKSPACE XY ZERO
;//////////////////////////
;// SAVE CONTROLLER SETTINGS
%UNITS=modal.units, DISTANCE=modal.distance
;// CREATE VARIABLE TO CALL AT THE END TO RESTORE CONTROLLER SETTINGS
%RESTORE_SETTINGS = [UNITS] + [DISTANCE]
;// SET MACRO UNITS AND DISTANCE MODE (INCHES)(ABSOLUTE)
G20 G90
;// MOVE Z UP OUT OF THE WAY FIRST (MACHINE ZERO)
G53 Z0
;// MOVE TO CURRENT WORKSPACE XY ZERO COORDINATES
G1 X0Y0 F100
[RESTORE_SETTINGS]
A macro could be set up like the last example using the current workspace coordinates G54, G55, etc or machine coordinates G53, but If you’re just looking for a parking position, G28 and G30 predefined coordinates on the controller can be set up.
Here’s a macro for moving to G28, and if it’s already there it will move to G30 and vice versa.
I will add an example macro of how to set the coordinates, but I just use the console since it’s not something that is changed very often, just need to type in G28.1 or G30.1 with the machine at the position you want to set.
Macro - Move to G28 or G30
;///////////////////
;// GO TO G28 OR G30
;///////////////////
;// SAVE CONTROLLER SETTINGS
%UNITS=modal.units, DISTANCE=modal.distance
;// CREATE VARIABLE TO CALL AT THE END TO RESTORE CONTROLLER SETTINGS
%RESTORE_SETTINGS = [UNITS] + [DISTANCE]
;// SET MACRO UNITS AND DISTANCE MODE (INCHES)(ABSOLUTE)
G20 G90
;// REFRESH CONTROLLER DATA
$#
;// WAIT MAKE SURE DATA IS RECEIVED
G4 P0.25
;// GET CURRENT COORDINATES
%MPOS = {x: mposx, y: mposy, z: mposz}
;// GET SAVED G28 AND G30 COORDINATES
%PARK_ONE = {x: params.G28.x, y: params.G28.y, z: params.G28.z,}
%PARK_TWO = {x: params.G30.x, y: params.G30.y, z: params.G30.z,}
;// FUNCTION TO MAKE SURE VALUES ARE NUMBERS WITH SAME AMOUNT OF DECIMAL PLACES
%TF = function(x){return Number(x).toFixed(3)}
;// FUNCTION TO CHECK IF COORDINATE OBJECTS ARE EQUAL
%CHECK = function(object){return (TF(MPOS.x) == TF(object.x)) && (TF(MPOS.y) == TF(object.y)) && (TF(MPOS.z) == TF(object.z)) }
;// SET UP CHECK FOR IF CURRENT POSITION IS AT G28 OR G30
%G28_CHECK = CHECK(PARK_ONE)
%G30_CHECK = CHECK(PARK_TWO)
;// SET UP MOVEMENT, (IF NOT AT G28 OR G30 MOVE TO G28)(IF AT G30 MOVE TO G28) (IF AT G28 MOVE TO G30)
%SET_MOVE = (G28_CHECK != true) && (G30_CHECK != true) ? "G28" : (G28_CHECK != true) && (G30_CHECK == true) ? "G28" : (G28_CHECK == true) && (G30_CHECK != true) ? "G30" : "(--"
;// MOVE Z UP OUT OF THE WAY FIRST (MACHINE ZERO)
G53 Z0
;// MOVE TO SET PARK COORDINATES G28 OR G30
[SET_MOVE]
;// RESTORE CONTROLLER SETTINGS
[RESTORE_SETTINGS]
Macro - Set G28
;//////////////////////
;//SET G28 COORDINATES
;//////////////////////
;// POP UP TO CONFIRM CHANGE
M0; CHANGE G28 COORDINATES? ____________________________________________________________________________________ CLICK TO CONTINUE.
;// SAVE CURRENT COORDINATES TO G28
G28.1
;// PRINT LOCATION TO TO CONSOLE
(G28 SET TO MACHINE COORDINATES: X:[mposx], Y:[mposy], Z:[mposz])
More about macros and shortcuts can be found here…
Thank you for replying. I have read that section regarding macros and it doesn’t make sense to me. I have tried typing in the locations for X, Y, and Z and it does nothing. Is it possible for someone to explain it in newbie terms of how to do a simple reposition macro so that when I click on the macro to run it, it will them move the spindle to where I would like it.
I have tried finding the formula in the drop down menu and fill in the coordinates however that didn’t yield any positive results nor did the spindle head move back in to position once it was moved off the front and center position.
Which formula should I use?
As an example, is this the correct format for typing in a location macro?
G59; G0, X289, Y510, Z1.16; G54
This information is all relative to the home location in the right rear of the CNC machine.
The other question I have regarding storing a preset location based on zero is one that I would like to learn the reason this is not an option. It seems that “Save Preset” based on zero would be an idea that could be implemented.
@EVH5150 I’ll send you a short and sweet macro later this morning, but remind me, which machine do you have? If it’s a sienci machine, which controller?
@EVH5150 I don’t speak for Sienci, but to reply to your question about why a preset location is not an option, I would think it’s because it would not be of much use. I don’t want some postion preset dictating where I put the material, nor where the router moves so that I can change bits. That preset could mean that the machine travels over clamps, for example. Also, some times, I set XY0 to the centre of the material and other times, I set it to the left front corner. If the XY0 position was preset, I would lose that ability.
You have a preset location. It is machine zero as set by your limit switches. (I don’t have limit switches on my machine.) @cjm has provided you with macros that will do exactly what you are asking. With respect, I don’t quite understand what more you want.
If you want to continue to use gSender, I strongly suggest that you read all the documentation on its functions.
Hello gwilki. The point of the macros is to bring the spindle to me without having to hold an arrow down until it arrives. Also, to have the spindle move up and out of the way upon completion of a project. What is confusing to me is the drop down menu and the formula to select to create a position/location macro. I know for a fact that the advice @cjm gave me is correct. However, it is a bit of a foreign language to me and the application of the information given to me is also not clear. What I am hoping for…unfortunately…are step by step instructions on how to do things. Once I understand it…then teaching it is easy.
I use to teach MRI for G.E. and I had to work hard to find common language that everyone understood and a repeatable step by step way of how to do things and to repeatable explain how everything impacts everything else.
Fast forward to today’s success. After I HOMED the machine…when I went in to SETTINGS, selected SHORTCUTS, selected LOCATION from the drop down menu, that is where I found the four corners of the CNC. Once I was there I simply had to assign a key stroke that was not assigned and then the spindle moved to the appropriate corner. Basically I assigned a hot key to each corner and the software treats each corner like a HOME position, thus raising the spindle in the Z direction which would get it out of the way of any clamps (most of the time).
Where I got myself in to trouble is I was trying to assign it to a position front and center to change the bits as needed. This is where I fixated to much on that without seeing the other possibilities. In my world…(trust me when I say my world is not that important)…if I can go in to SETTINGS and change a toggle switch from INCHES to MM then why is that not possible for other functions. In one stroke,they removed the need for G20 and G21 commands. I am sure that I am over simplifying things and I will pay a price for that as well.
When I go in to ADD A NEW MACRO…this is where I get confused. Naming the MACRO and giving is a description is easy. What confuses me is in the MACRO COMMANDS and then the MACRO VARIABLES drop down menu. The formula for programming/inserting values is what is further confusing. I do understand that me being even newer than a newbie that I am missing things (…which seems to be my motto at this point in time). When people talk about beginner videos for learning some things seem to be glossed over and assumed which leaves gaps for confusion.
As I said, I had some success today which I will take the win and run like hell. I will be back at it tomorrow. I know that if I can learn the physics of Radiology and learn to be an Audio Engineer then I can pretty much learn anything. For me it will be a matter of going after it every day until I figure it out.
On, what I hope is a more positive note, THANK YOU to @gwilki and @cjm for your help and patience. I hope that you won’t run for cover every time that I come around.
@EVH5150 I’m confused by this last post. Did you add the macro that @cjm wrote that will move your spindle to a set location?
I had said that I would send a short macro, but @cjm beat me to it, so I held back. His macros are far more elaborate than mine and beyond my meager abilities.
If you did not install his macro, was it because you want to understand it before doing so? I can’t help you there at all.
I did not type the macros as I am still unclear on what/how I am suppose to do this. Here is what I did figure out.
After I HOMED the machine…when I went in to SETTINGS, selected SHORTCUTS, selected LOCATION from the drop down menu, that is where I found the four corners of the CNC. Once I was there I simply had to assign a key stroke that was not assigned and then the spindle moved to the appropriate corner. Basically I assigned a hot key to each corner and the software treats each corner like a HOME position, thus raising the spindle in the Z direction which would get it out of the way of any clamps (most of the time).
Go in and HOME the machine.
Select SETTINGS.
Select SHORTCUTS.
Select LOCATION from the drop down menu.
Assign a key to each corner that is essentially a HOME corner.
In my case, the right rear corner is HOME which is ZERO and that is assigned the 1 key for the shortcut. For the front right corner I assigned 2 for the shortcut key. For the front left corner I assigned 3 for the shortcut key. Lastly I assigned 4 for the rear left corner.
This effectively raises the spindle to zero on the Z axis and pushes the spindle out of the way when I press 2 or 4 on my keyboard.
If you have the E-Stop switch from Sienci Labs, it has three buttons that can be assigned to various functions.
You could create a macro to move the Axis’s to a tool change location, for example, then assign that macro to one of those buttons.
Then you would have a button to invoke that move.
Hello @JohnnyL . Thank you for this feedback. Would you be willing to give an example in steps to demonstrate what you’re talking about. Just a friendly reminder, I am a complete newbie to this.
I could show you but it’s really as simple as making sure Z is up to a safe level then G53 G0X-20.0 Y-40.0 if it’s inches or of course the equivalent in mm of wherever you want to park it. The homing position is the Machine zero not your work offset zero. If you know where it is you can go from it as well by just saying G0 G90 G54 X0.0 Y0.0 (or wherever you want to park it relative to your work offset zero) To clarify, G53 is working off the machine zero, G90 works from your G54 or whatever offset you are using. Email me at larrytech54@gmail.com if you want me to demonstrate anything.