Giter Site home page Giter Site logo

trelau / pyocct Goto Github PK

View Code? Open in Web Editor NEW
203.0 203.0 43.0 342.39 MB

Python bindings for OpenCASCADE via pybind11.

License: GNU Lesser General Public License v2.1

CMake 9.18% Python 64.56% C++ 24.36% C 1.04% Batchfile 0.37% Shell 0.49%
cad computer-aided-design computer-aided-engineering engineering opencascade pybind11 python

pyocct's People

Contributors

frmdstryr avatar gitter-badger avatar looooo avatar mnesarco avatar shrdluk avatar trelau avatar whophil avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pyocct's Issues

Can't call AIS_InteractiveContext::EntityOwners method, no SelectMgr_IndexedMapOfOwner type

I cannot find a way to call the method AIS_InteractiveContext::EntityOwners. It requires an argument of type SelectMgr_IndexedMapOfOwner which is not available through pyocct.

Any idea for a workaround to get the list of SelectMgr_EntityOwner from AIS_InteractiveContext or any over way to programmatically select subshapes of an AIS_Shape?

Edit:
An alternative could have been SelectMgr_Selection::Entities, however the return type NCollection_Vector<Handle< SelectMgr_SensitiveEntity > >& is not available through pyocct either.

Add AIS_CustomObject that can be implemented in python

It'd be nice to be able to create a custom AIS_InteractiveObject that can be implemented in python.

Expected Behavior

Something along the lines of:

from OCCT.AIS import AIS_CustomObject

class MyAISObject(AIS_CustomObject):

    def Compute(self, prs_mgr, prs, mode):
         # draw stuff...

    def ComputeSelection(self, projector, prs):
         # etc...

    def HandleClick(self, owner):
        # etc..

Current Behavior

Attempting to extend the AIS_InteractiveObject doesn't work since there's no constructor and extending some other object doesn't work either since there's no delegation to the python virtual fn.

Possible Solution

Create a AIS_CustomObject class that delegates certain calls to python as described in https://pybind11.readthedocs.io/en/stable/advanced/classes.html#overriding-virtual-functions-in-python

Would be nice to add to the 7.5 release.

I can try to implement it if you think it'll work. I'm not sure how much of a performance impact it'll have.

How to call specific function signatures?

Do I understand correctly that pyocct keeps function signatures from C++ to avoid clashing? For example, this is the way this function is supposed to be called:

bounds = ShapeAnalysis.GetFaceUVBounds_(face, 0, 0, 0, 0) #argument zeros are required to call a specific C++ function and are not used as actual inputs in python

In this case I have a trouble trying to call function ShapeAnalysis_Edge.PCurve as its third argument needs to be a handle to Geom2d_Curve which is abstract.
How to correctly call this function in pyocct?

%run 'import_step.py' result in libatk and wx error

Hello.
I have successfully installed pyocct now.
Python 3.5 was used in OCCT env following the installation page.
nb_conda_kernel was installed in conda base env to access other env.

from OCCT.TopoDS import TopoDS_Shape returns no error

However,
%run 'import_step.py' gives the following error

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
~/Documents/pyOCCT-master/examples/import_step.py in <module>
     20 
     21 from OCCT.Exchange import ExchangeBasic
---> 22 from OCCT.Visualization import BasicViewer
     23 
     24 shape = ExchangeBasic.read_step('./models/compressor.step')

~/anaconda3/envs/occt/lib/python3.5/site-packages/OCCT/Visualization/__init__.py in <module>
     17 # License along with this library; if not, write to the Free Software
     18 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA
---> 19 from OCCT.Visualization.Basic import *

~/anaconda3/envs/occt/lib/python3.5/site-packages/OCCT/Visualization/Basic.py in <module>
     22 import platform
     23 
---> 24 import wx
     25 from OCCT.AIS import (AIS_InteractiveContext, AIS_Shape, AIS_Shaded,
     26                       AIS_WireFrame)

~/anaconda3/envs/occt/lib/python3.5/site-packages/wx/__init__.py in <module>
     15 # Import all items from the core wxPython module so they appear in the wx
     16 # package namespace.
---> 17 from wx.core import *
     18 
     19 

~/anaconda3/envs/occt/lib/python3.5/site-packages/wx/core.py in <module>
     10 """
     11 
---> 12 from ._core import *
     13 
     14 #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

ImportError: /usr/lib/x86_64-linux-gnu/libatk-1.0.so.0: undefined symbol: g_log_structured_standard

running the script for the second time (without resetting the kernel) gives the following error:

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
~/Documents/pyOCCT-master/examples/import_step.py in <module>
     20 
     21 from OCCT.Exchange import ExchangeBasic
---> 22 from OCCT.Visualization import BasicViewer
     23 
     24 shape = ExchangeBasic.read_step('./models/compressor.step')

~/anaconda3/envs/occt/lib/python3.5/site-packages/OCCT/Visualization/__init__.py in <module>
     17 # License along with this library; if not, write to the Free Software
     18 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA
---> 19 from OCCT.Visualization.Basic import *

~/anaconda3/envs/occt/lib/python3.5/site-packages/OCCT/Visualization/Basic.py in <module>
     22 import platform
     23 
---> 24 import wx
     25 from OCCT.AIS import (AIS_InteractiveContext, AIS_Shape, AIS_Shaded,
     26                       AIS_WireFrame)

~/anaconda3/envs/occt/lib/python3.5/site-packages/wx/__init__.py in <module>
     10 # Load the main version string into the package namespace
     11 import wx.__version__
---> 12 __version__ = wx.__version__.VERSION_STRING
     13 
     14 

AttributeError: module 'wx' has no attribute '__version__'

I think this error is related to visualisation issue?
Is there a specific version for wxpython that I need to install?
Synaptic shows libatk is installed.

Kind regards,
Iwan

AIS_Line Points() method doesn't make expected changes to parameters

Expected Behavior

I'm trying to retrieve the end points of an AIS_Line instance.

The OCCT documentation for AIS_Line gives the Points() method:

void Points (Handle< Geom_Point > &thePStart, Handle< Geom_Point > &thePEnd) const
  Returns the starting point thePStart and the end point thePEnd of the line set by SetPoints.

Current Behavior

In pyOCCT, Geom_Point instances passed to the method are unchanged. See test program below.

Other parts of AIS_Line, including SetPoints() seem to work fine.

Possible Solution

I can't see any obvious problems in AIS.cpp. I've used lots of similar methods without issues. Wild guess - the parameters are specified as Geom_Point, but that class doesn't have a constructor so I'm using Geom_CartesianPoint. Something to do with upcasting/downcasting?

Steps to Reproduce (for bugs)

Short test program:

from OCCT.gp import gp_Pnt
from OCCT.AIS import AIS_Line
from OCCT.Geom import Geom_CartesianPoint

# Construct points for line
pt1 = Geom_CartesianPoint(10.0, 20.0, 30.0)
pt2 = Geom_CartesianPoint(40.0, 50.0, 60.0)
print("Pts set:", pt1.Coord(0.0, 0.0, 0.0), pt2.Coord(0.0, 0.0, 0.0))

# Construct the line
line = AIS_Line(pt1, pt2)
line.SetPoints(pt1, pt2)  # Get same result without this line, but just to confirm

# Point instances for Points() method
pt3 = Geom_CartesianPoint(gp_Pnt())
pt4 = Geom_CartesianPoint(gp_Pnt())

# Invoke the Points() method
line.Points(pt3, pt4)
print("Pts retrieved 1:", pt3.Coord(0.0, 0.0, 0.0), pt4.Coord(0.0, 0.0, 0.0))

# Initialise points to non-zero values
pt5 = Geom_CartesianPoint(7.0, 8.0, 9.0)
pt6 = Geom_CartesianPoint(7.5, 8.5, 9.5)

# Invoke the Points() method
line.Points(pt5, pt6)
print("Pts retrieved 2:", pt5.Coord(0.0, 0.0, 0.0), pt6.Coord(0.0, 0.0, 0.0))

Results:

Pts set: (10.0, 20.0, 30.0) (40.0, 50.0, 60.0)
Pts retrieved 1: (0.0, 0.0, 0.0) (0.0, 0.0, 0.0)
Pts retrieved 2: (7.0, 8.0, 9.0) (7.5, 8.5, 9.5)

Context

I can easily work round this. I'm raising it because it may be an indicator of related issues elsewhere.

Your Environment

  • Version used: Current
  • Operating System and version (desktop or mobile): Linux
  • Link to your project:

OpenCASCADE Bug

It's possible that it's a bug in the OCCT code, but AIS_Line.hxx in occt-7.2.0-2 has the following implementation, which looks OK to me:

//! Returns the starting point thePStart and the end point thePEnd of the line set by SetPoints.
  void Points (Handle(Geom_Point)& thePStart, Handle(Geom_Point)& thePEnd) const
  {
    thePStart = myStartPoint;
    thePEnd   = myEndPoint;
  }

install pyocct PackageNotFoundError

@trelau Hello,

I am a beginner to python. I found your pyOCCT very helpful so I want to use it. But some problems occured when I followed the instructions to install. I work with win64.

conda create -n occt python=3.5
conda activate occt
conda install -c trelau pyocct

then, it showed:

  1. Solving environment: failed

2.PackageNotFoundError: The following packages are not available from current channels:
-pyocct
-netgen ==6.2.1804
-pyocct
-occt ==7.2.0
-pyocct
-smesh == 8.3.0b0

Could you please offer me some suggestions ? I will appreciate it very much.

Originally posted by @HuaJianDeng in https://github.com/LaughlinResearch/pyOCCT/issue_comments#issuecomment-446118515

conda install incompatible Python version

Hello. I am trying to install pyocct on Pop_OS 18.04. I have installed anaconda and create conda environment with python 3.5, 3.6, and 3.7. All of them failed saying incompatible Python version.

The command prompt was written below. May I know which specific version should work for current open cascade version?

Kind regards, Iwan

Upon installing pyocct, the process failed as follows:

(occt) iwan@pop-os:~$ conda install -c trelau pyocct
Collecting package metadata (current_repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: failed with repodata from current_repodata.json, will retry with next repodata source.
Collecting package metadata (repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: \ 
Found conflicts! Looking for incompatible packages.
This can take several minutes.  Press CTRL-C to abort.
failed                                                                          

UnsatisfiableError: The following specifications were found
to be incompatible with the existing python installation in your environment:

Specifications:

  - pyocct -> python[version='>=2.7,<2.8.0a0|>=3.7,<3.8.0a0']

Your python: python=3.5

If python is on the left-most side of the chain, that's the version you've asked for.
When python appears to the right, that indicates that the thing on the left is somehow
not available for the python version you are constrained to. Note that conda will not
change your python version to a different minor version unless you explicitly specify
that.

It seems the python required is 3.7, so I create another environment with python3.7 and do the same process. It end up like this:

(occt_3.7) iwan@pop-os:~$ conda install -c trelau pyocct
Collecting package metadata (current_repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: failed with repodata from current_repodata.json, will retry with next repodata source.
Collecting package metadata (repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: - 
Found conflicts! Looking for incompatible packages.
This can take several minutes.  Press CTRL-C to abort.
failed                                                                          

UnsatisfiableError: The following specifications were found
to be incompatible with the existing python installation in your environment:

Specifications:

  - pyocct -> python[version='>=3.5,<3.6.0a0|>=3.6,<3.7.0a0']

Your python: python=3.7

If python is on the left-most side of the chain, that's the version you've asked for.
When python appears to the right, that indicates that the thing on the left is somehow
not available for the python version you are constrained to. Note that conda will not
change your python version to a different minor version unless you explicitly specify
that.

So this time it asked for version 3.6., which ends up asking for 3.7 version:

(occt_3.6) iwan@pop-os:~$ conda install -c trelau pyocct
Collecting package metadata (current_repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: failed with repodata from current_repodata.json, will retry with next repodata source.
Collecting package metadata (repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: \ 
Found conflicts! Looking for incompatible packages.
This can take several minutes.  Press CTRL-C to abort.
failed                                                                          

UnsatisfiableError: The following specifications were found
to be incompatible with the existing python installation in your environment:

Specifications:

  - pyocct -> python[version='>=2.7,<2.8.0a0|>=3.7,<3.8.0a0']

Your python: python=3.6

If python is on the left-most side of the chain, that's the version you've asked for.
When python appears to the right, that indicates that the thing on the left is somehow
not available for the python version you are constrained to. Note that conda will not
change your python version to a different minor version unless you explicitly specify
that.

Source typos

I have found typos in the source comments. What thirdparty directories should I omit from my typo PR ?

Are you willing to continue maintenance? Can't build normally.

Current Behavior

❯ cmake --build .
[  0%] Built target Adaptor2d
[  1%] Built target Adaptor3d
[  1%] Building CXX object CMakeFiles/AdvApp2Var.dir/src/AdvApp2Var.cxx.o
In file included from /tmp/download/pyOCCT-master/src/AdvApp2Var.cxx:63:
/tmp/download/pyOCCT-master/src/bind_NCollection_Sequence.hxx: In function ‘void bind_NCollection_Sequence(pybind11::module&, const std::string&, const pybind11::module_local&)’:
/tmp/download/pyOCCT-master/src/bind_NCollection_Sequence.hxx:61:85: Error:Cannot declare pointer to member 'void'
   61 | cls_NCollection_Sequence.def("Remove", (void (NCollection_Sequence<TheItemType>::*)(Iterator &)) &NCollection_Sequence<TheItemType>::Remove, "Remove one item", py::arg("thePosition"));
      |                                                                                     ^~~~~~~~
/tmp/download/pyOCCT-master/src/bind_NCollection_Sequence.hxx:61:41: Error:expected primary-expression before ‘void’
   61 | cls_NCollection_Sequence.def("Remove", (void (NCollection_Sequence<TheItemType>::*)(Iterator &)) &NCollection_Sequence<TheItemType>::Remove, "Remove one item", py::arg("thePosition"));
      |                                         ^~~~
/tmp/download/pyOCCT-master/src/bind_NCollection_Sequence.hxx:61:41: Error:expected ‘)’ before ‘void’
   61 | cls_NCollection_Sequence.def("Remove", (void (NCollection_Sequence<TheItemType>::*)(Iterator &)) &NCollection_Sequence<TheItemType>::Remove, "Remove one item", py::arg("thePosition"));
      |                                        ~^~~~
      |                                         )
/tmp/download/pyOCCT-master/src/bind_NCollection_Sequence.hxx:70:90: Error:Cannot declare pointer to member 'void'
   70 | cls_NCollection_Sequence.def("InsertAfter", (void (NCollection_Sequence<TheItemType>::*)(Iterator &, const TheItemType &)) &NCollection_Sequence<TheItemType>::InsertAfter, "InsertAfter the position of iterator", py::arg("thePosition"), py::arg("theItem"));
      |                                                                                          ^~~~~~~~
/tmp/download/pyOCCT-master/src/bind_NCollection_Sequence.hxx:70:46: Error:expected primary-expression before ‘void’
   70 | cls_NCollection_Sequence.def("InsertAfter", (void (NCollection_Sequence<TheItemType>::*)(Iterator &, const TheItemType &)) &NCollection_Sequence<TheItemType>::InsertAfter, "InsertAfter the position of iterator", py::arg("thePosition"), py::arg("theItem"));
      |                                              ^~~~
/tmp/download/pyOCCT-master/src/bind_NCollection_Sequence.hxx:70:46: Error:expected ‘)’ before ‘void’
   70 | cls_NCollection_Sequence.def("InsertAfter", (void (NCollection_Sequence<TheItemType>::*)(Iterator &, const TheItemType &)) &NCollection_Sequence<TheItemType>::InsertAfter, "InsertAfter the position of iterator", py::arg("thePosition"), py::arg("theItem"));
      |                                             ~^~~~
      |                                              )
make[2]: *** [CMakeFiles/AdvApp2Var.dir/build.make:76:CMakeFiles/AdvApp2Var.dir/src/AdvApp2Var.cxx.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:811:CMakeFiles/AdvApp2Var.dir/all] Error 2
make: *** [Makefile:136:all] Error 2

Steps to Reproduce (for bugs)

Just follow the steps that were written in readme.

Your Environment

  • Version used: 7.5.3.1
  • Operating System and version (desktop or mobile):
❯ neofetch
                   -`                    tim@TimTu-Arch 
                  .o+`                   -------------- 
                 `ooo/                   OS: Arch Linux x86_64 
                `+oooo:                  Host: Code01 Ver2.0 1 
               `+oooooo:                 Kernel: 6.7.1-arch1-1 
               -+oooooo+:                Uptime: 24 mins 
             `/:-:++oooo+:               Packages: 1338 (pacman) 
            `/++++/+++++++:              Shell: bash 5.2.26 
           `/++++++++++++++:             Resolution: 2560x1600 
          `/+++ooooooooooooo/`           DE: Plasma 5.27.10 
         ./ooosssso++osssssso+`          WM: kwin 
        .oossssso-````/ossssss+`         Theme: NephriteLight [Plasma], Breeze [GTK2/3] 
       -osssssso.      :ssssssso.        Icons: [Plasma], Colloid [GTK2/3] 
      :osssssss/        osssso+++.       Terminal: konsole 
     /ossssssss/        +ssssooo/-       Terminal Font: Hack [SRC] 10 
   `/ossssso+/:-        -:/+osssso+-     CPU: AMD Ryzen 7 6800H with Radeon Graphics (16) @ 4.785GHz 
  `+sso+:-`                 `.-/+oso:    GPU: AMD ATI Radeon 680M 
 `++:.                           `-/+/   Memory: 11474MiB / 30808MiB 
 .`                                 `/
❯ conda list
# packages in environment at /tmp/occt_env:
#
# Name                    Version                   Build  Channel
_libgcc_mutex             0.1                 conda_forge    conda-forge
_openmp_mutex             4.5                       2_gnu    conda-forge
aom                       3.6.1                h59595ed_0    conda-forge
binutils_impl_linux-64    2.40                 hf600244_0    conda-forge
bzip2                     1.0.8                hd590300_5    conda-forge
c-ares                    1.26.0               hd590300_0    conda-forge
ca-certificates           2023.11.17           hbcca054_0    conda-forge
clang                     17.0.6               hda56bd4_2    conda-forge
clang-17                  17.0.6          default_hb11cfb5_2    conda-forge
clang-format              17.0.6          default_hb11cfb5_2    conda-forge
clang-format-17           17.0.6          default_hb11cfb5_2    conda-forge
clang-tools               17.0.6          default_hb11cfb5_2    conda-forge
clangdev                  17.0.6          default_hb11cfb5_2    conda-forge
clangxx                   17.0.6          default_hb11cfb5_2    conda-forge
curl                      8.5.0                hca28451_0    conda-forge
double-conversion         3.2.0                h27087fc_1    conda-forge
eigen                     3.4.0                h00ab1b0_0    conda-forge
elfutils                  0.190                h6f2b95c_0    conda-forge
expat                     2.5.0                hcb278e6_1    conda-forge
ffmpeg                    4.4.2           gpl_hdf48244_113    conda-forge
font-ttf-dejavu-sans-mono 2.37                 hab24e00_0    conda-forge
font-ttf-inconsolata      3.000                h77eed37_0    conda-forge
font-ttf-source-code-pro  2.038                h77eed37_0    conda-forge
font-ttf-ubuntu           0.83                 h77eed37_1    conda-forge
fontconfig                2.14.2               h14ed4e7_0    conda-forge
fonts-conda-ecosystem     1                             0    conda-forge
fonts-conda-forge         1                             0    conda-forge
freeimage                 3.18.0              h530e30e_10    conda-forge
freetype                  2.12.1               h267a509_2    conda-forge
gettext                   0.21.1               h27087fc_0    conda-forge
gl2ps                     1.4.2                h0708190_0    conda-forge
gmp                       6.3.0                h59595ed_0    conda-forge
gnutls                    3.7.9                hb077bed_0    conda-forge
hdf4                      4.2.15               h9772cbc_5    conda-forge
hdf5                      1.12.2          nompi_h4df4325_101    conda-forge
icu                       73.2                 h59595ed_0    conda-forge
imath                     3.1.6                h6239696_1    conda-forge
jpeg                      9e                   h0b41bf4_3    conda-forge
jsoncpp                   1.9.5                h4bd325d_1    conda-forge
jxrlib                    1.1                  hd590300_3    conda-forge
kernel-headers_linux-64   2.6.32              he073ed8_16    conda-forge
keyutils                  1.6.1                h166bdaf_0    conda-forge
krb5                      1.21.2               h659d440_0    conda-forge
lame                      3.100             h166bdaf_1003    conda-forge
lcms2                     2.14                 h6ed2654_0    conda-forge
ld_impl_linux-64          2.40                 h41732ed_0    conda-forge
lerc                      4.0.0                h27087fc_0    conda-forge
libaec                    1.1.2                h59595ed_1    conda-forge
libarchive                3.7.2                h2aa1ff5_1    conda-forge
libclang                  17.0.6          default_hb11cfb5_2    conda-forge
libclang-cpp              17.0.6          default_hb11cfb5_2    conda-forge
libclang-cpp17            17.0.6          default_hb11cfb5_2    conda-forge
libclang13                17.0.6          default_ha2b6cf4_2    conda-forge
libcurl                   8.5.0                hca28451_0    conda-forge
libdeflate                1.14                 h166bdaf_0    conda-forge
libdrm                    2.4.114              h166bdaf_0    conda-forge
libedit                   3.1.20191231         he28a2e2_2    conda-forge
libev                     4.33                 hd590300_2    conda-forge
libexpat                  2.5.0                hcb278e6_1    conda-forge
libffi                    3.4.2                h7f98852_5    conda-forge
libgcc-devel_linux-64     13.2.0             ha9c7c90_104    conda-forge
libgcc-ng                 13.2.0               h807b86a_4    conda-forge
libgfortran-ng            13.2.0               h69a702a_4    conda-forge
libgfortran5              13.2.0               ha4646dd_4    conda-forge
libgomp                   13.2.0               h807b86a_4    conda-forge
libhwloc                  2.9.3           default_h554bfaf_1009    conda-forge
libiconv                  1.17                 hd590300_2    conda-forge
libidn2                   2.3.7                hd590300_0    conda-forge
libllvm17                 17.0.6               hb3ce162_1    conda-forge
libmicrohttpd             0.9.77               h97afed2_0    conda-forge
libnetcdf                 4.8.1           nompi_h261ec11_106    conda-forge
libnghttp2                1.58.0               h47da74e_1    conda-forge
libnsl                    2.0.1                hd590300_0    conda-forge
libogg                    1.3.4                h7f98852_1    conda-forge
libpciaccess              0.17                 h166bdaf_0    conda-forge
libpng                    1.6.39               h753d276_0    conda-forge
libraw                    0.20.2               h9772cbc_2    conda-forge
libsqlite                 3.44.2               h2797004_0    conda-forge
libssh2                   1.11.0               h0841786_0    conda-forge
libstdcxx-devel_linux-64  13.2.0             ha9c7c90_104    conda-forge
libstdcxx-ng              13.2.0               h7e041cc_4    conda-forge
libtasn1                  4.19.0               h166bdaf_0    conda-forge
libtheora                 1.1.1             h7f98852_1005    conda-forge
libtiff                   4.4.0                h82bc61c_5    conda-forge
libunistring              0.9.10               h7f98852_0    conda-forge
libuuid                   2.38.1               h0b41bf4_0    conda-forge
libva                     2.20.0               hd590300_0    conda-forge
libvorbis                 1.3.7                h9c3ff4c_0    conda-forge
libvpx                    1.13.1               h59595ed_0    conda-forge
libwebp-base              1.3.2                hd590300_0    conda-forge
libxcb                    1.15                 h0b41bf4_0    conda-forge
libxml2                   2.12.4               h232c23b_1    conda-forge
libzip                    1.10.1               h2629f0a_3    conda-forge
libzlib                   1.2.13               hd590300_5    conda-forge
llvm-tools                17.0.6               hb3ce162_1    conda-forge
llvmdev                   17.0.6               hb3ce162_1    conda-forge
loguru                    0.6.0            py37h89c1867_1    conda-forge
lz4-c                     1.9.4                hcb278e6_0    conda-forge
lzo                       2.10              h516909a_1000    conda-forge
mesalib                   23.3.4               hf257a20_0    conda-forge
ncurses                   6.4                  h59595ed_2    conda-forge
nettle                    3.9.1                h7ab15ed_0    conda-forge
occt                      7.5.3                h665cfa0_4    conda-forge
openexr                   3.1.5                h0cdce71_2    conda-forge
openh264                  2.3.1                hcb278e6_2    conda-forge
openjpeg                  2.5.0                h7d73246_1    conda-forge
openssl                   3.2.0                hd590300_1    conda-forge
p11-kit                   0.24.1               hc5aa10d_0    conda-forge
pip                       23.3.2             pyhd8ed1ab_0    conda-forge
proj                      9.0.1                h93bde94_1    conda-forge
pthread-stubs             0.4               h36c2ea0_1001    conda-forge
pugixml                   1.11.4               h59595ed_1    conda-forge
python                    3.7.12          hf930737_100_cpython    conda-forge
python-clang              17.0.6          default_hccd1708_2    conda-forge
python_abi                3.7                     4_cp37m    conda-forge
rapidjson                 1.1.0             he1b5a44_1002    conda-forge
readline                  8.2                  h8228510_1    conda-forge
setuptools                69.0.3             pyhd8ed1ab_0    conda-forge
sqlite                    3.44.2               h2c6b66d_0    conda-forge
svt-av1                   1.4.1                hcb278e6_0    conda-forge
sysroot_linux-64          2.12                he073ed8_16    conda-forge
tbb                       2021.11.0            h00ab1b0_1    conda-forge
tbb-devel                 2021.11.0            h5ccd973_1    conda-forge
tk                        8.6.13          noxft_h4845f30_101    conda-forge
utfcpp                    4.0.5                ha770c72_0    conda-forge
vtk                       9.1.0           osmesa_py37h4fefe72_115    conda-forge
wheel                     0.42.0             pyhd8ed1ab_0    conda-forge
x264                      1!164.3095           h166bdaf_2    conda-forge
x265                      3.5                  h924138e_3    conda-forge
xorg-damageproto          1.2.1             h7f98852_1002    conda-forge
xorg-fixesproto           5.0               h7f98852_1002    conda-forge
xorg-glproto              1.4.17            h7f98852_1002    conda-forge
xorg-kbproto              1.0.7             h7f98852_1002    conda-forge
xorg-libice               1.1.1                hd590300_0    conda-forge
xorg-libsm                1.2.4                h7391055_0    conda-forge
xorg-libx11               1.8.7                h8ee46fc_0    conda-forge
xorg-libxau               1.0.11               hd590300_0    conda-forge
xorg-libxdamage           1.1.5                h7f98852_1    conda-forge
xorg-libxdmcp             1.1.3                h7f98852_0    conda-forge
xorg-libxext              1.3.4                h0b41bf4_2    conda-forge
xorg-libxfixes            5.0.3             h7f98852_1004    conda-forge
xorg-libxrandr            1.5.2                h7f98852_1    conda-forge
xorg-libxrender           0.9.11               hd590300_0    conda-forge
xorg-libxt                1.3.0                hd590300_1    conda-forge
xorg-randrproto           1.5.0             h7f98852_1001    conda-forge
xorg-renderproto          0.11.1            h7f98852_1002    conda-forge
xorg-util-macros          1.19.3               h7f98852_0    conda-forge
xorg-xextproto            7.3.0             h0b41bf4_1003    conda-forge
xorg-xf86vidmodeproto     2.3.1             h7f98852_1002    conda-forge
xorg-xproto               7.0.31            h7f98852_1007    conda-forge
xz                        5.2.6                h166bdaf_0    conda-forge
zlib                      1.2.13               hd590300_5    conda-forge
zstd                      1.5.5                hfc55251_0    conda-forge

OpenGl_GraphicDriver.ChangeOptions Runtime Error

Can not change the graphics driver options.

from OCCT.Aspect import Aspect_DisplayConnection
from OCCT.OpenGl import OpenGl_GraphicDriver

aspect_display_connection = Aspect_DisplayConnection()
opengl_graphic_driver = OpenGl_GraphicDriver(aspect_display_connection)

opengl_graphic_driver.ChangeOptions().buffersNoSwap = True # Throws the below runtime error.
#print(opengl_graphic_driver.Options()) # Throws the below runtime error.
#print(opengl_graphic_driver.ChangeOptions()) # Throws the below runtime error.

#RuntimeError: return_value_policy = copy, but type is non-copyable! (compile in debug mode for details)

compiling XwWindow on osx

Hi,

I'm trying to compile pyocct on osx.
So far, so good, though compilation trips over XwWindow.

This is probably due to linking to Xw_Window rather than Cocoa_Window
PythonOCC does conditional compilation like so for the visualization module:

#ifdef WNT
  #include <windows.h>
  #include <WNT_WClass.hxx>
  #include <WNT_Window.hxx>
#elif defined(__APPLE__) && !defined(MACOSX_USE_GLX)
  #include <Cocoa_Window.hxx>
#else
  #include <Xw_Window.hxx>
#endif

Perhaps this could be carried over as:

#include <pyOCCT_Common.hpp>

#include <xTypes.h>

#include <Aspect_DisplayConnection.hxx>
#include <Aspect_FBConfig.hxx>
#include <Aspect_Window.hxx>

#ifdef WNT
  #include <WNT_Window.hxx>
#elif defined(__APPLE__) && !defined(MACOSX_USE_GLX)
  #include <Cocoa_Window.hxx>
#else
  #include <Xw_Window.hxx>
#endif

#include <Xw_Window.hxx>

Which brings me to my question; would by extension the class definition look like so?
( I'm new to pybinder11 and not a c++ programmer... go easy on me ;)

   #ifdef WNT
     py::class_<Xw_Window, opencascade::handle<WNT_Window>, Aspect_Window>(mod, "Xw_Window", "This class defines XLib window intended for creation of OpenGL context.")
   #elif defined(__APPLE__) && !defined(MACOSX_USE_GLX)
     py::class_<Xw_Window, opencascade::handle<Cocoa_Window>, Aspect_Window>(mod, "Xw_Window", "This class defines XLib window intended for creation of OpenGL context.")
   #else
     py::class_<Xw_Window, opencascade::handle<Xw_Window>, Aspect_Window>(mod, "Xw_Window", "This class defines XLib window intended for creation of OpenGL context.")
   #endif

I'm a little surprised, since seeing pyocct up and running on windows, which should run into the same compilation issue I figure. Any pointer to how this works currently is much appreciated.

Finally, this thread on conda-forge was very helpful ( MacOSX10.9.sdk pointer ). That said, should those improvements to the conda recipe not be carried over to this repo?


Finally, the viewer is doing a similar conditional ( pyocct ) import.
For conditional WNT / Xw / Cocoa Window instantiating see this

[Packaging] Mostly empty "setup.py" makes pyOCCT mostly impossible to package

I'd love to pyOCCT for Gentoo Linux and suspect other Linux distros feel similarly. Sadly, doing so requires a working setup.py script. The current version mostly appears to be an empty placeholder; there's no reference to pyOCCT's pure-Python dependency stack or CMake-based binding generation process, for example:

from setuptools import setup

setup(
    name='OCCT',
    version='7.5.2.0',
    packages=['OCCT', 'OCCT.Exchange', 'OCCT.Visualization'],
    package_data={'OCCT': ['*.so', '*.pyd', '*.dll', 'Visualization/_resources/*']},
    author='Trevor Laughlin',
    description='Python bindings for OpenCASCADE via pybind11.',
    url='https://github.com/trelau/pyOCCT',
    license='LGPL v2.1',
    platforms=['Windows', 'Linux']
)

That's... not gonna cut it.

Thankfully, this feature request has nothing to do with pip, poetry, PyPI, PyPA, or the special hell that is Python packaging standards. It's just setuptools all the way down. Without a working setuptools-based script, packaging pyOCCT for various platforms is basically infeasible. That saddens me, 'cause pyOCCT otherwise looks great.

Of course, it's fantastic that pyOCCT has such phenomenal support for conda! You've done a great job there, @trelau. 👍

Pass by reference of the immutable types?

Quantity_Color from opencascade docs,
void Values (Standard_Real &theR1, Standard_Real &theR2, Standard_Real &theR3, const Quantity_TypeOfColor theType) const

From ..\OCCT\Quantity.pyd
Values(self: OCCT.Quantity.Quantity_Color, theR1: float, theR2: float, theR3: float, theType: OCCT.Quantity.Quantity_TypeOfColor) -> Tuple[float, float, float]

`from OCCT.Quantity import Quantity_Color, Quantity_TOC_RGB

r = 0.0
g = 0.0
b = 0.0

quantity_color = Quantity_Color(1.0, 0.5, 0.25, Quantity_TOC_RGB)

values = quantity_color.Values(r, g, b, Quantity_TOC_RGB)

print(r, g, b)
print(values)`

r, g and b variables is required to call .Values but they dont receive the values?

Edit: Well https://pyocct.readthedocs.io/en/latest/dev.html#reference-arguments

Graphic3d_RenderingParams class lacks data fields

Expected Behavior

The OCCT man page and Graphic3d_RenderingParams.hxx include a number of data fields (Method, TransparencyMethod and others), which do not appear to be present in pyOCCT.

Current Behavior

Python 3.6.3 |Anaconda, Inc.| (default, Nov  9 2017, 00:19:18) 
[GCC 7.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from OCCT.Graphic3d import Graphic3d_RenderingParams
>>> g = Graphic3d_RenderingParams ()
>>> g.Anaglyph
<class 'OCCT.Graphic3d.Graphic3d_RenderingParams.Anaglyph'>
>>> g.ResolutionRatio()
1.0
>>> g.Method
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'OCCT.Graphic3d.Graphic3d_RenderingParams' object has no attribute 'Method'
>>> g.TransparencyMethod
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'OCCT.Graphic3d.Graphic3d_RenderingParams' object has no attribute 'TransparencyMethod'
>>> 

Possible Solution

The data fields are not present in Graphic3d.cpp, as far as I can see.

Steps to Reproduce (for bugs)

See Python session above.

Context

This came up because I was trying to use Graphic3d_RenderingParams.Method to look at ray tracing. It's by no means important and I'm recording it here for completeness.

Your Environment

  • Version used: Current
  • Operating System and version (desktop or mobile): Linux
  • Link to your project:

OpenCASCADE Bug

Retrieving weights of a rational BSpline surface causes crashing

Calls to method const TColStd_Array2OfReal* Geom_BSplineSurface::Weights() const crash while the same operation runs fine using the alternative signature void Geom_BSplineSurface::Weights(TColStd_Array2OfReal& W) const.

from OCCT.Geom import Geom_BSplineSurface, Geom_RectangularTrimmedSurface, Geom_SphericalSurface
from OCCT.GeomConvert import GeomConvert
from OCCT.TColStd import TColStd_Array2OfReal
from OCCT.gp import gp_Ax3

# Prepare some geometry to initialize a rational BSpline surface.
spherical_surface = Geom_SphericalSurface(gp_Ax3(), 1.)
surface = Geom_RectangularTrimmedSurface(spherical_surface, 0., 1., 0., 1.)

# Second loop won't be executed due to the crash.
reproduce = True
for k in range(2):
    bspline_surface: Geom_BSplineSurface = GeomConvert.SurfaceToBSplineSurface_(surface)
    if reproduce:  # causes crashing
        weights = bspline_surface.Weights()
    else:  # a lengthy workaround
        bspline_surface.Weights(weights := TColStd_Array2OfReal(1, bspline_surface.NbUPoles(), 1, bspline_surface.NbVPoles()))
    values = [[weights(i, j) for j in range(1, 1 + weights.NbColumns())] for i in range(1, 1 + weights.NbRows())] # not essential
    print(k)

This might be caused by the fact that the return type is a pointer unlike with other similar methods, such as const TColgp_Array2OfPnt& Geom_BSplineSurface::Poles() const which return a reference and do not cause any problems.
I think the same problem occurs with rational BSpline curves. Let me know if a code snippet for this case would be useful too.

Using PySide2 with pyocct

I discovered pyocct few days ago and it matched perfectly with my own needs (pybind11 and last versions of opencascade). Thanks for that!

I use elementaryOS in a virtual machine and installed conda and pyocct. During my first tests with code examples, wxpython and his "RuntimeError: Xw_Window, given invalid X window" stopped me! I tried a solution from tpaviot/pythonocc-core@5b9d1f4 without success.

For my own projects, I adapted your old pyside code with pyside2 (after installing pyside2 5.6.0a1 py35h45ccf91_3 from conda-forge). It works but to see the compressor, I have to resize main window and keypress "fit" (Note: Apart from that, move, rotate and keypress are OK)

Console message: "TKOpenGl | Type: Other | ID: 0 | Severity: Medium | Message:
OpenGl_Window::CreateWindow: window Visual is incomplete: no depth buffer, no stencil buffer"

Perhaps an opencascade bug (https://www.opencascade.com/content/samples-tutorial-gui-1-shows-no-icons-2-mnunew-reports-errors)?

For now, my lack of skills keeps me from resolve myself this issue, could you help me?

My changes below

...
# from OCCT.WNT import WNT_Window
from OCCT.XwWindow import Xw_Window
...
from OCCT.Exchange import ExchangeBasic
...
try:
    from PySide2 import QtCore
    from PySide2.QtWidgets import QApplication, QMainWindow, QOpenGLWidget
    from PySide2.QtGui import QPalette, QIcon
...
class View(QOpenGLWidget):
...
        # Windows window
        # self.wind = WNT_Window(self.window_handle)
        self.wind = Xw_Window(self.display_connect, self.window_handle)
...
if __name__ == '__main__':
    shape = ExchangeBasic.read_step('./models/compressor.step')
    v = Viewer()
    v.display(shape,
              rgb=(0.5, 0.5, 0.5),
              material=Graphic3d_NOM_ALUMINIUM)
    v.start()

Here the full code

Basic.py.zip

Need unit test for AIS_CustomObject

Reminder to write a unit test for AIS_CustomObject so it stays intact as the project evolves. Since they are automated, perhaps a unit test that just initializes an object. Perhaps an example file can be provided to show it in use.

(Cc @frmdstryr )

is ubuntu16.0.4 supported in 7.3.0

I used to use pythonocc,but I find that it cannot retrieve name of parts in step file by OCAF~ i'm looking forward to know if your repo support the feature?

Error running examples/import_step.py

I'm following the Getting started using conda instructions. Running the example produce the following error. I included all the output, but the error is at the end and says invalid X window. The event loop seems running, but nothing is displayed.

$ python import_step.py 
/home/francisg/miniconda3/envs/pyocct/lib/python3.8/site-packages/OCCT/Visualization/WxViewer.py:46: RuntimeWarning: SMESH module was not found for visualization.
  warnings.warn(msg, RuntimeWarning)
Gtk-Message: 11:24:16.278: Failed to load module "overlay-scrollbar"
Gtk-Message: 11:24:16.281: Failed to load module "atk-bridge"
Gtk-Message: 11:24:16.285: Failed to load module "canberra-gtk-module"
Press "c" to continue...

(import_step.py:35929): Gdk-WARNING **: 11:24:24.941: gdkdrawable-x11.c:952 drawable is not a pixmap or window
Traceback (most recent call last):
  File "/home/francisg/miniconda3/envs/pyocct/lib/python3.8/site-packages/wx/core.py", line 3383, in <lambda>
    lambda event: event.callable(*event.args, **event.kw) )
  File "/home/francisg/miniconda3/envs/pyocct/lib/python3.8/site-packages/OCCT/Visualization/WxViewer.py", line 144, in _init_wind
    wind = Xw_Window(self.display_connect, hwnd)
RuntimeError: Xw_Window, given invalid X window

Expected Behavior

The window should display. If such a crash occurs, the process should exit.

Steps to Reproduce (for bugs)

  1. install pyocct from conda
  2. run the example import_step.py

Your Environment

  • Version used: pyocct 7.4.0.0 py38_1 trelau
  • Operating System and version (desktop or mobile): Ubuntu Linux 18.04 (desktop)

Is XSDRAWSTLVRML or anything under TKXSDRAW available in pyocct?

Context

Hi,
I'm trying to follow these guidelines for viewing an STL:
https://dev.opencascade.org/doc/overview/html/occt_user_guides__visualization.html#occt_visu_3_5_5

But I am unable to find XSDRAWSTLVRML to create the data source as MeshVS.MeshVS_DataSource doesn't have a constructor. Is this class available somewhere within pyOCCT? I have been unable to find it, but also I'm new to OCCT so maybe I'm just missing something/there's another way to create this data source?

>>> import OCCT
>>> for package in pkgutil.iter_modules(OCCT.__path__):
...     try:
...         foo = foo + dir(importlib.import_module(f'OCCT.{package.name}'))
...     except:
...         print(package.name)
...
IVtkTools
RWGltf
step
>>> [bar for bar in foo if 'xsdraw' in bar.lower()]
[]
>>> [bar for bar in foo if 'stlvrml' in bar.lower()]
[]

It's also not in those modules that it couldn't import.

Your Environment

  • Version used: 7.5.2.1
  • Operating System and version (desktop or mobile): Windows 10, Debian 9 Stretch, Desktop

Thanks!

Latest build doesn't work on Linux

Expected Behavior

Trying Linux build from Anaconda

@shrdluk @looooo Linux builds should be available if you want to try them out: https://anaconda.org/trelau/pyocct/files

Current Behavior

In a new conda environment (called demo):

$ conda install -c trelau/label/master pyocct
<installation messages including:>
    ...
    netgen:           6.2.1802-py36_3         conda-forge        
    occt:             7.2.0-3                 conda-forge        
    smesh:            8.3.0b0-py36_4          conda-forge       
    vtk:              8.1.0-py36h969b564_201   
    ...
Preparing transaction: done
Verifying transaction: done
Executing transaction: done
$   

Installed without errors. Try unittests:

$ cd pyOCCT/test/
$ python -m unittest test_modules.py 
terminate called after throwing an instance of 'pybind11::error_already_set'
  what():  SystemError: <built-in method __contains__ of dict object at 0x7f6e136bc480> returned a result with an error set
Aborted
$ python -m unittest test_graphic3d.py 
E
======================================================================
ERROR: test_graphic3d (unittest.loader._FailedTest)
----------------------------------------------------------------------
ImportError: Failed to import test module: test_graphic3d
Traceback (most recent call last):
  File "/home/keith/miniconda3/envs/demo/lib/python3.6/unittest/loader.py", line 153, in loadTestsFromName
    module = __import__(module_name)
  File "/home/keith/projects/occt/pyOCCT/test/test_graphic3d.py", line 22, in <module>
    from OCCT.Graphic3d import (Graphic3d_RenderingParams, Graphic3d_RenderingMode,
ImportError: /home/keith/miniconda3/envs/demo/lib/python3.6/site-packages/OCCT/Graphic3d.so: undefined symbol: _ZN25Graphic3d_RenderingParams17THE_DEFAULT_DEPTHE


----------------------------------------------------------------------
Ran 1 test in 0.000s

FAILED (errors=1)

Possible Solution

I also merged the changes in master to my trbuild branch and built from that on Travis. Same errors occur, so it appears to be related to the code changes rather than the build process.

@looooo Have you tried the latest Anaconda version? Any suggestions?

Steps to Reproduce (for bugs)

See above

Context

Your Environment

  • Version used: Latest from Anaconda
  • Operating System and version (desktop or mobile): Linux
  • Link to your project:

OpenCASCADE Bug

Bindig generator not open sourced

You have a very interesting project here! We are considering reusing it to implement a new version of cadquery (cf. dcowden/cadquery#268 ) to get the latest OCCT 7.2 capabilities and bugfixes.

One drawback that I see is that the code (I assume that there exists one) used to generate the pybind11 glue code is not share. This poses some risks w.r.t. long term support of the project. Do you maybe plan to share that code at some point of time?

Methods that take a stream (ie DumpJson) don't work

I'm probably doing this wrong...

from OCCT.gp import *
t = gp_Trsf()

import sys
t.DumpJson(sys.stdout)
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-10-653204f5a44e> in <module>
----> 1 t.DumpJson(sys.stdout)

TypeError: DumpJson(): incompatible function arguments. The following argument types are supported:
    1. (self: OCCT.gp.gp_Trsf, arg0: std::ostream) -> None
    2. (self: OCCT.gp.gp_Trsf, theOStream: std::ostream, theDepth: int) -> None

Invoked with: <OCCT.gp.gp_Trsf object at 0x7f0facf7c170>, <ipykernel.iostream.OutStream object at 0x7f0fb063bac0>

Did you forget to `#include <pybind11/stl.h>`? Or <pybind11/complex.h>,
<pybind11/functional.h>, <pybind11/chrono.h>, etc. Some automatic
conversions are optional and require extra headers to be included
when compiling your pybind11 module.

Expected Behavior

I think that should write to stdout

Current Behavior

Gives the error

Possible Solution

Does including the <pybind11/stl.h> make this work?

Failed to build due to unnamed enums

Hi @trelau thanks for this project ;)

I didn't managed to build bindings of occt=7.5.3 due to unnamed enums in occt headers.
I get a lot of similar errors:

// ENUM: 
py::enum_<(unnamed enum at /home/adrien/micromamba/envs/binder/include/opencascade/Aspect_VKeyFlags.hxx:21:1)>(mod, "(unnamed enum at /home/adrien/micromamba/envs/binder/include/opencascade/Aspect_VKeyFlags.hxx:21:1)", "Key modifier, for combining with general key from Aspect_VKey.")
	.value("Aspect_VKeyFlags_NONE", (unnamed enum at /home/adrien/micromamba/envs/binder/include/opencascade/Aspect_VKeyFlags.hxx:21:1)::Aspect_VKeyFlags_NONE)
	.value("Aspect_VKeyFlags_SHIFT", (unnamed enum at /home/adrien/micromamba/envs/binder/include/opencascade/Aspect_VKeyFlags.hxx:21:1)::Aspect_VKeyFlags_SHIFT)
	.value("Aspect_VKeyFlags_CTRL", (unnamed enum at /home/adrien/micromamba/envs/binder/include/opencascade/Aspect_VKeyFlags.hxx:21:1)::Aspect_VKeyFlags_CTRL)
	.value("Aspect_VKeyFlags_ALT", (unnamed enum at /home/adrien/micromamba/envs/binder/include/opencascade/Aspect_VKeyFlags.hxx:21:1)::Aspect_VKeyFlags_ALT)
	.value("Aspect_VKeyFlags_MENU", (unnamed enum at /home/adrien/micromamba/envs/binder/include/opencascade/Aspect_VKeyFlags.hxx:21:1)::Aspect_VKeyFlags_MENU)
	.value("Aspect_VKeyFlags_META", (unnamed enum at /home/adrien/micromamba/envs/binder/include/opencascade/Aspect_VKeyFlags.hxx:21:1)::Aspect_VKeyFlags_META)
	.value("Aspect_VKeyFlags_ALL", (unnamed enum at /home/adrien/micromamba/envs/binder/include/opencascade/Aspect_VKeyFlags.hxx:21:1)::Aspect_VKeyFlags_ALL)
	.export_values();

related to unnamed enum, here declared in Aspect_VKeyFlags.hxx

//! Key modifier, for combining with general key from Aspect_VKey.
typedef unsigned int Aspect_VKeyFlags;

//! Key modifier, for combining with general key from Aspect_VKey.
enum
{
  Aspect_VKeyFlags_NONE  = 0,
  // reserve first 8 bits to combine value with Aspect_VKey
  Aspect_VKeyFlags_SHIFT = 1 <<  8, //!< Aspect_VKey_Shift
  Aspect_VKeyFlags_CTRL  = 1 <<  9, //!< Aspect_VKey_Control
  Aspect_VKeyFlags_ALT   = 1 << 10, //!< Aspect_VKey_Alt
  Aspect_VKeyFlags_MENU  = 1 << 11, //!< Aspect_VKey_Menu
  Aspect_VKeyFlags_META  = 1 << 12, //!< Aspect_VKey_Meta

  Aspect_VKeyFlags_ALL = Aspect_VKeyFlags_SHIFT | Aspect_VKeyFlags_CTRL | Aspect_VKeyFlags_ALT | Aspect_VKeyFlags_MENU | Aspect_VKeyFlags_META
};

TBH I don't really understand what's the benefit of having some enums declared that way.. any thoughts?

My local setup is:

  • Ubuntu 21.10 amd64
  • env created using micromamba create -f binder/environment.yml extended the following way to have compilers and gl libs installed without installing at sys level
name: binder
channels:
  - conda-forge
dependencies:
  - python=3.9
  - clangdev
  - python-clang
  - occt=7.5.3
  - tbb-devel
  - cmake
  - make
  - gxx_linux-64
  - mesa-libgl-devel-cos6-x86_64
  - libxi-devel-cos6-x86_64
  - libxext-devel-cos6-x86_64
  - glfw
  - pybind11

I will try running this in a container.

Running the generator gave me quite a lot of errors, but apparently no critical one:

(binder) adrien@tower:~/Documents/codes/occt/pyOCCT$ python binder/run.py -c binder/config.txt -o src
----------------------------------------------------------------------------------------------------
pyOCCT Binder
----------------------------------------------------------------------------------------------------
Include directories:
Clang: /home/adrien/micromamba/envs/binder/lib/clang/13.0.1/include
        OpenCASCADE: /home/adrien/micromamba/envs/binder/include/opencascade
        VTK: /home/adrien/micromamba/envs/binder/include/vtk-9.0
        TBB: /home/adrien/micromamba/envs/binder/include

Generating all_includes.h file...

Writing binding output files to: /home/adrien/Documents/codes/occt/pyOCCT/src

Parsing headers...
----------------------
DIAGNOSTIC INFORMATION
----------------------
Complete with 568 issues with lower than 4 severity not shown.
----------------------
Traversing headers...
Sorting binders...
Building includes...
Building imports...
Checking circular imports...
Binding templates...
Patched file: bind_BVH_BaseBox
Patched file: bind_BOPTools_PairSelector
Binding...
Patched file: Standard
Patched file: Standard
Patched file: Standard
Patched file: Standard
Patched file: Standard
Patched file: Geom
Patched file: AIS
Patched file: IVtkTools
Patched file: IVtkTools
Done!
----------------------------------------------------------------------------------------------------

Is it normal to have so many issues?

I had then to patch the CMakeLists.txt file line 76 to replace find_package(OpenGL REQUIRED GLX EGL) with find_package(OpenGL REQUIRED) . Didn't managed to find some conda packages to make it work another way.

Last step to reproduce is to run make and I got those kind of errors.
Git blame on OCCT repo doesn't mention any recent change. Do you see what I'm missing here?

Thanks!

BOPAlgo_Options protected methods not available

In the occt_730 branch, protected methods from the BOPAlgo_Options class, e.g. SetFuzzyValue, HasWarnings, are not available to instances of classes that inherit it, e.g. BRepAlgoAPI_Fuse.

In the master branch, these protected methods are defined at the top of the BRepAlgoAPI.cpp file with the following comment:
// FIXME Access protected members of this class that are made available with "using". Need to write as lambdas.

Should I just add a class definition for BOPAlgo_Options similarly to the other classes defined in the BRepAlgoAPI.cxx file or does the protected nature of these methods need to be handled differently?

Example for writing STEP file?

Hello, I'm trying out pyOCCT. I need to programmatically create some geometry and save it as step. Could you add an example for writing a step file? Similar to examples/import_step.py but in the other direction :)

Image_Pixmap().Data pointer?

I am trying to convert V3d_View contents into a QPixmap object.
Using V3d_View we can Dump contents of the View to an image file. Using ToPixMap we can dump them to an Image_PixMap object. But Image_Pixmap.Data() returns an int? There is also InitWrapper method that takes a pointer as int?

conda install -c trelau pyocct PackageNotFoundError

conda create -n occt python=3.5
conda activate occt
conda install -c trelau pyocct

gives me a:

PackageNotFoundError: Package missing in current linux-64 channels: 
  - pyocct

Close matches found; did you mean one of these?

    pyocct: occt, pysot, pydot
$ uname -a
Linux linux-rozm 4.4.120-45-default #1 SMP Wed Mar 14 20:51:49 UTC 2018 (623211f) x86_64 x86_64 x86_64 GNU/Linux

boost-cpp dependency issue

The environment resulting from conda create -n myenv -c defaults -c conda-forge -c trelau pyocct fails to import OCCT.SMESH because of a DLL error

Reversing the channel priorities like so conda create -n myenv -c trelau -c conda-forge -c defaults pyocct results in an environment that works as expected

After investigating, I've determined that this is due to the version of boost-cpp which is 1.67.0 in the former case and 1.73.0 in the later. Running the original command with a precise specification of boost-cpp like so conda create -n myenv -c defaults -c conda-forge -c trelau pyocct boost-cpp=1.73.0=h89d28cc_2 also results in an environment that works as expected.

How difficult would it be to fix the dependency specifications so conda does not make broken environments?

This issue was observed on a 64-bit x64 windows machine

support for OCCT 7.3.0

Hi,
I'm wondering if you have any plans to support OCCT 7.3.0 and SMESH 9.1.9?

Best
C

Sweeping profile along helical path failing on pyOCCT

Trying to create a helical spiral fails on pyOCCT.

The attached code should generate a helical spiral, instead it throws a runtime error. When the same code is run on C++ it works perfectly.

Python code:
import OCCT.gp as GP
import OCCT.Geom as geo
import OCCT.Geom2d as geo2d
import OCCT.BRepBuilderAPI as bT
import OCCT.BRepOffsetAPI as bOff
import math

zAxis = GP.gp_Ax3(GP.gp_Pnt(0, 0, 0), GP.gp_Dir(0, 0, 1))
aCyn = geo.Geom_CylindricalSurface(zAxis, 5)
lin = geo2d.Geom2d_Line(GP.gp_Pnt2d(0,0), GP.gp_Dir2d(1,1))
aSeg = geo2d.Geom2d_TrimmedCurve(lin, 0, 2 * math.pi)
ahEdge = bT.BRepBuilderAPI_MakeEdge(aSeg, aCyn, 0, 4 * math.pi)
ahWire = bT.BRepBuilderAPI_MakeWire(ahEdge.Edge())

yAxis = GP.gp_Ax2(GP.gp_Pnt(5, 0, 0), GP.gp_Dir(0, 1, 0))
circProf = GP.gp_Circ(yAxis, 1)
circEdge = bT.BRepBuilderAPI_MakeEdge(circProf)
circWire = bT.BRepBuilderAPI_MakeWire(circEdge.Edge())
circFace = bT.BRepBuilderAPI_MakeFace(circWire.Wire())
spir = bOff.BRepOffsetAPI_MakePipe(ahWire.Wire(), circFace.Face())

The code first generates a helix, the code then creates a face. Finally the code aims to sweep the face along the helix, on python if fails, on C++ it works. On python when I tried to replace the helix with a straight edge it worked also. So the issue basically occurs only when trying to sweep a profile along a helix on pyOCCT.

Any help with that is appreciated.

Build issues for 7.3.0 branch on Ubuntu

I am testing building the new 7.3.0 branch. It looks like there's a problem with something Windows-only:

[  6%] Building CXX object CMakeFiles/TCollection.dir/src/modules/TCollection/bind_TCollection_ExtendedString.cxx.o
/home/kkremitzki/.local/src/pyocct/src/modules/TCollection/bind_TCollection_ExtendedString.cxx: In function ‘void bind_TCollection_ExtendedString(pybind11::module&)’:
/home/kkremitzki/.local/src/pyocct/src/modules/TCollection/bind_TCollection_ExtendedString.cxx:104:149: error: ‘ToWideString’ is not a member of ‘TCollection_ExtendedString’
 cls_TCollection_ExtendedString.def("ToWideString", (const Standard_WideChar * (TCollection_ExtendedString::*)() const) &TCollection_ExtendedString::ToWideString, "Returns pointer to string as wchar_t* on Windows platform where wchar_t* is considered as UTF-16 string. This method is useful to pass string into wide-char system APIs, and makes sense only on Windows (other systems use UTF-8 and can miss wide-char functions at all).");
                                                                                                                                                     ^~~~~~~~~~~~
make[2]: *** [CMakeFiles/TCollection.dir/build.make:167: CMakeFiles/TCollection.dir/src/modules/TCollection/bind_TCollection_ExtendedString.cxx.o] Error 1

If I comment that out, I get:

[ 14%] Building CXX object CMakeFiles/ShapeAnalysis.dir/src/modules/ShapeAnalysis/bind_ShapeAnalysis_BoxBndTree.cxx.o
In file included from /home/kkremitzki/.local/src/pyocct/src/modules/ShapeAnalysis/bind_ShapeAnalysis_BoxBndTree.cxx:28:
/home/kkremitzki/.local/src/pyocct/src/include/bind_NCollection_UBTree.hxx: In function ‘void bind_NCollection_UBTree(pybind11::module&, const string&, const pybind11::module_local&)’:
/home/kkremitzki/.local/src/pyocct/src/include/bind_NCollection_UBTree.hxx:62:188: error: type/value mismatch at argument 1 in template parameter list for ‘template<class T> struct Deleter’
 py::class_<NCollection_UBTree<TheObjType, TheBndType>::Selector, std::unique_ptr<NCollection_UBTree<TheObjType, TheBndType>::Selector, Deleter<NCollection_UBTree<TheObjType, TheBndType>::Selector>>> cls_Selector(cls_NCollection_UBTree, "Selector", "Class defining the minimal interface of selector.", local);
                                                                                                                                                                                            ^~~~~~~~
/home/kkremitzki/.local/src/pyocct/src/include/bind_NCollection_UBTree.hxx:62:188: note:   expected a type, got ‘NCollection_UBTree<TheObjType, TheBndType>::Selector’
/home/kkremitzki/.local/src/pyocct/src/include/bind_NCollection_UBTree.hxx:62:196: error: type/value mismatch at argument 1 in template parameter list for ‘template<class _Tp, class _Dp> class std::unique_ptr’
 py::class_<NCollection_UBTree<TheObjType, TheBndType>::Selector, std::unique_ptr<NCollection_UBTree<TheObjType, TheBndType>::Selector, Deleter<NCollection_UBTree<TheObjType, TheBndType>::Selector>>> cls_Selector(cls_NCollection_UBTree, "Selector", "Class defining the minimal interface of selector.", local);
                                                                                                                                                                                                    ^~
/home/kkremitzki/.local/src/pyocct/src/include/bind_NCollection_UBTree.hxx:62:196: note:   expected a type, got ‘NCollection_UBTree<TheObjType, TheBndType>::Selector’
/home/kkremitzki/.local/src/pyocct/src/include/bind_NCollection_UBTree.hxx:62:196: error: template argument 2 is invalid
/home/kkremitzki/.local/src/pyocct/src/include/bind_NCollection_UBTree.hxx:62:198: error: type/value mismatch at argument 1 in template parameter list for ‘template<class type_, class ... options> class pybind11::class_’
 py::class_<NCollection_UBTree<TheObjType, TheBndType>::Selector, std::unique_ptr<NCollection_UBTree<TheObjType, TheBndType>::Selector, Deleter<NCollection_UBTree<TheObjType, TheBndType>::Selector>>> cls_Selector(cls_NCollection_UBTree, "Selector", "Class defining the minimal interface of selector.", local);
                                                                                                                                                                                                      ^
/home/kkremitzki/.local/src/pyocct/src/include/bind_NCollection_UBTree.hxx:62:198: note:   expected a type, got ‘NCollection_UBTree<TheObjType, TheBndType>::Selector’
/home/kkremitzki/.local/src/pyocct/src/include/bind_NCollection_UBTree.hxx:62:198: error: template argument 2 is invalid
/home/kkremitzki/.local/src/pyocct/src/include/bind_NCollection_UBTree.hxx:62:307: error: expression list treated as compound expression in initializer [-fpermissive]
 BTree<TheObjType, TheBndType>::Selector, Deleter<NCollection_UBTree<TheObjType, TheBndType>::Selector>>> cls_Selector(cls_NCollection_UBTree, "Selector", "Class defining the minimal interface of selector.", local);
                                                                                                                                                                                                                     ^

/home/kkremitzki/.local/src/pyocct/src/include/bind_NCollection_UBTree.hxx:67:14: error: request for member ‘def’ in ‘cls_Selector’, which is of non-class type ‘int’
 cls_Selector.def("Reject", (Standard_Boolean (NCollection_UBTree<TheObjType, TheBndType>::Selector::*)(const TheBndType &) const) &NCollection_UBTree<TheObjType, TheBndType>::Selector::Reject, "Rejection base on the bounding type.", py::arg(""));
              ^~~
/home/kkremitzki/.local/src/pyocct/src/include/bind_NCollection_UBTree.hxx:68:14: error: request for member ‘def’ in ‘cls_Selector’, which is of non-class type ‘int’
 cls_Selector.def("Accept", (Standard_Boolean (NCollection_UBTree<TheObjType, TheBndType>::Selector::*)(const TheObjType &)) &NCollection_UBTree<TheObjType, TheBndType>::Selector::Accept, "Confirm the object while making necessary tests on it. This method is called when the bounding box of the object conforms to the conditions (see Reject()). It is also supposed to keep record of accepted objects.", py::arg(""));
              ^~~
/home/kkremitzki/.local/src/pyocct/src/include/bind_NCollection_UBTree.hxx:69:14: error: request for member ‘def’ in ‘cls_Selector’, which is of non-class type ‘int’
 cls_Selector.def("Stop", (Standard_Boolean (NCollection_UBTree<TheObjType, TheBndType>::Selector::*)() const) &NCollection_UBTree<TheObjType, TheBndType>::Selector::Stop, "This condition is checked after each call to Accept().");
              ^~~
/home/kkremitzki/.local/src/pyocct/src/include/bind_NCollection_UBTree.hxx: In instantiation of ‘void bind_NCollection_UBTree(pybind11::module&, const string&, const pybind11::module_local&) [with TheObjType = int; TheBndType = Bnd_Box; std::__cxx11::string = std::__cxx11::basic_string<char>]’:
/home/kkremitzki/.local/src/pyocct/src/modules/ShapeAnalysis/bind_ShapeAnalysis_BoxBndTree.cxx:32:90:   required from here
/home/kkremitzki/.local/src/pyocct/src/include/bind_NCollection_UBTree.hxx:62:302: warning: left operand of comma operator has no effect [-Wunused-value]
 BTree<TheObjType, TheBndType>::Selector, Deleter<NCollection_UBTree<TheObjType, TheBndType>::Selector>>> cls_Selector(cls_NCollection_UBTree, "Selector", "Class defining the minimal interface of selector.", local);
                                                                                                                                                                                                                ^~~~~

/home/kkremitzki/.local/src/pyocct/src/include/bind_NCollection_UBTree.hxx:62:302: warning: right operand of comma operator has no effect [-Wunused-value]
/home/kkremitzki/.local/src/pyocct/src/include/bind_NCollection_UBTree.hxx:62:302: warning: right operand of comma operator has no effect [-Wunused-value]
/home/kkremitzki/.local/src/pyocct/src/include/bind_NCollection_UBTree.hxx:62:200: error: cannot convert ‘const pybind11::module_local’ to ‘int’ in initialization
 py::class_<NCollection_UBTree<TheObjType, TheBndType>::Selector, std::unique_ptr<NCollection_UBTree<TheObjType, TheBndType>::Selector, Deleter<NCollection_UBTree<TheObjType, TheBndType>::Selector>>> cls_Selector(cls_NCollection_UBTree, "Selector", "Class defining the minimal interface of selector.", local);
                                                                                                                                                                                                        ^~~~~~~~~~~~
make[2]: *** [CMakeFiles/ShapeAnalysis.dir/build.make:89: CMakeFiles/ShapeAnalysis.dir/src/modules/ShapeAnalysis/bind_ShapeAnalysis_BoxBndTree.cxx.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:2034: CMakeFiles/ShapeAnalysis.dir/all] Error 2
make: *** [Makefile:130: all] Error 2

Cannot Setup pyOCCT in non-env Miniconda

Hey Trelau!

I have been using pythonOCC for a few years now, and thought I would give your pyOCCT a try (so I can use SMESH/NETGEN). I was able to setup pyOCCT using the env method in miniconda, but I cannot make it work without an env, even though I use a miniconda with the same version of python: I just get DLL load failed error for all modules.

I would really prefer to install it without using an env, do you have some suggestion?

Steps to Reproduce (for bugs)

Install Miniconda3-py38-4.8.3: https://repo.anaconda.com/miniconda/Miniconda3-py38_4.8.3-Windows-x86_64.exe
Do:
conda init
conda install -c conda-forge -c trelau pyocct
Then try:
python
from OCCT.Graphic3d import Graphic3d_NOM_ALUMINIUM
Gets a message:
ImportError: DLL load failed while importing Graphic3d: The specified module could not be found.

Module Not Found Error

Module Not Found Error:

I followed the "Getting started using conda", and as I tried to implement the DEMO code, an error occurs:
ModuleNotFoundError: No module name 'OCCT'. How can I solve this issue? Thanks!

Vincent
image

Feature request: Support raytracing

I'm not sure if raytracing works on other platforms or not but it currently doesn't in linux (I tried with a Windows VM and it didn't work there either).

I believe this is an issue with occt, but pyOCCT will also need to add support as well (if occt gets it).

Expected Behavior

In the cad assistant app rendering with raytracing works (notice shadows, antialiasing, and reflections).

raytracing

Current Behavior

In DeclaraCAD these settings have no effect as the OpenGl_GraphicDriver says it's not supported.

no-raytracing

Possible Solution

From scanning the code it looks like OCCT requires the "USE_GLES2" flag then it imports the gles2 headers and enables this block: https://github.com/Open-Cascade-SAS/OCCT/blob/master/src/OpenGl/OpenGl_Context.cxx#L1707

I'm trying to get it to work on linux, I've managed to build the occt package with gles2 support but still need to get pyOCCT to work with it.

Setting referenced based class attributes

Expected Behavior

I am unable to set the ShapeFix_Wireframe mode to remove small edges via its attribute ModeDropSmallEdges Relatedly, I am also unable to change any of the modes (i.e. FixSolidMode, FixFreeFaceMode, etc) in ShapeFix_Shape

>>> from OCCT.Exchange.Basic import ExchangeBasic
>>> from OCCT.ShapeFix import ShapeFix_Wireframe
>>> my_part = ExchangeBasic.read_step('path/to/my/step.step')
>>> wireframe_fixer = ShapeFix_Wireframe(my_part)
>>> wireframe_fixer.ModeDropSmallEdges = True
>>> wireframe_fixer.ModeDropSmallEdges()
True

Current Behavior

>>> from OCCT.Exchange.Basic import ExchangeBasic
>>> from OCCT.ShapeFix import ShapeFix_Wireframe
>>> my_part = ExchangeBasic.read_step('path/to/my/step.step')
>>> wireframe_fixer = ShapeFix_Wireframe(my_part)
>>> wireframe_fixer.ModeDropSmallEdges = True
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'OCCT.ShapeFix.ShapeFix_Wireframe' object attribute 'ModeDropSmallEdges' is read-only
>>> wireframe_fixer.ModeDropSmallEdges()
False

Possible Solution

This seems to be because those attributes are passed by reference in the C++ libraries, I'm not strong in pybind-fu so I'm not sure what would have to be changed, but I'm willing to try if you point me in the right direction!

Context

I have been having issues with the capping plane feature and I was pointed to these shape healing tools on the OpenCascade forums They work alright, but it is clear that I have some small disconnected edges that need removed and I'm unable to set the attribute.

Your Environment

  • Version used: 7.5.2
  • Operating System and version (desktop or mobile): Windows 10, Debian Stretch

How to Access STEP Instance ID's?

Suppose this data is in a STEP file:

#417=ADVANCED_FACE('face_1',(#112),#405,.F.);
#418=ADVANCED_FACE('face_2',(#113),#406,.F.);
#419=ADVANCED_FACE('face_3',(#114),#407,.F.);

Then the code below would print face_1, face_2 and face_3

name = item.Name().ToCString()

But how can I access the ID's of the ADVANCED_FACE instances? (#417, #418 and #419)

RuntimeError: Xw_Window, given invalid X window on Linux (Mint 19.2)

Examples does not run in Linux:

(pyocct) dev@devel03:examples$ python bop_speed.py 
Gtk-Message: 17:08:52.114: Failed to load module "atk-bridge"
05:08:52 PM: Debug: Failed to connect to session manager: None of the authentication protocols specified are supported
Press "c" to continue...

(bop_speed.py:1986): Gdk-WARNING **: 17:08:52.451: gdkdrawable-x11.c:952 drawable is not a pixmap or window
Traceback (most recent call last):
  File "/home/mnesarco/miniconda3/envs/pyocct/lib/python3.8/site-packages/wx/core.py", line 3285, in <lambda>
    lambda event: event.callable(*event.args, **event.kw) )
  File "/home/mnesarco/miniconda3/envs/pyocct/lib/python3.8/site-packages/OCCT/Visualization/WxViewer.py", line 144, in _init_wind
    wind = Xw_Window(self.display_connect, hwnd)
RuntimeError: Xw_Window, given invalid X window

Expected Behavior

Examples should run

Steps to Reproduce (for bugs)

python bop_speed.py

Your Environment

  • Version used: 7.4.0
  • Operating System and version (desktop or mobile): Linux Mint 19.2 (64)
# Name                    Version                   Build  Channel
_libgcc_mutex             0.1                        main  
atk                       2.36.0                        0    conda-forge
atk-1.0                   2.36.0               haf93ef1_0    conda-forge
boost-cpp                 1.73.0               h7b93d67_1    conda-forge
brotlipy                  0.7.0           py38h1e0a361_1000    conda-forge
bzip2                     1.0.8                h516909a_2    conda-forge
ca-certificates           2020.6.20            hecda079_0    conda-forge
cairo                     1.16.0            h3fc0475_1005    conda-forge
certifi                   2020.6.20        py38h32f6830_0    conda-forge
cffi                      1.14.0           py38hd463f26_0    conda-forge
chardet                   3.0.4           py38h32f6830_1006    conda-forge
cryptography              2.9.2            py38h766eaa4_0    conda-forge
curl                      7.71.1               he644dc0_0    conda-forge
expat                     2.2.9                he1b5a44_2    conda-forge
fontconfig                2.13.1            h1056068_1002    conda-forge
freetype                  2.10.2               he06d7ca_0    conda-forge
fribidi                   1.0.9                h516909a_0    conda-forge
future                    0.18.2           py38h32f6830_1    conda-forge
gdk-pixbuf                2.38.2               h3f25603_4    conda-forge
gettext                   0.19.8.1          hc5be6a0_1002    conda-forge
glib                      2.65.0               h6f030ca_0    conda-forge
gobject-introspection     1.64.1           py38h03d966d_1    conda-forge
graphite2                 1.3.13            he1b5a44_1001    conda-forge
gst-plugins-base          1.14.5               h0935bb2_2    conda-forge
gstreamer                 1.14.5               h36ae1b5_2    conda-forge
gtk2                      2.24.32              h194ddfc_3    conda-forge
harfbuzz                  2.4.0                hee91db6_5    conda-forge
hdf4                      4.2.13            hf30be14_1003    conda-forge
hdf5                      1.10.6          nompi_h3c11f04_100    conda-forge
icu                       67.1                 he1b5a44_0    conda-forge
idna                      2.10               pyh9f0ad1d_0    conda-forge
jpeg                      9d                   h516909a_0    conda-forge
jsoncpp                   1.8.4             hc9558a2_1002    conda-forge
krb5                      1.17.1               hfafb76e_1    conda-forge
ld_impl_linux-64          2.33.1               h53a641e_7  
libcurl                   7.71.1               hcdd3856_0    conda-forge
libedit                   3.1.20191231         h7b6447c_0  
libffi                    3.2.1             he1b5a44_1007    conda-forge
libgcc-ng                 9.1.0                hdf63c60_0  
libgfortran-ng            7.5.0                hdf63c60_6    conda-forge
libglu                    9.0.0             he1b5a44_1001    conda-forge
libiconv                  1.15              h516909a_1006    conda-forge
libnetcdf                 4.7.4           nompi_h84807e1_104    conda-forge
libpng                    1.6.37               hed695b0_1    conda-forge
libssh2                   1.9.0                hab1572f_2    conda-forge
libstdcxx-ng              9.1.0                hdf63c60_0  
libtiff                   4.1.0                hc7e4089_6    conda-forge
libuuid                   2.32.1            h14c3975_1000    conda-forge
libwebp-base              1.1.0                h516909a_3    conda-forge
libxcb                    1.13              h14c3975_1002    conda-forge
libxml2                   2.9.10               h72b56ed_1    conda-forge
lz4-c                     1.9.2                he1b5a44_1    conda-forge
ncurses                   6.2                  he6710b0_1  
netgen4smesh              6.2.1804             h6bb024c_0    trelau
occt                      7.4.0                h9121d39_5    conda-forge
openssl                   1.1.1g               h516909a_0    conda-forge
pango                     1.42.4               h7062337_4    conda-forge
pathlib2                  2.3.5            py38h32f6830_1    conda-forge
pcre                      8.44                 he1b5a44_0    conda-forge
pip                       20.1.1                   py38_1  
pixman                    0.38.0            h516909a_1003    conda-forge
pthread-stubs             0.4               h14c3975_1001    conda-forge
pycparser                 2.20               pyh9f0ad1d_2    conda-forge
pyocct                    7.4.0.0                  py38_1    trelau
pyopenssl                 19.1.0                     py_1    conda-forge
pypubsub                  4.0.3                      py_0    conda-forge
pysocks                   1.7.1            py38h32f6830_1    conda-forge
python                    3.8.3           cpython_he5300dc_0    conda-forge
python_abi                3.8                      1_cp38    conda-forge
readline                  8.0                  h7b6447c_0  
requests                  2.24.0             pyh9f0ad1d_0    conda-forge
setuptools                47.3.1                   py38_0  
six                       1.15.0             pyh9f0ad1d_0    conda-forge
smesh4pyocct              8.3.0.4              hf484d3e_0    trelau
sqlite                    3.32.3               h62c20be_0  
tbb                       2020.1               hc9558a2_0    conda-forge
tk                        8.6.10               hbc83047_0  
urllib3                   1.25.9                     py_0    conda-forge
vtk                       8.2.0           py38hf2e56f5_218    conda-forge
wheel                     0.34.2                   py38_0  
wxpython                  4.0.7.post2      py38hac52f33_3    conda-forge
xorg-kbproto              1.0.7             h14c3975_1002    conda-forge
xorg-libice               1.0.10               h516909a_0    conda-forge
xorg-libsm                1.2.3             h84519dc_1000    conda-forge
xorg-libx11               1.6.9                h516909a_0    conda-forge
xorg-libxau               1.0.9                h14c3975_0    conda-forge
xorg-libxdmcp             1.1.3                h516909a_0    conda-forge
xorg-libxext              1.3.4                h516909a_0    conda-forge
xorg-libxrender           0.9.10            h516909a_1002    conda-forge
xorg-libxt                1.2.0                h516909a_0    conda-forge
xorg-renderproto          0.11.1            h14c3975_1002    conda-forge
xorg-xextproto            7.3.0             h14c3975_1002    conda-forge
xorg-xproto               7.0.31            h14c3975_1007    conda-forge
xz                        5.2.5                h7b6447c_0  
zlib                      1.2.11               h7b6447c_3  
zstd                      1.4.4                h6597ccf_3    conda-forge

RWGltf package

Hello,
I would like to use a glTF Writer, which is available in Open CASCADE since v7.5.0.
I can see a binary module RWGltf.pyd among others in the OCCT package. It should be extracted to python source files, but it never happens.
All other RW modules are there except RWGltf.

Your Environment

  • Version used: 7.5.3.0, 7.5.2.1, 7.5.1.1
  • Operating System and version (desktop or mobile): Windows 10

Build and Install Documentation

First, thank you for developing and providing this package!

There are some bugs fixed in the 7.3 release of OCC that address some issues we have run into. I would like to try your occt_730 branch, but I'm not sure how to build and install the software for the Conda and Win64 environment. I read one of the earlier issues in which building was discussed but could not figure out what needs to be done. Do you have documentation on the building process and making the built package available in Anaconda? Thanks for any help you can provide.

CI/CD support discussion

@shrdluk @looooo

Starting an issue to open up the discussion for how to proceed with CI/CD services for pyOCCT.

Some thoughts off the top of my head:

  • Conda seems to be a natural choice, put having pip support would be a plus also. I collected all necessary binaries into the wheel for my local build and it makes for a nice single file download/install. The challenge there might be collecting all the binaries, but can probably be done via CMake. This includes OCCT, VTK, freetype, freeimage, SMESH, Netgen, etc..

  • Only the official releases from OpenCASCADE will be used

  • My latest build uses VTK 8.1.0 w/ freetype 2.8.1

  • Keeping dependencies free from a specific version of Python would be nice (e.g., VTK and Netgen)

  • Support for Python 3.5 and beyond should be easy, and would really like Python 2.7 if possible. I'm not concerned about Python 3.0-3.4.

  • Appveyor and Travis-CI are the most applicable I think

  • Locally, I build the binaries and then install them into the project "OCCT/" folder, then I use "python setup.py install" or "python setup.py bdist_wheel" as needed. I think the OCCT folder can be used as the target to build the eventual conda package or the wheel and stored as an archive (in Appeveyor for example).

  • Using third-party packages like conda-forge would be nice, but in case we need our own builds for whatever reason, I think we set up our own conda channel. I think @looooo has already done this, just need to think about what dependencies we need if we can't use conda-forge.

  • For now I have my own "netgen4smesh" repo, but if we can get the main Netgen project to incorporate our changes and then just have a repo to build it, that would be ideal.

Any feedback and thoughts are welcomed. I have some experience with Appveyor and none with Travis-CI, so in case anyone wants to help out feel free to jump in.

Apply fix for Font_BRepFont

from #38 (comment) @frmdstryr

Awesome, looks like its working now!

Could you also pull in the changes to make Font_BRepFont work?

Add a subclass that exposes new and delete
https://github.com/frmdstryr/pyOCCT/blob/github-actions/inc/bind_Font_BRepFont.hxx

Add header (and remove it from excluded classes)
https://github.com/frmdstryr/pyOCCT/blob/github-actions/config.txt#L637

Patch Font_BRepTextBuilder to use the font subclass
https://github.com/frmdstryr/pyOCCT/blob/github-actions/config.txt#L942-L946

I'm not sure if the nodelete option is needed there. I don't get why they decided to make it inherit from a protected class...

to do:

  • apply recommended fixes
  • write unit test to verify fix stays fixed as things update and/or change

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.