Announcement

Collapse
No announcement yet.

Rhino 6 Plugin+ Vray 5 - check for render finished

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Rhino 6 Plugin+ Vray 5 - check for render finished

    Hi, I am trying to migrate my rhino plugin from 3.x to vray 5. I have been using VRayForRhinoNETInterface > HasRenderFinished() to check for render ended then do some post action.
    Just wondering what is the equivalent of that in version 5 since VRayForRhinoNETInterface is not included anymore?
    Thanks.

  • #2
    Hello, sto_sto ,
    Please check https://docs.chaosgroup.com/display/...tAccess-Render
    Calling vray.Render() with a timeout value of -1 makes the call synchronous when executed.

    Kind regards,
    Peter
    Peter Chaushev
    V-Ray for SketchUp | V-Ray for Rhino | Product Specialist
    www.chaos.com

    Comment


    • #3
      Great thanks Peter. Exactly what I needed.

      Comment


      • #4
        I see your McNeel forum thread is no longer available, so allow me to reply here to your question how to close the VFB programatically in case anyone else find this useful.

        This can be achieved in C++, using:
        Code:
        HWND hwnd = FindWindow("V-Ray Frame Buffer")
        SendMessage(hwnd, WM_CLOSE, 0, 0)
        Scripting a solution in Python should look like this:
        Code:
        import ctypes
        from ctypes import wintypes
        
        WNDENUMPROC = ctypes.WINFUNCTYPE(wintypes.BOOL,
                                        wintypes.HWND,
                                        wintypes.LPARAM)
        
        cpid = ctypes.windll.kernel32.GetCurrentProcessId()
        lppid = ctypes.c_ulong()
        
        def worker(hwnd, lParam):
            length = ctypes.windll.user32.GetWindowTextLengthW(hwnd) + 1
            buffer = ctypes.create_unicode_buffer(length)
            ctypes.windll.user32.GetWindowTextW(hwnd, buffer, length)
            title = repr(buffer.value)
            if title.startswith("'V-Ray Frame Buffer'"):
                ctypes.windll.user32.GetWindowThreadProcessId(hwnd , ctypes.byref(lppid))
                if lppid.value == cpid:
                    ctypes.windll.user32.SendMessageA(hwnd, 0x0010, 0, 0)
                    return False
            return True
        
        cb_worker = WNDENUMPROC(worker)
        ctypes.windll.user32.EnumWindows(cb_worker, 0)
        Kind regards,
        Peter
        Peter Chaushev
        V-Ray for SketchUp | V-Ray for Rhino | Product Specialist
        www.chaos.com

        Comment

        Working...
        X