Bug 290214 - [NEW PORT] cad/pythonocc-core: 3D modeling based on the OpenCascade Technology modeling kernel
Summary: [NEW PORT] cad/pythonocc-core: 3D modeling based on the OpenCascade Technolog...
Status: Open
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: amd64 Any
: --- Affects Only Me
Assignee: Thierry Thomas
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-10-13 17:47 UTC by Philippe Hay
Modified: 2026-08-05 17:10 UTC (History)
2 users (show)

See Also:


Attachments
diff file (50.15 KB, patch)
2025-10-13 17:47 UTC, Philippe Hay
no flags Details | Diff
format-patch file (50.95 KB, patch)
2025-10-13 17:49 UTC, Philippe Hay
no flags Details | Diff
diff file (50.87 KB, patch)
2025-10-30 19:04 UTC, Philippe Hay
no flags Details | Diff
Updated diff file (51.12 KB, patch)
2025-11-09 16:40 UTC, Philippe Hay
no flags Details | Diff
Updated diff file (51.12 KB, patch)
2025-12-17 14:14 UTC, Philippe Hay
no flags Details | Diff
actual stand (7.22 KB, application/octet-stream)
2026-08-03 18:23 UTC, Philippe Hay
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Philippe Hay 2025-10-13 17:47:38 UTC
Created attachment 264545 [details]
diff file

pythonocc provides 3D modeling and dataexchange features.
It is intended to CAD/PDM/PLM/BIM development.
The module is based on the OpenCascade Technology modeling kernel.

Features
--------
pythonocc provides the following features:

*   a full access from Python to almost all af the thousand OpenCascade C++ classes.
    Classes and methods/functions share the same names, and, as possible as it can be, the same signature
*   3D visualization from the most famous Python Gui (tkinter, pyQt5 and 6, PySide2 and 6, wxPython)
*   3D visualization in a web browser using threejs or x3dom frameworks
*   3D visualization and work within a jupyter notebook
*   data exchange using most famous formats IGES/STEP/STL/PLY/OBJ/GLTF
*   Utility Python classes/methods for Topology operations, inertia computations,and more

The port is tested under 16 current and 14.3 (Q3/Q4)
Comment 1 Philippe Hay 2025-10-13 17:49:24 UTC
Created attachment 264546 [details]
format-patch file
Comment 2 Mark Linimon freebsd_committer freebsd_triage 2025-10-14 02:24:20 UTC
Comment on attachment 264546 [details]
format-patch file

Triage: either way of submitting is sufficient; we don't need both, thanks.
Comment 3 Philippe Hay 2025-10-30 19:04:02 UTC
Created attachment 265035 [details]
diff file
Comment 4 Philippe Hay 2025-10-30 19:08:23 UTC
Small update for opencascade version 7.9.2
(It compiles for both 7.9.1 and 7.9.2)
Tested and build with poudriere on 16 current and 14.3 realease (2025Q4)
Comment 5 Philippe Hay 2025-11-09 16:26:50 UTC
Comment on attachment 265035 [details]
diff file

Need an update for SWIG dependency version 4.3.1 (was max 4.3.0)
Comment 6 Philippe Hay 2025-11-09 16:40:01 UTC
Created attachment 265293 [details]
Updated diff file

Small update for SWIG (4.2.1...4.3.1)

Tested and build with poudriere:
-14.3 RELEASE (quarterly)
-16 CURRENT
Comment 7 Philippe Hay 2025-12-17 14:14:17 UTC
Created attachment 266291 [details]
Updated diff file

CMakeLists.txt updated for OpenCASCADE 7.9.3

Tested and build with poudriere:
-14.3 RELEASE (quarterly)
-15.0 RELEASE (quarterly)
-16 CURRENT
Comment 8 Thierry Thomas freebsd_committer freebsd_triage 2026-07-30 13:46:06 UTC
Sorry for the delay!

Meanwhile, OpenCascade 8.0.0 entered in the ports tree, and it seems that even the latest release of pythonocc-core does not support it, but there is a PR:

https://github.com/tpaviot/pythonocc-core/pull/1493

Could you please upgrade your patch until a tagname including the corresponding commits?

Some other remarks:
- cmake is listed as a BUILD_DEPENDS, but also in USES;
- python is hard-coded to 3.11, although 3.12 (the default) and more recent version are supported, and cython3 is now cython;
- it is sufficient to list libTKernel.so in LIB_DEPENDS to get cad/opencascade, you could remove the other libs;
- SWIG release is now 4.4.1, don't set a upper limit if not needed;
- pkg-descr lists several visualization methods (tkinter, pyQt, PySide, etc.), but there is no corresponding dependencies in the Makefile: do you plan to add some options?
Comment 9 Philippe Hay 2026-07-30 18:28:10 UTC
Hello Thierry Thomas,

thank you for having a look at this!
I was not aware of a PR concerning pythonocc-core for 8.0.0.

So yes, I will work on an update for this.

Thank you also for the other remarks.

The situation of python is actually much better, I will work on the possibility to add flavors.

"- pkg-descr lists several visualization methods (tkinter, pyQt, PySide, etc.), but there is no corresponding dependencies in the Makefile: do you plan to add some options?"

No, if I remember there is only an option/possibility in the CMakeList.txt to disable completely the visualization, I do not think this make sense.
Numpy is also a hard dependency despite the option in the CmakeList.txt
Comment 10 Philippe Hay 2026-08-03 18:19:55 UTC
(In reply to Thierry Thomas from comment #8)

I could adapt the patch, but it fails in the port tree.
(it compiles outside the port tree)

Make configure gives:

---------------------------------------------------------------------
...
...
104 warnings generated.
[465/465] Linking target numpy/_core/_multiarray_umath.cpython-312.so
[890/890] /usr/ports/math/py-numpy/work-py312/numpy-2.4.6/numpy/_core/tests/examples/limited_api/setup.py
Successfully built numpy-2.4.6-cp312-cp312-freebsd_16_0_current_amd64.whl
===>  Staging for py312-numpy-2.4.6_1,1
===>   py312-numpy-2.4.6_1,1 depends on executable: gfortran14 - found
===>   py312-numpy-2.4.6_1,1 depends on file: /usr/local/bin/python3.12 - found
===>   Generating temporary packing list
/usr/bin/find /usr/ports/math/py-numpy/work-py312/stage/usr/local/lib/python3.12/site-packages -name '*.so' -exec /usr/local/bin/strip {} +
/usr/bin/unzip -qo /usr/ports/distfiles/numpy-2.4/numpy-html.zip -d /usr/ports/math/py-numpy/work-py312/stage/usr/local/share/doc/py312-numpy
===> Creating unique files: Move MAN files needing SUFFIX
===> Creating unique files: Move files needing SUFFIX
Move: bin/f2py --> bin/f2py-3.12
Link: @bin/f2py --> bin/f2py-3.12
Move: bin/numpy-config --> bin/numpy-config-3.12
Link: @bin/numpy-config --> bin/numpy-config-3.12
====> Compressing man pages (compress-man)
====> Running Q/A tests (stage-qa)
===>  Installing for py312-numpy-2.4.6_1,1
===>  Checking if py312-numpy is already installed
===>   Registering installation for py312-numpy-2.4.6_1,1 as automatic
Installing py312-numpy-2.4.6_1,1...
===>   py312-pythonocc-core-8.0.0.a depends on executable: py312-numpy - not found
*** Error code 1
-------------------------------------------------------------------------

Because it compiles outside the port tree, I suppose the error is in my Makefile.

Also posted in the forum:
https://forums.freebsd.org/threads/porting-pythonocc-core.98942/post-770524
Comment 11 Philippe Hay 2026-08-03 18:23:48 UTC
Created attachment 273418 [details]
actual stand
Comment 12 Thierry Thomas freebsd_committer freebsd_triage 2026-08-05 09:00:27 UTC
Thanks for your follow-up, but as I wrote previously I cannot see how the the visualization programs could be built, because there is no dependencies for them!

pkg-descr announces 3D visualization from the most famous Python (tkinter, pyQt5 and 6, PySide2 and 6, wxPython), in a web browser and within a jupyter notebook Gui, but none of them is declared in the Makefile.

Note: we prefer a file in format .diff to one in format .zip, and don't forget to run portlint - see https://docs.freebsd.org/en/books/porters-handbook/book/index.html
Comment 13 Philippe Hay 2026-08-05 16:11:05 UTC
(In reply to Thierry Thomas from comment #12)

The backend for the visualisation is choosen with this preference:
PyQt5, PySide2, PyQt6, PySide6, wx
And a fallback to tk (supposed to be installed on all plateform) when no previous packages are found.

You are right, since tk is not part of the default python installation this will be a problem.
I will investigate this (some backends have probably advantages over the others).
My preference would be to set a default one and display a message after installation.
Would this be acceptable?

Concerning the opencascade version, now at 8.0.1
See also:
https://forums.freebsd.org/threads/porting-pythonocc-core.98942/post-770624

I could create some patches according the migration notes from:
https://github.com/Open-Cascade-SAS/OCCT/releases/tag/V8_0_0_p1 

So the port compiles now with 8.0.1, but I am not able to go deeper in all the changes, so some advanced functions will probably fail.
(I am not really happy with this situation)
Comment 14 Thierry Thomas freebsd_committer freebsd_triage 2026-08-05 17:10:22 UTC
Ideally it would be great to use flavors for the various back-ends, but we could just pick one to begin.

ATM opencascade uses Qt5, therefore it is already installed and I would suggest to use it, even if next release could upgrade to Qt6.