This problem also exist in version 1.0.2+dfsg-1 in testing.
When trying to output G-code from the FreeCAD CAM module using the fanuc
postprocessor, I get a exception backtrace because the postprocessor try
to handle thread taps, while the surrounding code in FreeCAD do not seem
to support tool types.
From the internal console:
20:24:40 Running the Python command 'CAM_Post' failed:
Traceback (most recent call last):
File "/usr/share/freecad/Mod/CAM/Path/Post/Command.py", line 188, in Activated
post_data = postprocessor.export()
File "/usr/share/freecad/Mod/CAM/Path/Post/Processor.py", line 321, in export
gcode = self.script_module.export(sublist, "-", self._job.PostProcessorArgs)
File "/usr/lib/freecad/Mod/CAM/Path/Post/scripts/fanuc_post.py", line 262, in export
gcode += parse(obj)
File "/usr/lib/freecad/Mod/CAM/Path/Post/scripts/fanuc_post.py", line 420, in parse
if pathobj.Tool.ToolType == "Tap":
The problem need either horizontal or vertical feed rate or spindle
speed to trigger. The error above showed up when creating a simple
cylinder, creating a CAM job with fanuc as the post processor, adding a
simple facing operation on the top end of the cylinder, and then setting
feed rates to 150 mm/min and spindle speed to 1000.
I see the same problem discussed in
<URL: https://forum.freecad.org/viewtopic.php?t=74878 >, and
modification in the upstream code which seem related in
<URL: https://github.com/FreeCAD/FreeCAD/commit/bd24577184e44f29d6b11baa950dda1bf28e21fe >
and the following commit for that file.
I am not aware of any sensible workaround for this yet, and believe it
make FreeCAD CAM kind of useless for use with Fanuc CNC controllers.
Using the following hack, I was able to get the fanuc postprocessor to
output G-code.
--- /usr/lib/freecad/Mod/Path/PathScripts/post/fanuc_post.py 2025-10-11 19:39:13.262502507 +0200
+++ /usr/lib/freecad/Mod/Path/PathScripts/post/fanuc_my_post.py 2025-10-11 21:45:54.261357653 +0200
@@ -431,17 +431,20 @@
continue
# if it's a tap, we rigid tap, so don't start the spindle yet...
+ if hasattr(pathobj, "ToolController") \
+ and hasattr(pathobj.ToolController, "Tool") \
+ and hasattr(pathobj.ToolController.Tool, "ToolType"):
+ tooltype = pathobj.ToolController.Tool.ToolType
+ else:
+ tooltype = "non-tap"
if command == "M03" or command == "M3":
- if pathobj.ToolController.Tool.ToolType == "Tap":
+ if tooltype == "Tap":
tapSpeed = int(pathobj.SpindleSpeed)
continue
# convert drill cycles to tap cycles if tool is a tap
if command == "G81" or command == "G83":
- if (
- hasattr(pathobj, "ToolController")
- and pathobj.ToolController.Tool.ToolType == "Tap"
- ):
+ if tooltype == "Tap":
command = "G84"
out += linenumber() + "G95\n"
paramstring = ""
This move tool type to a new local variable and only set this if the
ToolType feature is available in FreeCAD. I do not know in which
version of FreeCAD such tool type string is available, if it used to be
available and have moved location or if it will become available in a
future version of FreeCAD. For now I assume there is no support for
tapping in FreeCAD, and the code in question in effect just disable such
support in the Fanuc postprocessor.
Hi Petter, regarding the upstream commit, maybe I've got confused: https://github.com/FreeCAD/FreeCAD/commit/bd24577184e44f29d6b11baa950dda1bf28e21fe Does this commit help the issue or is your patch needed on top? (refering https://github.com/FreeCAD/FreeCAD/pull/22330 and its issue https://github.com/FreeCAD/FreeCAD/issues/14016 ) It would proably makes sense to add your information to the upstream discussion, can you engange there, especially if the upstream issues are not the same as the one you are seeing? Cheers, -- tobi
Hi, Tobias. You seem to believe the Debian bug tracking system send emails to requestors by default. This is not the case, and I discovered your email just by chance when I was going to share this issue URL with a friend. :) [Tobias Frost] I do not know if fanuc postprocessor work in the git edition from upstream, as I do not know how to test it. My patch apply to the version in Debian oldstable. I do not know if it will work with the version in Debian stable. But I can confirm that the fanuc postprocessor in FreeCAD from Debian stable do not work. I'll have a look.
Using the following patch I was able to get FreeCAD version 1.0.0+dfsg-8
in Debian Stable / Trixie working.
I am submitting patches upstream to ensure this is fixed there too.
--- /usr/lib/freecad/Mod/CAM/Path/Post/scripts/fanuc_post.py 2024-11-18 17:48:00.000000000 +0100
+++ /usr/lib/freecad/Mod/CAM/Path/Post/scripts/fanuc_test_post.py 2025-11-29 20:43:18.052877155 +0100
@@ -417,7 +417,7 @@
# if it's a tap, we rigid tap, so don't start the spindle yet...
if command == "M03" or command == "M3":
- if pathobj.Tool.ToolType == "Tap":
+ if hasattr(pathobj, "Tool") and pathobj.Tool.ShapeName.lower() == "tap":
tapSpeed = int(pathobj.SpindleSpeed)
continue
@@ -425,7 +425,7 @@
if command == "G81" or command == "G83":
if (
hasattr(pathobj, "ToolController")
- and pathobj.ToolController.Tool.ToolType == "Tap"
+ and pathobj.ToolController.Tool.ShapeName.lower() == "tap"
):
command = "G84"
out += linenumber() + "G95\n"
Is there anything more I can do to get the fanuc post processor working by default in Debian stable?
Hi Petter, working threw me off and I didn't take a look if the tag is still valid, sorry for that. Re-reading the upstream discussion I'm confused in what patch I'd need to fix this issue, can you point me to the commit(s) I need? (I'm removing the patch tag because I can't tell what patch I'll need…) On the other hand, upstream is converging on 1.1 (the last RC was three days ago, RC-3), so the best option might be to simply wait until 1.1 is released - (I guess you have locally something that works for you, so I hope you are set for the moment - as you indicated on the upstream discussion, there seems not to be many faunc users running into that issue anyways…) Regarding stable: This of course required proper backporting of the issue, I don't think I would be able to sneak 1.1 into stable. Said that, I've planned to have 1.1 in trixie-backports, although I've not checked how much effort that will be. Would a backport work for you? Another possiblity would be backporting the fix via s-p-u, but for that the release manager will have a say too, I fear this bug isn't "important enough." - if you want to try the s-p-u route, please go ahead :) - I probably will not go that route, but as said, if you want, be my guest and if release managers ask, I'll ACK the s-p-u.
I discovered this message by pure luck, circling back to check the state of the Debian issue as I was wrapping up the issue upstream. Please keep me on CC when replying, as I do not receive messages only sent to 1117850@bugs.debian.org. Sure. I tried to do on better, and submitted a merge request, <URL: https://salsa.debian.org/debian/freecad/-/merge_requests/1 >. I've already sent a tested patch upstream for 1.1, waiting for review and merging, see <URL: https://github.com/FreeCAD/FreeCAD/pull/27964 >, but want to do my best to get this fix is included in 1.0 while we wait for 1.1 to be released. I'll see what I decide to do regarding Debian stable, once 1.0 in unstable is fixed.
[Petter Reinholdtsen] The patch was applied to the upstream 1.1 branch a few minutes ago.
Hello, Bug #1117850 in freecad reported by you has been fixed in the Git repository and is awaiting an upload. You can see the commit message below and you can check the diff of the fix at: https://salsa.debian.org/debian/freecad/-/commit/aa9583a7ea2824c44350e7c2cd31e8187075434b Fixes crash problem, milling, drilling, tool changes, thread tapping and get the post processor working as it should. This patch is tested on a Fanuc controller and sent upstream as <URL: https://github.com/FreeCAD/FreeCAD/pull/27960 >. I hope and expect the fix will be included in FreeCAD 1.1. Closes: #1117850 ------------------------------------------------------------------------ (this message was generated automatically) -- Greetings https://bugs.debian.org/1117850
Hello, Bug #1117850 in freecad reported by you has been fixed in the Git repository and is awaiting an upload. You can see the commit message below and you can check the diff of the fix at: https://salsa.debian.org/debian/freecad/-/commit/9b5c8298df40c384b89b80dad149d4729adf2a64 (this message was generated automatically) -- Greetings https://bugs.debian.org/1117850
We believe that the bug you reported is fixed in the latest version of
freecad, which is due to be installed in the Debian FTP archive.
A summary of the changes between this version and the previous one is
attached.
Thank you for reporting the bug, which will now be closed. If you
have further comments please address them to 1117850@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.
Debian distribution maintenance software
pp.
Tobias Frost <tobi@debian.org> (supplier of updated freecad package)
(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing ftpmaster@ftp-master.debian.org)
Format: 1.8
Date: Mon, 02 Mar 2026 19:44:47 +0100
Source: freecad
Architecture: source
Version: 1.0.2+dfsg-6
Distribution: unstable
Urgency: medium
Maintainer: FreeCAD Packaging Team <team+freecad-packaging-team@tracker.debian.org>
Changed-By: Tobias Frost <tobi@debian.org>
Closes: 1117850
Changes:
freecad (1.0.2+dfsg-6) unstable; urgency=medium
.
* Fix "CAM output fail with fanuc postprocessor, thanks Petter Reinholdtsen
for the patch (Closes: #1117850)
Checksums-Sha1:
db0abd1b6183ca49b9853e7941a94cd56ed3aa41 3590 freecad_1.0.2+dfsg-6.dsc
422ce4deb9aff5151e005b5b7f67a1e488125a5e 67680 freecad_1.0.2+dfsg-6.debian.tar.xz
a3e90b63a111ba977b00f1081006198677761de4 37244 freecad_1.0.2+dfsg-6_amd64.buildinfo
Checksums-Sha256:
0c15436bfb68f3b7cb2ff6e39a6df9eea74edd62ca167b78b8951f4ca68fc0d5 3590 freecad_1.0.2+dfsg-6.dsc
739f22d24ba79eb314f9fed80f84077fc2af6b1fd392ba08adf5d1ba1f0a9bb0 67680 freecad_1.0.2+dfsg-6.debian.tar.xz
37197a27480d9eed994cb773f88afe2d2a1aadd47190105fa4d5852942b2efa1 37244 freecad_1.0.2+dfsg-6_amd64.buildinfo
Files:
7bdee779363923c1d264e89a99dd6f2f 3590 science optional freecad_1.0.2+dfsg-6.dsc
3eba4b078e869e1182f4bc702f70ffb2 67680 science optional freecad_1.0.2+dfsg-6.debian.tar.xz
98d2d143b517022b7f5673bb120608a9 37244 science optional freecad_1.0.2+dfsg-6_amd64.buildinfo
-----BEGIN PGP SIGNATURE-----
iQIzBAEBCgAdFiEE/d0M/zhkJ3YwohhskWT6HRe9XTYFAmml5z8ACgkQkWT6HRe9
XTa4NQ/+JWegVnOYhhnToxsaq/fo/D5oGJTpBhx9LJUBQdoDc843q51tBGgYmFIa
FCPBopFKesMOjXB1GDO3n5FULvFGC7CSHsHUfCYzleWOPyeJfufJZh7gQUEdFKVv
gF/R1VaJ4GfKoqj1JiAcv0feX6b2bobs1mITXBJQGqCxLScZLpUF0qlVxwu23oLA
TBjjHniSjDw1lHhzo9/bhmNioZ3s89Dbh4zk4csf+3Imr2k4mwjtQNDCnO8fX6+w
aMi2Wm3Gzb9IKsVfAdO9IwkJ6pQa7qPBxNMoPkL99W5JYK9dN0lPYnA0h37eN0uP
6ydSXS++gkEz5yQU64BY8uQnGlvIY4ck9kei6wm4lc0Z0bHE90yeNXE2qmGrAsyQ
gR4gESq5bXFnndXGfT9OdsaMSghf/eENCwQhsMaJMZx4o+H+qmUkICp4m8d4sPQd
WxmssZLW7+ElEAM5nuiH7mqUnrp3dnkq47lNloCMHMHbeXZccretHgX/o3KP0rjn
WjKbaOJFDR+r9tKvMCOrb0YlA/du20r5Rd6mxThXzjMs3QUXTz2Gy4iccD6XKB6b
CYF4Z3EcLYuo8TLx2qFnRBbTGGeejpF/oTeR1BLZ0Zpc1aNofwUYsjxrcHDCMbUq
rqU1/xWxjdHLdoIcw5YmWk9LxoMxYYfGRYsNOh4YV43n3W5xZi0=
=ajvL
-----END PGP SIGNATURE-----
I guess that even though this issue do not affect everyone, it break the CAM feature for ever user of a Fanuc controller, and thus deserve severity important.
We believe that the bug you reported is fixed in the latest version of freecad, which is due to be installed in the Debian FTP archive. A summary of the changes between this version and the previous one is attached. Thank you for reporting the bug, which will now be closed. If you have further comments please address them to 1117850@bugs.debian.org, and the maintainer will reopen the bug report if appropriate. Debian distribution maintenance software pp. Petter Reinholdtsen <pere@debian.org> (supplier of updated freecad package) (This message was generated automatically at their request; if you believe that there is a problem with it please contact the archive administrators by mailing ftpmaster@ftp-master.debian.org) Format: 1.8 Date: Sat, 07 Mar 2026 22:02:07 +0100 Source: freecad Architecture: source Version: 1.0.0+dfsg-8+deb13u1 Distribution: trixie Urgency: medium Maintainer: Debian Science Maintainers <debian-science-maintainers@lists.alioth.debian.org> Changed-By: Petter Reinholdtsen <pere@debian.org> Closes: 1117850 Changes: freecad (1.0.0+dfsg-8+deb13u1) trixie; urgency=medium . * Maintaner approvided upload. * Get fanuc post processor working (Closes: #1117850). Checksums-Sha1: c8c90dbf4e0ed7614241edb75cc52a64581f580e 3648 freecad_1.0.0+dfsg-8+deb13u1.dsc d2a700f6dfc87fac0b1e7766ab6cc07bcb5b26ef 67560 freecad_1.0.0+dfsg-8+deb13u1.debian.tar.xz 0c6fab64c98e5c038f2fd9b3feca181fd8ab143b 36731 freecad_1.0.0+dfsg-8+deb13u1_source.buildinfo Checksums-Sha256: 9f477e5c1df125e04e77897843bb9194a53f54dfd7300264b39b60e91970a62f 3648 freecad_1.0.0+dfsg-8+deb13u1.dsc 7a98306a440a9baed7f0c29ae24b3c8432f1ac24c9497cebc967f0a0bef8add1 67560 freecad_1.0.0+dfsg-8+deb13u1.debian.tar.xz ecb0dff8ca22a2d5078ba1e624a8bdaab8179a9c96001371ee28b4690171ef1c 36731 freecad_1.0.0+dfsg-8+deb13u1_source.buildinfo Files: ab0947d9d011166fc02d0a0a5d65b5b4 3648 science optional freecad_1.0.0+dfsg-8+deb13u1.dsc 18a4a6c2ab675af0af101c1fa1ce1bdf 67560 science optional freecad_1.0.0+dfsg-8+deb13u1.debian.tar.xz 26092cdcba0dced217b6f4d943ca9804 36731 science optional freecad_1.0.0+dfsg-8+deb13u1_source.buildinfo -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEERqLf4owIeylOb9kkgSgKoIe6+w4FAmof/GcACgkQgSgKoIe6 +w7X1g/9GEqB4oH84Vqi313YeVTMNq59bXj/fI4piOy5f2qj33rB9wwlcCY8G18E n0SwR22ZhQ0Au0SS7rusEVaUnFp/mJrGbOp4NZ/rj63KWdoVnMnpgyx/fw0oIWgX g6fdzZRUVOOXfZxyBqBctNUMOyjZRZSGkfMjZEC1iAimKz2weKnqZNXH5zoneMsF pOKoQIzgSxtRt7f+7jNq2mSgshHtDI91MbGFVeWEZg7a4jI23o7r1YoPYOyyIh1H wDP+WHfA3IwkqKlh/VN3Fs+yzEv+AyZm7pLQiG3I74bC8yOexepi2OTkV/J+l8dC DAhKKsFlbY/VmUgOOd6w5rmKIeDVfbU3s65o09CZmYqQa5s1awCL1WCVGwmwt+J/ p+iaNkUYTNZgcqIKJbGYGj4Zilzm/IXP5+tkK5RQPxsu2EYbIFU1JkYUzw8akXdM dreETujNAVqwClLnB53RfhZYFC8xH/5zVf0L+hQeoXHC32bVn6/svNFtl+F8R3th 92tDKRdVfd4MI9NsF5s1433+LoT8Q/Z3aJBhYw4GAMa991ZuJY3fEmM5nV3kBmZ2 qTR9+ifNvjyNxDUCJ8fyLx4RBktItDP13NoYqibC6BcOcROVvfPWBayPP2+qaOkZ kQwNBjZA571wCoAeZ1auRnjDl56HdBk8q06MZxTzSM0G6CZfh2I= =0tgJ -----END PGP SIGNATURE-----