Machsupport Forum

Mach Discussion => VB and the development of wizards => Topic started by: fredeflint on October 16, 2016, 04:14:33 PM

Title: help withusing vbscript to "feedhold" gcode execution
Post by: fredeflint on October 16, 2016, 04:14:33 PM
Hi,

I am trying to write a macro with vbscript which will call feed hold using "DoOEMButton(1001)" but mach3 seems to blow right through the macro and the code does not pause in the same way it would if i hit space bar or click thefeed hold button on the default mill screen set. Is this the correct way to call a feedhold from a macro?

I found the feedhold button info on this page:
http://www.machsupport.com/Mach3Wiki/index.php?title=OEM_Buttons

Some background in case there is a better idea for doing what i want instead of feed hold:

I have multiple vise setup holding many blanks that will all get the same machining done on them.

I have a gcode that changes coordinates, calls the main part to cut the part several times etc, this all seems to work perfectly once the coordinate systems are setup.

What i desire is that at the beginning of each copy mach3 prompts the operator to verify the XY Zero is lined up. To check this i have a camera on the spindle, so the gcode moves the camera to what it thinks the XY zero for each respective part is before it cuts it. If it is not lined up I want the user to be able to jog the spindle to line up the camera, reset the coordinate system offset, and then continue.

My first attempt at this was to make MsgBox in vbscript that more or less says "is it ok" and you have yes or no. if yes it just continues, but if the msgbox returns no i call "code" M0", the spindle stops, you can jog, use some buttons i made to reset the coordinates once the camera is aligned.

This is almost a good enough solution EXCEPT i dont want the spindle to stop if i have to re align. And it seems that you cant jog once the msgbox is up.  So from what i understand a macro that just causes a feedhold would be excellent and i would not even need a msg box because for example, the gcode execution  would just pause at the beginning of each piece, and the operator can just correct the XY zero if needed and then hit cycle start again. I have tested with pressing space bar to feed hold and it does appear you can jog in feedhold hence why i think it may be the solution.

Any comments suggestions would be appreciated, while i have some experience making screen sets and other simple macros, i can't really think why the feedhold does not happen/do not have the deepest understanding of the software.
Title: Re: help withusing vbscript to "feedhold" gcode execution
Post by: TPS on October 17, 2016, 03:02:30 AM
hi,
i am not sure, but you can try also:

DoButton(1)

should be the same, but let's try.

Thomas
Title: Re: help withusing vbscript to "feedhold" gcode execution
Post by: stirling on October 17, 2016, 05:45:40 AM
By definition, feedhold only works when there's movement TO feedhold.

Whilst an M code is running, there IS no movement.

Try an M1 instead and see if that does what you want. (remember to enable it).
Title: Re: help withusing vbscript to "feedhold" gcode execution
Post by: RICH on October 17, 2016, 08:08:32 AM
Not an answer to your question.........................

Maybe consider setting up differently and use Work Offsets.
ie; Use camera to locate each work piece held in the vice to define work offset for each piece then run the same program code.

RICH
Title: Re: help withusing vbscript to "feedhold" gcode execution
Post by: RICH on October 17, 2016, 09:11:50 AM
Quote
while i have some experience making screen sets and other simple macros

Why not have some fun..................... automate the setup if your constantly making multiple parts in multiple fixtures.

Consider creating a screen page or set which would have vises along with DRO's for each vise or part in them.
Also have buttons to create the  different Work Offsets.
Simply put, could use the laser dot to locate work / vise or whatever and use the buttons to populate the Work Offset table.
OR
Maybe even refine the above to probe the locations.

Have a look in the Mach Tool box as you can use some wizards as a starting point for the screen and VB.

Something to think about,

RICH
Title: Re: help withusing vbscript to "feedhold" gcode execution
Post by: fredeflint on October 17, 2016, 10:28:17 AM
hi,
i am not sure, but you can try also:

DoButton(1)

should be the same, but let's try.

Thomas


OK i will try and let you know.
By definition, feedhold only works when there's movement TO feedhold.

Whilst an M code is running, there IS no movement.

Try an M1 instead and see if that does what you want. (remember to enable it).


Ok i will also try this.


Not an answer to your question.........................

Maybe consider setting up differently and use Work Offsets.
ie; Use camera to locate each work piece held in the vice to define work offset for each piece then run the same program code.

RICH

I already do this i think. basically i use G59 PX where X is the number of the vise say. THe GCODE is a bit more complicated because i also have on the screen buttons to turn on and off certain vise, in case i don't have all full load etc, then macros called from the gcode check the led state and branch the gcode accordingly to skip pieces.. I don;t use separate DROS for each piece though, but otherwise i think i am already doing most of what you suggested.  I attached a shot of my screen so far to give you an idea.

But nothing to do with the screen/gcode  is really causing issues i haven't been able to solve, i just want to be able to pause and then jog mid code without stopping the spindle, which i cant do yet.

THank you for the suggestions, i will try the out and report back tomorrow.
Title: Re: help withusing vbscript to "feedhold" gcode execution
Post by: stirling on October 17, 2016, 10:43:33 AM
hi,
i am not sure, but you can try also:

DoButton(1)

should be the same, but let's try.

Thomas


OK i will try and let you know.

No point. This is just the legacy way of doing a feedhold so for the reasons I've given above it won't work.
Title: Re: help withusing vbscript to "feedhold" gcode execution
Post by: fredeflint on October 17, 2016, 10:57:44 AM
hi,
i am not sure, but you can try also:

DoButton(1)

should be the same, but let's try.

Thomas


OK i will try and let you know.

No point. This is just the legacy way of doing a feedhold so for the reasons I've given above it won't work.

Can you feed hold a dwell? (G4?)

this might work if so... dwell for a time long enough to execute the macro which calls doButton? i am not at my machine today so i can;t try....
Title: Re: help withusing vbscript to "feedhold" gcode execution
Post by: fredeflint on October 18, 2016, 11:33:14 PM
By definition, feedhold only works when there's movement TO feedhold.

Whilst an M code is running, there IS no movement.

Try an M1 instead and see if that does what you want. (remember to enable it).


looks like this is the ticket. thank you for your help.

ftr it does not look like you can feed hold a g4 command.
Title: Re: help withusing vbscript to "feedhold" gcode execution
Post by: stirling on October 19, 2016, 04:21:58 AM
looks like this is the ticket. thank you for your help.

No worries.

ftr it does not look like you can feed hold a g4 command.

By definition, feedhold only works when there's movement TO feedhold.
Title: Re: help withusing vbscript to "feedhold" gcode execution
Post by: fredeflint on October 19, 2016, 12:03:25 PM
ftr it does not look like you can feed hold a g4 command.

By definition, feedhold only works when there's movement TO feedhold.

yes, and excuse my ignorance as i ma not a mach3 expert,  but it is not immediately clear to me why a pause in a sequence of moves would not be considered movement. probably i don't understand the logic behind what feed hold is really used for in practice since im not much of a machinist, but if i had a piece of gcode that had a g4 in a complicated sequence i wanted to pause, i might expect that feedhold will pause the gcode execution. or at least pause at the subsequent movement after the g4. obviously it does not as found empirically.

anyway thank you again for your help, it is greatly  appreciated and saved me a lot  of time.

s
Title: Re: help withusing vbscript to "feedhold" gcode execution
Post by: Tweakie.CNC on October 19, 2016, 01:12:05 PM
Quote
yes, and excuse my ignorance as i ma not a mach3 expert,  but it is not immediately clear to me why a pause in a sequence of moves would not be considered movement. probably i don't understand the logic behind what feed hold is really used for in practice since im not much of a machinist, but if i had a piece of gcode that had a g4 in a complicated sequence i wanted to pause, i might expect that feedhold will pause the gcode execution. or at least pause at the subsequent movement after the g4. obviously it does not as found empirically.

I agree with you and what you say but Mach3 operates the way it does and that is the way we must learn to use it.

Tweakie.
Title: Re: help withusing vbscript to "feedhold" gcode execution
Post by: fredeflint on October 19, 2016, 01:31:20 PM
Quote
yes, and excuse my ignorance as i ma not a mach3 expert,  but it is not immediately clear to me why a pause in a sequence of moves would not be considered movement. probably i don't understand the logic behind what feed hold is really used for in practice since im not much of a machinist, but if i had a piece of gcode that had a g4 in a complicated sequence i wanted to pause, i might expect that feedhold will pause the gcode execution. or at least pause at the subsequent movement after the g4. obviously it does not as found empirically.

I agree with you and what you say but Mach3 operates the way it does and that is the way we must learn to use it.

Tweakie.

ya that is my experience with it so far, it does work, but you just have to know all it's peculiarities.  lots of good info in the forum though at least. i pretty much figured out everything else i needed else from reading through it.

Title: Re: help withusing vbscript to "feedhold" gcode execution
Post by: stirling on October 20, 2016, 05:06:21 AM
it is not immediately clear to me why a pause in a sequence of moves would not be considered movement.

I understand where you're coming from but try not to think of it as a PAUSE in GCode execution. It's a HOLD in axis movement i.e. a HOLD in FEED. - does that help?

probably i don't understand the logic behind what feed hold is really used for in practice

You can hit STOP at any time and that is exactly what will happen. i.e. stop movement, stop gcode execution - stop everything.

However, if you STOP whilst moving you may loose position. Therefore, there's a need for another way of stopping in the case where there's movement that doesn't cause a position loss. That is FEED HOLD. - does that help?

Also, this is not peculiar to Mach - this (AFAIK) is how it works generally across all CNC controllers.
Title: Re: help withusing vbscript to "feedhold" gcode execution
Post by: fredeflint on October 20, 2016, 10:20:40 AM
ya it's all good, thank you for that explanation,  i think my post came off as complain-y, everything is good. at first i was not sure mach3 could even do a pause as i wanted, so i guess that was really part of my original question as well.

I also realized  yesterday a less elegant solution. I could have just  disabled the spindle on/off relays setting and simply toggled the spindle on or off  on a gpio on the controller card, one that isnt assigned to the "spindle relay" in mach 3, likely this would not get changed in a stop command. Then toggle it in a  macro instead of using m3/m5. this is less desirable cause i have to change the setup and then my old gcodes need to be modified etc and as you say with STOP you may lose position etc etc.

"Optional" stop as you suggested does not seem to stop the spindle. Again not intuitive to me but i will take it, since its exactly what i want :)

Thanks again for your input.