require 'sketchup'
# Create a new SketchUp model
model = SketchUp.active_model
# Create a group to hold the cube
group = model.groups.add 'Cube'
# Create a new face to represent the cube's side
face = group.faces.add
# Set the face's normal (direction) to be up and right
face.normal = [1, 0, 0]
# Set the face's size to be 1 unit
face.set_size 1, 1, 1
# Create a new entity to represent the cube's corner
corner = group.entities.add_face face
# Move the corner to the origin (0, 0, 0)
corner.translation = [0, 0, 0]
# Create three more corners and move them to the correct location
corner2 = group.entities.add_face face
corner2.translation = [1, 0, 0]
corner3 = group.entities.add_face face
corner3.translation = [0, 1, 0]
corner4 = group.entities.add_face face
corner4.translation = [0, 0, 1]
# Done! You now have a cube in your SketchUp model
Next, the code creates a new entity to represent the cube's corner and moves it to the origin (0, 0, 0). It then creates three more corners and moves them to the correct location.