G86 Boring Cycle, Spindle Stop, Rapid Move Out

More
10 years 1 month ago - 10 years 1 month ago #80242 by andypugh
Replied by andypugh on topic G86 Boring Cycle, Spindle Stop, Rapid Move Out

snujcnc wrote: if i want to make modification in interp_cycles.cc
can i add some custom M-Code like m119 in this script
in g86 cycle
where
STOP_SPINDLE_TURNING(); is given
i want to use m199 code at this place


No, these are all very different things.

Some background: The G-code interpreter converts G-code to "Canonical Commands" such as STRAIGHT_TRAVERSE or, the one you have noticed, STOP_SPINDLE. Those commands are put in a queue which is then run through by the realtime code, which uses it to change the pins in the HAL layer, where you hook up your hardware interfaces.

interp_convert.cc is a source file of Linuxcnc (written in C++). It is part of the G-cde interpreter. No changes made there will have any effect unless you recompile all of LinuxCNC. I just gave you that link to see that there are some other G-codes you can use, and so see exactly what each canned-cycle does. For practical purposes interp_convert.cc is a fixed part of linuxCNC, though that isn't to say that the developers wouldn't accept extra features that would be coded in there.

M199 codes are something that is acted on by the G-code interpreter (of which interp_convert.cc is a part). G-code execution stops and the executable file is run. Note that this is an executable Linux file, not a G-code routine or (for that matter) a C or C++ file. It would typically be interpreted by the Linux shell (bash) or it could be a Python script. Both methods can work with the HAL layer, setting and reading pin values. Additionally Python can read interpreter state and send some commands, including G-code commands to the MDI interface.
I am not 100% certain that if a Python routine is called by M1xx that an MDI command in the script will be interpreted and run. MDI is normally only valid when the machine is not running in auto mode, and as there is only one queue it is hard to see how the system would decide what to do.

Remap is a bit different. It adds new G-code commands and you are effectively adding new code to the G-code interrupter. This is rather more powerful than an M199 script, because a remapped routine can send canonical commands directly, or can be a bit of G-code that is run through the standard interpreter.

To complete the set there are the MDI_COMMANDS in the INI, which alls HAL pin changes to run G-code routines (which can be remapped codes, or M1xx codes, or G-code subroutines). However MDI_COMMANDs have to swim upstream, Normally G-code causes changes in HAL, not the reverse, so MDI_COMMANDs are only possible when the interpreter is idle, i.e. G-code is not running.

also for remap things if you have example config please send me sample


You already have a sample, takes look in the sample configs in the config picker.
sim/axis/remap/rack-tolchange
That uses the line in the INI here:
github.com/LinuxCNC/linuxcnc/blob/master...cktoolchange.ini#L58
to redefine the M6 command to call a python file (which yo wouldn't need) then run a G-code file called rack_change which is here:
github.com/LinuxCNC/linuxcnc/blob/master...ines/rack_change.ngc

The config is a complete one, it has special g-code routines to handle tool-change abort, and the python routines make sure that the routine has the right info.
The point is that you can relatively easily convert a new G-code to a sequence of existing G-code commands kept in a file somewhere.

Having said all this, I do quite a lot of boring-bar work on my CNC mill (I have two different sizes of Wohlhaupter head, and have a special shank for one of them to make it CNC itself. (a partial success).) I typically don't care on the sizing passes, and just stop the spindle at the bottom and manually retract on the finish pass. Not an option when doing may holes in G-code though.
Last edit: 10 years 1 month ago by andypugh.

Please Log in or Create an account to join the conversation.

More
10 years 1 month ago #80253 by snujcnc
Thank you
I will look in details and come back to you after results

Please Log in or Create an account to join the conversation.

More
10 years 3 weeks ago #81242 by stiles
as long as g19 works it's really easy to do with just a few lines of gcode. This is presudio code but it will give you an idea:

<modal preamble inch per rev, absolute, g54 yadda yadda>
xy position
z rapid approach move
g1 z-xx.x f.004
z-xx.xx f.002 (for slowing down the feed inside an interrupt cut)
m19 r<whatever orientation you require> p1
g94 (if you want to make a controlled feed move, if you want to rapid this isn't required)
g91 (make the next move incremental, we can now start at any xy position and be a ok)
x-.005 f1 (this is still a feed move, wont work in g95, if you want to rapid do g0 x-.005)
g0z2.
g53z0
g0


this give you some advantages like having 2 feed rates depending on cutting conditions, you could change speeds too if you saw fit.

Just a few ideas.

Please Log in or Create an account to join the conversation.

Time to create page: 1.084 seconds
Powered by Kunena Forum