Blender Grasshopper live link test

Поділитися
Вставка
  • Опубліковано 16 жов 2024

КОМЕНТАРІ • 3

  • @TimmyMian
    @TimmyMian Рік тому +1

    Hey i would love to know how you did this

    • @seanzhang3873
      @seanzhang3873  Рік тому +2

      Hi! The process is actually quite straightforward. On the Grasshopper side, I've written a C# script that exports the geometry as an .fbx file to a specific directory every time the geometry gets updated (You can use other plugins that exports the geometry as well). Additionally, I export a text file that sends commands, indicating when Blender should start or stop fetching the geometry.
      Moving on to Blender, I've developed a Python script containing a 'while' loop that continuously checks for changes (I used a python library call 'watchdog', but you can use other methods) in both the .fbx file and the command.txt file. If the command is "run" and the .fbx file has been updated, the script imports the geometry into Blender, replacing the previous mesh if it exists. Otherwise, the script waits for a few milliseconds before attempting again, continuing this cycle until the command is "stop".
      Please note that the Blender script must implement either asynchronous functions or utilize multi-threading. Failing to do this would mean the 'while' loop blocks the main thread, causing Blender to become unresponsive indefinitely.

    • @seanzhang3873
      @seanzhang3873  Рік тому +1

      Additionally, it's worth noting that my script sometimes causes Blender to crash without warning if the Grasshopper geometry changes too rapidly. I suspect this could be due to the Grasshopper side not having completely written the .fbx file, while Blender is simultaneously trying to read it, leading to these crashes. Implementing a longer wait time within each loop can alleviate this issue, but it also introduces lag.
      Unfortunately, I haven't yet found a solution to this problem. If you happen to come across a successful fix, I'd greatly appreciate it if you could share it. Thank you!