FreeCAD 0.12.5284 and OpenCASCADE 6.5.2 – Working together on Slackware | Niels Horn's Blog

Niels Horn's Blog

Random thoughts, tips & tricks about Slackware-Linux, Lego and Star Wars

FreeCAD 0.12.5284 and OpenCASCADE 6.5.2 – Working together on Slackware


Building a new version of FreeCAD and OpenCASCADE is always a lot of fun…
These two projects are constantly evolving, but almost never ‘in sync’.

In December a new version of the OpenCASCADE library was released – 6.5.2. It solves several bugs and looked like a good reason to build a newer version of FreeCAD in the process. And this is where the fun begins! :)

Building OpenCASCADE

OpenCASCADE_logoBuilding the new version of OpenCASCADE was straightforward. I just needed to update the patch to get it to build with’s version of ftgl and test my patience – as it takes more than two hours to build on my Virtual machine. But after some fiddling around, I had a package.
Time to do some testing and trying to build FreeCAD against it! :)

Building FreeCAD

FreeCADI decided to try the latest “stable” version of FreeCAD – 0.12.5284. The FreeCAD developers have not created any new source tarballs for a while, so I had to get the SVN revision 5284. I uploaded the tarball I created from that revision to my site so that everyone can create the same stable version.
I soon noticed that they solved all the problems I had with building against OpenCASCADE 6.5.1 some time ago, so I was able to remove that patch.
But then I ran against a new problem:

error: no matching function for call to 'BRepBuilderAPI_MakeFace::BRepBuilderAPI_MakeFace(Handle_Geom_Plane&, double, double&, double, double&)'

Reading the release notes of 6.5.2 I found out that the BRepBuilderAPI_MakeFace function now needs an extra parameter:

BRepLib_MakeFace has been modified to accept tolerance value for resolution of degenerated
edges. This tolerance parameter has no default value (to ensure that the client code takes care of
passing some meaningful value, not just Precision::Confusion), so some porting overheads
are expected.

So, it doesn’t have a default value. But what was the default before?
I read through the documentation and found that previously the default was Precision::Confusion():

A default tolerance (Precision::Confusion()) is given to the face,
this tolerance may be increased during construction of the face
using various algorithms.

I tried to add this default to the function call and … it worked!
Trying to compile the rest of FreeCAD I found several other locations in the source with the same problem, resulting in this patch:

--- FreeCAD-0.12.5284/src/Mod/Part/App/AppPartPy.cpp	2012-01-02 16:32:09.000000000 -0200
+++ FreeCAD-0.12.5284_patched/src/Mod/Part/App/AppPartPy.cpp	2012-01-02 21:36:18.000000000 -0200
@@ -492,7 +492,7 @@
             d.SetCoord(vec.x, vec.y, vec.z);
         Handle_Geom_Plane aPlane = new Geom_Plane(p, d);
-        BRepBuilderAPI_MakeFace Face(aPlane, 0.0, length, 0.0, width);
+        BRepBuilderAPI_MakeFace Face(aPlane, 0.0, length, 0.0, width, Precision::Confusion());
         return new TopoShapeFacePy(new TopoShape((Face.Face())));
     catch (Standard_DomainError) {
--- FreeCAD-0.12.5284/src/Mod/Part/App/GeometrySurfacePyImp.cpp	2012-01-02 16:32:09.000000000 -0200
+++ FreeCAD-0.12.5284_patched/src/Mod/Part/App/GeometrySurfacePyImp.cpp	2012-01-02 22:08:47.000000000 -0200
@@ -79,7 +79,7 @@
             if (!PyArg_ParseTuple(args, "|dddd", &u1,&u2,&v1,&v2))
                 return 0;
-            BRepBuilderAPI_MakeFace mkBuilder(s, u1, u2, v1, v2);
+            BRepBuilderAPI_MakeFace mkBuilder(s, u1, u2, v1, v2, Precision::Confusion());
             TopoDS_Shape sh = mkBuilder.Shape();
             return new TopoShapeFacePy(new TopoShape(sh));
--- FreeCAD-0.12.5284/src/Mod/Part/App/Geometry.cpp	2012-01-02 16:32:09.000000000 -0200
+++ FreeCAD-0.12.5284_patched/src/Mod/Part/App/Geometry.cpp	2012-01-02 22:37:08.000000000 -0200
@@ -1252,7 +1252,7 @@
     Handle_Geom_Surface s = Handle_Geom_Surface::DownCast(handle());
     Standard_Real u1,u2,v1,v2;
-    BRepBuilderAPI_MakeFace mkBuilder(s, u1, u2, v1, v2);
+    BRepBuilderAPI_MakeFace mkBuilder(s, u1, u2, v1, v2, Precision::Confusion());
     return mkBuilder.Shape();

--- FreeCAD-0.12.5284/src/Mod/Part/App/PrimitiveFeature.cpp	2012-01-02 16:32:09.000000000 -0200
+++ FreeCAD-0.12.5284_patched/src/Mod/Part/App/PrimitiveFeature.cpp	2012-01-02 22:40:21.000000000 -0200
@@ -191,7 +191,7 @@
     gp_Pnt pnt(0.0,0.0,0.0);
     gp_Dir dir(0.0,0.0,1.0);
     Handle_Geom_Plane aPlane = new Geom_Plane(pnt, dir);
-    BRepBuilderAPI_MakeFace mkFace(aPlane, 0.0, L, 0.0, W);
+    BRepBuilderAPI_MakeFace mkFace(aPlane, 0.0, L, 0.0, W, Precision::Confusion());

     const char *error=0;
     switch (mkFace.Error())
--- FreeCAD-0.12.5284/src/Mod/Part/App/TopoShape.cpp	2012-01-02 16:32:09.000000000 -0200
+++ FreeCAD-0.12.5284_patched/src/Mod/Part/App/TopoShape.cpp	2012-01-03 00:19:12.000000000 -0200
@@ -1338,7 +1338,7 @@
     double u1,u2,v1,v2;

-    BRepBuilderAPI_MakeFace mkBuilder(surf, umin, umax, v1, v2);
+    BRepBuilderAPI_MakeFace mkBuilder(surf, umin, umax, v1, v2, Precision::Confusion());
     return mkBuilder.Face();

@@ -1391,7 +1391,7 @@

         Standard_Real u1,u2,v1,v2;
-        BRepBuilderAPI_MakeFace mkBuilder(mySurface, u1, u2, v1, v2);
+        BRepBuilderAPI_MakeFace mkBuilder(mySurface, u1, u2, v1, v2, Precision::Confusion());
         return mkBuilder.Shape();

@@ -1443,7 +1443,7 @@
     mkSweep.Perform(tol, Standard_False, GeomAbs_C1, BSplCLib::MaxDegree(), 1000);

     const Handle_Geom_Surface& surf = mkSweep.Surface();
-    BRepBuilderAPI_MakeFace mkBuilder(surf, umin, umax, vmin, vmax);
+    BRepBuilderAPI_MakeFace mkBuilder(surf, umin, umax, vmin, vmax, Precision::Confusion());
     return mkBuilder.Face();

--- FreeCAD-0.12.5284/src/Mod/Part/App/TopoShapeFacePyImp.cpp	2012-01-02 16:32:09.000000000 -0200
+++ FreeCAD-0.12.5284_patched/src/Mod/Part/App/TopoShapeFacePyImp.cpp	2012-01-03 00:24:40.000000000 -0200
@@ -135,7 +135,7 @@
                 return -1;

-            BRepBuilderAPI_MakeFace mkFace(S);
+            BRepBuilderAPI_MakeFace mkFace(S, Precision::Confusion());
             if (bound) {
                 Py::List list(bound);
                 for (Py::List::iterator it = list.begin(); it != list.end(); ++it) {

With this patch I was able to build FreeCAD successfully on Slackware and now I’m happy playing around with it, discovering the new features :)

Where to get it

I submitted the new scripts to, where they are waiting in the pending queue to be approved.
In the mean time, pre-built packages for Slackware (both 32- and 64-bits) can be downloaded from my site.

Bookmark and Share

This entry was posted on Thursday, January 5th, 2012 at 0:40 and is filed under FreeCAD, OpenCASCADE, Slackware. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

12 Responses to “FreeCAD 0.12.5284 and OpenCASCADE 6.5.2 – Working together on Slackware”

  1. Antoine Says:

    Hello Niels,
    I stumbled upon your very nice blog / web site while trying to compile FreeCAD and its dependencies for Slackware x86_64 13.37.
    I finally gave up and decided to install your pre-built packages.
    FreeCAD launches OK but when I try to open the default Workbench I get a “No module named SketcherGui” error message as described on:

    That web site indicates that installing libeigen3-dev solves the problem.
    The libeigen3-dev package is essentially a bunch of C include files, installing it after compilation should not change anything.
    Did you have that library installed when you compiled and created the package?
    Do you see the same problem?
    Thanks for any help you can provide.

  2. Antoine Says:

    Hello again,
    I should have mentioned that the problems that I described in my previous message were with your FreeCAD 0.12.5284 and OpenCASCADE 6.5.2 packages.
    When using the 0.11 and 6.5.1 packages, I get a bunch of “Cannot find icon:” messages at startup, but the FreeCAD window seems to be populated with all the icons.

  3. Niels Horn Says:

    Hi Antoine,

    Yes, I know about this problem… It needs the eigen3 libs at build-time, and it actually complains if they’re not installed on your system when compiling FreeCAD, but it says it is “optional” so I did not worry too much about it.
    I did some basic testing with the new FreeCAD before publishing the article, like loading designs made with the previous version, adding some basic parts, printing, etc. and everything worked. I only noticed the “SketcherGUI” problem after the post…

    Well, it seems eigen3 solves the problem, but Slackware 13.37 still comes with eigen2. I’m trying a solution where both can be installed concurrently, without removing or upgrading eigen2, which may impact lots of other packages.
    As soon as I have this all figured out, I’ll write about it here on my blog.

    In the mean time, you could install eigen3 on your system or fall back to the previous versions of FreeCAD and OpenCASCADE.

  4. Antoine Says:

    Thanks for the quick response Niels.

    All the eigen2 files seem to be in /usr/include/eigen2 and by default libeigen3-dev installs in /usr/local/include/eigen3 so it might be possible to have them both installed.

  5. Niels Horn Says:

    Hi again,

    I did some testing and built a new package.
    Can you test if it works fine for you?
    You can download it here.

    Note: This is a temporary location…

  6. Antoine Says:

    It is a lot better, thanks!
    The Sketcher GUI error message is gone, all the tools icons show up, things seem to work normally (but this is the first time I use this software so I will only be able to check if everything works as I got through the tutorial).

    I do get the following message on the shell at startup though. I don’t know if it is serious or not:

    Traceback (most recent call last):
    File “/opt/FreeCAD/Mod/Draft/”, line 197, in Initialize
    self.appendToolbar(str(DraftTools.translate(”draft”,”Draft creation tools”)),self.cmdList)
    UnboundLocalError: local variable ‘DraftTools’ referenced before assignment

    I also just noticed that at startups this one says “FreeCAD 0.13, Libs: 0.13RUnknown” which doesn’t match the package’s numbering.
    Help->About FreeCAD also shows a mix of 0.12 and 0.13.
    Not an issue, but I’m curious did you build this one from a daily 0.13 build?

    Feel free to communicate by email if you don’t want to clutter your blog.

  7. Chris Says:

    Hello Niels!

    Thank you for your great packages!

    I just tested the new build and the sketcher is now working.
    But when trying to open the “draft”-menu, I get: “local variable ‘DraftTools’ referenced before assignment”,
    and when leaving it:
    ‘module’ object has no attribute ‘activeDraftCommand’

    BTW: You can test the installation in the “Test framework” menu with “self test”

    Greetings, Chris

  8. Tony Says:

    Thanks for posting the patch – I would have given up on this and went with another cad program if it had not been for you posting the patch. Just a big THANKS!

  9. Chris Says:

    Hello Niels,
    Recently I found time to try freecad more indepth. I found, that for creating drawings, it is essential, that the “Draft”-Menu is working… But anyway thank you very much!

  10. thuyavan Says:

    sir i installed opencascade but only draw test opens but how to open full window featured opencascade i donot know please please help me to please reply

  11. Ryan Says:

    I’m a Mechanical Engineering Major at the University of Massachusetts here in the states so I was very excited to find your blog and FreeCAD slackware packages. Unfortunately I am running -current (14 beta) right now and things are not looking good. I installed your prebuilt packages and FreeCAD complained about not finding the right version of many libraries. Instead of trying to go back and make lots of version links to new new libs I attempted to just compile the packages using your slackbuilds. Here is the second issue. Coin will not compile at all. After a few days of research and headache, I had the thought that maybe you were already working on slackware 14 packages. Would you happen to have some that I can help alpha/beta test? I figure that you have a deeper understanding of what these programs need in order to compile and it would be easier to work with you then alone. Can we help each other?

  12. Niels Horn Says:

    Slackware 14.0 has been released and the SlackBuild scripts have been updated.
    I’ll build new ready-to-go packages for it as soon as I can find some spare time.

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

It may take some time for your comment to appear, it is not necessary to submit it again.