Skip to main content

Drawscape Factorio

Project description

image

Drawing a Factorio Base with a Pen Plotter

CLI written in Python to create SVG images from Factorio base data that you can then draw on a pen plotter.

Demos

Installation

pip3 install drawscape-factorio
  • Requires python 3.8+
  • I'm using with python 3.12 in development and production

CLI Usage

drawscape-factorio create --json exported-entities.json

Additional Params

--theme [default]
--color [main, black, blueprint, matrix, easter]
--debug-grid (helpful for theme development)

Code Usage

Include the modules

from drawscape_factorio import create as createFactorio
from drawscape_factorio import importFUE5

You are responsible for parsing the input file and then saving the output as an SVG file.

# Load the JSON file coming from the FUE5 MOD
with open('/path/to/exported-entities.json, 'r') as file:
    json_data = json.load(file)

# Parse the JSON data
data = importFUE5(json_data)

# Call the create function with the parsed data and settings
result = create(data, {
    'theme_name': 'default',
    'color_scheme': 'main',
    'show_layers': ['assets', 'belts', 'walls', 'rails', 'electrical', 'spaceship']
})

# Save the SVG file
with open(output_file_name, 'w') as f:
    f.write(result['svg_string'])

Exporting Map Data (exported-entities.json)

Currently using a Factorio MOD called FUE5-Exporter to export all entites on a map in JSON format.

https://github.com/FUE5BASE/FUE5-Exporter

  1. Install the MOD via the Factorio GUI. Search for FUE5
  2. Use MOD to "select" area of the map you want to export. Try to "frame" your seletion to only export the area you want to render.
  3. Find the exported-entities.json file inside your Factorio Application Data:
  • Mac (~/Library/Application Support/factorio/script-output)
  • Windows (%APPDATA%/Factorio/script-output)
  1. Copy/Paste they JSON file somewhere else so you can work with it. It will get overwritten if you leave it there.

Themes

The drawscape-factorio CLI supports different themes for rendering the Factorio base. Each theme is a Python class that extends the ParentTheme class. The ParentTheme class provides the basic structure and functionality for rendering the base, while the child themes (e.g., DefaultTheme) define the specific colors and styles for each entity in the base.

A child theme can extend and of the render_ function to create new shapes and designs.

Theme Requirements:

  • Must define a THEME_NAME, THEME_SLUG, and THEME_VERSION
  • Must define a COLOR_SCHEMES dictionary with a 'main' key

Easiest way to get started it to clone the default_theme.py and start making your edits.

Examples

IMG_6588 IMG_6620
IMG_6635 IMG_6576
IMG_6635 IMG_6635

Development

conda env update --file environment.yml --prune  
conda activate drawscape_factorio

Install for live local dev

pip3 install -e .

Distribution Cheat Sheet

PyPi API saved in ~/.pypirc for auto-authentication

python setup.py clean --all
rm -rf dist/*
python setup.py sdist bdist_wheel
twine upload dist/*

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

drawscape_factorio-0.15.13.tar.gz (14.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

drawscape_factorio-0.15.13-py3-none-any.whl (15.6 kB view details)

Uploaded Python 3

File details

Details for the file drawscape_factorio-0.15.13.tar.gz.

File metadata

  • Download URL: drawscape_factorio-0.15.13.tar.gz
  • Upload date:
  • Size: 14.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.5

File hashes

Hashes for drawscape_factorio-0.15.13.tar.gz
Algorithm Hash digest
SHA256 e886f949822bc87c803987c3698ec574dbaddc86d8086c47d1d922ad9d176207
MD5 125d6cd4eac039877821793f7fc14971
BLAKE2b-256 5c26fdec3b33ebb959b9fd8b9e3d9ddec3ca2ca7bf3debc548c00c63dc919c77

See more details on using hashes here.

File details

Details for the file drawscape_factorio-0.15.13-py3-none-any.whl.

File metadata

File hashes

Hashes for drawscape_factorio-0.15.13-py3-none-any.whl
Algorithm Hash digest
SHA256 bdce0de099e800b56065cd04631d0aac02db22933c5f7174721bb22723f12e82
MD5 9d7f13103f6d47c5717dc369e28e2258
BLAKE2b-256 c9c398e4191d26e3c895be883c8ec2e2a005aab93c71bfaed0f7ae61d648d0cf

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page