Toggle Type User Button linked to Macro

This is where you talk about Macros, show examples of your macro scripting and SHARE handy segments of script code as examples.

Re: Toggle Type User Button linked to Macro

Postby Robertspark » Thu Oct 04, 2018 9:29 pm

cncdrive wrote:It not looses the reference, the operation is correct by g-code definition. Just think it through.
Feedhold does not stop and execute the g-code line again. While Stop and Start stops the cycle and executes the same line again which in increment mode means different if the TCP is not on the startpoint of the arc.



Can't argue with that
Robertspark
 
Posts: 1892
Joined: Sat Sep 03, 2016 4:27 pm

Re: Toggle Type User Button linked to Macro

Postby cncdrive » Thu Oct 04, 2018 11:46 pm

The issue is that it just can't be made right.
If we follow the thinking of what we following now that it has to be fine g-code wise then somebody will come and tell us it is not good by toolpath-wise.
If we change it to how you think it is OK, toolpath-wise then it will not be OK g-code wise and then it will be only a question of time when somebody else will come and say it is not OK.
It simply can't be done properly both ways and I personally think the first way is the better, how it is now.

Don't say mach3 is doing this right, it is not, I have just checked and it is doing the same thing as the UCCNC.
cncdrive
Site Admin
 
Posts: 4695
Joined: Tue Aug 12, 2014 11:17 pm

Re: Toggle Type User Button linked to Macro

Postby Robertspark » Fri Oct 05, 2018 6:06 am

Solution suggestion

When you call your emulated freehold cycle stop, use the uccnc variable exec.actualmodal

Then do a conditional check
If exec.actualmodal == 02 || exec.actualmodal == 03
Then save the variables
exec.ArcstartposY and exec.ArcstartposY

You now have your arc start point coordinates.

Now when you run the emulated freehold restart, all you do is instead of moving to the stopped position X and Y move to the exec.ArcstartposY and exec.ArcstartposX and then run your restart.

That way the cycle start can rerun the same gcode line and it won't matter what mode the machine is in g90 /91 wise (exec.actualdistmode)

I would also suggest maybe saving not only the current work coordinates but also the current work offset (g54 etc) and also the machine coordinates using exec.Wa, exec.Wb etc (abcxyz), that way when you run a restart the machine goes back to the actual machine coordinates it left when you performed the emulated / advanced freehold routine.

I would also suggest saving variables
exec.actualSS (spindle speed)
exec.lastfeed (federate)
And maybe
exec.actualfeedoverride
That way when you press cycle restart....you set the machine up exactly how it was when you called the emulated or advanced freehold

Also consider saving and using variablre
exec.gcodelinenumber
That way you perform a conditional check at restart to make sure the machine is actually still on the same gcode line number

Just a thought ;)
Robertspark
 
Posts: 1892
Joined: Sat Sep 03, 2016 4:27 pm

Re: Toggle Type User Button linked to Macro

Postby Robertspark » Fri Oct 05, 2018 12:35 pm

I am going to update the manual and add in a few more bits + some corrections i was given some time ago {waiting for the next UCCNC development release really, but I should keep it up to date)
Robertspark
 
Posts: 1892
Joined: Sat Sep 03, 2016 4:27 pm

Re: Toggle Type User Button linked to Macro

Postby Robertspark » Fri Oct 05, 2018 5:28 pm

It may be sort of possible to do it

Think for a moment like this....

How do you first start or run a gcode program?

Besides file load etc, you have to press cycle start.

So therefore it is possible to record the machines first positional machine coordinates.

Let's say part way through you decide your tool is a bit blunt or whatever.

So you press your advanced feedhold function button,
Besides recording all the other info at the time of motion So you can save the current machine coordinates.

For simplicity, considering 1x axis (replicate for all 6 as required)
Subtracting current machine X from the initial X coordinates

You now have the total X axis distance moved.

Now you run a parse on the loaded gcode file and add up all of the X coordinate moves up to the previous line number...... , Subtract one from the other and You now have the X axis offset , which will tell you how much to move away from your current coordinates to the end position of the previous gcode line, so that you are now able to reload your current gcode line number .

Let's say you have the following gcode
N0G91
N1G0X5Y10
N2G1X3Y4 f500
N3G2X-10Y3I5J2
N4G1x10y2

Your running total to line n3 will be -2 from the start coordinates.... So if you stop the machine on the next line and the subtracting the current from initial work coordinates provides a location of X=2, you know that if you move the cutting head from its current location X-4, you can restart from line n4

Yes or no?
Robertspark
 
Posts: 1892
Joined: Sat Sep 03, 2016 4:27 pm

Re: Toggle Type User Button linked to Macro

Postby Robertspark » Fri Oct 05, 2018 7:46 pm

Parse gcode file, I'm sure I posted some examples a while ago, with Dezsoe's help using streamreader

Every line of gcode provides the destination of the tool

So if you add up all of the individual coordinates (X,y,z,a,b,c) you know the change in movement from a start to current position..... All you then need is to transfer these coordinates into machine coordinates ..... As they never change (unless you rehome or reset..)
Robertspark
 
Posts: 1892
Joined: Sat Sep 03, 2016 4:27 pm

Re: Toggle Type User Button linked to Macro

Postby Robertspark » Fri Oct 05, 2018 7:47 pm

... if we're easy it would have been done before...
Robertspark
 
Posts: 1892
Joined: Sat Sep 03, 2016 4:27 pm

Re: Toggle Type User Button linked to Macro

Postby Robertspark » Fri Oct 05, 2018 8:16 pm

G0, G1 G2 and G3 are all the same.... They provide a tool destination, in g91 that is incremental.... So they will always be +/- and the sum of them will always be less than the machine bed size

(I'll wait for someone to say G2 and g3 are different.... Yes ijk provide the centerpoint of the arc but actually as far as backtracking (which is what we need to do with g91) ikj mean nothing)

Ok.... Now I'm going to get a smart ar£# who says...
I do my linear motion in g90 absolute and arcs in g91 (or is that g91.1?).... Of flip half way through just to be a pia.... Then what you have to do is parse the gcode file in reverse (line number --i(1)) from current location if modal g91 is active at the time of the advanced feedhold until it hits a line that contains g91 and then if you parse the line before..... You get your starting offset work coordinates which you can compare to your current work coordinates .... Again comparing that to your delta X,y,z,a,b,c.... You know how much to move the tool back to the start position..... And you can restart from that position.

If you are running plasma.... You can fire the torch on the fly..... As you know exactly where you stopped ..... Even if it's an arc because the machine will again pass those same coordinates.

(Sorry I am being an arm chair spectator and not helping with code ..... Trying to wire up my new panel at the moment to allow for uccnc {plasma + mill + router + development play around of lathe/turn}, mach3 {scanything}, mach4 {working turn} and linuxcnc {development play around lathe plasma} all from 1 cabinet and pc.... Uc300eth Ub1+ud1u, pokeys57e pobob, Mesa 7i76e (+THC AD10).... All via a patch panel... To control 6 drives (+1 for dedicated to neuron lite thc), a servo spindle (lathe), vfd (mill), and a superpid (router)... The idea was nice but the application takes a while to implement!)
Robertspark
 
Posts: 1892
Joined: Sat Sep 03, 2016 4:27 pm

Re: Toggle Type User Button linked to Macro

Postby Robertspark » Fri Oct 05, 2018 8:56 pm

Why can't you just move back and start the motion at the start of the arc?
Robertspark
 
Posts: 1892
Joined: Sat Sep 03, 2016 4:27 pm

Re: Toggle Type User Button linked to Macro

Postby ger21 » Sat Oct 06, 2018 5:53 pm

I do my linear motion in g90 absolute and arcs in g91 (or is that g91.1?)


Assuming you mean "incremental IJ, then the arcs are still G90. The IJ mode is separate from the G90/G91.

Nobody is going to be doing absolute G1's and incremental G2/G3.
Gerry
UCCNC 2022 Screenset - http://www.thecncwoodworker.com/2022.html
ger21
 
Posts: 2663
Joined: Sat Sep 03, 2016 2:17 am

PreviousNext

Return to Macros

Who is online

Users browsing this forum: No registered users and 5 guests

cron