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

3D Arch: Blender to Web
3D Arch: Blender to Web

Live stream set for 2025-08-30 at 14:00:00 Eastern

Ask questions in the live chat about any programming or lifestyle topic.

This livestream will be on YouTube or you can watch below.

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

About Edward

Edward is a software engineer, web developer, and author dedicated to helping people achieve their personal and professional goals through actionable advice and real-world tools.

As the author of impactful books including Learning JavaScript, Learning Python, Learning PHP, Mastering Blender Python API, and fiction The Algorithmic Serpent, Edward writes with a focus on personal growth, entrepreneurship, and practical success strategies. His work is designed to guide, motivate, and empower.

In addition to writing, Edward offers professional "full-stack development," "database design," "1-on-1 tutoring," "consulting sessions,", tailored to help you take the next step. Whether you are launching a business, developing a brand, or leveling up your mindset, Edward will be there to support you.

Edward also offers online courses designed to deepen your learning and accelerate your progress. Explore the programming on languages like JavaScript, Python and PHP to find the perfect fit for your journey.

📚 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.
🎓 Ready to Learn? – Check out his Online Courses to turn your ideas into results.

Leave a Reply

Your email address will not be published. Required fields are marked *