Giter Site home page Giter Site logo

problem of mentor example 10.1 about pivy HOT 9 CLOSED

coin3d avatar coin3d commented on August 21, 2024
problem of mentor example 10.1

from pivy.

Comments (9)

looooo avatar looooo commented on August 21, 2024

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.

from pivy.

cbjcbj avatar cbjcbj commented on August 21, 2024

Thank you for your reply. Hope everything gose well.

from pivy.

looooo avatar looooo commented on August 21, 2024

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.

from pivy.

cbjcbj avatar cbjcbj commented on August 21, 2024

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

from pivy.

looooo avatar looooo commented on August 21, 2024

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.

from pivy.

looooo avatar looooo commented on August 21, 2024

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

from pivy.

looooo avatar looooo commented on August 21, 2024
  • The error is somewhere in the __imul__ (*=) function of SfVec3f... I will have a look at this, but simply using a = a * b instead of a *= b should also work. See here: examples/Mentor/10.1.addEventCB.py#L68
  • Another thing not working in this example is this examples/Mentor/10.1.addEventCB.py#L184.
    With quarter I added a callback function to redraw the scene when the selection changed: examples/Mentor_quarter/10.1.addEventCB.py#L193
  • With my pivy branch callbacks have to be set to a variable in python. This way it's possible to delete a callback. This is done similarly in FreeCAD. The problem with my implementation is that the return value of addEventCallback(foo) has to be set to a variable in python. Otherwise the garbage collector will delete this object and the callback can't access the function. examples/Mentor_quarter/10.1.addEventCB.py#L119[done]

from pivy.

cbjcbj avatar cbjcbj commented on August 21, 2024

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

from pivy.

looooo avatar looooo commented on August 21, 2024

I think this should be fixed

from pivy.

Related Issues (20)

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.