Learn FACTORYIO-MACROS with Real Code Examples
Updated Nov 27, 2025
Architecture
Macro engine running inside Factory I/O runtime
Reads/writes to the simulation tag system
Executes in simulation cycles
Tight integration with physics and scene events
Lightweight interpreter for logic blocks
Rendering Model
User defines macros -> Scene loads macros -> Runtime executes in simulation cycles
Tags update with physics values
Logic triggers visual/physical behavior
External PLC (optional) overrides macros
Everything syncs through tag updates
Architectural Patterns
State machine macros
Event-driven logic loops
Timer-based sequences
Tag-based inter-machine communication
Hybrid macro + PLC design
Real World Architectures
Training systems for students
Prototype assembly lines using only macros
Macroscopy-based machine behavior demos
Hybrid PLC + Macro control for testing
Virtual commissioning with external drivers
Design Principles
Keep logic simple
Use clean event-based structure
Leverage tags for communication
Replicate realistic machine behavior
Align with real automation patterns when possible
Scalability Guide
Keep macro count low
Use global tags for shared logic
Avoid heavy calculations per frame
Split scenes into logical segments
Upgrade to PLC logic when complexity grows
Migration Guide
Convert simple macros -> PLC logic if integrating real hardware
Map macro states to PLC tags
Replace macro timers with PLC TON/TOF
Recreate logic in ladder/structured text
Replace behavior blocks with PLC routines