View Full Version : Move to Table Base coordinate
EricSchimel
04-30-2016, 02:34 PM
So here's a question: I'm trying to write a script that moves to a specific TABLE BASE location, not one that is offset from my 0,0 location, so explain further:
I start my machine up and I do C3. My tool is now zeroed in X and Y off of the prox switches. I can zero my table base coordinates there too. This way I can set software limits for my table so no matter where I zero my job I can't drive the machine off of the table.
This works nicely for the keypad shortcuts, so even though I zero somewhere else on the table, my preset 1 always goes back to the TABLE BASE 0,0 (that's where I change my bits)
What I'm looking to do is make a script that sends the tool to a TABLE base location in X and Y, regardless of where my current 0,0 setting is. Does that make any sense?
Basically what I'm doing is trying to send my machine to a fixed zero plate, even though in my scripts I'm making sure I switch to absolute mode (SA) my moves are started from where ever I have zeroed, not from the table base 0....
Is there a certain way I do a move for this to work the way that I want?
bill.young
04-30-2016, 04:04 PM
So here's a question: I'm trying to write a script that moves to a specific TABLE BASE location, not one that is offset from my 0,0 location, so explain further:
I start my machine up and I do C3. My tool is now zeroed in X and Y off of the prox switches. I can zero my table base coordinates there too. This way I can set software limits for my table so no matter where I zero my job I can't drive the machine off of the table.
This works nicely for the keypad shortcuts, so even though I zero somewhere else on the table, my preset 1 always goes back to the TABLE BASE 0,0 (that's where I change my bits)
What I'm looking to do is make a script that sends the tool to a TABLE base location in X and Y, regardless of where my current 0,0 setting is. Does that make any sense?
Basically what I'm doing is trying to send my machine to a fixed zero plate, even though in my scripts I'm making sure I switch to absolute mode (SA) my moves are started from where ever I have zeroed, not from the table base 0....
Is there a certain way I do a move for this to work the way that I want?
A running tally of the table base corrdinate offsets are stored in System Variables: %(6) for X, %(7) for Y, and %(8) for Z. So one thing you might try is subtract the appropriate system variable from the system variable for the current location.
Maybe something like:
M2, &(1) - &(6), %(2) - %(7)
to move to Table base 0,0
And just as an FYI, the default XYZero routines reset the Table Base coordinates on every run, I think using the VA command?
EricSchimel
04-30-2016, 04:54 PM
Maybe I should have done a better job explaining this...
When I run XY Zero (The stock Shopbot zero routine) I get my table base, and my current location set to 0,0 at the physical bottom left corner of my machine.
So let's say I jog over to the middle of the table and zero my X and Y there by hitting Z2. So now my working 0,0 is somewhere in the middle of the table, but my table base coordinates 0,0 remains at the physical bottom left of the machine.
What I want in my script is to be able to say "Go to this location on the table base coordinates" (not in reference to wherever I've zero'd my current job..
I think what you're saying is that I can use those commands to MOVE my table base coordinates which is not something I want to do.
Gary Campbell
04-30-2016, 05:01 PM
Eric...
I would do it similar, but slightly different than Bill does. In your "go to zero plate" file:
Lift Z
&x_offset = 0
&Y_offset = 0
&x_offset = %(1) - %(6)
&y_offset = %(2) - %(7)
J2, {plate x} + &x_offset, {plate y} + &y_offset
Then run "normal z zero" code
You could also put the 2 offsets in the my variables file (and remove the "=0" lines) or even write them to the file. The ATC system uses table based cords for a number of things, look in the SbParts\Custom\ATC folder for more examples
bill.young
04-30-2016, 05:16 PM
Maybe I should have done a better job explaining this...
When I run XY Zero (The stock Shopbot zero routine) I get my table base, and my current location set to 0,0 at the physical bottom left corner of my machine.
So let's say I jog over to the middle of the table and zero my X and Y there by hitting Z2. So now my working 0,0 is somewhere in the middle of the table, but my table base coordinates 0,0 remains at the physical bottom left of the machine.
What I want in my script is to be able to say "Go to this location on the table base coordinates" (not in reference to wherever I've zero'd my current job..
I think what you're saying is that I can use those commands to MOVE my table base coordinates which is not something I want to do.
I'm still feeling like it does what you want.
In your example, when you move to the middle of the table and zero the X and Y there, the system Variable for your new X location, %(1) , is now 0 and the same for current Y, %(2). Your current working location is 0,0
The table base offset variables though will be how far you are from your table Base 0,0, the bottom left corner in your case. So for the middle of the table %(6) might be 48 and %(7) might be 24
To move back to your table base 0,0 you just subtract the table base offset value from the current location value when you make the move, and you should go back to table base 0,0
Your current location display will be -48,-24, but Table Base will be 0,0. If you want to go to somewhere other than table base 0,0, just add that value into the calculations in your move command.
Bill
EricSchimel
04-30-2016, 05:36 PM
Ah ok, Bills post is making more sense to me now Gary. Let me see if I can explain the code in English...
Lift Z <Lifts Z axis to predetermined safe level
&x_offset = 0 <Set's the offset back to 0. So in other words, if I had my tool zeroed out in the middle of the table, running this command would remove that "offset" and instead of my coordinates reading 0,0 out in the middle of the table they would read whatever my current table base coordinate is.
&Y_offset = 0 <same as above
&x_offset = %(1) - %(6) <I'm not clear on what these do
&y_offset = %(2) - %(7)
J2, {plate x} + &x_offset, {plate y} + &y_offset <Now that my offset is removed via the first two lines this jogs X and Y over to my plate location. It's doing that from the table base 0, adding the offset which we've set to 0 in the previous command?
Assuming I'm right about how this works, is there a way to do this without resetting the offset, or is that the only way? (Reason being is that one could potentially swap out a tool mid file, re-zero and not lose the offset)
bill.young
04-30-2016, 05:49 PM
Gary's routine is not resetting anything....either is mine. He's just done a neater job of what I did by putting the value of %(1) - %(6) into a user variable he has created called &x_offset, and the same for the Y axis.
&x_offset and &y_offset are nothing special in this case...they are just a place to store the result of the calculations to make the Move/Jog command cleaner. There's nothing in either method that resets the Table Base coordinates.
bill.young
04-30-2016, 05:51 PM
(Good to hear from you Gary..give me a call sometime if you get bored!)
EricSchimel
04-30-2016, 06:09 PM
Ahh! I get it now, the % values store the actual location according to the table base coordinates. This all makes sense now!
I couldn't find that in the ShopBot docs because I was looking in the wrong place (move commands)
Ok, NOW I can really write my script!
THANK YOU!
bill.young
04-30-2016, 06:15 PM
Bingo.
You can find out more about using system variables and see the list of all of them in the Programming manual...there's a link to it in the Help menu.
EricSchimel
05-01-2016, 12:32 PM
Ok, I've made some progress but I'm still having some trouble...
Here's what I'm using to test:
'Initialize
'Punch in where your fixed plate is
&platex = 19.7
&platey = -1
SA 'Let's be in Absolute Mode
SF,0 'Turn off limit checking temporarily
'This next line would zero X and Y if I wanted
'FP, XYzero custom
J2, %(1) - %(6)+&platex, %(2) - %(7)+&platey
'FP, z zero fixed.sbp
'J2, %(1) - %(6)+0, %(2) - %(7)+0
How I am testing is this:
C3 to zero X and Y. Then I jog out in the middle of the table and Z2. I run this script. It works once, but then if I don't touch anything and run it again it doesn't go back to the zero plate. It keeps heading in the same X and Y direction like it's moving to another plate.
I tried my best to boil this down to the most basic element: I'm trying to move the tool to a table base coordinate regardless of where zero has been set by the user.
To test out if I can do that, I C3'd, then jogged along X some distance, then I zeroed X (Zx). If I do MX, %1 the tool doesn't move. If I do MX, %6 the tool still doesn't move. This tells me that with these two variables they are both 0 so there's no way to come up with the true coordinates of the machine using these variables.
bill.young
05-01-2016, 12:48 PM
Ok, I've made some progress but I'm still having some trouble...
Here's what I'm using to test:
'Initialize
'Punch in where your fixed plate is
&platex = 19.7
&platey = -1
SA 'Let's be in Absolute Mode
SF,0 'Turn off limit checking temporarily
'This next line would zero X and Y if I wanted
'FP, XYzero custom
J2, %(1) - %(6)+&platex, %(2) - %(7)+&platey
'FP, z zero fixed.sbp
'J2, %(1) - %(6)+0, %(2) - %(7)+0
How I am testing is this:
C3 to zero X and Y. Then I jog out in the middle of the table and Z2. I run this script. It works once, but then if I don't touch anything and run it again it doesn't go back to the zero plate. It keeps heading in the same X and Y direction like it's moving to another plate.
I tried my best to boil this down to the most basic element: I'm trying to move the tool to a table base coordinate regardless of where zero has been set by the user.
To test out if I can do that, I C3'd, then jogged along X some distance, then I zeroed X (Zx). If I do MX, %1 the tool doesn't move. If I do MX, %6 the tool still doesn't move. This tells me that with these two variables they are both 0 so there's no way to come up with the true coordinates of the machine using these variables.
I'll check it out after lunch when I get back to the shop, but one way to see what's going on is to Type UV which will show you the Table Base Offset values for your current location. Are they staying at 0" when you move away from 0,0?
EricSchimel
05-01-2016, 01:05 PM
28057
I am seeing an offset when I C3, jog X, then zero X
I thought I could call that value by %6, but apparently %6 still equals zero even though I have an X offset value? I tried %61 (X offset for current file) but that didn't work either...
Gary Campbell
05-01-2016, 01:51 PM
Eric...
The "%(n)" system variables are the CURRENT user (1-5) and table 6-10) coordinates for a given axis. You cannot expect any motion when using them alone as a coordinate.
Think of this as "move to where I am"
Let me enter a "whine" here for a "G53" clone command. Lets call it "JT". This would allow exactly what you are looking for; a rapid move using table based coordinates. Desperately needed for fixed zero device and ATC use.
bill.young
05-01-2016, 02:11 PM
Eric...
The "%(n)" system variables are the CURRENT user (1-5) and table 6-10) coordinates for a given axis. You cannot expect any motion when using them alone as a coordinate.
Think of this as "move to where I am"
Let me enter a "whine" here for a "G53" clone command. Lets call it "JT". This would allow exactly what you are looking for; a rapid move using table based coordinates. Desperately needed for fixed zero device and ATC use.
Save this as a file and see if it works the way you expect:
************************************************** *********
' Store ZZero plate offsets in variables
&x_plate_offset = 3
&y_plate_offset = 2
' Find total distance offset from current location to actual 0,0
' and Store in variables
&x_tablebase_offset = %(1) + %(6)
&y_tablebase_offset = %(2) + %(7)
' Subtract those saved offset values from the current location, and add in plate offset values
M2, %(1) - &x_tablebase_offset + &x_plate_offset, %(2) - &y_tablebase_offset + &y_plate_offset
EricSchimel
05-01-2016, 02:47 PM
That appears to work! I just tried it on the Handibot (the big tool is busy) and it did exactly what I wanted it to.
Let me spit this back to you so I make sure I get it (and others will get it)
' Store ZZero plate offsets in variables This is pretty easy, just punch in the location of where the zero plate is
&x_plate_offset = 3
&y_plate_offset = 2
' Find total distance offset from current location to actual 0,0
' and Store in variables
&x_tablebase_offset = %(1) + %(6) This creates a variable for the table base offset that's adding the current location plus the offset, so say I had zeroed in the middle of the table and moved a little, this adds up those two values
&y_tablebase_offset = %(2) + %(7)
' Subtract those saved offset values from the current location, and add in plate offset values
M2, %(1) - &x_tablebase_offset + &x_plate_offset, %(2) - &y_tablebase_offset + &y_plate_offset This is where it gets tricky: You take %1 and minus the tablebase offset, that brings you to 0. Then you add back in the plate X location, bringing you to a positive value. To say it more simply, you used math to get us back to 0, then you added in the value for the plate X and Y
I know it works now, but do I get it?
Gary Campbell
05-01-2016, 02:54 PM
Eric...
Now you know why my first instinct was to store those offsets as variables. :) They just seem to work better than doing the calcs "on the fly"
bill.young
05-01-2016, 03:52 PM
Eric...
Now you know why my first instinct was to store those offsets as variables. :) They just seem to work better than doing the calcs "on the fly"
Gary's right as always...it's much clearer if you store things in variables as you go.
Seems like it should be easily simplified. My gut feeling is that all those %(1)'s can be eliminated...why don't you try something like this? Who knows, it might work?
************************************************** *****
' Store ZZero plate offsets in variables
&x_plate_offset = 3
&y_plate_offset = 2
' Since we want to move in the opposite direction from the way the offset is applied
' subtract it from 0
&x_tablebase_offset = (0 - %(6))
&y_tablebase_offset = (0 - %(7))
M2, &x_tablebase_offset + &x_plate_offset, &y_tablebase_offset + &y_plate_offset
srwtlc
05-01-2016, 04:00 PM
Here's something that may save a bunch of math. I haven't worked through it with your situation, but I use a system for saving jig/fixture offsets to return to at anytime, overwrite with a new location, or return to TBC (with a jog home if desired). Instead of using all the math (did that at first and then greatly simplified it), you might be able to use the ST command along with variables and a small set of files. Attached are the files used for it to look at. The Offset files show the simplified ST usage.
I use the Button program in v3.8 to display the desired buttons, but it could be done with just adding a file to the custom cut menu as well.
bill.young
05-02-2016, 09:34 AM
Gary's right as always...it's much clearer if you store things in variables as you go.
Seems like it should be easily simplified. My gut feeling is that all those %(1)'s can be eliminated...why don't you try something like this? Who knows, it might work?
************************************************** *****
' Store ZZero plate offsets in variables
&x_plate_offset = 3
&y_plate_offset = 2
' Since we want to move in the opposite direction from the way the offset is applied
' subtract from 0 or multiply by -1
&x_tablebase_offset = (0 - %(6))
&y_tablebase_offset = (0 - %(7))
M2, &x_tablebase_offset + &x_plate_offset, &y_tablebase_offset + &y_plate_offset
Finally got some time to test it out on a machine and this simplified version works fine. For those following along, sorry to have made it more complicated than it needed to be!
And nice job Scott.
Gary Campbell
05-02-2016, 10:00 AM
Bill....
Gary here again....
I would use "%(6) * -1)" rather than "0 - %6)" as subtraction can return undesired results when current position is negative.
http://www.talkshopbot.com/forum/images/misc/quote_icon.png Originally Posted by BillYoung http://www.talkshopbot.com/forum/images/buttons/viewpost-right.png (http://www.talkshopbot.com/forum/showthread.php?p=189914#post189914) Gary's right as always...
Nope!! but he gets there on the last time! You have to screw up many times to get the right answer! Like saying that even a blind squirrel will find a nut eventually.
bill.young
05-02-2016, 11:09 AM
Bill....
Gary here again....
I would use "%(6) * -1)" rather than "0 - %6)" as subtraction can return undesired results when current position is negative.
Great minds think alike! I added that to the comments in the quoted section of my last post, but forgot to note it!
Joe Porter
05-02-2016, 11:41 AM
Sometimes I feel like a pair of brown shoes in a room full of tuxedos....joe
dmidkiff
05-02-2016, 11:47 AM
Yeah I hear ya Joe. Pair of camo crocs here.
bill.young
05-02-2016, 01:43 PM
Yeah I hear ya Joe. Pair of camo crocs here.
Don't worry...you can go your whole ShopBotting career and make all kinds of amazing things and never have to think about this stuff. I almost never interact with the Table Base Coordinate system (as you may have guessed by how long it took me to remember how it worked!), but it's useful to know that in the background your ShopBot always keeps track of where's its physical 0,0 position is located, even when you re-zero somewhere else on the table.
That's the reason that file limit checking works...the software always knows where it is relative to the physical table, no matter how many times you try to fool it by re-zeroing.
dmidkiff
05-03-2016, 08:32 AM
Thanks Bill. Guys like you and Gary and Brady and Bleeth and Scott have been helping with this technical stuff for years. Thank you for that. I have learned a lot from the forum. I'm afraid that when I see the code for anything on the screen, my eyes glaze over. Makes it hard for me to concentrate so I can learn. I still try and sometimes a light comes on. I know that learning this stuff could make some things easier and maybe faster but can't seem to get past the glaze.
EricSchimel
05-03-2016, 09:07 AM
This is awesome. I was able to get my fixed zero plate code to work! I'm going to clean it all up and I should have something to post back if anyone else wants to use it for something.
bill.young
05-03-2016, 12:11 PM
Thanks Bill. Guys like you and Gary and Brady and Bleeth and Scott have been helping with this technical stuff for years. Thank you for that. I have learned a lot from the forum. I'm afraid that when I see the code for anything on the screen, my eyes glaze over. Makes it hard for me to concentrate so I can learn. I still try and sometimes a light comes on. I know that learning this stuff could make some things easier and maybe faster but can't seem to get past the glaze.
The truth is that software like VCarvePro has gotten so good that you never need to think about any of this fancy-pants stuff. In the very early days you really did have to know a bit of programming to do much with a ShopBot. but these days it's just icing on the cake.
For those of you interested in programming and development though, I'd suggest you check out the work going on with Fabmo and Fabmo apps. I went to a talk last week in DC and one of the speakers was from the National Science Foundation. His whole talk was about how the future of manufacturing was web-enabled and app-driven.
http://gofabmo.org/
Bill
EricSchimel
05-03-2016, 01:08 PM
You're totally right about that Bill. I used to be better at programming and now, 95% of what I do on a computer I can draw my way around/through/out of without having to touch code. The problem (for me) comes in when I have an understanding of the code and what it can do, but no daily experience.
I think with all of this cheap and powerful open hardware we're going through another renaissance of programming and app development. Having powerful programs like VCarve used in concert with open hardware and software can really level up a programmer and make them much more powerful.
Powered by vBulletin® Version 4.2.2 Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.