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

DataExchange refactoring and X3D export #842

Open
tpaviot opened this issue May 22, 2020 · 10 comments
Open

DataExchange refactoring and X3D export #842

tpaviot opened this issue May 22, 2020 · 10 comments

Comments

@tpaviot
Copy link
Owner

tpaviot commented May 22, 2020

The DataExchange.py module became too big. Current work it to split the content to dedicated modules.

New modules XDE.py and X3D.py will contain the recent work related to X3D export.

see commit 009ea2b

ping @andreasplesch

@tpaviot tpaviot changed the title DataExchange refactor and X3D export DataExchange refactoring and X3D export May 22, 2020
@andreasplesch
Copy link

Looks good to me.

@andreasplesch
Copy link

I found a few small oversights in the port which need a self._ .
Also I think it is a good idea to add a get_scene and a get_internalFaceEntries method.
I can provide PR#s and a working notebook soon.
Is this issue a good place to continue ?

@andreasplesch
Copy link

started a PR: #844

@andreasplesch
Copy link

andreasplesch commented May 27, 2020

Here is a notebook which demonstrates how to use the module. It then uses the x3d function to produce x3dom compatible HTML which the notebook can display.

https://nbviewer.jupyter.org/github/andreasplesch/OCCToX3D/blob/275a01e047db69108040ef8db3501d945e7a2737/notebooks/XDEscenegraph.ipynb

@tpaviot
Copy link
Owner Author

tpaviot commented May 29, 2020

I included the officiel x3d.py module as a dependency, into the x3d_official subpackage:

import OCC.Extend.DataExchange.x3d_standard.x3d as XX3D

see commit be5d4dd

@andreasplesch
Copy link

I think this is safe. I will let Don as the maintainer know.

@tpaviot
Copy link
Owner Author

tpaviot commented Jun 9, 2020

I pushed a set of commits with a very first try for the new X3D.py, base on the pure python Tesselator and the x3d standard package see 56d5bac

There's still a big work to do: testing, clean ups (some old code has not been removed yet), small issues with the official x3d package (creaseAngle is not a property of the IndexedTriangleSet but I used to work with it, I don't know if I have to manually add this property or use another class, for instance the IndexedFaceSet)

@tpaviot
Copy link
Owner Author

tpaviot commented Jun 11, 2020

@andreasplesch I face an issue while trying to use a Normal node:
The single line

Normal(vector=[[1,0,0], [0,1,0]])

raises the following issue

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/thomas/Devel/pythonocc-core/src/Extend/DataExchange/x3d_standard/x3d.py", line 35739, in __init__
    self.vector = vector
  File "/home/thomas/Devel/pythonocc-core/src/Extend/DataExchange/x3d_standard/x3d.py", line 35749, in vector
    assertGreaterThanEquals('vector', vector, -1)
  File "/home/thomas/Devel/pythonocc-core/src/Extend/DataExchange/x3d_standard/x3d.py", line 1652, in assertGreaterThanEquals
    assert isGreaterThanEquals(value, minimum), fieldName + '=' + str(value) + ' fails assertGreaterThanEquals minimum=' + str(minimum)
  File "/home/thomas/Devel/pythonocc-core/src/Extend/DataExchange/x3d_standard/x3d.py", line 1641, in isGreaterThanEquals
    if each < minimum:
TypeError: '<' not supported between instances of 'list' and 'int'

There's a quality check I don't understand inthe Normal class definition (from the official x3d.py file):

    def vector(self, vector):
        if  vector is None:
            vector = MFVec3f.DEFAULT_VALUE(self)
        assertValidMFVec3f(vector)
        assertGreaterThanEquals('vector', vector, -1)
        assertLessThanEquals('vector', vector, 1)
        self.__vector = vector

I don't understant the assertGreaterThanEquals and assertLessThanEquals purpose. What do I miss ?

@andreasplesch
Copy link

andreasplesch commented Jun 11, 2020 via email

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

No branches or pull requests

2 participants