Generate Low-Poly Gothic Arches With Blender Python API For Website

3D Arch: Blender to Web
On 3 min, 16 sec read

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

  1. Open Blender.
  2. Go to the Scripting tab.
  3. 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

  1. In Blender, export the model as .glb:
    • File > Export > glTF 2.0 (.glb/.gltf)
    • Choose .glb and save the file
  2. 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

Low poly gothic arches Python code
Blender Scripting Workspace Displaying Low Poly Gothic Arches Python Code

Low poly gothic arches in Blender
Blender Layout Workspace Displaying Low Poly Gothic Arches

Low poly gothic arches in Web browser
Web Browser Displaying Rendered Low Poly Gothic Arches

Screencast For Blender Python API Low Poly Gothic Arches

📚 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

🚀 Recommended Resources


Disclosure: Some of the links above are referral links. I may earn a commission if you make a purchase at no extra cost to you.

About Edward

Edward is a software engineer, author, and designer dedicated to providing the actionable blueprints and real-world tools needed to navigate a shifting economic landscape.

With a provocative focus on the evolution of technology—boldly declaring that “programming is dead”—Edward’s latest work, The Recession Business Blueprint, serves as a strategic guide for modern entrepreneurship. His bibliography also includes Mastering Blender Python API and The Algorithmic Serpent.

Beyond the page, Edward produces open-source tool review videos and provides practical resources for the “build it yourself” movement.

📚 Explore His Books – Visit the Book Shop to grab your copies today.

💼 Need Support? – Learn more about Services and the ways to benefit from his expertise.

🔨 Build it Yourself – Download Free Plans for Backyard Structures, Small Living, and Woodworking.