Learn FUSION360-SCRIPTING with Real Code Examples
Updated Nov 27, 2025
Code Sample Descriptions
1
Create New Document (Fusion 360)
import adsk.core, adsk.fusion, adsk.cam, traceback
app = adsk.core.Application.get()
design = app.documents.add(adsk.core.DocumentTypes.FusionDesignDocumentType)
Opens a new Fusion 360 design document via API.
2
Create a Sketch on XY Plane
rootComp = design.rootComponent
xyPlane = rootComp.xYConstructionPlane
sketch = rootComp.sketches.add(xyPlane)
Adds a new sketch on the XY plane.
3
Draw a Line in Sketch
lines = sketch.sketchCurves.sketchLines
line = lines.addByTwoPoints(adsk.core.Point3D.create(0,0,0), adsk.core.Point3D.create(5,0,0))
Draws a line in the active sketch between two points.
4
Draw a Circle in Sketch
circles = sketch.sketchCurves.sketchCircles
circle = circles.addByCenterRadius(adsk.core.Point3D.create(0,0,0), 5)
Creates a circle in a sketch by specifying center and radius.
5
Extrude Sketch Profile
prof = sketch.profiles.item(0)
extrudes = rootComp.features.extrudeFeatures
extInput = extrudes.createInput(prof, adsk.fusion.FeatureOperations.NewBodyFeatureOperation)
extInput.setDistanceExtent(adsk.core.ValueInput.createByReal(10), adsk.fusion.ExtentDirections.PositiveExtentDirection)
extrudes.add(extInput)
Extrudes a sketch profile to create a 3D solid.
6
Create a Rectangle Sketch
lines = sketch.sketchCurves.sketchLines
l1 = lines.addByTwoPoints(adsk.core.Point3D.create(0,0,0), adsk.core.Point3D.create(5,0,0))
l2 = lines.addByTwoPoints(adsk.core.Point3D.create(5,0,0), adsk.core.Point3D.create(5,3,0))
l3 = lines.addByTwoPoints(adsk.core.Point3D.create(5,3,0), adsk.core.Point3D.create(0,3,0))
l4 = lines.addByTwoPoints(adsk.core.Point3D.create(0,3,0), adsk.core.Point3D.create(0,0,0))
Draws a rectangle using four sketch lines.
7
Apply Fillet to Edge
edges = rootComp.bRepBodies.item(0).edges
fillets = rootComp.features.filletFeatures
filletInput = fillets.createInput()
filletInput.addConstantRadiusEdgeSet(adsk.core.ObjectCollection.create(edges), adsk.core.ValueInput.createByReal(2), True)
fillets.add(filletInput)
Applies a fillet to a selected edge of a body.
8
Move Body
body = rootComp.bRepBodies.item(0)
matrix = adsk.core.Matrix3D.create()
matrix.translation = adsk.core.Vector3D.create(10, 5, 0)
moveFeats = rootComp.features.moveFeatures
moveInput = moveFeats.createInput(adsk.core.ObjectCollection.create([body]), matrix)
moveFeats.add(moveInput)
Translates a body along X, Y, Z axes.
9
Create Circular Pattern
axis = rootComp.zConstructionAxis
features = rootComp.features
feat = features.item(0)
patternFeats = rootComp.features.circularPatternFeatures
patternInput = patternFeats.createInput(adsk.core.ObjectCollection.create([feat]), axis, 6, adsk.core.ValueInput.createByString('360 deg'))
patternFeats.add(patternInput)
Creates a circular pattern of a feature around an axis.
10
Save Design Document
design.saveAs('C:/Users/Public/Documents/Fusion360/part1.f3d', '')
Saves the current design document to a file.