Skip to main content
CodeSpeedTest
Languages
Start TypingJump into a test — pick any languageAdaptive TrainingUnlock chars as you master themPractice DrillsFocused sessions targeting weak spotsDaily ChallengesNew coding challenges every dayRace ModeCompete against others in real timeAI OpponentRace against an AI at your WPM levelTournamentsLive coding speed tournamentsArcade GamesZType, Overkill Survival, Glyphica & moreGamificationXP, coins, badges & quests
LeaderboardGlobal rankings for every languageCertificatesEarn verifiable Bronze / Silver / Gold certsActivityDaily streaks & historical analyticsProfileYour stats, badges & achievements
Browse Languages500+ languages with real code examplesBlogTips, guides & deep divesFree ToolsWPM calculator, typing speed report & moreFAQCommon questions answeredGetting StartedNew to CodeSpeedTest?AboutOur story & missionSupportGet help — Pro users get priorityContactGet in touch with the team
Pricing
  1. Home
  2. /
  3. Learn
  4. /
  5. Factory-io-scripting

Learn Factory-io-scripting - 10 Code Examples & CST Typing Practice Test

Factory I/O scripting refers to automating, controlling, and interacting with Factory I/O simulations using C# (or Python via API). It enables programmatic control of virtual industrial environments, input/output devices, and process logic, allowing testing and validation of PLC programs without physical hardware.

View all 10 Factory-io-scripting code examples →
Factory I/O Toggle Sensor OutputFactory I/O Timed Conveyor StartFactory I/O Counter for Produced ItemsFactory I/O Sorting with Two ActuatorsFactory I/O Emergency Stop LogicFactory I/O Light Stack IndicatorFactory I/O Palletizer Robot CycleFactory I/O Variable Speed ConveyorFactory I/O Fault Reset HandlingFactory I/O Multi-Sensor Condition Check

Learn FACTORY-IO-SCRIPTING with Real Code Examples

Updated Nov 27, 2025

Explain

Factory I/O is a 3D industrial simulator for training and testing automation systems.

Scripting allows programmatic interaction with virtual sensors, actuators, and machinery.

Automation of repetitive testing scenarios and process sequences is possible.

Supports integration with PLCs via OPC, Modbus, and other industrial protocols.

Widely used in industrial automation education, PLC training, and rapid prototyping.

Core Features

API for programmatic control (C# or Python)

Event-driven interaction with simulation objects

Input/output mapping to virtual sensors and actuators

Custom scenario scripting and automation

Real-time monitoring and logging of simulation data

Basic Concepts Overview

Scenes - prebuilt or custom industrial environments

Objects - machines, sensors, conveyors, and actuators

Signals - digital or analog I/O representing process data

PLC connection - interface to control logic

Scripting - programmatic access to simulation elements

Project Structure

Factory I/O scenes (.fio files)

Scripts (.cs or .py files) for automation

I/O configuration files for PLC mapping

Supporting data files for input/output

Optional reports or logs for analysis

Building Workflow

Open or create a Factory I/O scene

Map sensors and actuators to I/O signals

Write scripts to control objects or respond to events

Connect to PLC or run simulation programmatically

Collect outputs and log data for analysis

Difficulty Use Cases

Beginner: Automate conveyor start/stop sequences

Intermediate: Program event-driven object interactions

Advanced: Simulate complete production lines with sensors

Expert: Integrate multiple PLCs with complex logic

Architect: Create full training scenarios with logging and automated testing

Comparisons

Factory I/O vs physical PLC labs: Safe, cost-effective, repeatable

Factory I/O vs MATLAB/Simulink: 3D industrial environment vs system modeling

Factory I/O vs Arena: Focused on industrial automation vs process simulation

Factory I/O vs Automation Studio: More accessible 3D visualization

Factory I/O vs Excel modeling: Visual, interactive simulation vs data-oriented analysis

Versioning Timeline

2014 - Factory I/O first released by Real Games

2016 - Added C# scripting API

2018 - Introduced Python scripting support

2019 - Enhanced 3D graphics and physics engine

2022 - Added OPC and Modbus protocol integration

2025 - Expanded scenario automation and cloud-based training features

Glossary

Factory I/O - 3D industrial automation simulator

Scene - Virtual industrial environment

Object - Machine, sensor, or actuator in a scene

Digital Input/Output - Signals representing process states

PLC - Programmable Logic Controller interfacing with simulation

Installation Setup

Install Factory I/O on a compatible Windows system

Verify license and activate software

Install Visual Studio or Python environment if using scripts

Set up simulation projects and working directories

Test with sample scenes to validate installation

Environment Setup

Install Factory I/O

Verify license activation

Set up IDE for scripting

Load sample scenes

Enable PLC or protocol connections if needed

Config Files

Factory I/O scene files (.fio)

C# or Python scripts for automation

PLC configuration and I/O mapping files

Data files for simulation inputs/outputs

Custom object scripts or libraries

Cli Commands

FactoryIO.exe /load 'scene.fio' - Load scene via CLI

FactoryIO.exe /run - Run scene

Scripts executed via Visual Studio or Python IDE

Logging configured via API

Scene state saved for replay

Internationalization

Supports multiple GUI languages

Numerical and date formats follow system locale

Custom labels and annotations possible

Scene data compatible with global standards

Suitable for international training programs

Accessibility

Accessible on Windows desktop

Remote automation via scripts supported

Hybrid PLC connection for real-time control

Data export for accessibility

Educational scenarios designed for ease of use

Ui Styling

Factory I/O GUI for scene editing and control

3D visualization for interactive simulation

Custom dashboards via scripting optional

Reports generated via external tools

Integration with HMI-like interfaces possible

State Management

Simulation state tracked internally by Factory I/O

Scripts can read/write object states

Event-driven updates ensure real-time control

Batch scenarios maintain input/output consistency

Logs allow replay and analysis of simulation

Data Management

Inputs from scripts, files, or PLC signals

Outputs logged for monitoring or reports

Large datasets handled efficiently in memory

Integration with Excel, CSV, or databases

Historical simulation data stored for analysis

Architecture

3D simulation engine renders industrial environment

Script engine communicates with sensors, actuators, and objects

PLC interface handles external device interaction

Event-driven system allows real-time simulation control

Logging and data collection for analysis

Rendering Model

3D engine renders scene objects and physics

Script engine interacts with sensors and actuators

PLC interface enables real-world device connection

Simulation state updated in real-time

Logging and monitoring of signals for analysis

Architectural Patterns

Event-driven object control

Signal-based input/output mapping

Scenario-based simulation

Script modularization for reusable logic

Integration with external control and logging systems

Real World Architectures

Assembly line automation simulation

Conveyor and material handling systems

Robot pick-and-place operations

Process control and sensor automation

Industrial safety and emergency stop training

Design Principles

Visual 3D simulation of industrial environments

Programmatic automation via scripting API

Modular scene design with reusable objects

Event-driven and real-time simulation

Integration with PLCs and industrial protocols

Scalability Guide

Modularize scenes and scripts

Optimize object rendering for large plants

Batch run multiple scenarios for training

Use efficient logging and data handling

Integrate multiple PLCs or simulations for complex setups

Migration Guide

Update scripts for new Factory I/O versions

Validate scene objects and mappings

Check API changes in C# or Python libraries

Test existing scenarios with upgraded engine

Document changes for training or production use

Performance Notes

Use minimal logging for real-time simulations

Disable unneeded objects to improve FPS

Optimize scripts for event-driven control

Batch simulate simple processes before full scenes

Profile scripts to reduce latency in control loops

Security Notes

Avoid exposing PLC credentials in scripts

Validate external libraries for malware

Control access to simulation projects

Back up scene and script files regularly

Follow corporate IT guidelines for software use

Monitoring Analytics

Monitor simulation in real-time

Log sensor and actuator states

Analyze performance and response times

Generate automated reports

Audit multiple scenarios for consistency

Code Quality

Use clear variable and object naming

Comment scripts for readability

Reuse modular functions and event handlers

Validate I/O mapping

Maintain scripts for reproducibility and maintainability

Practical Examples

Start and stop a conveyor based on sensor input

Simulate emergency stop and safety system response

Automate pick-and-place robot operations

Test sequential production line logic with timers

Log sensor data for process analysis

Troubleshooting

Ensure correct mapping of I/O signals

Validate scene objects have proper names

Check PLC connection and protocol settings

Monitor simulation logs for errors

Test scripts incrementally to identify issues

Testing Guide

Validate individual object behavior

Check I/O signal mapping to PLC or script

Run scripted scenarios and verify outputs

Simulate edge cases and emergency stops

Compare scripted outputs with manual simulation

Deployment Options

Run automated scenarios for training

Integrate scripts with PLC programs for testing

Package simulation projects for classroom use

Use logs for analysis and reporting

Connect to hardware for hybrid simulations

Tools Ecosystem

Factory I/O editor and 3D engine

Visual Studio or Python IDE for scripting

PLC software for hardware integration

OPC/Modbus/industrial protocol libraries

Data logging and visualization tools

Integrations

Connect to Siemens, Allen-Bradley, or other PLCs

Use OPC, Modbus TCP/RTU for industrial communication

Python scripts for external automation or data analysis

Visual Studio C# scripts for scene control

Export simulation data to Excel, CSV, or databases

Productivity Tips

Modularize scripts for reuse

Automate repetitive simulation tasks

Use events for efficient control

Log only necessary signals to reduce overhead

Document scenes and scripts thoroughly

Challenges

Mapping multiple I/O signals correctly

Synchronizing scripts with real-time simulation

Debugging event-driven automation sequences

Optimizing large or complex scenes for performance

Integrating multiple PLCs and protocols

Learning Path

Learn basic Factory I/O scene navigation

Understand objects, sensors, and actuators

Connect scenes to PLC or script for control

Write simple C# or Python scripts for automation

Advance to scenario automation and data logging

Skill Improvement Plan

Week 1: Explore Factory I/O scenes and objects

Week 2: Learn I/O signal mapping and scripting basics

Week 3: Automate simple sequences

Week 4: Implement event-driven and timed sequences

Week 5: Integrate with PLCs and log simulation data

Interview Questions

What is Factory I/O scripting used for?

How do you control a conveyor using Factory I/O scripts?

Explain how to integrate a PLC with Factory I/O.

What are common challenges in automating Factory I/O scenes?

How do you log sensor data programmatically?

Cheat Sheet

Simulator simulator = new Simulator(); - Initialize simulator

simulator.Connect(); - Connect to Factory I/O scene

simulator.DigitalOutputs[n] = true/false; - Control actuator

simulator.DigitalInputs[n]; - Read sensor input

simulator.Update(); - Refresh simulation state

Books

Factory I/O: Industrial Automation Simulation Guide

PLC Programming with Factory I/O

C# Automation for Industrial Simulations

Python Scripting for Factory I/O

Hands-on Industrial Automation with Factory I/O

Tutorials

Factory I/O Basics and Scene Navigation

C# Scripting for Factory I/O Automation

Python Scripting for Process Control

PLC Integration and I/O Mapping

Scenario Automation and Data Logging

Official Docs

https://factoryio.com/

https://factoryio.com/documentation

https://factoryio.com/tutorials

https://factoryio.com/api

Community Links

Factory I/O forums

YouTube tutorials and channels

LinkedIn automation and PLC groups

Technical blogs and industrial automation communities

Online courses on Factory I/O scripting

Community Support

Factory I/O forums and knowledge base

YouTube tutorials on Factory I/O scripting

PLC and industrial automation communities

LinkedIn groups for automation and control engineers

Technical blogs and online courses

Monetization

Industrial automation training courses

Custom simulation and prototyping services

PLC training and certification programs

Consulting for automation solutions

Software licensing and workshops

Future Roadmap

Cloud-based training and simulation sharing

AI-assisted scenario generation

Enhanced physics and large-scale plant simulation

Expanded protocol and PLC support

Integration with virtual reality for immersive training

When Not To Use

For non-industrial or purely theoretical simulations

When real hardware testing is required

For complex chemical or process engineering simulations

When advanced physics simulations are needed

For simple PLC programming exercises that do not require 3D visualization

Final Summary

Factory I/O scripting automates control and testing of virtual industrial environments.

Enables safe, cost-effective, and repeatable PLC training and prototyping.

Supports event-driven automation, scenario testing, and I/O monitoring.

Integrates with PLCs and external scripts for hybrid simulations.

Essential for industrial automation education, testing, and rapid prototyping.

Faq

Do I need a physical PLC to use Factory I/O? -> No, you can use built-in simulation.

Can scripts automate multiple objects? -> Yes, using loops and event logic.

Does Factory I/O support Python scripting? -> Yes, via API.

Can I connect to real PLCs? -> Yes, through OPC or Modbus.

Is it suitable for industrial training? -> Yes, it’s widely used in education.

Code Sample Descriptions

1

Factory I/O Toggle Sensor Output

void Update() {
    bool sensor = IOLink.GetBool("Sensor1");
    IOLink.SetBool("Actuator1", sensor);
}

Read a digital sensor and toggle an output actuator.

Let’s Try →
2

Factory I/O Timed Conveyor Start

float timer = 0;
bool running = false;

void Update() {
    if (IOLink.GetBool("EntrySensor") && !running) {
        running = true;
        timer = 3f;
        IOLink.SetBool("Conveyor", true);
    }

    if (running) {
        timer -= Time.deltaTime;
        if (timer <= 0) {
            IOLink.SetBool("Conveyor", false);
            running = false;
        }
    }
}

Start the conveyor for 3 seconds whenever a sensor triggers.

Let’s Try →
3

Factory I/O Counter for Produced Items

int count = 0;

void Update() {
    if (IOLink.GetBool("OpticSensor")) {
        count++;
        Debug.Log("Items: " + count);
    }
}

Count items detected by an optical sensor.

Let’s Try →
4

Factory I/O Sorting with Two Actuators

void Update() {
    int color = IOLink.GetInt("ColorID");
    if (color == 1) {
        IOLink.SetBool("PusherLeft", true);
    }
    else if (color == 2) {
        IOLink.SetBool("PusherRight", true);
    }
    else {
        IOLink.SetBool("PusherLeft", false);
        IOLink.SetBool("PusherRight", false);
    }
}

Sort items left or right based on color sensor.

Let’s Try →
5

Factory I/O Emergency Stop Logic

void Update() {
    if (IOLink.GetBool("EmergencyStop")) {
        IOLink.SetBool("Motor1", false);
        IOLink.SetBool("Motor2", false);
        IOLink.SetBool("Conveyor", false);
    }
}

Stop all outputs if an emergency switch is pressed.

Let’s Try →
6

Factory I/O Light Stack Indicator

void Update() {
    bool idle = IOLink.GetBool("IdleState");
    bool running = IOLink.GetBool("RunState");
    bool fault = IOLink.GetBool("FaultState");

    IOLink.SetBool("LightGreen", running);
    IOLink.SetBool("LightYellow", idle);
    IOLink.SetBool("LightRed", fault);
}

Control a stack light (red/yellow/green) based on machine states.

Let’s Try →
7

Factory I/O Palletizer Robot Cycle

void Update() {
    if (IOLink.GetBool("BoxArrived")) {
        IOLink.SetBool("RobotGrab", true);
        IOLink.SetBool("RobotMoveToStack", true);
    }
    if (IOLink.GetBool("RobotAtStack")) {
        IOLink.SetBool("RobotGrab", false);
        IOLink.SetBool("RobotReturn", true);
    }
}

Automate a simple pick-and-place robot cycle.

Let’s Try →
8

Factory I/O Variable Speed Conveyor

void Update() {
    float speed = IOLink.GetFloat("SpeedDial");
    IOLink.SetFloat("ConveyorSpeed", speed);
}

Control conveyor speed dynamically from an analog input.

Let’s Try →
9

Factory I/O Fault Reset Handling

int itemCount = 0;

void Update() {
    if (IOLink.GetBool("ResetButton")) {
        itemCount = 0;
        IOLink.SetBool("Actuator1", false);
        IOLink.SetBool("Actuator2", false);
    }
}

Reset actuators and counters when a reset button is pressed.

Let’s Try →
10

Factory I/O Multi-Sensor Condition Check

void Update() {
    bool s1 = IOLink.GetBool("Sensor1");
    bool s2 = IOLink.GetBool("Sensor2");
    bool s3 = IOLink.GetBool("Sensor3");

    bool fault = s1 || s2 || s3;
    IOLink.SetBool("Alarm", fault);
}

Trigger an alarm if any sensor in a group detects an issue.

Let’s Try →

Frequently Asked Questions about Factory-io-scripting

What is Factory-io-scripting?

Factory I/O scripting refers to automating, controlling, and interacting with Factory I/O simulations using C# (or Python via API). It enables programmatic control of virtual industrial environments, input/output devices, and process logic, allowing testing and validation of PLC programs without physical hardware.

What are the primary use cases for Factory-io-scripting?

Simulating industrial processes for PLC training. Testing and debugging automation logic. Automated control of virtual sensors and actuators. Scenario-based training for operators and engineers. Integration with external control systems for prototyping

What are the strengths of Factory-io-scripting?

Safe and cost-effective testing of industrial processes. Rapid prototyping and debugging of PLC logic. Supports educational labs and hands-on learning. Visual, interactive, and immersive training experience. Extensible via scripting for complex scenarios

What are the limitations of Factory-io-scripting?

Requires Factory I/O license. Limited to simulated environment; not a full PLC replacement. Advanced physics or large-scale plants may impact performance. Scripting API is less extensive than full programming platforms. Integration may require knowledge of industrial protocols

How can I practice Factory-io-scripting typing speed?

CodeSpeedTest offers 10+ real Factory-io-scripting code examples for typing practice. You can measure your WPM, track accuracy, and improve your coding speed with guided exercises.

Learn Other Programming Languages

CReactPythonC++RustTypeScriptKotlinPHPJavaC#RubyMqlCqlN1qlCypherGremlinPartiqlHaskellElixirFsharpView all languages →
CodeSpeedTest

Improve your coding speed, code accuracy, and programming syntax WPM with practice sessions across 500+ programming languages.

Quick Links

HomeAboutFeaturesGetting StartedLanguages

Legal & Support

Pro ⚡ PricingContactPrivacy PolicyTerms of Service

Connect

CodeSpeedTest on GitHubCodeSpeedTest on TwitterEmail CodeSpeedTest

© 2026 CodeSpeedTest. All rights reserved.