"""
R2-D2 - Star Wars
Generated by Gemini AI
Creates the iconic R2-D2 astromech droid from the Star Wars franchise.
Features the classic design with:
- Cylindrical main body with proper proportions
- Hemispherical dome on top (cut from full sphere)
- Blue and white color scheme ready for materials
- Compact, functional astromech droid appearance
- Proper scale for a droid that fits in starfighter cockpits
Author: Gemini AI
Category: robots
Tags: star-wars, astromech, r2d2, droid, sci-fi, iconic
Dimensions: ~90cm tall (with dome)
Complexity: medium
"""
import bpy
# Clear scene
bpy.ops.object.select_all(action="SELECT")
bpy.ops.object.delete()
# 1. Main Body Cylinder
bpy.ops.mesh.primitive_cylinder_add(radius=25, depth=60, location=(0, 0, 45))
body = bpy.context.active_object
body.name = "R2_Body"
# 2. The Dome (Hemisphere)
bpy.ops.mesh.primitive_uv_sphere_add(radius=25, location=(0, 0, 75))
dome = bpy.context.active_object
dome.name = "R2_Dome"
# Use a Boolean to cut off the bottom half of the sphere
bpy.ops.mesh.primitive_cube_add(size=100, location=(0, 0, 25))
cutter = bpy.context.active_object
cutter.name = "Dome_Cutter"
# Apply Boolean modifier to dome
bool_mod = dome.modifiers.new(name="CutDome", type="BOOLEAN")
bool_mod.object = cutter
bool_mod.operation = "DIFFERENCE"
# Hide the cutter object (but keep it for the boolean)
cutter.hide_viewport = True
cutter.hide_render = True