Professional Documents
Culture Documents
Blender Castle
Blender Castle
```python
import bpy
bpy.ops.object.select_all(action='DESELECT')
bpy.ops.object.select_by_type(type='MESH')
bpy.ops.object.delete()
tower_size = 7
tower_height = 15
wall_height = 7
wall_length = 50
# Create tower
tower = bpy.context.active_object
tower.name = "Tower"
main_building = bpy.context.active_object
main_building.name = "MainBuilding"
bpy.ops.object.select_all(action='DESELECT')
tower.select_set(True)
main_building.select_set(True)
bpy.context.view_layer.objects.active = tower
bpy.ops.object.join()
# Create roof
roof_angle = 30 # in degrees
roof_height = 2
roof = bpy.context.active_object
roof.name = "Roof"
roof.rotation_euler = (radians(roof_angle), 0, 0)
# Create door
door_size = 2
door_height = 4
door = bpy.context.active_object
door.name = "Door"
# Create windows
window_size = 3
window_height = 3
window_offset = wall_length / 4
bpy.ops.mesh.primitive_cube_add(size=window_size, location=(window_offset, -wall_length/2,
window_height/2))
window1 = bpy.context.active_object
window1.name = "Window1"
window2 = bpy.context.active_object
window2.name = "Window2"
# Create grounds
ground_size = 100
ground_thickness = 0.1
bpy.ops.mesh.primitive_plane_add(size=ground_size)
ground = bpy.context.active_object
ground.name = "Ground"
ground.location.z = -ground_thickness/2
bpy.ops.wm.save_as_mainfile(filepath="castle.blend")
```
2. Go to Scripting workspace.
5. Press the "Run Script" button or use the shortcut "Alt+P" to execute the script.
7. Save the created model by pressing "Ctrl+S" and providing a file name (e.g., "castle.blend") in the
appropriate directory.
Please note that this script only creates a basic castle model. Additional modifications and details can be
added based on your specific requirements.