Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some modules/bindings missing... #15

Closed
frmdstryr opened this issue Apr 25, 2020 · 8 comments · Fixed by #42
Closed

Some modules/bindings missing... #15

frmdstryr opened this issue Apr 25, 2020 · 8 comments · Fixed by #42

Comments

@frmdstryr
Copy link

Hi! Glad to see OCP has been released!

I tried porting DeclaraCAD to OCP with just a find and replace and hit a few errors.

Version:

ocp                       7.4                     1_py3.7    cadquery

A few errors (after commenting some things out to try and catch others)

# 1st
from OCP.TopTools import (
ImportError: cannot import name 'TopTools_ListIteratorOfListOfShape' from 'OCP.TopTools' (unknown location)

# 2nd
ModuleNotFoundError: No module named 'OCP.STEPCAFControl'; 'OCP' is not a package

# 3rd (Cannot get further without making a lot more changes...)
AttributeError: type object 'OCP.TopoDS.TopoDS' has no attribute 'Vertex_'
AttributeError: type object 'OCP.Font.Font_FontMgr' has no attribute 'GetInstance_'
AttributeError: type object 'OCP.gp.gp' has no attribute 'Origin_'
AttributeError: type object 'OCP.AIS.AIS_Shape' has no attribute 'SelectionMode_

Does OCP add bindings for static members in a different way than pyOCCT?

If there's any way I can help test in the future let me know, thanks!

@adam-urbanczyk
Copy link
Member

From the top of my head:

(1) I did not wrap the nested iterators but there should be an __iter__ method exposed
(2) STEPCAFControl is not wrapped at the moment
(3) Static methods end with _s

@adam-urbanczyk
Copy link
Member

@frmdstryr regarding TopTools_ListIteratorOfListOfShape I see that you are using it here:
https://github.com/codelv/declaracad/blob/ec6d05eeece2a5b3785cfc4f90c9ab3cf4051323/declaracad/occ/impl/occ_shape.py#L110
it should be possible to skip it completely:

for topo_to_add in occ_seq:
    seq.append(topo_to_add)

@adam-urbanczyk
Copy link
Member

BTW: I'll try wrapping STEPCAFControl once #14 is solved. If you want to help you could try generating and compiling bindings with this module added to the conf file (ocp.toml)

@frmdstryr
Copy link
Author

Ok, I gave another try. Iterating over the occ_seq as you mentioned is working well. Replacing _s is also working. Do you happen to know what convention python-occ uses?

Hit one more error...

AttributeError: type object 'OCP.Graphic3d.Graphic3d_RenderingParams' has no attribute 'Anaglyph_RedCyan_Optimized'

But after commenting out that everything else seems to be working.

Nice work!

@adam-urbanczyk
Copy link
Member

@frmdstryr I added STEPCAFControl in 8aaad0e, azure should be finished in a couple of hours and then you can just pull the conda package from our channel. Let me know how it works. If you have access to osx I could use some help in testing the UI related functionality in OCP (Cocoa_Window and related).

Some of the fields of Graphic3d_RenderingParams are not exposed indeed, for now pywrap is not binding nested types.

@jmwright
Copy link
Member

jmwright commented May 5, 2020

It seems like the Interface_Static binding may be missing as mentioned here.

@jmwright
Copy link
Member

Please ignore my post about Interface_Static. It's not OCP.Interface_Static, it's OCP.Interface.Interface_Static which is present.

@adam-urbanczyk
Copy link
Member

All nested enums should be wrapped now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants