• Models
  • Contests
  • Slicer
  • Login
  • Start Here
    thingiverse-iconprintables-iconcults3d-iconmakerworld-iconmyminifactory-icon

    3D GO

    3D ModelsContestsCollectionsSaved ModelsOn a mobile device?

3D GO

Privacy Policy
Geodesic sphere with 3-axis polygon equators in OpenSCAD 3D Printer File Image 1
Geodesic sphere with 3-axis polygon equators in OpenSCAD 3D Printer File Thumbnail 1

Geodesic sphere with 3-axis polygon equators in OpenSCAD

Amatulic avatarAmatulic

February 12, 2024

thingiverse-icon
DescriptionCommentsTags

Description

This is a geodesic sphere or hemisphere for OpenSCAD, using the same arguments as OpenSCAD's sphere(). It is based on my geodesic hemisphere, derived from the Geodesic Sphere (icosahedral sphere) by Jamie Kawabata.

##Explanation

The default sphere in OpenSCAD is rendered as a circle rotated around a diameter. This results in a globe-shape with longitude and latitude edges, with many wasted facets concentrated at the poles. One can fix this problem by subdividing an icosahedron, resulting in a geodesic sphere with evenly-distributed faces. Such a sphere has no planar polygon equator, so it cannot be matched against other regular polygon shapes.

This code generates a geodesic sphere (or hemisphere) based on an octahedron. Unlike a sphere based on an icosahedron, using an octahedron results in flat equators in all three axis planes. These three equators are regular polygons that can match up with other regular polygon shapes (cylinders etc.).

If you need a hemisphere with more flexibility in the number of sides, use my hemisphere() function instead, on which this octahedral version is based.

##Usage

To use this, simply put this file in the directory where you keep .scad files, and include this line in your other .scad files:

use <octsphere.scad>

Modular syntax to make a sphere is exactly like OpenSCAD sphere():

octsphere(<radius|r=radius|d=diameter> [, <$fa|$fs|$fn>=number]);

Adding the parameter hemisphere=true creates a hemisphere instead. For example:

// geodesic sphere, radius 20, 32-side polygons on 3 axes
octsphere(r=20, $fn=32);

// same thing but a hemisphere, the top half of a sphere
octsphere(r=20, hemisphere=true, $fn=32);

Functional syntax: You may call octsphere() as a function, which returns an array of polyhedron vertices and faces, any of the following ways:

ph_array = octsphere(radius);
ph_array = octsphere(r=radius);
ph_array = octsphere(d=diameter);

Again, the parameter hemisphere=true can be included to create a hemisphere instead.

The above examples return an array with ph_array[0] being a list of 3D vertices and ph_array[1] being a list of faces. You can manipulate the vertices (saving everything in another vertex array) and call polyhedron(), passing the new vertex array and original face array as arguments. In this way you can create spheres with distortions.

The number of sides in the sphere's equator is controlled by the $fa, $fs, and $fn special variables; e.g. $fn=32 for a sphere with a 32-sided equator. It should not be necessary to go beyond $fn=128. Other values of $fn result in spheres having the nearest number of sides to 4, 8, 16, 32, 64, 128, ... 4×2n.

License:

Creative Commons - Public Domain Dedication

Related Models

Customizable Geodesic Kitchen Sink Drain Strainer preview image

Customizable Geodesic Kitchen Sink Drain Strainer

EduardoFoltran profile image

EduardoFoltran

10,035

Geodesic Dome Cat House - Pine Tree Cutouts preview image

Geodesic Dome Cat House - Pine Tree Cutouts

Dean Rogers profile image

Dean Rogers

7,703

You Rock! Ornament preview image

You Rock! Ornament

Jackehboy profile image

Jackehboy

3

Geodesic Dome Cat House preview image

Geodesic Dome Cat House

Abby575 profile image

Abby575

5,115

EPCOT Spaceship Earth preview image

EPCOT Spaceship Earth

Adafruit profile image

Adafruit

2,706

Geodesic D20 Dome preview image

Geodesic D20 Dome

SpyrosPante profile image

SpyrosPante

177