Potpourri 3d functions in python3 Grasshopper Rhino8

potpourri3d.gh (55.4 KB)

Testing some functions from potpourri3d library to python3 Component in grasshopper, needs work and thanks to Nick sharp’s repo and openai, any comments and additions are welcome, i want to take a deeper look at the distance heat method, Install potpourri from PyPi using the python.exe used by the python3 interpreter in rhino8 .


That’s neat, thanks for sharing!

Any reason you did not want to use the RhinoCode requirements mechanism for installing Python packages? Just adding # r: potpourri3d as the first line of your scripts seems to install all required dependencies for me. More info here: Rhino - Using Python Packages

In any case, I would refrain from doing this manual installation step, you might end up messing up other users’ Python environments:

def _ensure_pp3d() -> None:
    try:
        globals()["pp3d"] = __import__("potpourri3d")
    except ImportError:
        subprocess.check_call(
            [sys.executable, "-m", "pip", "install", "--quiet", "potpourri3d>=0.2.0"]
        )
        globals()["pp3d"] = __import__("potpourri3d")

Have you tried the Lion Fish Grasshopper plugin? It is based on the same C++ library (https://geometry-central.net/) that potpourri3d itself is based on. You might be trying to do something not available in Lion Fish, I haven’t looked into it enough.