1 / 2
Triangulated Hex Torus — image 1
1 / 2

Triangulated Hex Torus

Order a print of this model

We calculate the final price from your selected file. You review and accept it before payment.

Saved on this device.

A torus with 864 facets.

Rating
0 / 5
Likes
3
Downloads
5
Makes
0
Views
45
Reviews
0

Updated at source:

Model information

License
Creative Commons — Public Domain

I had Claude create a script for FreeCAD using my specifications. This shape is the basis for a manifold that I am using to develop spiking-neural-networks. I'll drop the script below.

I posted this one before. I'm not trying to spam or anything, the previous post was just way too busy and I spaced out on being able to edit it.

It's shaped the way it is for a reason, but it's also just a neat torus. It has a helix in it. Maybe try to print sideways with a raft and interface ironing. IDK. My top and bottom looked like trash.

Update: I tried printing it like this. Much better.

import FreeCAD as App
import Part
import FreeCADGui as Gui
import math

doc = App.newDocument("TriangulatedHexTorus")

=== PARAMETERS (adjust for ~50 mm local edges) ===

major_div = 36 # around major circle (multiple of 6 preferred) minor_div = 12 # around tube (even number helps stagger) R = 120.0 # major radius (center to tube centerline) r = 55.0 # minor radius (tube radius)

Tune R/r after measuring an edge with Draft → Measure Distance

================================================

Build staggered grid points

grid = [[None] * minor_div for _ in range(major_div)] for i in range(major_div): u = i * 2 * math.pi / major_div stagger = (math.pi / minor_div) if (i % 2 == 1) else 0.0 for j in range(minor_div): v = j * 2 * math.pi / minor_div + stagger x = (R + r * math.cos(v)) * math.cos(u) y = (R + r * math.cos(v)) * math.sin(u) z = r * math.sin(v) grid[i][j] = App.Vector(x, y, z)

Create triangular faces (2 per parametric quad cell, wraps toroidally)

faces = [] for i in range(major_div): for j in range(minor_div): i_next = (i + 1) % major_div j_next = (j + 1) % minor_div

    p1 = grid[i][j]
    p2 = grid[i][j_next]
    p3 = grid[i_next][j]
    p4 = grid[i_next][j_next]
    
    # Triangle 1: p1-p2-p3
    wire1 = Part.makePolygon([p1, p2, p3, p1])
    face1 = Part.Face(wire1) # simpler constructor, reliable for 3 points
    if face1:
        faces.append(face1)
    
    # Triangle 2: p2-p4-p3
    wire2 = Part.makePolygon([p2, p4, p3, p2])
    face2 = Part.Face(wire2)
    if face2:
        faces.append(face2)

Assemble into shell (watertight if grid is closed)

if faces: shell = Part.makeShell(faces) Part.show(shell, "Torus_TriMesh_Shell")

# Optional: try solid if you need volume (may need .fix(...) if tiny gaps)
try:
    solid = Part.makeSolid(shell)
    Part.show(solid, "Torus_TriMesh_Solid")
except:
    print("Solid creation skipped - use shell for now or check tiny gaps")

App.ActiveDocument.recompute() Gui.SendMsgToActiveView("ViewFit") Gui.ActiveDocument.ActiveView.viewIsometric()

Tags