The 3dm importer depends on the rhino3dm package that has to be installed as well. In order to get the add-on working:
- Install the 3dm importer add-on.
The first step can be accomplished by running the following script. Open Blender, switch to the Scripting workspace, copy and paste the script into the text editor and execute it. Make sure to check the output on the console for any error messages (Window > Toggle System Console). If everything works properly it should print the version of the installed package.
In case your Blender installation is located in
C:\Program Files\ you will have to start Blender as administrator. Otherwise, it doesn't have the permission to install the package.
# The import failed, therefore we check ensure that pip is available and attempt to install the package.
# ensurepip.bootstrap() also calls pip, which adds the environment variable PIP_REQ_TRACKER. After
# ensurepip.bootstrap() finishes execution, the directory doesn't exist anymore. However, when subprocess
# is used to call pip, in order to install a package, the environment variables still contain
# PIP_REQ_TRACKER with the now nonexistent path. This is a problem since pip checks if PIP_REQ_TRACKER is
# set and if it is, attempts to use it as temp directory. This would result in an error because the
# directory couldn't be found. Therefore, PIP_REQ_TRACKER needs to be removed from os.environ.
# Try to install the package. This may fail with subprocess.CalledProcessError
subprocess.run([bpy.app.binary_path_python, "-m", "pip", "install", "rhino3dm"], check=True)
Next download and install the most recent release of add-on. With the required dependency installed it should activate without any issues.
Important: In case you intend to use the code above in an add-on, it's common courtesy to not connect to the internet or install packages without the explicit consent of the user.