Update:
I think I figured it out.
Code: Select all
plane=coin.SbPlane(coin.SbVec3f(0,0,1), 30.0)
planeproj=coin.SbPlaneProjector(plane)
vpr=Gui.ActiveDocument.ActiveView.getViewer().getSoRenderManager().getViewportRegion()
matrix=coin.SoGetMatrixAction(vpr)
matrix.apply(Gui.ActiveDocument.ActiveView.getSceneGraph())
planeproj.setWorkingSpace(matrix.getMatrix())
fRatio=vpr.getViewportAspectRatio()
sp=vpr.getViewportSizePixels()
vvolume=Gui.ActiveDocument.ActiveView.getViewer().getSoRenderManager().getCamera().getViewVolume(fRatio)
c=Gui.ActiveDocument.ActiveView.getCursorPos()
currentpos=(vpr.getViewportSize().getValue()[0]*c[0]/sp.getValue()[0], vpr.getViewportSize().getValue()[1]*c[1]/sp.getValue()[1])
planeproj.setViewVolume(vvolume)
p=planeproj.project(coin.SbVec2f(currentpos))
print(p.getValue())