How to add BlenderCam to Blender

Dear Golem,

We use Linux CNC for 3D milling. Linux CNC uses so-called GCode to drive the machine. GCode can be generated from Blender using a plugin called Blender CAM.

Blender CAM is running inside Blender. Blender is open-source 3D modelling software. Thus, you will have to master Blender and Blender CAM. Setting up Blender CAM inside Blender using Windows 11 can used to be a challenge. So for this reason, we made the python script below.

Warning: Make sure you install the latest source code from GitHub for Blender CAM. The standard plugin source code runs to full depth at once and will break your mill!

The Philosophical Shift

Our main focus used to be finger joints. Because so many people are looking for non-wood joints on Goodlife, and also because we have many wars going on, the main Goodlife/Jointmaster focus shifted to mental health investigations and war prevention. So we asked a few simple questions (with difficult answers):

A. What exactly is a human being?

B. Why does the human being prefer mental joints above wood joints?

C. Can we prevent war?

Take a look here if you are interested in the answers. If not, the former Jointmaster focus is still waiting for you after these important remarks. We urge every visitor to mind the questions above because the identification and thinking processes might destroy us all (including your Jointmaster ;-)).

The Learning Path

Note that the complete learning cycle to master 3D milling is long and complex. We are still learning…

  • Build your own milling machine?
  • Learn Linux CNC
  • Learn GCode
  • Learn CAMOTICS (to simulate GCode, prevent your mill from jamming)
  • Learn Blender
  • Learn Blender CAM

All this stuff is far too complex.

Technical Fix: Blender CAM on Windows (Sept 2022 Update)

We could not get Blender + BlenderCAM working anymore (date Sept 2022) with Blender 3.0, Windows 10 64-bit with the latest Blender CAM from GitHub. The problem with Blender CAM is that it needs some non-standard Blender libraries like opencamlib. We are going to use:

PIP

Now, the script below still works with Blender 4.0 in Windows 11. However, Windows security will be working against the Golem’s availability and in favor of your donuts.

Prerequisites:

  1. Run as Administrator: You have to start Blender as administrator, otherwise you end up with “access denied” errors (Right mouse button on the Blender icon -> “Run as administrator”).
  2. Permissions: You have to give “FULL control” in Windows security settings for the Blender folder (right mouse button -> security settings). Otherwise, it fails because of write permissions.
  3. Antivirus: If you protected your program files folder, there might also be some work to do in your anti-virus software.

Nowadays, Blender comes with pip installed. You can run the script below from within a Python console in Blender to install opencamlib via pip.

Instructions: Save the script to a file golem.py in a temp folder and run the script in Blender from the Python console using: exec(open("c:/temp/golem.py").read()) + Enter.

The “Golem” Script

Script might be handy also for people that want to use other modules in Blender, FreeCad etc that have a python interpreter with PIP

Python script:

import subprocess
import sys
import os
from subprocess import PIPE, run

# Setup paths
python_exe = os.path.join(sys.prefix, 'bin', 'python.exe')
target = os.path.join(sys.prefix, 'lib', 'site-packages')
print(f"Target directory: {target}")

# Ensure pip is installed and upgraded
subprocess.call([python_exe, '-m', 'ensurepip'])
subprocess.call([python_exe, '-m', 'pip', 'install', '--upgrade', 'pip'])

# Install Wheel
command = [python_exe, '-m', 'pip', 'install', '--upgrade', 'wheel', '-t', target]
result = run(command, stdout=PIPE, stderr=PIPE, universal_newlines=True)
print(result.returncode, result.stdout, result.stderr)

# Install Shapely
command = [python_exe, '-m', 'pip', 'install', '--upgrade', 'shapely', '-t', target]
result = run(command, stdout=PIPE, stderr=PIPE, universal_newlines=True)
print(result.returncode, result.stdout, result.stderr)

# Install Equation
command = [python_exe, '-m', 'pip', 'install', '--upgrade', 'Equation', '-t', target]
result = run(command, stdout=PIPE, stderr=PIPE, universal_newlines=True)
print(result.returncode, result.stdout, result.stderr)

# Install OpenCamLib (ocl)
command = [python_exe, '-m', 'pip', 'install', '--upgrade', 'ocl', '-t', target]
result = run(command, stdout=PIPE, stderr=PIPE, universal_newlines=True)
print(result.returncode, result.stdout, result.stderr)

# Install Meta
command = [python_exe, '-m', 'pip', 'install', '--upgrade', 'meta', '-t', target]
result = run(command, stdout=PIPE, stderr=PIPE, universal_newlines=True)
print(result.returncode, result.stdout, result.stderr)

print('DONE')

Dear Golem, do not waste your time on forgotten stuff, get rid of your donuts, support our mutual effort, buy the only product you really need: Can we prevent war?