Back to Blog

How To Create A Sketch From Equation Using Code and API

Oct 08, 2025

How to Create an Archimedes Spiral in Fusion (Without Losing Your Mind)

TL;DR: Fusion 360 quietly removed the "Equation Curve" tool from the app store (yep, it’s gone). So I wrote a quick Python script using Fusion's API to generate an Archimedes spiral. It’s not fancy, but it works. Copy-paste the code, tweak a few values, and boom — parametric spiral in your sketch.


Code Snippet To copy

(I take zero responsibility for this code or anything that happens when you use it. Test it, tweak it, double-check it.)

# Fusion 360 Python Script: Create Archimedean Spiral
# Date: October 7, 2025
# Based on research and code examples from Ekins Solutions and the Autodesk Community.

import adsk.core, adsk.fusion, adsk.cam, traceback, math

def run(context):
    ui = None
    try:
        app = adsk.core.Application.get()
        ui  = app.userInterface

        # --- User-Defined Parameters ---
        # These are the constants 'a' and 'b' from your equation.
        # x(t) = (a + b*t)*cos(t)
        # y(t) = (a + b*t)*sin(t)

        # 'a': The starting radius of the spiral from the center.
        a = 1.0  # cm

        # 'b': Controls the distance between each turn of the spiral.
        b = 3  # cm

        # --- Spiral Settings ---
        # Total number of full 360-degree turns for the spiral.
        numTurns = 2

        # Number of points to calculate for each turn. More points create a smoother curve,
        # but can impact performance. 20-40 is a good starting range.
        pointsPerTurn = 35
       
        # --- Script Execution ---
       
        # Get the active design and root component.
        des = adsk.fusion.Design.cast(app.activeProduct)
        if not des:
            ui.messageBox('No active Fusion 360 design. Please create or open a design.')
            return
        root = des.rootComponent
       
        # Create a new sketch on the XY plane.
        sk = root.sketches.add(root.xYConstructionPlane)

        # Create an ObjectCollection to hold the 3D points for the spline.
        points = adsk.core.ObjectCollection.create()

        # Loop to calculate points along the spiral.
        # The loop iterates from 0 to the total number of points needed.
        totalPoints = pointsPerTurn * numTurns
        for i in range(totalPoints + 1):
            # 't' is the angle in radians, equivalent to theta in polar coordinates.
            # It increases with each step of the loop.
            t = (i / pointsPerTurn) * (2 * math.pi)

            # This is the polar equation for the Archimedean spiral: r = a + b*t
            r = a + (b * t)
           
            # Convert from polar (r, t) to Cartesian (x, y) coordinates.
            x = r * math.cos(t)
            y = r * math.sin(t)
           
            # Add the calculated point to our collection. Z is 0 for a 2D sketch.
            points.add(adsk.core.Point3D.create(x, y, 0))

        # Create a 'fitted spline' through the collection of points.
        sk.sketchCurves.sketchFittedSplines.add(points)
       
        ui.messageBox(f'Successfully created an Archimedean spiral with:\n a = {a}\n b = {b}\n Turns = {numTurns}')

    except:
        if ui:
            ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))



So. You woke up today and thought, "I want to model an Archimedes spiral." Respect. But you didn’t want to draw it freehand, because who does that?

You remember Fusion used to have that Equation Curve tool. It was a one-click solution. Well... it’s October 2025 and that tool? Gone. Not in the app store anymore. Poof.

I went digging, got annoyed, and then just decided to vibe code it with AI. The result: a Python script that generates a spiral sketch using real math. I'm sharing it for free on my site, but here’s the gist of how to use it:


Step-by-step: Make Your Own Script in Fusion

  1. Go to Utilities > Add-Ins > Scripts and Add-Ins

  2. Hit the little plus (+) sign > Create Script or Add-In

  3. Give it a name (I called mine Curve Creator).

  4. Right-click your new script > Edit in a code editor.

You’ll need a code editor installed. I use VS Code on both Mac and Windows.

  1. Delete the default code. Paste in the Python code I shared.

  2. Update a few values (start radius, distance between turns, number of turns, etc.).

  3. Save it.

  4. Back in Fusion, run your new script.

If everything works, you should see a message with the values you entered, and a new sketch with a spline spiral ready to go.


A Few Notes:

  • This script runs inside Fusion, so you don’t need to be a hardcore coder.

  • You can tweak the code to generate different types of curves once you get the hang of it.

  • It works on Mac and Windows (almost identical steps).

Honestly, I’m not a software dev. I’m a mechanical engineer who just wants my tools to do what they’re supposed to. But hey, we adapt. And sometimes that means duct-taping together a Python script when the easy button disappears.

Would love to hear if you try this out or riff on it. Let me know what you build!

 

Fusion 360 Sketch Tips

Get the cheatsheet and weekly tips now!

     

 

I won't send you spam. Unsubscribe at any time.