start M3 S

Here's the place for discussion related to CAM/CNC and the development of the Path module.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
memfis
Posts: 585
Joined: Tue Nov 15, 2016 7:58 pm

start M3 S

Post by memfis »

After a long break from 2017, yesterday I started to work g-code created in FC without manual editing. And at once I had to remember the old story - FC creates code, gives the command M3 Sxxxxx, the machine takes everything as written - ie instantly begins to move. In general, after the M3 command we should provide a pause of at least 5 seconds for the spindle to spin up.
Otherwise, it turns out that the program can already create a fully working code, portable, but still requires manual editing at least to set the pause.
User avatar
roerich_64
Veteran
Posts: 1465
Joined: Thu May 21, 2015 7:00 pm
Location: Ostfriesland

Re: start M3 S

Post by roerich_64 »

The grbl-post processor have the commands you search:

Code: Select all

# Parser arguments list & definition
parser = argparse.ArgumentParser(prog='grbl', add_help=False)
parser.add_argument('--comments',           action='store_true', help='output comment (default)')
parser.add_argument('--no-comments',        action='store_true', help='suppress comment output')
parser.add_argument('--header',             action='store_true', help='output headers (default)')
parser.add_argument('--no-header',          action='store_true', help='suppress header output')
parser.add_argument('--line-numbers',       action='store_true', help='prefix with line numbers')
parser.add_argument('--no-line-numbers',    action='store_true', help='don\'t prefix with line numbers (default)')
parser.add_argument('--show-editor',        action='store_true', help='pop up editor before writing output (default)')
parser.add_argument('--no-show-editor',     action='store_true', help='don\'t pop up editor before writing output')
parser.add_argument('--precision',          default='3',         help='number of digits of precision, default=3')
parser.add_argument('--translate_drill',    action='store_true', help='translate drill cycles G81, G82 & G83 in G0/G1 movements')
parser.add_argument('--no-translate_drill', action='store_true', help='don\'t translate drill cycles G81, G82 & G83 in G0/G1 movements (default)')
parser.add_argument('--preamble',                                help='set commands to be issued before the first command, default="G17 G90"')
parser.add_argument('--postamble',                               help='set commands to be issued after the last command, default="M5\nG17 G90\n;M2"')
parser.add_argument('--inches',             action='store_true', help='Convert output for US imperial mode (G20)')
parser.add_argument('--tool-change',        action='store_true', help='Insert M6 for all tool changes')
parser.add_argument('--wait-for-spindle',   type=int, default=0, help='Wait for spindle to reach desired speed after M3 / M4, default=0')
parser.add_argument('--return-to',          default='',          help='Move to the specified coordinates at the end, e.g. --return-to=0,0')
parser.add_argument('--bcnc',               action='store_true', help='Add Job operations as bCNC block headers. Consider suppressing existing comments: Add argument --no-comments')
parser.add_argument('--no-bcnc',            action='store_true', help='suppress bCNC block header output (default)')
-> wait-for-spindle ## in sec.

example: my arguments for the grbl-postprozessor: --bcnc --tool-change --wait-for-spindle 2 --postamble "M05 M09 G0 Z20 G04 P03"

example gcode:

Code: Select all

(Exported by FreeCAD)
(Post Processor: grbl)
(Output Time:2020-03-16 18:34:19.237489)
(Begin preamble)
G17 G90
G21
(Block-name: Fixture)
(Block-expand: 0)
(Block-enable: 1)
(Begin operation: Fixture)
(Path: Fixture)
G54
G0 Z5.500
(Finish operation: Fixture)
(Block-name: T2: T2_2mm_flach)
(Block-expand: 0)
(Block-enable: 1)
(Begin operation: T2: T2_2mm_flach)
(Path: T2: T2_2mm_flach)
(T2: T2_2mm_flach)
(Begin toolchange)
M6 T2.0     (<---------------------------------------------------------- Tool change )
M3 S17600.0 (<------------------------------------------------------ drive up spindle )
G4 P2       (<------------------------------------------------------- wait 2 sec.)
(Finish operation: T2: T2_2mm_flach)
(Block-name: Adaptive)
(Block-expand: 0)
(Block-enable: 1)
(Begin operation: Adaptive)
(Coolant On:Flood)
M8
(Path: Adaptive)
(Adaptive)
G0 Z5.500
(Finish operation: Adaptive)
(Coolant Off:Flood)
M9
(Block-name: T3: T3_3mm_flach)
(Block-expand: 0)
(Block-enable: 1)
(Begin operation: T3: T3_3mm_flach)
(Path: T3: T3_3mm_flach)
(T3: T3_3mm_flach)
(Begin toolchange)
M6 T3.0
M3 S19700.0
G4 P2
(Finish operation: T3: T3_3mm_flach)
(Block-name: Contour)
(Block-expand: 0)
(Block-enable: 1)
(Begin operation: Contour)
(Coolant On:Mist)
M7
(Path: Contour)
(Contour)
(Compensated Tool Path. Diameter: 3.0)
G0 Z5.500
G0 X91.061 Y111.061
G0 Z3.500
G1 X91.061 Y111.061 Z-2.500 F1200.000
G2 X91.500 Y110.000 Z-2.500 I-1.061 J-1.061 K0.000 F1200.000
G1 X91.500 Y0.000 Z-2.500 F1200.000
G2 X91.061 Y-1.061 Z-2.500 I-1.500 J0.000 K0.000 F1200.000
G1 X41.061 Y-51.061 Z-2.500 F1200.000
G2 X40.000 Y-51.500 Z-2.500 I-1.061 J1.061 K0.000 F1200.000
G1 X-40.000 Y-51.500 Z-2.500 F1200.000
G2 X-41.061 Y-51.061 Z-2.500 I0.000 J1.500 K0.000 F1200.000
G1 X-91.061 Y-1.061 Z-2.500 F1200.000
G2 X-91.500 Y0.000 Z-2.500 I1.061 J1.061 K0.000 F1200.000
G1 X-91.500 Y110.000 Z-2.500 F1200.000
G2 X-90.000 Y111.500 Z-2.500 I1.500 J-0.000 K0.000 F1200.000
G1 X90.000 Y111.500 Z-2.500 F1200.000
G2 X91.061 Y111.061 Z-2.500 I-0.000 J-1.500 K0.000 F1200.000
G1 X91.061 Y111.061 Z-5.500 F1200.000
G2 X91.500 Y110.000 Z-5.500 I-1.061 J-1.061 K0.000 F1200.000
G1 X91.500 Y0.000 Z-5.500 F1200.000
G2 X91.061 Y-1.061 Z-5.500 I-1.500 J0.000 K0.000 F1200.000
G1 X41.061 Y-51.061 Z-5.500 F1200.000
G2 X40.000 Y-51.500 Z-5.500 I-1.061 J1.061 K0.000 F1200.000
G1 X-40.000 Y-51.500 Z-5.500 F1200.000
G2 X-41.061 Y-51.061 Z-5.500 I0.000 J1.500 K0.000 F1200.000
G1 X-91.061 Y-1.061 Z-5.500 F1200.000
G2 X-91.500 Y0.000 Z-5.500 I1.061 J1.061 K0.000 F1200.000
G1 X-91.500 Y110.000 Z-5.500 F1200.000
G2 X-90.000 Y111.500 Z-5.500 I1.500 J-0.000 K0.000 F1200.000
G1 X90.000 Y111.500 Z-5.500 F1200.000
G2 X91.061 Y111.061 Z-5.500 I-0.000 J-1.500 K0.000 F1200.000
G1 X91.061 Y111.061 Z-8.500 F1200.000
G2 X91.500 Y110.000 Z-8.500 I-1.061 J-1.061 K0.000 F1200.000
G1 X91.500 Y0.000 Z-8.500 F1200.000
G2 X91.061 Y-1.061 Z-8.500 I-1.500 J0.000 K0.000 F1200.000
G1 X41.061 Y-51.061 Z-8.500 F1200.000
G2 X40.000 Y-51.500 Z-8.500 I-1.061 J1.061 K0.000 F1200.000
G1 X-40.000 Y-51.500 Z-8.500 F1200.000
G2 X-41.061 Y-51.061 Z-8.500 I0.000 J1.500 K0.000 F1200.000
G1 X-91.061 Y-1.061 Z-8.500 F1200.000
G2 X-91.500 Y0.000 Z-8.500 I1.061 J1.061 K0.000 F1200.000
G1 X-91.500 Y110.000 Z-8.500 F1200.000
G2 X-90.000 Y111.500 Z-8.500 I1.500 J-0.000 K0.000 F1200.000
G1 X90.000 Y111.500 Z-8.500 F1200.000
G2 X91.061 Y111.061 Z-8.500 I-0.000 J-1.500 K0.000 F1200.000
G1 X91.061 Y111.061 Z-11.500 F1200.000
G2 X91.500 Y110.000 Z-11.500 I-1.061 J-1.061 K0.000 F1200.000
G1 X91.500 Y0.000 Z-11.500 F1200.000
G2 X91.061 Y-1.061 Z-11.500 I-1.500 J0.000 K0.000 F1200.000
G1 X41.061 Y-51.061 Z-11.500 F1200.000
G2 X40.000 Y-51.500 Z-11.500 I-1.061 J1.061 K0.000 F1200.000
G1 X-40.000 Y-51.500 Z-11.500 F1200.000
G2 X-41.061 Y-51.061 Z-11.500 I0.000 J1.500 K0.000 F1200.000
G1 X-91.061 Y-1.061 Z-11.500 F1200.000
G2 X-91.500 Y0.000 Z-11.500 I1.061 J1.061 K0.000 F1200.000
G1 X-91.500 Y110.000 Z-11.500 F1200.000
G2 X-90.000 Y111.500 Z-11.500 I1.500 J-0.000 K0.000 F1200.000
G1 X90.000 Y111.500 Z-11.500 F1200.000
G2 X91.061 Y111.061 Z-11.500 I-0.000 J-1.500 K0.000 F1200.000
G1 X91.061 Y111.061 Z-14.500 F1200.000
G2 X91.500 Y110.000 Z-14.500 I-1.061 J-1.061 K0.000 F1200.000
G1 X91.500 Y0.000 Z-14.500 F1200.000
G2 X91.061 Y-1.061 Z-14.500 I-1.500 J0.000 K0.000 F1200.000
G1 X41.061 Y-51.061 Z-14.500 F1200.000
G2 X40.000 Y-51.500 Z-14.500 I-1.061 J1.061 K0.000 F1200.000
G1 X-40.000 Y-51.500 Z-14.500 F1200.000
G2 X-41.061 Y-51.061 Z-14.500 I0.000 J1.500 K0.000 F1200.000
G1 X-91.061 Y-1.061 Z-14.500 F1200.000
G2 X-91.500 Y0.000 Z-14.500 I1.061 J1.061 K0.000 F1200.000
G1 X-91.500 Y110.000 Z-14.500 F1200.000
G2 X-90.000 Y111.500 Z-14.500 I1.500 J-0.000 K0.000 F1200.000
G1 X90.000 Y111.500 Z-14.500 F1200.000
G2 X91.061 Y111.061 Z-14.500 I-0.000 J-1.500 K0.000 F1200.000
G1 X91.061 Y111.061 Z-17.500 F1200.000
G2 X91.500 Y110.000 Z-17.500 I-1.061 J-1.061 K0.000 F1200.000
G1 X91.500 Y0.000 Z-17.500 F1200.000
G2 X91.061 Y-1.061 Z-17.500 I-1.500 J0.000 K0.000 F1200.000
G1 X41.061 Y-51.061 Z-17.500 F1200.000
G2 X40.000 Y-51.500 Z-17.500 I-1.061 J1.061 K0.000 F1200.000
G1 X-40.000 Y-51.500 Z-17.500 F1200.000
G2 X-41.061 Y-51.061 Z-17.500 I0.000 J1.500 K0.000 F1200.000
G1 X-91.061 Y-1.061 Z-17.500 F1200.000
G2 X-91.500 Y0.000 Z-17.500 I1.061 J1.061 K0.000 F1200.000
G1 X-91.500 Y110.000 Z-17.500 F1200.000
G2 X-90.000 Y111.500 Z-17.500 I1.500 J-0.000 K0.000 F1200.000
G1 X90.000 Y111.500 Z-17.500 F1200.000
G2 X91.061 Y111.061 Z-17.500 I-0.000 J-1.500 K0.000 F1200.000
G1 X91.061 Y111.061 Z-20.500 F1200.000
G2 X91.500 Y110.000 Z-20.500 I-1.061 J-1.061 K0.000 F1200.000
G1 X91.500 Y0.000 Z-20.500 F1200.000
G2 X91.061 Y-1.061 Z-20.500 I-1.500 J0.000 K0.000 F1200.000
G1 X41.061 Y-51.061 Z-20.500 F1200.000
G2 X40.000 Y-51.500 Z-20.500 I-1.061 J1.061 K0.000 F1200.000
G1 X-40.000 Y-51.500 Z-20.500 F1200.000
G2 X-41.061 Y-51.061 Z-20.500 I0.000 J1.500 K0.000 F1200.000
G1 X-91.061 Y-1.061 Z-20.500 F1200.000
G2 X-91.500 Y0.000 Z-20.500 I1.061 J1.061 K0.000 F1200.000
G1 X-91.500 Y110.000 Z-20.500 F1200.000
G2 X-90.000 Y111.500 Z-20.500 I1.500 J-0.000 K0.000 F1200.000
G1 X90.000 Y111.500 Z-20.500 F1200.000
G2 X91.061 Y111.061 Z-20.500 I-0.000 J-1.500 K0.000 F1200.000
G0 Z5.500
(Finish operation: Contour)
(Coolant Off:Mist)
M9
(Block-name: post_amble)
(Block-expand: 0)
(Block-enable: 1)
(Begin postamble)
M05 G0 Z20 G04 P03
And here how does bCNC read the gcode:
2020-03-18-010313_1824x984_scrot.png
2020-03-18-010313_1824x984_scrot.png (713.21 KiB) Viewed 871 times
Bests
Walter

Edit:
I have delete anything of the 'adaptive'-code so we can see the G4 P2 after toolchange and spindel-start with M3 S## ;-)
Die Liebe wird siegen, denn sie ist unzerstörbar :) ;)
memfis
Posts: 585
Joined: Tue Nov 15, 2016 7:58 pm

Re: start M3 S

Post by memfis »

Ok. I used linuxCNC and a postprocessor for it. Therefore, it makes sense to add it there.
memfis
Posts: 585
Joined: Tue Nov 15, 2016 7:58 pm

Re: start M3 S

Post by memfis »

For those who work at high speeds with a tree, the problems are familiar - the tool can round the trajectory. You should set G64 P0.05 (tolerance) for control.
schnebeck
Posts: 130
Joined: Thu Jun 22, 2017 8:04 pm

Re: start M3 S

Post by schnebeck »

memfis wrote: Tue Mar 17, 2020 9:19 pm After a long break from 2017, yesterday I started to work g-code created in FC without manual editing. And at once I had to remember the old story - FC creates code, gives the command M3 Sxxxxx, the machine takes everything as written - ie instantly begins to move. In general, after the M3 command we should provide a pause of at least 5 seconds for the spindle to spin up.
Otherwise, it turns out that the program can already create a fully working code, portable, but still requires manual editing at least to set the pause.
Do you use a VFD for driving your spindle? Then you can feed an VFD output signal "atSpeed" back to linuxcnc.
spindle-at-speed
Post Reply