Skip to content

Instantly share code, notes, and snippets.

@StoneLabs
Last active May 18, 2026 10:36
Show Gist options
  • Select an option

  • Save StoneLabs/9f50215475f30440de5c15ebcc1900d9 to your computer and use it in GitHub Desktop.

Select an option

Save StoneLabs/9f50215475f30440de5c15ebcc1900d9 to your computer and use it in GitHub Desktop.
Factorio Circle Blueprint Generator
print("Please make sure py_factorio_blueprints is installed (pip install)")
print("Please make sure https://github.com/tzwaan/python-factorio-blueprints is cloned in this directory")
from py_factorio_blueprints.blueprint import Blueprint
print("\nEnter radius: ", end="")
radius = int(input())
print("Enter Thickness: ", end="")
thickness = int(input())
print("\nGenerating Circle...")
blueprint = Blueprint()
Blueprint.import_prototype_data('./python-factorio-blueprints/py_factorio_blueprints/entity_data.json')
# Generate Circle
import numpy
diameter = 2*radius + 2*thickness + 1
xx, yy = numpy.mgrid[:diameter, :diameter]
circle = (xx - radius - thickness) ** 2 + (yy - radius - thickness) ** 2
print(circle)
donut = (circle < (radius + thickness)**2) & (circle > (radius-0.5)**2)
print(donut.shape)
# Make Blueprint
print("\nGenerating Blueprint...", end="\r")
total = diameter * diameter
current = 0
percent = -1
for pos,val in numpy.ndenumerate(donut):
current = current + 1
if round((current / total * 100)) != percent:
percent = round((current / total * 100))
print("Generating Blueprint... " + str(percent) + "%", end="\r", flush=True)
if val == True:
blueprint.entities.make(name="stone-wall", position=pos)
print("\n")
print(blueprint.to_string())
print("\nCopying to Clipboard...")
import pyperclip
pyperclip.copy(blueprint.to_string())
@StoneLabs

Copy link
Copy Markdown
Author

Demo output for radius 200, tickness 3:
image

@richard-hajek

richard-hajek commented May 18, 2026

Copy link
Copy Markdown

I made a version that you can just directly uv run circle.py, no need to manually pip install anything or clone anything

https://gist.github.com/richard-hajek/f1a53566c27a11d8b7a09dea4546f302

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment