pivy SoRayPickAction
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Be nice to others! Respect the FreeCAD code of conduct!
pivy SoRayPickAction
In the coin documentation for SoRayPickAction it is recommended to get the scene with view.getSceneManager().getSceneGraph() to have the camera-node in the path of a SoRayPickAction. I haven't found something like this in freecad. Is there a way to get the camera of the view into the traversing path?
Re: pivy SoRayPickAction
Hello,
This depends on your free cad version. If you are on stable you can use the method getscnegraph() of the view3DInventorViewer to get the scene including the camera. On current master there was a change yesterday that changed this. Now the getscenegraph() method returns only the geometry scene. If you want the one with the camera you need to call getSoRenderManager().getscenegraph() on the View3DInventorViewer
This depends on your free cad version. If you are on stable you can use the method getscnegraph() of the view3DInventorViewer to get the scene including the camera. On current master there was a change yesterday that changed this. Now the getscenegraph() method returns only the geometry scene. If you want the one with the camera you need to call getSoRenderManager().getscenegraph() on the View3DInventorViewer
Re: pivy SoRayPickAction
Thanks, I have compiled a newer version and the SoRenderManager is working. But now another problem occurs: For the raypick I will need the ViewportRegion. Any idea where I can find it?
OS: Debian GNU/Linux unstable (sid)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.15.4075 (Git)
Branch: master
Hash: dfd2eb33273dd7dfb802f3cde2bd384206903685
Python version: 2.7.8
Qt version: 4.8.6
Coin version: 4.0.0a
OS: Debian GNU/Linux unstable (sid)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.15.4075 (Git)
Branch: master
Hash: dfd2eb33273dd7dfb802f3cde2bd384206903685
Python version: 2.7.8
Qt version: 4.8.6
Coin version: 4.0.0a
Re: pivy SoRayPickAction
GetSoRenderManager()->getViewportRegion() should work
Re: pivy SoRayPickAction
My freecad crashed with this command. (GUI.ActiveDocument.ActiveView.getViewer(). getSoRenderManager().getViewportRegion()) Previously I had to import soqt to get the viewportregion. Maybe there is something similuar with the new system?
Re: pivy SoRayPickAction
does getViewer() return a valid object? and returns getSoRenderManager a valid object?
SoQt is not needed anymore, you will need to import coin, but I suppose that you did so already?
SoQt is not needed anymore, you will need to import coin, but I suppose that you did so already?
Re: pivy SoRayPickAction
What was your exact Python code to get the viewport with the old soqt stuff?
Re: pivy SoRayPickAction
the crash is happening when doing this comand: RenderManager.getViewportRegion(). No problem with the getViewer() and getSoRenderManager().does getViewer() return a valid object? and returns getSoRenderManager a valid object?
I tried both (with coin imported and withoout) but always get the crash afer doing the getViewportRegion() command and moving the mouse over the scene.SoQt is not needed anymore, you will need to import coin, but I suppose that you did so already?
I haven't got it anymore. I will try to reproduce on another machine and post here.What was your exact Python code to get the viewport with the old soqt stuff
Re: pivy SoRayPickAction
here is the way how I get the Viewportregion in older freecad version:
from pivy.gui import soqt
view = Gui.ActiveDocument.ActiveView
viewer = view.getViewer()
viewportregion = viewer.getViewportRegion()
Version info:
OS: Ubuntu 14.04.1 LTS
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.15.3989 (Git)
Branch: master
Hash: 7318a1d443c34c29b16aa44c89b371123ffc6f9f
Python version: 2.7.6
Qt version: 4.8.6
Coin version: 4.0.0a
SoQt version: 1.6.0a
OCC version: 6.7.1
from pivy.gui import soqt
view = Gui.ActiveDocument.ActiveView
viewer = view.getViewer()
viewportregion = viewer.getViewportRegion()
Version info:
OS: Ubuntu 14.04.1 LTS
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.15.3989 (Git)
Branch: master
Hash: 7318a1d443c34c29b16aa44c89b371123ffc6f9f
Python version: 2.7.6
Qt version: 4.8.6
Coin version: 4.0.0a
SoQt version: 1.6.0a
OCC version: 6.7.1
Re: pivy SoRayPickAction
same error with daily build in ubuntu. after getting the viewport and moving the mouse freecad crashes.