Commit Graph

98 Commits

Author SHA1 Message Date
Petter Reinholdtsen
e155e0a976 CAM: Ensure pre-/postamble help text matches active values by avoiding duplication
Make sure to use the active default values for preamble and postamble in the help text,
and provide the current default values as the default in the add_argument().

The only exception is uccnc_post.py, where the real default value depend on the use of
--no-comments, and sending the default argument to add_argument() would change behaviour.

This change was inspired by the changes done to fix (#20792) in
d84d9c9bd1.
2026-01-23 19:43:16 +01:00
petterreinholdtsen
bca1fe32d1 CAM: Dropped trailing percent from fanuc post processor output. (#26617)
* CAM: Dropped trailing percent from fanuc post processor output.

A trailing percent cause one Fanuc controller to hang when the program
is completed when drip feeding G code, and the minicom ascii upload
was unable to complete the upload.

Had to use emergecy stop to get the machine out of the hang.

* CAM: Adjust Fanuc post processor test to no longer expect trailing percent.
2026-01-09 10:40:02 -06:00
sliptonic
7f7bdf2d04 Merge pull request #25786 from Connor9220/FixLinuxCNCPostprocesor
CAM: Add rigid Tapping back to legacy LinuxCNC postprocessor
2025-12-12 11:44:36 -06:00
Petter Reinholdtsen
38423d81c0 CAM: Made Fanuc post processor compatible with FreeCAD 1.1.
Use setPlainText() if available, otherwise use setText().
Workaround for a regression from #23862.
2025-12-11 00:57:21 +01:00
Petter Reinholdtsen
0200f18414 CAM: Adjusted Fanuc post processor to move Z to tool change position before M6
A "G28 G91 Z0" is needed according to testing and page 195 (6-1-2 Procedure for ATC operation) in
<URL: https://www.milco.bg/source/Technical%20Service/Documentation%20Dahlih/MCV%20510_1250B%20Operation%20and%20maintenance%20manual%20V2_2.pdf >
to get the spindle into the correct position for a tool change.
2025-12-11 00:57:21 +01:00
Petter Reinholdtsen
22f0328c1c CAM: Made Fanuc post processor compatible with FreeCAD 1.0.
Several methods introduced 2025-05-04 are preferred, but the methods
available in version 1.0 are used as fallback sources
for active status and coolent enabled.
2025-12-11 00:57:21 +01:00
Petter Reinholdtsen
a23f27bacd CAM: Switched Fanuc post processor to end program with M30, not M2.
The difference according to the documentation is that M30 will rewind
the paper tape while M2 will not.  The effect on a CNC from 1994 is
that M30 turn on the indicator light marking that the program has
completed, while M2 do not, and the light is wanted to know when
the machine is done.
2025-12-11 00:57:21 +01:00
Petter Reinholdtsen
3e85623f4a CAM: Adjusted Fanuc post processor to use M05 consistently everywhere. 2025-12-11 00:57:21 +01:00
Petter Reinholdtsen
4d2719ff97 CAM: Provide correct and more relevant header from Fanuc post processor
Fanuc only understand upper case letters, no point in providing the
file name in lower case letters.  The provided file name is always "-",
so drop it completely. The first comment is presented in the Fanuc user
interface, it should get more relevant content.

Dropped useless semicolon.
2025-12-11 00:57:21 +01:00
Petter Reinholdtsen
8f36c8cd79 CAM: Avoid Z overtravel error on Fanuc tool changes
Enabling tool height compensation will cause the axis to move up
the length of the tool, which will cause a Z overtravel error when
the tool change take place close to the top of the machine.  To
counter this move, ask the machine to move its commanded position
down the length of the tool height, which in effect causes no upward
movement after the tool change.  The #4120 variable contain the
current tool number, and #2000 - #20XX contain the tool heights.
2025-12-11 00:57:21 +01:00
Petter Reinholdtsen
fdd8e46c4d CAM: Avoid adding trailing space to all M6 lines.
The Fanuc post processor add a trailing space to all M6 lines.
This make it problematic to write test for the generated output,
when compiled with the automatic policy enforcer on github
removing trialing space from the expected output.  Avoid the
problem by removing the trailing space from the generated
output.
2025-12-11 00:57:21 +01:00
Petter Reinholdtsen
6710ad6e9d CAM: Corrected Fanuc post processor M3 handling
The thread tapping implementation in the Fanuc post processor change
behaviour of M3, G81 and G82 when the tool ShapeID matches "tap".
but the code not not expect that the parse() method will be
called with two different classes as arguments.

Rewrite the M3 handling to handle ToolController arguments
instead of crashing with an AttributeError.

Issues:

Fixes #14016
Fixes #25723
2025-12-11 00:57:21 +01:00
Petter Reinholdtsen
14ff081eba CAM: Switch Fanuc post processor default for M6T0 to disable by default. 2025-12-11 00:57:21 +01:00
Petter Reinholdtsen
5e55d55655 CAM: Made empty spindle at the end optional in Fanuc CAM post processing script
Some Fanuc machines do not understand the 'M6 T0' instructions in the
preamble.  Move it out of the preamble and controlled by a new
command line argument --no-end-spindle-empty for the machines
where running to cause a "Tool Number Alarm" and the program to crash
as tool zero is not a valid tool.

Fixes: #25677
2025-12-11 00:57:21 +01:00
Petter Reinholdtsen
4978c7369d CAM: Adjusted Fanuc post processing script to always start with a percent
The percent signal to the machine that a program follows, and is not
part of the header but a required part when uploading programs into
the machine.
2025-12-11 00:57:21 +01:00
Petter Reinholdtsen
aff382e9d1 CAM: Adjusted Fanuc post processing script to not inherit behaviour between calls
Reset line number when using --line-numbers.  Restore all default values when a
command line argument is not used.

This helps the test scripts ensure that the arguments passed during one test is the only
one taking effect during this test.
2025-12-11 00:57:21 +01:00
Petter Reinholdtsen
28ae99501b CAM: Print "Show editor" status boolean as string, not integer
This get rid of a Python style warning and make the output easier
to understand.
2025-12-11 00:57:20 +01:00
Billy Huddleston
2a06a94e61 CAM: Add rigid Tapping back to legacy LinuxCNC postprocessor
This PR adds rigid tapping back to the legacy LinuxCNC postprocessor, which
was removed in commit cd1c29e3f23fde0a90980ffcf3e70406769f2d43 in PR 24771.

The changes include:
- Modifying the linuxcnc_legacy_post.py script to include logic for Rigid tapping
- Updating comments and documentation to reflect the addition of Rigid tapping
2025-11-28 18:30:28 -05:00
sliptonic
ab632d5e57 Merge pull request #25023 from sebastianohl/main
CAM: fixing drill handling, as KinetiNC does not implement G81 etc. correctly
2025-11-28 11:54:08 -06:00
sliptonic
2b45d86510 Merge pull request #25022 from s-ohl-ostfalia-de/main
CAM: adding cooling feature to Kinetic post processor
2025-11-28 11:52:29 -06:00
sliptonic
6904cfafb3 Merge pull request #23862 from tarman3/gcode_editor_dialog
CAM: Show line numbers in export gcode dialog
2025-11-28 11:47:01 -06:00
pre-commit-ci[bot]
b3c309bda4 [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2025-11-24 23:12:28 +00:00
Lawrence Woestman
048681fccf CAM: fix for linuxcnc ignoring --preamble argument, with test 2025-11-24 14:40:16 -08:00
tarman3
6ff91d1290 CAM: Show line numbers in export gcode dialog 2025-11-17 19:55:15 +02:00
sliptonic
8c21a7a53c CAM: Renaming of postprocessors and cleanup (#24771)
* Post Processor cleanup and rename

remove unused files
Basic implementation of generic post
add blending mode support for linuxcnc
add mocking for postprocessor tests
Add tests for generic post
linuxcnc test only tests linuxcnc specific functionality

minor improvements
add arc splitting to refactored post processors
Refactor smoothie post
move posts to legacy.  Remove 'refactored'
lint cleanup
fixes #19417

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2025-11-15 09:46:34 -06:00
Billy Huddleston
cb3639e679 Add rigid tapping support to linuxcnc_post.py and annotate tapping commands in Tapping.py
- Added --rigid-tap argument to linuxcnc_post.py to enable G33.1 rigid tapping cycle output.
- Implemented logic to skip G80, G98, G99 commands with tapping annotation when rigid tapping is enabled.
- Enhanced handling of G84/G74 tapping cycles for rigid tapping, including pitch (K), depth (Z), dwell (G04 P), spindle reversal (M3/M4/M5), and reverse-out moves.
- Updated Tapping.py to annotate G98/G99 and G80 commands with {"operation": "tapping"} for improved post processor handling.
2025-11-10 02:48:27 -05:00
pre-commit-ci[bot]
7707dc1ade [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2025-11-03 14:11:42 +00:00
Sebastian Ohl
a11355e21d fixing drill handling, as KinetiNC does not implement G81 etc. correctly 2025-11-03 15:02:14 +01:00
pre-commit-ci[bot]
773d018a19 [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2025-11-03 13:53:32 +00:00
Sebastian Ohl
0b82126a0e adding cooling feature to Kinetic post processor 2025-11-03 14:45:12 +01:00
pre-commit-ci[bot]
2c252d6ccf [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2025-10-31 21:06:39 +00:00
PhoneDroid
70acbc99c8 [ CAM ]: Update SPDX License Identifiers 2025-10-31 17:00:32 -04:00
Sebastian Ohl
7e6982e399 adding newline, as the Zero-4 machine controller don't like two M-commands in one line 2025-10-23 13:54:22 +02:00
ᴩʜᴏɴᴇᴅʀᴏɪᴅ
c727846508 CAM: Remove UTF-8 coding declarations (#24527)
These declarations are no longer needed for Python 3+.
2025-10-09 13:49:18 -05:00
Billy Huddleston
3d3eaef02e CAM: Convert tapping operation to experimental feature, Add tap pitch support, improve tapping logic, and update toolbit schema and legacy linuxcnc post
CAM/App/PathSegmentWalker.cpp
- Add G74 to drill/tap/bore G-code recognition for tapping cycles

CAM/InitGui.py
- Move CAM_Tapping command behind experimental feature flag
- Only group drilling/tapping commands if both are enabled

CAM/Path/Base/Generator/tapping.py
- Add pitch and spindle_speed parameters to tapping.generate
- Output S (spindle speed) and F (pitch) in generated G-code

CAM/Path/Op/Tapping.py
- Require Pitch property for tap tools and SpindleSpeed for tool controllers
- Pass pitch and spindle speed to tapping.generate
- Use SpindleDirection to determine right/left hand tap

CAM/Path/Post/scripts/linuxcnc_post.py
- Handle G84/G74 tapping cycles: convert pitch and spindle speed to feed rate
- Remove F and S from output and recalculate F as needed

CAM/Path/Tool/shape/models/tap.py
- Add Pitch property to ToolBitShapeTap schema
- CAM/Path/Tool/toolbit/models/tap.py
- Show pitch and rotation in tap tool summary
- Use is_imperial_pitch to format pitch as TPI or mm

CAM/Path/Tool/toolbit/util.py
- Add is_imperial_pitch utility to classify pitch as imperial or metric

CAM/Tools/Bit/375-16_Tap.fctb
- Remove unused parameters (Coating, Rotation, TPI, Type)
- Keep only relevant tap parameters for new schema
2025-09-25 16:26:03 -04:00
Matthias Deimbacher
88b3995f12 CAM: fix library import in postprocessor 2025-09-13 21:33:31 +02:00
zophon
967342ef34 Update KineticNCBeamicon2_post.py (#23602)
Added a return in the postamble to separate M05 and M09 GCode as beamicon2-basic doesn't like having both M-code on the same line.
2025-09-08 11:07:01 -05:00
tarman3
3863ce947c CAM: Fix uccnc postprocessor for G2|G3 (#23194) 2025-09-02 11:20:14 -05:00
J-Dunn
b384f87cb4 CAM: correct grbl_post retract heights (#23010)
* CAM: correct grbl_post retract heights

Some small corrections to retraction heights in expansion of G8x drilling cycles for GRBL machines. 

Add comment blocks from NIST definitions to aid maintenance and understanding. 
Rename some variables for clarity and ease of future maintenance.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* correct typo which prevented final retract move

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2025-09-02 11:15:37 -05:00
J-Dunn
8a65e29d23 CAM: revert grbl_post regression (#22569)
* CAM: revert grbl_post regression

I recently noticed a bug in grbl_proc post processor where it was not correctly setting OLD_Z  if current machine_z is below G81 retract plane in R parmeter. 

On digging into my original commit is looks like the two lines which did this have been commented out. 
I can never find the Blame feature when I need so if someone else can find the culprit feel free. 

2bd617a2b3

This PR simply reinstates the missing lines and adds a snippet of NIST as a comment block  to prevent any over-zealous editing in the future. 

This regression means that drilling cycles start with z=clearance height instead of z=safe height leading to much costly air cutting.
This similarly messes up the  the retract plane for G98 leading to excessive machine time wasting and incorrect application of G98 returns. 

Indeed this regression was noticed because some were claiming the Safe height was redundant in drilling ops since it was never used. 

There is much discussion about all this at the moment which is being disrupted by people assuming the current broken paths are what FreeCAD is intended to do. 

Let's fix this ASAP, so we can stop this confusion and get discussions back to reality.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2025-08-04 10:57:03 -05:00
Ian Abreu
8a69bdb0c4 correcting to use Tool vs. ToolController 2025-07-04 11:30:46 -04:00
Ian Abreu
2ec501f802 initial fix 2025-07-04 11:10:43 -04:00
sliptonic
44faed9248 Cam: Add Ondsel SVG post processor (#21743)
* Ondsel SVG post processor

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update src/Mod/CAM/Path/Post/scripts/svg_post.py

* Update src/Mod/CAM/Path/Post/scripts/svg_post.py

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Benjamin Nauck <benjamin@nauck.se>
2025-06-03 21:37:20 +00:00
sliptonic
40ed30397c Merge pull request #21416 from jffmichi/custom_gcode_allow_empty_lines
CAM: allow empty lines in Custom operation
2025-05-29 09:47:32 -05:00
jffmichi
95410edc01 CAM: fix philips postprocessor always writing to "-" instead of specified file and not processing arguments 2025-05-20 05:18:03 +02:00
jffmichi
a102f15da4 CAM: fix fablin postprocessor always writing to "-" instead of specified file 2025-05-20 05:17:53 +02:00
jffmichi
97a33cb526 CAM: fix some non-refactored postprocessors crashing on blank lines 2025-05-20 05:00:06 +02:00
Lawrence Woestman
087d393449 CAM: added three command line arguments, with tests 2025-05-19 13:52:20 -07:00
sliptonic
7d5d1c7295 Merge pull request #21129 from jffmichi/fix_active_and_coolant
CAM: fix handling of Active state and CoolantMode with nested dressups
2025-05-19 10:33:45 -05:00
Luz Paz
ee4fa234c9 Fix various typos
Missed by the codespell CI not being functional for a period of time.
2025-05-15 10:59:48 -05:00