How to Generate Gothic Arches in Blender with Python and View Them on the Web
If you’re new to both 3D modeling and coding, combining Blender’s Python API with web-based visualization might sound intimidating — but it’s totally achievable, even for beginners. In this tutorial, we’ll walk you through how to generate Gothic arches using a Python script in Blender, export the model, and display it directly in a web browser using the
HTML element.
This is a perfect project if you’re looking to learn Blender scripting or want a cool interactive way to share your 3D models online.
⚙ What You’ll Need
- Blender (any recent version)
- Python (comes bundled with Blender)
- A code editor (VS Code, Sublime, etc.)
- Basic HTML knowledge
- A modern web browser (Chrome, Firefox, etc.)
🧱 Step 1: Creating the Gothic Arch in Blender via Python
- Open Blender.
- Go to the Scripting tab.
- Paste the following beginner-friendly Python script:
import bpy import math def create_gothic_arch(radius=1.0, height=2.0, segments=32): bpy.ops.object.select_all(action='DESELECT') bpy.ops.object.select_by_type(type='MESH') bpy.ops.object.delete() mesh = bpy.data.meshes.new(name='GothicArchMesh') obj = bpy.data.objects.new(name='GothicArch', object_data=mesh) bpy.context.collection.objects.link(obj) bpy.context.view_layer.objects.active = obj obj.select_set(True) verts = [] edges = [] faces = [] for i in range(segments + 1): angle = math.pi * i / segments x = radius * math.cos(angle) y = 0 z = height * math.sin(angle) verts.append((x, y, z)) # Mirror arch to form full shape verts += [(-x, y, z) for x, y, z in reversed(verts[:-1])] # Add depth by extruding depth = 0.1 verts = [(x, y - depth / 2, z) for (x, y, z) in verts] + [(x, y + depth / 2, z) for (x, y, z) in verts] total = len(verts) // 2 for i in range(total - 1): faces.append([i, i + 1, total + i + 1, total + i]) mesh.from_pydata(verts, edges, faces) mesh.update() create_gothic_arch()
🚀 Step 2: Run the Script from Command Line
To automate the process, you can run the script directly from the terminal without opening the Blender GUI:
blender --background --python path/to/gothic_arch.py
Replace path/to/gothic_arch.py
with the actual file path where you saved your script.
🌐 Step 3: Export and Display in Web Browser with model-viewer
- In Blender, export the model as
.glb
:- File > Export > glTF 2.0 (.glb/.gltf)
- Choose .glb and save the file
- Create an
index.html
file with the following code:
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Gothic Arch</title> <script type="module" src="https://unpkg.com/@google/model-viewer/dist/model-viewer.min.js"></script> </head> <body> <model-viewer src="gothic_arch.glb" alt="Gothic Arch" auto-rotate camera-controls ar> </model-viewer> </body> </html>
Open the HTML file in a browser and interact with your 3D model!
📸 Screenshots & Screencast



📚 Further Learning
If this sparked your interest, check out my books and courses:
Books:
Course:
👨💻 Need Help?
I also offer one-on-one online Python tutorials, including Blender scripting.
Contact me for private tutoring
Disclosure: Some of the links above are referral (affiliate) links. I may earn a commission if you purchase through them - at no extra cost to you.