Scripting FreeCAD from Rhino: FilletEdge case

I recently started working on a Rhino.Python script that accesses another CAD application / modeling engine via scripting without leaving Rhino’s GUI. The script is an alternative to _FilletEdge for when Open Cascade, via FreeCAD, can solve some constant radius, rolling-ball problems like those reported to the forum and/or are currently listed as Bugs in YouTrack.

I’m using Rhino 7, 7.13.21348.13001 and FreeCAD 0.019.24267 on Windows.

The following are a couple of examples of _FilletEdge vs. FreeCAD’s Part Fillet. Both FreeCAD/OCCT’s solutions include a patch-like surface at intersection of the edges. (Notice the setback fillets in the last GIF. They were not specified.)

FilletEdge_A FilletEdgeFC_A
(Stubborn Corner)

FilletEdge_B FilletEdgeFC_B
(4 Corner fillets)

I’m going to work on the script more before publishing it.


Hi Steve,
Thank you for sharing the progress! Can’t really help you, but your fillet project looks quite interesting.
Do you mind if I ask how is the connection to FreeCAD achieved? Through Rhino.Inside or?

The Rhino.Python script writes out a .py, then subprocesses headless FreeCAD to run it.

1 Like

Thank you @spb ,
So from the Rhino.Python you are directly calling FreeCAD?

He mentioned using the subprocess module to communicate with headless Freecad, which means running it as a command line tool.


rhinopython/ at master · CADacombs/rhinopython · GitHub

The file paths are set for use on Windows. The script and STEP files are created on the current user’s Desktop. Their paths and the path to the headless FreeCAD executable are set immediately after the imports near the beginning of the script.

What file paths can get this working on a Mac?

User input works a little differently than _FilletEdge; pressing the Enter key confirms the choice of the currently selected edges and radius value.

Examples showing variable radius fillets created to connect fillets of different constant radii:
FilletEdgeFC_C FilletEdgeFC_D


I don’t have FreeCAD but line 70 surely needs to be changed to point to the Applications folder, where the FreeCAD binary resides:
sFCcmd_Path = '"{}"'.format(r"/Applications/FreeCAD")

*nix systems (Linux, macOS) also use forward slashes in paths, so you might want to change all of these, for instance:

sPath_Script_for_FC = desktop + r"\"sPath_Script_for_FC = desktop + r"/"

However, you could easily make this more multiplatform compliant, by using os.path.join(path1, path2) instead of adding raw strings.

It would also probably be a good idea to place the FreeCAD file in the same directory as the current Rhino one, instead of dumping everything on the desktop:




Thanks for great script
But I also need a script for chamfer
Are you for ChamferEdge too write
Python script ?[and blendEdge]
And is it possible to make spb fillet and ChamferEdge (free cad)?components
If we want to increase or decrease the amount of fillet that has already been filleted(Is it possible? If yes, how? If not, please add this feature to your script)
Similar Nx


Here you go:
rhinopython/ at master · CADacombs/rhinopython · GitHub

I do not see a BlendEdge-type command in FreeCAD or in Open Cascade’s library.

I don’t know if these FreeCAD-involved scripts are a good basis for Grasshopper components. Their processes are one-way streets; no history is preserved. They also don’t allow existing fillets, etc., to be modified.

Are you reporting _FilletEdge / FilEdge / Brep.CreateFilletEdges, etc., failures to McNeel?


Amazing!!! Do you think the Freecad`s shell command is also worth going with that way? I hope that freecad better solves self-intersections during shell than Rhino.

Freecad has a big amount of nice procedural plugins (addons) which also could be reached in that way (maybe). F.e. generate bolts, screws, nuts (fasteners workbench) also commands for filling holes (surface workbench) maybe is better than in Rhino.

The blend command may be seen here: [FreeCAD] Surfacing Tutorial (Surface WB & Curves WB) Part 1: Introduction - YouTube
You can also see fill hole based on 6 edges which also looks cool (Filling command in Surface Workbench).
Zrzut ekranu 2022-02-20 234138

It`s inside Curves workbench which should be manually installed from the addon manager.

Zrzut ekranu 2022-02-20 233347

You have opened many doors for many possibilities in Rhino.

You`ve done a great job with that.


1 Like


If you have examples where _Shell and _OffsetSrf fail, but FreeCAD’s Part::Thickness or Part::Offset succeed, please send them to me.

The Curves WB doesn’t seem to be accessible by the API without the GUI. If it was, BlendSurface could be applied after Part:Chamfer to create BlendEdge-like features.

In January, I started to work on an alternative to _Patch using FC’s Surface::Filling, but it is still a WIP.

The offset and shell are not so great in Freecad to use them inside Rhino (there is a self-intersection detection button but it doesn`t work properly).

To get access to those Curves and Surface WB I`ve created a thread in the Freecad forum: Headless access to Curves and Surface WB - FreeCAD Forum

I think it’s possible to run it in headless mode but I`m too fresh a user of Freecad to help you effectively.

Your scripts are awesome , thank’s a lot

1 Like

Hi @spb ,

Can you add FreeCAD BooleanDifference for Rhinoceros?
sometimes rhino’s BooleanDifference will failed?

Please post an example where _BooleanDifference fails but shouldn’t.

@spb okay, thanks
i have uploaded the attachment. you can check it, using FreeCAD Boolean can succeed, so can rhinoceros call FreeCAD Boolean script?
BooleanDifference.3dm (10.0 MB)

This is challenging geometry to Boolean; the result I got from FreeCAD has errors.

I recommend simplifying the knurl geometry for it to be Boolean-friendly, maybe like The simpliest way to create texture on Rhino - YouTube
If the cross section needs to be round, one of the two sets of shapes should have a different cross section to avoid tangential intersections.