Commit Graph

492 Commits

Author SHA1 Message Date
sliptonic
96d1084484 Merge pull request #25850 from petterreinholdtsen/cam-fanuc-post-fixes
CAM: Get Fanuc post processor working and implement several improvements
2025-12-12 10:41:51 -06:00
sliptonic
78102d294d Merge pull request #26008 from tarman3/editor_setText
CAM: CodeEditor - stub for setText()
2025-12-12 10:34:17 -06:00
luzpaz
5c0ff4bd8a Fix typos
Fixes various documentation/source-comment typos
2025-12-12 13:59:38 +01:00
Petter Reinholdtsen
9c78ced00c 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
8386f1394e 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
38c3eebd7a 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
34a5301862 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
8b500ca9a3 CAM: Adjusted Fanuc post processor to use M05 consistently everywhere. 2025-12-11 00:57:21 +01:00
Petter Reinholdtsen
4c18ac6c54 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
e4862572ae 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
bcb569977d 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
3c5f39c0ca 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
06fe4b37ba CAM: Switch Fanuc post processor default for M6T0 to disable by default. 2025-12-11 00:57:21 +01:00
Petter Reinholdtsen
87185c8135 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
0cdf9abc4b 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
ef794c31bd 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
533e957f80 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
tarman3
76d939c21f CAM: CodeEditor - stub for setText() 2025-12-07 20:23:14 +02:00
Billy Huddleston
ab817f8dc5 CAM: Fix job assignment and model/stock initialization in ObjectOp
This PR fixes a bug introduced with PR #25800
It updates the ObjectOp class to correctly assign the job, model,
and stock properties from the parentJob object. Previously, only
PathUtils.addToJob was called, which did not set these attributes directly.

This change ensures that when creating a new operation, the job, model,
and stock fields are properly initialized from the parent job. This
fixes issues where operations did not inherit the correct job context,
leading to missing or incorrect references to the model and stock, and
potential errors in downstream processing.
2025-12-03 00:23:23 -05:00
Billy Huddleston
b5d97057be CAM: Introduce unified ToolBit parameter migration logic for Bullnose tools
- Added new migration system to handle legacy parameter conversion for ToolBit assets and objects.
- Implemented ParameterAccessor abstraction for consistent access to dicts and FreeCAD objects.
- Centralized migration logic for CornerRadius from TorusRadius or FlatRadius/Diameter, restricted to Bullnose shape-type.
- Updated asset and object initialization to use migration logic and filter Bullnose parameters.

src/Mod/CAM/Path/Tool/camassets.py:
- Integrate new migration logic for ToolBit assets using ParameterAccessor and migrate_parameters.
- Ensure shape-type is set before parameter migration; only write changes if migration occurred.

src/Mod/CAM/Path/Tool/toolbit/migration.py:
- Add ParameterAccessor class and migrate_parameters function for unified migration.
- Handle legacy parameter conversion for Bullnose tools.

src/Mod/CAM/Path/Tool/toolbit/models/base.py:
- Apply migration logic to ToolBit objects on restore.
- Filter Bullnose parameters to remove FlatRadius after migration.

src/Mod/CAM/Path/Tool/shape/models/bullnose.py:
- Add filter_parameters method to remove FlatRadius for Bullnose.

src/Mod/CAM/Path/Op/SurfaceSupport.py:
- Derive FlatRadius from CornerRadius and Diameter if both are present.

src/Mod/CAM/Path/Op/Surface.py:
- Remove obsolete setOclCutter method.
2025-12-01 11:30:00 -06:00
sliptonic
db65e44bca CAM: fixes bug with op creation/cancelation (#25800) 2025-12-01 10:59:49 -06:00
Billy Huddleston
708717cee2 CAM: Turn off debugging in CAM Preferences
Debugging was left on by mistake. Also 'Setting asset path' log message was at info level. Changed to debug level.
2025-12-01 10:53:02 -06:00
Roy-043
6a65b45242 Convert asset path to string in filePath function 2025-12-01 10:51:16 -06:00
sliptonic
98a2cb52c3 Merge pull request #25273 from Thom-de-Jong/main
CAM: Exporting G-code can be canceled from the editor dialog
2025-11-30 14:04:22 -06:00
sliptonic
46f9cb0ac5 Merge pull request #25253 from tarman3/geom_usehelixforbspline
CAM: Path.Geom.cmdsForEdge() - remove useless 'useHelixForBSpline'
2025-11-30 09:59:03 -06:00
Thom de Jong
bbb3bdd839 Merge remote-tracking branch 'upstream/HEAD' 2025-11-30 12:43:31 +01:00
sliptonic
28b9fa0151 Merge pull request #25553 from tarman3/leadinout_overtravel6
CAM: LeadInOut - Fix regression after #24829
2025-11-29 12:34:37 -06:00
sliptonic
eb8b2ddad2 [CAM] Reimplemented Mill facing operation (#24367) 2025-11-28 23:26:36 +00:00
tarman3
91fd699f2d CAM: Path.Geom.cmdsForEdge() - remove useless 'useHelixForBSpline' 2025-11-28 20:13:24 +02:00
sliptonic
f18842114f Merge pull request #25205 from tarman3/isVertical
CAM: Path.Geom.isVertical() for BSpineSurface (simple face after scale)
2025-11-28 12:08:10 -06:00
sliptonic
effe043019 Merge pull request #25635 from tarman3/oputil_1_linter
CAM: OpUtil - Fix linter errors
2025-11-28 12:03:06 -06:00
sliptonic
1ff6d15b64 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
c3068b2b66 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
83fc0385a3 Merge pull request #24807 from tarman3/inspect
CAM: Line numbers in Inspect window
2025-11-28 11:48:24 -06:00
sliptonic
e20fd153ed 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
Thom de Jong
dc4f9c694d Change button text and disable OK when text unchanged 2025-11-25 22:10:32 +01:00
pre-commit-ci[bot]
6da7cb2f9f [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
f349336fc8 CAM: fix for linuxcnc ignoring --preamble argument, with test 2025-11-24 14:40:16 -08:00
tarman3
06bc4f61e0 CAM: OpUtil - Fix linter errors 2025-11-24 23:21:36 +02:00
Billy Huddleston
9cab1f8f52 CAM: Make CAM tests and serialization robust to locale-dependent decimal separators
Updated CAM unit tests and LinuxCNC serializer to handle decimal separators consistently, ensuring tests pass regardless of system locale. Assertions now compare FreeCAD.Units.Quantity objects directly or normalize decimal separators in strings. LinuxCNC serializer output is forced to use periods for decimals.

src/Mod/CAM/CAMTests/TestPathToolBitListWidget.py:
- Normalize decimal separators in tool description assertions for locale robustness.

src/Mod/CAM/CAMTests/TestPathToolBitPropertyEditorWidget.py:
- Use FreeCAD.Units.Quantity for direct quantity comparisons in property editor tests.

src/Mod/CAM/CAMTests/TestPathToolBitSerializer.py:
- Compare deserialized and serialized quantities using FreeCAD.Units.Quantity for consistency.

src/Mod/CAM/CAMTests/TestPathToolShapeClasses.py:
- Compare parameter values and units directly instead of relying on string formatting.

src/Mod/CAM/Path/Tool/library/serializers/linuxcnc.py:
- Force period as decimal separator in LinuxCNC serializer output to avoid locale issues.
2025-11-24 18:53:32 +01:00
sliptonic
ebbddc97e2 Merge pull request #25570 from Connor9220/FixChipLoad
CAM: Ensure Chipload is restored and displayed with user-preferred units
2025-11-23 12:42:24 -06:00
sliptonic
42e6af4237 Merge pull request #25106 from davidgilkaufman/tool_migrations_custom_dir
[CAM] Offer automatic migration of tools in (old) custom working directory to the new tool system
2025-11-23 12:28:17 -06:00
sliptonic
971fd31068 Merge pull request #22738 from tarman3/bsplinesurface
CAM: Pocket BSplineSurface
2025-11-23 11:49:52 -06:00
Billy Huddleston
4432575243 CAM: Ensure Chipload is restored and displayed with user-preferred units
Fixes an issue where Chipload and similar mixin-defined properties were added to
the schema but not reliably restored, because parameter restoration did not always
apply them to the toolbit object. This change ensures Chipload is restored from saved
data and displayed using the user's preferred unit schema, even when no document
is open. This update also ensures the toolbit editor respects the user’s unit schema
preference during editing, even outside an open document.

src/Mod/CAM/Path/Tool/toolbit/models/base.py:
- Restore Chipload (and other parameters) to toolbit.obj if the property exists.

src/Mod/CAM/Path/Tool/toolbit/ui/editor.py:
- Set units schema to user preference when opening the toolbit editor, so Chipload and other values display correctly.
2025-11-23 11:45:47 -05:00
tarman3
a0876f8060 CAM: LeadInOut - Fix regression after #24829 2025-11-21 23:00:37 +02:00
tarman3
dc776de547 CAM: Line numbers in Inspect window 2025-11-17 19:55:54 +02:00
tarman3
0e0f948d71 CAM: Show line numbers in export gcode dialog 2025-11-17 19:55:15 +02:00
tarman3
889dc7059c CAM: Pocket BSplineSurface 2025-11-17 19:53:47 +02:00
tarman3
5dd3d3d8b1 CAM: Engrave - Fix #22380 - duplicates 2025-11-17 19:40:05 +02:00
sliptonic
8c8b26ee4b Merge pull request #25371 from tarman3/engrave_fix9114
CAM: Engrave - Fix #9114 - Unable to engrave an arc
2025-11-17 11:19:23 -06:00