Machsupport Forum
Mach Discussion => VB and the development of wizards => Topic started by: UnKnown on May 14, 2015, 06:48:58 PM
-
Ok so I've been looking all night for an anser to this. It just hit me the other day that it "should" be very simple to have the CNC machine do a rapid move towards the homing switches and just stop like 10 mm shy of the switch. Then slowly do the homing and DRO zero of all axes. How ever, I cant get it to work.
Im using the 2010-screen set and Im editing the VB-script files for the homing buttons for X Y & Z.
So, this is what I've tried.
Code "G53 G0 Z-10"
DoButton(24)
Gode "G53 G0 Z-5"
While IsMoving()
Wend
One would thing that this code would first rapidly go to Z-10 and then rund the "DoButton(24) command. After that do a rapid move to Z-5. But NOOoooOOO!
Im guessing Ive missed something here, or I do not know how the "DoButton()" commands work. But as long as I have a "DoButton()" command anywhere in the code, it will FIRST rund that command. Then everything else.
What am I doing wrong?
Worth to mention, for this to work I have checked "PersistanceDRO" function.
What I want to do, in the end, is, when I push the "Ref all button", I want the CNC machine to do a rapid move to -10 mm from the homing switchen in all three axis, before doing the homing thingy :)
Is this possible? And if yes.. how do I make it so?
Regards
Magnus
-
Code "G53 G0 Z-10"
While IsMoving()
Wend
DoButton(24)
While IsMoving()
Wend
Gode "G53 G0 Z-5"
While IsMoving()
Wend
Be careful, because before you home, your machine may not know where Z-10 is.
-
Just a thought, could you wrap the CODE in a do while loop, set full speed until 2 mm (.2") from 0 then set the rapid speed to 30% OR SO
x=SetOEMDRO(800)
Do While x>2
[place normal code here ]
Exit Do
SetOEMDRO(223)=((GetOEMDRO(223)/100)*30)
[place normal code here]
Loop
regards
Wes
-
x=SetEOMDRO(800) should be x=GetOEMDRO(800)
and have a look at my 1024.set page one mod. next to the FRO slider.
it uses * and / to plus and minus the Rapid.
-
Gerry
Thank you very much for the clarification. And also, thanks for the screenset. It is a beutiful thing :)
I will be carefull. I'm well aware about what "can" happen. But as long as Mach3 dont forget its last possition (which I assume it wont) I think everything will work fine. I have had the CNC-machine for 1½ years now, so Im pretty comfortable in how it works
Thanks again Gerry. I will let you know of my success or failure ;)
-
Just a thought, could you wrap the CODE in a do while loop, set full speed until 2 mm (.2") from 0 then set the rapid speed to 30% OR SO
x=SetOEMDRO(800)
Do While x>2
[place normal code here ]
Exit Do
SetOEMDRO(223)=((GetOEMDRO(223)/100)*30)
[place normal code here]
Loop
regards
Wes
Hi there Wes
Not sure what this do? What would be the benifit of doing it this way?
As far as I know, when you call the "DoOEMButton()" command, the CNC machine will slow down to a set %-value in the settings (I do not recall where in the menu you find this).
Or is this code instead of the DoEOMButton command? :D (confused)
Thanks for the reply
-
The DoButton(24) I assume does a home move, the while ismoving() Wend statement is simply the sequence stopping all other actions till it's finished moving.
So if we get the x DRO co-ordinents (x=GetOEMDRO(800)) then place the do function between a loop that keeps checking the x value (x=GetOEMDRO(800))until it gets to 2 then reduce the rapid to a slower value, place the While IsMoving() Wend statement at the end of the loop.
As I don't have a 2010.set file I'm not sure of the button function.
Have a look at the 1024m screen I put there to see how I have done the slow down. It might help.
Wes
-
Wes
Ok I see what you mean. I ended up doing something similar but not "as advanced"
This is what I ended up with: (the modified file is for ref all axis M884.m1s)
Code "G53 G0 Z-20"
While IsMoving()
Wend
Code "G53 G1 F2000 Z-5"
While IsMoving()
Wend
Code "G53 G0 Y40 X40"
While IsMoving()
Wend
Code "G53 G1 F4000 Y5 X5"
While IsMoving()
Wend
DoButton(24)
While IsMoving()
Wend
Code "G53 G1 F9000 Z-5"
While IsMoving()
Wend
DoButton(23)
While IsMoving()
Wend
Code "G53 G1 F9000 Y5"
While IsMoving()
Wend
DoButton(22)
While IsMoving()
Wend
Code "G53 G1 F9000 X5"
While IsMoving()
Wend
As you can see, I do a rapid move to a "safe" distance from the home switches, then reduce the speed to 4000 mm/min on X & Y axis and to 2000 mm/min on the Z-axis.
It will also always start with Z, so that the machine wont collide with anything that might be laying around on the table.
And it works flawlessly!
Think of all the time I will save now everytime I have to ref my axis >:D
Thanks again to both of you for your help and ideas :)
Cheers from Sweden
-
Looks good. And if it works then that's a double winner
-
Something to remember When Mach3 first starts up it has NO idea where it is at in 3d space(your machine). So it would be possible if you ran the routine it could slam into the stops at full speed.
I would and do suggest for people to Refhome the machine at a reasonable safe speed then do a follow up at slow speed. Besides you only refhome once per machine session right ? No real time waisted compared to repairs.
Just a thought,
(;-) TP
-
Something to remember When Mach3 first starts up it has NO idea where it is at in 3d space(your machine). So it would be possible if you ran the routine it could slam into the stops at full speed.
I would and do suggest for people to Refhome the machine at a reasonable safe speed then do a follow up at slow speed. Besides you only refhome once per machine session right ? No real time waisted compared to repairs.
Just a thought,
(;-) TP
Sure.. I know all this.. and I hear what you are saying :)
With that in mind though.. im not sure if I agree with that Mach3 has no idea where the machine is. As long as you have not moved the machine with your own hands (when it is powered off) there is no problem at all. As long as you have activated "Persistance DRO" Mach3 will always remember the last machine coordinates. So even though you have turned the machine of and restarted Mach3, the Machine cooridantes wil be there.
So, I can not see anything that would go wrong here. As long as no one is tampering with the machine while it is off.
But I thank you for your advice.
-
As many times as I have seen Mach3 corrupt the XML on close( that is where your settings are stored) also people fiddle with your machine when you are not around(oh yes they do) and seen machines slam the stops I do not nor recommend trusting Mach3 for that.
BUT it is your machine, have at it. (;-)
(;-) TP
-
Haha. I appriciate your concern. If someone fiddels with my machine.. I will know. There are only 4 of us that are able to do so. And I know them all. No one has (as of yet) done anything like that.
With that said.. If Mach3 will screw up, well.. that is a different story. I will, how ever, keep an eye on the machine coordinates when I start Mach3. If it seems odd, or if the coordinates are all zero.. well.. then I cant runt the command. Or, I can run it.. the machine will just not ref that fast. No harm will come to it though.
Now this may not "save the machine" if something do happen, but I have adjusted the program so that the machine wont to a rapid move all the way to the home switches. It wil stop 20 mm away from them.. then move slower towards them and stop 5 mm short of the switch. If it would "hit the switch" in 4000 mm/min, there will be no harm. It will stop long before it hits the physical stop.
Anyway.. whith all that said. I cant guranantee that it will never do something stupid.. but I will take my changes.. for now ;)