Using FreeCAD as a lib in a python package

Show off your FreeCAD projects here!
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
Msfd
Posts: 1
Joined: Fri Oct 12, 2018 3:09 pm

Using FreeCAD as a lib in a python package

Post by Msfd »

Hi,

I'm from Dessia, a french start-up in enginneering. We needed a python package construct geometries and to make some computations 2D computations like areas, second moment area, intersections and so on. The package had to be lightweight, so we didn't wanted to use OpenCascade or such engine.
We developed volmdlr (Volume Modeler), an open source python package: https://github.com/Dessia-tech/volmdlr

The package make for now the computations in 2D. For 3D, we rely on FreeCAD with a binding: from our geometric description, we write a corresponding freecad script and we execute it. This allows to use python3 as the user must give the python2 path that can import FreeCAD as a lib.

Here is an example of a casing designed with our package: (Link to the script on github)
The inner contour is specified by points of the polygon and radii to round it's corners. Then these profiles are extruded. The upper "belt" interface with the screw holes is generated in the same way, and we sample the screw position by asking points on the contour at regular curvilinear absissa.

Image

I'll show you soon some other examples generated with this package.
Attachments
casing.fcstd
(23.36 KiB) Downloaded 90 times
chrisb
Veteran
Posts: 54213
Joined: Tue Mar 17, 2015 9:14 am

Re: Using FreeCAD as a lib in a python package

Post by chrisb »

Thanks for sharing.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: Using FreeCAD as a lib in a python package

Post by Kunda1 »

Very cool! Looking forward to seeing more examples, as you said. Thanks!
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: Using FreeCAD as a lib in a python package

Post by Kunda1 »

@Msfd would you be open to featuring your project in the User Showcase subforum ?
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
Post Reply