Week 07 – Computer Controlled Machining
Han Ferik
Weekly Assignments:
Check Out Our Group Assignment
Group assignment:
Complete your lab’s safety training
Test runout, alignment, fixturing, speeds, feeds, materials and toolpaths for your machine
Document your work to the group work page and reflect on your individual page what you learned
Individual assignment:
- Make (design+mill+assemble) something big
This Week’s Idea
For this week I wanted to do something that I did when I was at 11th grade at AP Calculus AB class. So, we were studying over volume calculations of functions in calculus with integral. And, for that we did an activity over cross sections, which is shown in the image.

And using this idea, I wanted to do a full revolve of a function as an object. So, it would be a reflection of the shape on the image. And, I wanted to build it a stand and add up some lights to hopefully make it as a trophyish object like sort of a statue that would look as an art.
In order to do this, I will be creating a script to create the designs, so that it would be both parametric and since its a loopish thing, it would be quite easier to work with code.
I also thought that this final shape might be used both as an art in our school, which will be from Fab Lab, and also an element to teach revolving in calculus to newcoming AP Calculus AB students.
Credits: I also found out that this project is quite alike to Nadieh’s, so I would also love to make a quick shout out to her week 7
Building the Revolving Function
1. Creating the Script
For the script I will use PyCharm.
Download and Open PyCharm.
Click New Project

Select Pure Python

Choose a folder
Click Create
Now create a new Python file.

Installing the Required Libraries:
Open the Terminal inside PyCharm and install:
pip install numpy ezdxf

Initial Script
Now create a script like the one given below:
import numpy as np
import ezdxf
import os
# output folder
os.makedirs("cnc_slices", exist_ok=True)
# function defining radius
def f(x):
return 80 + 20*np.sin(x)
# slice positions
x_values = np.linspace(0, 8, 40)
# hole parameters
hole_distance = 40
hole_radius = 4
for i, x in enumerate(x_values):
radius = f(x)
doc = ezdxf.new()
msp = doc.modelspace()
# outer circle
msp.add_circle((0,0), radius)
# alignment holes
msp.add_circle((-hole_distance,0), hole_radius)
msp.add_circle((hole_distance,0), hole_radius)
filename = f"cnc_slices/slice_{i}.dxf"
doc.saveas(filename)
print("DXF slices generated.")
This Script Produces cnc_slices
cnc_slices/
slice_0.dxf
slice_1.dxf
slice_2.dxf
...
slice_39.dxf
Each file contains:
- outer contour
- alignment holes
Ready for CNC toolpaths.
So, run the Script in PyCharm
And, this will create a new folder containing the slices inside your orginal python project folder.
Like this:

2. Import into CAM
Open your CAM software (examples):
Fusion 360
VCarve
Aspire
I will use Fusion.
Step 1 — Open Fusion 360
Launch Fusion 360
Create a New Design
Step 2 — Create a Sketch
DXF files are imported inside a sketch.
Click Create Sketch
Select the Top Plane (XY plane)
You will now enter sketch mode.
Step 3 — Insert the DXF File
Inside the sketch:
Insert → Insert DXF

Then:
- Click the folder icon

Click “Select from my computer”
Navigate to your file
Example:
slice_0.dxf

Select it
You can use the following settings below

- Click OK
You will now see the circle and alignment holes appear in the sketch.

Step 4 — Check the Scale (Important)
Sometimes DXF units import incorrectly.
Use the dimension tool:
Sketch → Sketch Dimension
Click the outer circle and verify the radius.

If it looks too small or too large:
Modify → Sketch Scale

Adjust until correct.
Step 5 — Finish the Sketch
Click Finish Sketch
Now your slice geometry exists in the design.
Step 6 — Extrude the Slice (Optional but Helpful)
For visualization you can extrude it.
Solid → Extrude
Select the outer profile.
Example thickness:
8 mm
This represents your wood thickness.

Also I thought I could open all of the slices all at one, but I figured that I couldn’t. So, I changed the script to produce all slices as one slicing sheet.
This script creates all slices, places them on a rectangular sheet (plywood layout), keeps spacing between parts, and saves one DXF. Therefore, nstead of this: slice_0.dxf, slice_1.dxf slice_2.dxf … We will get: cnc_sheet.dxf.
New Python Script To Get a Slice Sheet (Automatic Nesting)
Replace your previous script with this:
import numpy as np
import ezdxf
# function defining slice radius
def f(x):
return 80 + 20*np.sin(x)
# number of slices
num_slices = 40
x_values = np.linspace(0, 8, num_slices)
# sheet layout parameters
spacing = 220 # space between parts
columns = 6 # parts per row
# alignment holes
hole_distance = 40
hole_radius = 4
doc = ezdxf.new()
msp = doc.modelspace()
for i, x in enumerate(x_values):
radius = f(x)
# calculate grid position
col = i % columns
row = i // columns
offset_x = col * spacing
offset_y = row * spacing
# outer contour
msp.add_circle((offset_x, offset_y), radius)
# alignment holes
msp.add_circle((offset_x - hole_distance, offset_y), hole_radius)
msp.add_circle((offset_x + hole_distance, offset_y), hole_radius)
# save file
doc.saveas("nested_slices_sheet.dxf")
print("Nested DXF sheet generated!")
Now run it. You will have a dxf file called nested_slices_sheet again in your project directory.
Apply the same steps until Step 5.
And you will have something like this as a final sketch product.

Also for Step 4, in order to scale. Select all parts of the circles for the entities and center of the circle for the point.

But rather than that, I selected mm through the insert dxf part that appears after you insert your dfx.

After extruding, this will how it will look like.

Later, I realized that I couldn’t actually insert a stick inside this in order to combine and assamble all these together. So, I changed my script in order to create a spine for the whole slices, and I also changed the holes inside the circles into a single rectangle that would fit to the spine. So, here is how that worked out with its script. Again, apply the same steps as before.
Final Python Script (Slice Sheet With Spine)
import numpy as np
import ezdxf
# ---------- PARAMETERS ----------
num_slices = 40
min_radius = 100
max_radius = 150
slot_width = 20
slot_height = 60
columns = 6
spacing = 350
spine_width = slot_width
spine_length = num_slices * 40
# calculus function
def f(x):
return min_radius + (max_radius-min_radius)*(0.5+0.5*np.sin(x))
x_values = np.linspace(0, 8, num_slices)
# ---------- DXF ----------
doc = ezdxf.new()
msp = doc.modelspace()
# ----- CREATE SLICES -----
for i, x in enumerate(x_values):
radius = f(x)
col = i % columns
row = i // columns
offset_x = col * spacing
offset_y = row * spacing
# outer circle
msp.add_circle((offset_x, offset_y), radius)
# slot rectangle
x1 = offset_x - slot_width/2
x2 = offset_x + slot_width/2
y1 = offset_y - slot_height/2
y2 = offset_y + slot_height/2
msp.add_lwpolyline([
(x1,y1),
(x2,y1),
(x2,y2),
(x1,y2),
(x1,y1)
])
# ----- CREATE SPINE -----
spine_y = (row + 2) * spacing
msp.add_lwpolyline([
(0,spine_y),
(spine_length,spine_y),
(spine_length,spine_y+spine_width),
(0,spine_y+spine_width),
(0,spine_y)
])
# slice slots on spine
slot_spacing = spine_length / num_slices
for i in range(num_slices):
x = i * slot_spacing
msp.add_lwpolyline([
(x, spine_y),
(x+slot_width, spine_y),
(x+slot_width, spine_y+slot_height),
(x, spine_y+slot_height),
(x, spine_y)
])
doc.saveas("parametric_slice_sculpture.dxf")
print("DXF generated")

You can also try out on Appearance to check how it would look like by selecting the material you would like to use.
Here is with cherry wood.

3. Milling Process
Coming Out Soon