# sam-airobotics/f2d-studio architecture

> Architecture diagram of the GitHub repository sam-airobotics/f2d-studio, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/sam-airobotics/f2d-studio
- Repository: https://github.com/sam-airobotics/f2d-studio

## Overview

F2D Studio is a Fusion 360 add-in that turns a robot assembly into a ROS 2 description package. The user configures an export in the dialog, the execute handler validates the settings and starts extraction, then the exporter builds a robot model and writes the selected package artifacts. The model stage covers links, geometry, mass/inertia, materials, and joint frames/tree structure. README capabilities include URDF/Xacro, meshes, launch, RViz, Gazebo, and optional ROS 2 Control outputs. Some generator and parser wiring is only named in the source index, so uncertain links are dashed.

Main entry points: [`exporter/export_manager.py`](https://github.com/sam-airobotics/f2d-studio/blob/main/exporter/export_manager.py) (Export manager), [`fusion/robot_model.py`](https://github.com/sam-airobotics/f2d-studio/blob/main/fusion/robot_model.py) (Robot model builder), [`commands/ui`](https://github.com/sam-airobotics/f2d-studio/tree/main/commands/ui) (Export tabs), [`commands/input_changed_handler.py`](https://github.com/sam-airobotics/f2d-studio/blob/main/commands/input_changed_handler.py) (Dynamic inputs)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["Fusion Interface"]
  node_entry["Add-in entry<br/>[F2D-Studio.py]"]
  node_command["Export command<br/>[export_command.py]"]
  node_dialog["Dialog orchestration"]
  node_tabs["Export tabs"]
  node_ui_helpers["UI helpers<br/>[ui_builder.py]"]
  node_input_utils["Input access<br/>[input_utils.py]"]
  node_input_handler["Dynamic inputs"]
  node_ui_context["Dialog state<br/>[ui_context.py]"]
  node_execute["Export execution<br/>[execute_handler.py]"]
end

subgraph group_model["Robot Model"]
  node_model_builder["Robot model builder<br/>[robot_model.py]"]
  node_components["Component extraction"]
  node_collision["Collision detection"]
  node_joints["Joint frames<br/>[joint_parser.py]"]
  node_joint_tree["Joint tree<br/>[joint_tree.py]"]
  node_transforms["Transform parsing"]
  node_mass["Mass extraction<br/>[mass_extractor.py]"]
  node_inertia["Inertia calculation"]
  node_materials["Material parsing<br/>[material_parser.py]"]
  node_material_data["Material records<br/>[material.py]"]
  node_meshes["Mesh export<br/>[mesh_exporter.py]"]
end

subgraph group_export["Package Export"]
  node_manager["Export manager<br/>[export_manager.py]"]
  node_package["Package creation<br/>[package_creator.py]"]
  node_urdf["URDF and Xacro<br/>[urdf_generator.py]"]
  node_robot_xacro["Robot Xacro"]
  node_other_generators["Package generators"]
  node_file_writer["Package file writer<br/>[file_writer.py]"]
end

subgraph group_quality["Validation"]
  node_validator["Export validation<br/>[validate.py]"]
end

node_user(("Fusion user"))
node_fusion360{{"Fusion 360"}}
node_ros_package[("ROS 2 description package")]

node_user -->|"invokes"| node_entry
node_fusion360 -->|"hosts"| node_entry
node_entry -->|"registers"| node_command
node_command -->|"creates"| node_dialog
node_dialog -->|"builds"| node_tabs
node_tabs -->|"uses"| node_ui_helpers
node_dialog -->|"attaches"| node_execute
node_dialog -->|"attaches"| node_input_handler
node_input_handler -->|"uses"| node_input_utils
node_input_handler -->|"updates"| node_ui_context
node_input_handler -->|"reads components"| node_components
node_input_handler -->|"calculates"| node_inertia
node_execute -->|"reads settings"| node_input_utils
node_tabs -->|"loads data"| node_components
node_tabs -->|"loads data"| node_mass
node_tabs -->|"calculates"| node_inertia
node_tabs -->|"reads materials"| node_materials
node_tabs -->|"registers colors"| node_ui_context
node_execute -->|"validates config"| node_validator
node_execute -->|"starts export"| node_manager
node_manager -->|"validates model"| node_validator
node_manager -->|"creates package"| node_package
node_manager -->|"builds model"| node_model_builder
node_model_builder -->|"extracts links"| node_components
node_components -->|"detects shapes"| node_collision
node_model_builder -->|"parses joints"| node_joints
node_model_builder -->|"builds tree"| node_joint_tree
node_joints -->|"uses frames"| node_transforms
node_model_builder -->|"extracts mass"| node_mass
node_model_builder -.->|"calculates inertia"| node_inertia
node_model_builder -->|"parses materials"| node_materials
node_materials -->|"creates records"| node_material_data
node_model_builder -->|"exports meshes"| node_meshes
node_manager -->|"reads colors"| node_ui_context
node_manager -.->|"generates URDF"| node_urdf
node_manager -.->|"generates Xacro"| node_robot_xacro
node_manager -.->|"generates outputs"| node_other_generators
node_robot_xacro -->|"uses generator"| node_urdf
node_urdf -->|"writes files"| node_file_writer
node_robot_xacro -->|"writes files"| node_file_writer
node_other_generators -.->|"writes files"| node_file_writer
node_package -->|"creates files"| node_file_writer
node_manager -->|"returns package"| node_ros_package

click node_entry "https://github.com/sam-airobotics/f2d-studio/blob/main/F2D-Studio.py"
click node_command "https://github.com/sam-airobotics/f2d-studio/blob/main/commands/export_command.py"
click node_dialog "https://github.com/sam-airobotics/f2d-studio/blob/main/commands/command_created_handler.py"
click node_tabs "https://github.com/sam-airobotics/f2d-studio/tree/main/commands/ui"
click node_ui_helpers "https://github.com/sam-airobotics/f2d-studio/blob/main/commands/helpers/ui_builder.py"
click node_input_utils "https://github.com/sam-airobotics/f2d-studio/blob/main/commands/helpers/input_utils.py"
click node_input_handler "https://github.com/sam-airobotics/f2d-studio/blob/main/commands/input_changed_handler.py"
click node_ui_context "https://github.com/sam-airobotics/f2d-studio/blob/main/commands/ui/ui_context.py"
click node_execute "https://github.com/sam-airobotics/f2d-studio/blob/main/commands/execute_handler.py"
click node_model_builder "https://github.com/sam-airobotics/f2d-studio/blob/main/fusion/robot_model.py"
click node_components "https://github.com/sam-airobotics/f2d-studio/blob/main/fusion/component_parser.py"
click node_collision "https://github.com/sam-airobotics/f2d-studio/blob/main/fusion/collision_detector.py"
click node_joints "https://github.com/sam-airobotics/f2d-studio/blob/main/fusion/joint_parser.py"
click node_joint_tree "https://github.com/sam-airobotics/f2d-studio/blob/main/fusion/joint_tree.py"
click node_transforms "https://github.com/sam-airobotics/f2d-studio/blob/main/fusion/transform_parser.py"
click node_mass "https://github.com/sam-airobotics/f2d-studio/blob/main/fusion/mass_extractor.py"
click node_inertia "https://github.com/sam-airobotics/f2d-studio/blob/main/fusion/inertia_calculator.py"
click node_materials "https://github.com/sam-airobotics/f2d-studio/blob/main/fusion/material_parser.py"
click node_material_data "https://github.com/sam-airobotics/f2d-studio/blob/main/fusion/material.py"
click node_meshes "https://github.com/sam-airobotics/f2d-studio/blob/main/fusion/mesh_exporter.py"
click node_manager "https://github.com/sam-airobotics/f2d-studio/blob/main/exporter/export_manager.py"
click node_package "https://github.com/sam-airobotics/f2d-studio/blob/main/exporter/package_creator.py"
click node_urdf "https://github.com/sam-airobotics/f2d-studio/blob/main/exporter/urdf_generator.py"
click node_robot_xacro "https://github.com/sam-airobotics/f2d-studio/blob/main/exporter/robot_xacro_generator.py"
click node_other_generators "https://github.com/sam-airobotics/f2d-studio/tree/main/exporter"
click node_file_writer "https://github.com/sam-airobotics/f2d-studio/blob/main/exporter/file_writer.py"
click node_validator "https://github.com/sam-airobotics/f2d-studio/blob/main/utils/validate.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_entry,node_command,node_dialog,node_tabs,node_ui_helpers,node_input_utils,node_input_handler,node_ui_context,node_execute,node_user toneBlue
class node_model_builder,node_components,node_collision,node_joints,node_joint_tree,node_transforms,node_mass,node_inertia,node_materials,node_material_data,node_meshes,node_ros_package toneAmber
class node_manager,node_package,node_urdf,node_robot_xacro,node_other_generators,node_file_writer toneMint
class node_validator toneRose
class node_fusion360 toneIndigo
```

## Components

### Fusion Interface

- [Add-in entry](https://github.com/sam-airobotics/f2d-studio/blob/main/F2D-Studio.py): `F2D-Studio.py`
- [Export command](https://github.com/sam-airobotics/f2d-studio/blob/main/commands/export_command.py): `commands/export_command.py`
- [Dialog orchestration](https://github.com/sam-airobotics/f2d-studio/blob/main/commands/command_created_handler.py): `commands/command_created_handler.py`
- [Export tabs](https://github.com/sam-airobotics/f2d-studio/tree/main/commands/ui): `commands/ui`
- [UI helpers](https://github.com/sam-airobotics/f2d-studio/blob/main/commands/helpers/ui_builder.py): `commands/helpers/ui_builder.py`
- [Input access](https://github.com/sam-airobotics/f2d-studio/blob/main/commands/helpers/input_utils.py): `commands/helpers/input_utils.py`
- [Dynamic inputs](https://github.com/sam-airobotics/f2d-studio/blob/main/commands/input_changed_handler.py): `commands/input_changed_handler.py`
- [Dialog state](https://github.com/sam-airobotics/f2d-studio/blob/main/commands/ui/ui_context.py): `commands/ui/ui_context.py`
- [Export execution](https://github.com/sam-airobotics/f2d-studio/blob/main/commands/execute_handler.py): `commands/execute_handler.py`

### Robot Model

- [Robot model builder](https://github.com/sam-airobotics/f2d-studio/blob/main/fusion/robot_model.py): `fusion/robot_model.py`
- [Component extraction](https://github.com/sam-airobotics/f2d-studio/blob/main/fusion/component_parser.py): `fusion/component_parser.py`
- [Collision detection](https://github.com/sam-airobotics/f2d-studio/blob/main/fusion/collision_detector.py): `fusion/collision_detector.py`
- [Joint frames](https://github.com/sam-airobotics/f2d-studio/blob/main/fusion/joint_parser.py): `fusion/joint_parser.py`
- [Joint tree](https://github.com/sam-airobotics/f2d-studio/blob/main/fusion/joint_tree.py): `fusion/joint_tree.py`
- [Transform parsing](https://github.com/sam-airobotics/f2d-studio/blob/main/fusion/transform_parser.py): `fusion/transform_parser.py`
- [Mass extraction](https://github.com/sam-airobotics/f2d-studio/blob/main/fusion/mass_extractor.py): `fusion/mass_extractor.py`
- [Inertia calculation](https://github.com/sam-airobotics/f2d-studio/blob/main/fusion/inertia_calculator.py): `fusion/inertia_calculator.py`
- [Material parsing](https://github.com/sam-airobotics/f2d-studio/blob/main/fusion/material_parser.py): `fusion/material_parser.py`
- [Material records](https://github.com/sam-airobotics/f2d-studio/blob/main/fusion/material.py): `fusion/material.py`
- [Mesh export](https://github.com/sam-airobotics/f2d-studio/blob/main/fusion/mesh_exporter.py): `fusion/mesh_exporter.py`

### Package Export

- [Export manager](https://github.com/sam-airobotics/f2d-studio/blob/main/exporter/export_manager.py): `exporter/export_manager.py`
- [Package creation](https://github.com/sam-airobotics/f2d-studio/blob/main/exporter/package_creator.py): `exporter/package_creator.py`
- [URDF and Xacro](https://github.com/sam-airobotics/f2d-studio/blob/main/exporter/urdf_generator.py): `exporter/urdf_generator.py`
- [Robot Xacro](https://github.com/sam-airobotics/f2d-studio/blob/main/exporter/robot_xacro_generator.py): `exporter/robot_xacro_generator.py`
- [Package generators](https://github.com/sam-airobotics/f2d-studio/tree/main/exporter): `exporter`
- [Package file writer](https://github.com/sam-airobotics/f2d-studio/blob/main/exporter/file_writer.py): `exporter/file_writer.py`

### Validation

- [Export validation](https://github.com/sam-airobotics/f2d-studio/blob/main/utils/validate.py): `utils/validate.py`

### Other components

- **Fusion user**
- **Fusion 360**
- **ROS 2 description package**

## Connections

- Fusion user → Add-in entry: invokes (evidence: `README.md`)
- Fusion 360 → Add-in entry: hosts (evidence: `README.md`)
- Add-in entry → Export command: registers (evidence: `F2D-Studio.py`)
- Export command → Dialog orchestration: creates (evidence: `commands/export_command.py`)
- Dialog orchestration → Export tabs: builds (evidence: `commands/command_created_handler.py`)
- Export tabs → UI helpers: uses (evidence: `commands/ui/general_tab.py`)
- Dialog orchestration → Export execution: attaches (evidence: `commands/command_created_handler.py`)
- Dialog orchestration → Dynamic inputs: attaches (evidence: `commands/command_created_handler.py`)
- Dynamic inputs → Input access: uses (evidence: `commands/input_changed_handler.py`)
- Dynamic inputs → Dialog state: updates (evidence: `commands/input_changed_handler.py`)
- Dynamic inputs → Component extraction: reads components (evidence: `commands/input_changed_handler.py`)
- Dynamic inputs → Inertia calculation: calculates (evidence: `commands/input_changed_handler.py`)
- Export execution → Input access: reads settings (evidence: `commands/execute_handler.py`)
- Export tabs → Component extraction: loads data (evidence: `commands/ui/properties_tab.py`)
- Export tabs → Mass extraction: loads data (evidence: `commands/ui/properties_tab.py`)
- Export tabs → Inertia calculation: calculates (evidence: `commands/ui/properties_tab.py`)
- Export tabs → Material parsing: reads materials (evidence: `commands/ui/properties_tab.py`)
- Export tabs → Dialog state: registers colors (evidence: `commands/ui/properties_tab.py`)
- Export execution → Export validation: validates config (evidence: `commands/execute_handler.py`)
- Export execution → Export manager: starts export (evidence: `commands/execute_handler.py`)
- Export manager → Export validation: validates model (evidence: `exporter/export_manager.py`)
- Export manager → Package creation: creates package (evidence: `exporter/export_manager.py`)
- Export manager → Robot model builder: builds model (evidence: `exporter/export_manager.py`)
- Robot model builder → Component extraction: extracts links (evidence: `fusion/robot_model.py`)
- Component extraction → Collision detection: detects shapes (evidence: `fusion/component_parser.py`)
- Robot model builder → Joint frames: parses joints (evidence: `fusion/robot_model.py`)
- Robot model builder → Joint tree: builds tree (evidence: `fusion/robot_model.py`)
- Joint frames → Transform parsing: uses frames (evidence: `fusion/joint_parser.py`)
- Robot model builder → Mass extraction: extracts mass (evidence: `fusion/robot_model.py`)
- Robot model builder → Inertia calculation: calculates inertia (evidence: `fusion/robot_model.py`)
- Robot model builder → Material parsing: parses materials (evidence: `fusion/robot_model.py`)
- Material parsing → Material records: creates records (evidence: `fusion/material_parser.py`)
- Robot model builder → Mesh export: exports meshes (evidence: `fusion/robot_model.py`)
- Export manager → Dialog state: reads colors (evidence: `exporter/export_manager.py`)
- Export manager → URDF and Xacro: generates URDF (evidence: `exporter/export_manager.py`)
- Export manager → Robot Xacro: generates Xacro (evidence: `exporter/export_manager.py`)
- Export manager → Package generators: generates outputs (evidence: `README.md`)
- Robot Xacro → URDF and Xacro: uses generator (evidence: `exporter/robot_xacro_generator.py`)
- URDF and Xacro → Package file writer: writes files (evidence: `exporter/urdf_generator.py`)
- Robot Xacro → Package file writer: writes files (evidence: `exporter/robot_xacro_generator.py`)
- Package generators → Package file writer: writes files (evidence: `exporter/gazebo_generator.py`)
- Package creation → Package file writer: creates files (evidence: `exporter/package_creator.py`)
- Export manager → ROS 2 description package: returns package (evidence: `README.md`)
