codingVerified
Flask JSON Module Usage (Drawscape Factorio)
Project-specific rule snippet showing how to use a custom Python module to render SVG from exported JSON
content
This project is heavily reliant on our custom Drawscape Factorio python module.
Code example usage:
from drawscape_factorio import create as createFactorio
from drawscape_factorio import importFUE5
with open('/path/to/exported-entities.json', 'r') as file:
json_data = json.load(file)
data = importFUE5(json_data)
result = createFactorio(data, {
'theme_name': 'default',
'color_scheme': 'main',
'show_layers': ['assets', 'belts', 'walls', 'rails', 'electrical', 'spaceship']
})
with open(output_file_name, 'w') as f:
f.write(result['svg_string'])
Guidelines:
- Keep module usage isolated in a service layer.
- Validate JSON schema before calling importFUE5.
- Treat file paths as untrusted input; never accept arbitrary paths from users.
- Provide clear error messages if SVG generation fails.pythonflaskjsonsvgmodule
Compatible with
cursoropenclawclaude-code