coin3d / pivy

python bindings to coin3d
ISC License
53 stars 37 forks source link

problem of mentor example 10.1 #3

Closed cbjcbj closed 7 years ago

cbjcbj commented 8 years ago

Hi, I am new to openiv and find your pivy lib very useful. I install pivy from the FreeCAD ppa of Ubuntu. When I try to run the mentor example 10.1.addEventCB.py, I find it does not work. I cannot be pick the object if the scene is static. And if I pick an object and press the up arrow key, python will automatically exit, with: * Error in `python': free(): invalid pointer: 0x000000000300cfd8 *. I don't know if I miss something or it is a bug. Thank you.

looooo commented 8 years ago

This is a fork from https://bitbucket.org/Coin3D/pivy/src. This fork only tries to add python3 compatibility. I haven't got a working soqt version, so I can't test this example right now. I will try to translate this example to quarter in the next days.

cbjcbj commented 8 years ago

Thank you for your reply. Hope everything gose well.

looooo commented 8 years ago

https://github.com/looooo/pivy/blob/master/examples/Mentor_quarter/10.1.addEventCB.py this works for me. Is the pivy from the ppa based on this fork? I think all freecad-ppa use the official pivy repository, but maybe I am wrong.

ps.: Didn't try the arrow up... So the crash also appears with quarter.

cbjcbj commented 8 years ago

I don't know the ppa well. I download the official coin source and cannot compile. And I install FreeCAD and find it contains pivy. Then I find your pivy project here. So If I want to install your pivy lib, do I just need to run the setup.py?

I alo test some mentor examples. Some of them will show warning messages (like 02.1), and some fails (like 10.3 and 10.6). I don't know if it is a bug of something else.

pic2

looooo commented 8 years ago

Thanks for your feedback,

If I want to install your pivy lib, do I just need to run the setup.py?

exactly:

To compile pivy run python setup.py build

To install: python setup.py install

But the problems will remain...

The problem with 10.1 is the scaling function. setting the scalefactror crashes the programm. I haven't investigated this, because with my branch I have found a strange problem with the callbacks...

FreeCAD has implemented it's own viewer. So I never had a look at the viewers provided by pivy (quarter, sogui). Maybe you can try to run the example within FreeCAD. Allthough the scaling problem will also remain.

looooo commented 8 years ago

finally I have found what caused the problem with my pivy version. Here is the bt for the scaling problem:

0 0x00007ffff7826418 in __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:54

1 0x00007ffff782801a in __GI_abort () at abort.c:89

2 0x00007ffff786872a in __libc_message (do_abort=do_abort@entry=2, fmt=fmt@entry=0x7ffff79816b0 "* Error in `%s': %s: 0x%s *\n")

at ../sysdeps/posix/libc_fatal.c:175

3 0x00007ffff7870f4a in malloc_printerr (ar_ptr=, ptr=, str=0x7ffff797e48f "free(): invalid pointer",

action=3) at malloc.c:5007

4 _int_free (av=, p=, have_lock=0) at malloc.c:3868

5 0x00007ffff7874abc in __GI___libc_free (mem=) at malloc.c:2969

6 0x00007fffeea05a04 in _wrap_delete_SbVec3f (args=) at pivy/coin_wrap.cpp:49974

7 0x00000000004b0de3 in PyObject_Call ()

8 0x00000000004b9362 in PyObject_CallFunctionObjArgs ()

9 0x00007fffee76dd00 in SwigPyObject_dealloc (v=0x7fffef42aba0) at pivy/coin_wrap.cpp:1721

10 0x00000000004fd546 in ?? ()

11 0x00000000004d8d07 in ?? ()

12 0x00000000004c9970 in PyEval_EvalFrameEx ()

13 0x00000000004c22e5 in PyEval_EvalCodeEx ()

14 0x00000000004de7fe in ?? ()

15 0x00000000004b0de3 in PyObject_Call ()

16 0x00000000004ce140 in PyEval_CallObjectWithKeywords ()

17 0x00007fffee7d78b8 in SoEventPythonCallBack (userdata=0x7fffefdb37a0, node=) at pivy/coin_wrap.cpp:6898

looooo commented 8 years ago
cbjcbj commented 8 years ago

Hi, I am still reading your code. If I have any though, I will tell you. Thank you.

looooo commented 7 years ago

I think this should be fixed