Skip to content

cscullen/fusion360_token_generator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 

Repository files navigation

Batch Tokens – Quick Start (Fusion 360)

Generate multi-part 3MF token files from SVG icons. Works with circles and rounded-square tokens, supports rings/dots, mirrored verso art, per-icon manual scaling, and one-object/multi-part 3MF export for color assignment in slicers.

Features

Batch-create tokens from a simple config list

Circular tokens with optional ring and evenly-spaced dots (topmost at 12 o’clock)

Rounded-square tokens (no rings/dots)

Per-side SVGs (recto/verso), with automatic horizontal mirror on the verso

Robust centering & scaling; optional manual scale per icon

Exports single object with multiple parts as 3MF (ideal for multi-color slicing)

Units forced to millimeters

Folder Layout

Place these two files in the same folder:

Batch Tokens.py — main script

batch_tokens_config.py — settings and token list

Prepare two folders on disk:

SVG folder: contains your SVG icons (e.g., C:\Path\To\Icons)

Export folder: where 3MF files are written (e.g., C:\Path\To\Output)

Use raw strings for Windows paths with spaces:

SVG_FOLDER = r"C:\Path\To\Icons" EXPORT_FOLDER = r"C:\Path\To\Output"

Install & Run

Open Fusion 360.

Go to UTILITIES → Add-Ins → Scripts and Add-Ins….

In Scripts tab, select My Scripts, then click + (Add).

Select the folder containing Batch Tokens.py and batch_tokens_config.py.

Select Batch Tokens → Run.

The script reloads batch_tokens_config.py on every run.

Configure batch_tokens_config.py

Required fields (all units millimeters unless noted):

TOKENS accepts either shape:

(diameter_mm, circle_count, top_svg, bottom_svg_or_None)

(shape, diameter_mm, circle_count, top_svg, bottom_svg_or_None)

where shape is "circle" or "square" ("cirle" is accepted as "circle").

TOKENS = [ # Examples: (25, 3, "icon_top.svg", "icon_bottom.svg"), # circle token ("square", 16, 0, "icon_square.svg", "icon_square.svg") # rounded-square token ]

SVG_FOLDER = r"C:\Path\To\Icons" EXPORT_FOLDER = r"C:\Path\To\Output"

TOKEN_THICKNESS_MM = 3.0 CHAMFER_MM = 0.75

RING_OFFSET_MM = 2.0 RING_WIDTH_MM = 1.0 RING_DEPTH_MM = 0.3

RING_DOT_DIAMETER_MM = 2.0

ICON_DEPTH_MM = 0.6 ICON_MARGIN_MM = 0.5 ICON_SCALE = 0.75

Manual Per-Icon Scaling (Optional)

Override auto-scaling for specific SVGs (basename match, case-insensitive):

ICON_MANUAL_SCALES = [ {"file": "icon_octopus.svg", "scale": 0.12}, {"file": "icon_logo.svg", "scale": 0.10}, ]

scale is a uniform multiplier applied after centering.

Omit an icon to use auto-scale.

Token Row Behavior Circle tokens

Token is a circle of diameter_mm.

If a side has an SVG filename, that side also gets a ring. If circle_count > 0, small dots are evenly patterned on the ring (first dot at 12 o’clock).

Top artwork extrudes down from the top face.

Bottom artwork extrudes up from the bottom face and is horizontally mirrored so it reads correctly when the token is flipped.

Square tokens

Token is a rounded-corner square with side length diameter_mm.

No ring or dots for square tokens.

SVGs are centered/scaled the same way and extruded on both faces.

If a side’s SVG is None (or missing), that side is left blank.

SVG Preparation Tips

Prefer vector paths only. Convert strokes to outlines; convert text to curves if possible. The script also attempts to explode sketch text automatically.

Avoid embedded rasters/bitmaps.

Large built-in transforms are handled, but simpler files import more predictably.

Outputs

One .3mf per token in EXPORT_FOLDER.

Each 3MF is a single object with multiple parts:

aaaToken — base token body

bbRingTop / bbRingBottom — rings (when present)

Icon bodies named from the SVG, prefixed with cc (e.g., ccIconName, ccIconName2, …)

Units are forced to millimeters. A 25 mm token exports as 25 mm in your slicer.

Disable Export for Quick Tests

Open Batch Tokens.py, find the export block near the end (the lines that build out_path and call _export_any_3mf) and comment it out. Re-enable for final runs.

Troubleshooting

“Bodies collected: 0” or nothing exports

No meshable bodies were created (often the SVG produced no closed profiles).

Ensure SVG paths are closed; convert strokes to outlines.

Convert text to curves (or let the script explode text).

Test with a simple icon to validate the pipeline.

Size appears wrong in slicer

Confirm you opened the script-generated 3MF; export is forced to mm.

Bottom artwork mirrored the wrong way

The script mirrors across the YZ plane (horizontal flip). If a specific file looks wrong, confirm the SVG isn’t pre-flipped or using unusual nested transforms.

Paths with spaces

Use raw strings r"..." in the config and verify the folders exist.

Config changes not applying

The script re-reads batch_tokens_config.py on each run. Ensure you’re editing the config in the exact folder Fusion is running from (the same folder you added in Scripts and Add-Ins).

Minimal Example Config TOKENS = [ (25, 3, "icon_top.svg", "icon_bottom.svg"), # circle w/ ring + dots on both sides ("square", 16, 0, "icon_sq.svg", "icon_sq.svg"), # rounded square, no ring/dots (20, 0, "icon_simple.svg", None), # circle, top only ]

SVG_FOLDER = r"C:\Path\To\Icons" EXPORT_FOLDER = r"C:\Path\To\Output"

TOKEN_THICKNESS_MM = 3.0 CHAMFER_MM = 0.75 RING_OFFSET_MM = 2.0 RING_WIDTH_MM = 1.0 RING_DEPTH_MM = 0.3 RING_DOT_DIAMETER_MM = 2.0

ICON_DEPTH_MM = 0.6 ICON_MARGIN_MM = 0.5 ICON_SCALE = 0.75

ICON_MANUAL_SCALES = [ {"file": "icon_octopus.svg", "scale": 0.12}, ]

Naming Conventions

Base token: aaaToken

Rings: bbRingTop, bbRingBottom

Icons: cc (multiple parts suffixed 2, 3, …)

These stable names make it easy to assign colors or processes consistently across exported tokens in your slicer.

About

Generate simple tokens in fusion 360 from an input svg

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published