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

Global vector "Reverse()" method misused in tessellator.py #97

Open
tdeyster opened this issue May 16, 2023 · 1 comment
Open

Global vector "Reverse()" method misused in tessellator.py #97

tdeyster opened this issue May 16, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@tdeyster
Copy link

I ran into a bug when plotting a complex shape in in line 169 of tesselator.py

 flat.extend(n_buf.Reverse().Coord() if internal else n_buf.Coord())

"AttributeError: 'NoneType' object has no attribute 'Coord'"

Upon closer inspection I see that the .Reverse() method reverses the array in place and doesn't return it.

from OCP.gp import gp_Vec

n_buf = gp_Vec()
print("Is None?", n_buf.Reverse() is None)

prints out:
"Is None? True"

For the next release I would recommend the following fix to replace line 169 in tessellator.py:

# flat.extend(n_buf.Reverse().Coord() if internal else n_buf.Coord()) # old line 169; error here: n_buf.Reverse() is None
if internal: n_buf.Reverse()# TDE Added 5/16/23
flat.extend(n_buf.Coord()) #TDE Added 5/16/23
@bernhard-42 bernhard-42 added the bug Something isn't working label May 17, 2023
@bernhard-42
Copy link
Owner

Thanks @tdeyster for raising it.
You're right Reverse returns None, only Reversed returns the reversed copy
(https://dev.opencascade.org/doc/refman/html/classgp___vec.html#a12bc5a113c23663f11b1f0bd578ac13d)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants