CAM: Get Fanuc post processor working and implement several improvements#25850
CAM: Get Fanuc post processor working and implement several improvements#25850sliptonic merged 15 commits intoFreeCAD:mainfrom
Conversation
|
This pull request replaces #25722, #25769, #25768, #25799, #25806 and #25698, as requested in #25806. In addition it contain a few more cleanups and is tested on a machine with FreeCAD 1.0. There are still a hickup with tool changes (only work if manually moving the Z axis to its machine zero position), which I hope to figure out later. |
c4a48ff to
708e353
Compare
|
@LarryWoestman can you look at this? |
LarryWoestman
left a comment
There was a problem hiding this comment.
This looks reasonable to me.
|
Is there anything more I can do to assist in getting these fixes into
the next FreeCAD release? I do not know the process of backporting
fixes to the 1.1 branch, but happy to help if I can.
Note, I believe the fanuc_post.py script would be trivial and good to
push into both an updated 1.0 and 1.1 release.
…--
Happy hacking
Petter Reinholdtsen
|
33814a7 to
1ba1093
Compare
c4e77a2 to
a15d9e7
Compare
|
a15d9e7 CAM: Adjusted Fanuc post processor to move Z to tool change position before M6 Is this something that needs to be handled at the post processor level? That manual is talking about MDI mode from what I can tell. Does this controller not handle this automatically from a program? Is this a specific version of this controller? I'll bring up fusion and see if I have a post processor and post a program for a Fanuc controller. |
a15d9e7 to
0fd0eb6
Compare
|
[Connor9220]
Is this something that needs to be handled at the post processor
level? That manual is talking about MDI mode from what I can tell.
Does this controller not handle this automatically from a program? Is
this a specific version of this controller? I'll bring up fusion and
see if I have a post processor and post a program for a Fanuc
controller.
The controller I am testing need the program to move Z to the zero
position before a tool change. I was as surprised as you, but can
confirm that it is both required and working. No idea if this is a
special version of this controller. I have only experience with one
Fanuc controller so far, a 0-M edition from 1994.
I know I could write a M6 macro program to take care of this as a
workaround, but the machine is only using the default setup from the
factory at the moment, as far as I can tell, and here it is required to
move Z before M6.
Should it be a post processor command line argument to enable or disable
this? Is it not needed for other Fanuc controllers?
…--
Happy hacking
Petter Reinholdtsen
|
This get rid of a Python style warning and make the output easier to understand.
…etween 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.
…cent 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.
…ing 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: FreeCAD#25677
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 FreeCAD#14016 Fixes FreeCAD#25723
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.
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 FreeCAD#4120 variable contain the current tool number, and FreeCAD#2000 - #20XX contain the tool heights.
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.
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.
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.
Used TestMach3Mach4LegacyPost.py as the starting point with input from other test scripts too. The test demonstrate a fix for FreeCAD#25723, as the Fanuc post processor has not been not updated to the latest changes in the Path module. This is related to FreeCAD#24676, where thread tapping was added to LinuxCNC, but the equivalent code in the Fanuc postprocessor were not adjusted to cope, and FreeCAD#25677 where it was observed that the Fanuc postprocessor was broken in versions 0.20 and 1.0. Added MockTool class to provide ShapeName to fanuc_post.py, used to convert drill cycles to threading cycles if the tool has shapeid "tap".
…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.
Use setPlainText() if available, otherwise use setText(). Workaround for a regression from FreeCAD#23862.
2ab197d to
9c78ced
Compare
LarryWoestman
left a comment
There was a problem hiding this comment.
This looks reasonable to me.
|
Backport failed for Please cherry-pick the changes locally and resolve any conflicts. git fetch origin releases/FreeCAD-1-1
git worktree add -d .worktree/backport-25850-to-releases/FreeCAD-1-1 origin/releases/FreeCAD-1-1
cd .worktree/backport-25850-to-releases/FreeCAD-1-1
git switch --create backport-25850-to-releases/FreeCAD-1-1
git cherry-pick -x 533e957f80b4fae2fcd64d0c0631665af9d3e254 ef794c31bd85cd2d5a11df47b8a07e93e8982be3 0cdf9abc4b3af866928960a07fc324c5bd67583d 87185c8135e6ff8a2b1cb7efda0576208a368def 06fe4b37bac410d0c96bf3003eff4f6b8cf3fd5b 3c5f39c0caf084bb88779cf105b54e09ea120a6a bcb569977d3072ecbdc79cf3430fd48ea26447d9 e4862572aecd5ca2878c3d199724a5cf3d317932 4c18ac6c5480f741f0a2ad1594e8aa67a23b141f 8b500ca9a36c7e12e2f2f63161b06a669b237cdd 34a53018624ffdddf0eecbcdbbec22141353a7bf 38c3eebd7ab81756b6d6d29039c375f0d08dbc9d e6c95dbb9158dd48957b073446dd1784eba6ac52 8386f1394e4c88e56132e68888076c48c8f3a6ec 9c78ced00c67a6c2554d8fbfbeb84282a90d3363 |
|
Is there anything I can do or should do to get this included in the 1.1 release? |
|
@sliptonic @maxwxyz Can we see about getting this backported to 1.1? |
|
The automatic backport failed. Ideally you can open a separate PR against the 1-1 branch. |
|
[Max Wilfinger]
The automatic backport failed. Ideally you can open a separate PR
against the 1-1 branch.
OK. I created <URL: #26436 >
without the self test and no longer needed workaround. If the self test
is needed, I have to get help to figure out how to do it.
…--
Happy hacking
Petter Reinholdtsen
|
CAM: Made Fanuc post processor compatible with FreeCAD 1.1.
CAM: Adjusted Fanuc post processor to move Z to tool change position before M6
CAM: Added test of Fanuc post processor
CAM: Made Fanuc post processor compatible with FreeCAD 1.0.
CAM: Switched Fanuc post processor to end program with M30, not M2.
CAM: Adjusted Fanuc post processor to use M05 consistently everywhere.
CAM: Provide correct and more relevant header from Fanuc post processor
CAM: Avoid Z overtravel error on Fanuc tool changes
CAM: Avoid adding trailing space to all M6 lines.
CAM: Corrected Fanuc post processor M3 handling
CAM: Made empty spindle at the end optional in Fanuc CAM post processing script
CAM: Adjusted Fanuc post processing script to always start with a percent
CAM: Adjusted Fanuc post processing script to not inherit behaviour between calls
CAM: Print "Show editor" status boolean as string, not integer
Issues
Fixes #14016
Fixes #25723
Fixes #25677