OpenSCAD Code for Maya Rope Sculpture


Download: "mayarope.STL" (1.45 MB)

Based on the image you uploaded, here is a description of what it shows:


The image features an abstract, three-dimensional sculpture. It is composed of thick, continuous, rope-like strands that twist, fold, and loop around one another in a complex, knotted formation. The material has a highly textured appearance, resembling tightly bundled fibers, woven fabric, or ribbed cord, with fine parallel lines running along the length of the strands.


The color palette is mostly composed of muted earth tones, primarily beige, cream, and light brown, with deeper shadows in the crevices that give the structure a strong sense of depth and volume. The sculpture rests on a flat, thin horizontal base or platform, set against a plain background with a subtle light-to-dark gradient.




That is a spot-on description of the sculpture in `omni-fd14624c-1085-4eb4-b6fe-26fd36af1b83.jpg`! The complex, knotted structure and deep textured crevices give it a fantastic sense of volume and presence.


Because of its distinct shadows and solid horizontal base, it would be a perfect candidate to process through Trellis GGUF to generate a GLB file locally. Once it is converted into a manifold 3D mesh, it could easily be placed into a virtual gallery layout to visualize how those earth-tone strands and ribbed textures interact with directed architectural lighting.


Would you like to focus on prepping this specific image for local 3D generation, or would you rather explore writing some OpenSCAD code to procedurally recreate this twisting, rope-like aesthetic from scratch?



OpenSCAD code to procedurally recreate this twisting, rope-like aesthetic from scratch



To procedurally recreate this complex, twisting aesthetic in pure OpenSCAD, we need to tackle two main challenges: generating a continuous, tangled 3D path, and sweeping a ribbed, rope-like texture along that path while ensuring the final output is a completely manifold mesh ready for 3D printing.


Instead of relying on external libraries for 2D sweeps (which can sometimes produce non-manifold geometry), we can build this by calculating a parametric curve—like a Torus Knot—and using a hull() chain between clusters of 3D spheres. This guarantees a solid, printable object.


Here is the OpenSCAD code to generate the sculpture.



The OpenSCAD Generator

Copy and paste this into a new OpenSCAD file. Be aware that because it calculates hundreds of 3D hull() operations to create the smooth sweeping effect, it may take a minute or two to render (F5) and fully compile (F6).



// Parametric Tangled Rope Sculpture

// Generates a continuous, ribbed, twisting manifold mesh


$fn = 16; // Keep resolution low for the spheres to speed up rendering


// --- Path Parameters (The Tangle) ---

// Adjust p and q to change the complexity of the knot

p = 3; // Winds around the symmetry axis

q = 7; // Winds through the central hole

radius = 40;     // Overall width of the sculpture

tube_radius = 8; // Thickness of the main rope path


// --- Texture Parameters (The Rope) ---

strands = 6;           // Number of individual fibers/ribs making up the rope

strand_radius = 3.5;   // Thickness of each individual fiber

twist_rate = 12;       // How tightly the fibers twist along the path


// --- Render Settings ---

steps = 300; // Number of segments. Increase for smoother curves (increases render time)


// Function to calculate a 3D point on a parametric Torus Knot

function knot_point(t) = [

    radius * cos(p * t) + tube_radius * cos(q * t) * cos(p * t),

    radius * sin(p * t) + tube_radius * cos(q * t) * sin(p * t),

    tube_radius * sin(q * t)

];


// Module to draw one cross-sectional "slice" of the rope (a cluster of spheres)

module rope_slice(t) {

    pos = knot_point(t);

    

    // Calculate the tangent vector to orient the slice correctly along the path

    delta = 0.1;

    pos_next = knot_point(t + delta);

    vec = pos_next - pos;

    

    // Convert the vector into Euler rotation angles (Azimuth and Declination)

    azimuth = atan2(vec.y, vec.x);

    declination = atan2(sqrt(pow(vec.x, 2) + pow(vec.y, 2)), vec.z);

    

    translate(pos)

    rotate([0, 0, azimuth])

    rotate([0, declination, 0])

    rotate([0, 0, t * twist_rate]) // Apply the internal twisting of the rope

    for (i = [0 : strands - 1]) {

        angle = (360 / strands) * i;

        // Position each fiber in a ring around the center of the path

        translate([cos(angle) * (tube_radius - strand_radius), sin(angle) * (tube_radius - strand_radius), 0])

        sphere(r = strand_radius);

    }

}


// Assemble the sculpture

union() {

    // Generate the twisted rope using a continuous hull chain

    for (i = [0 : steps - 1]) {

        t1 = i * (360 / steps);

        t2 = (i + 1) * (360 / steps);

        

        hull() {

            rope_slice(t1);

            rope_slice(t2);

        }

    }

    

    // Add the minimalist gallery base 

    translate([0, 0, -radius - tube_radius - 2])

    cylinder(h = 2, r = radius * 1.5, $fn = 64);

}






To procedurally recreate this complex, twisting aesthetic in pure OpenSCAD, we need to tackle two main challenges: generating a continuous, tangled 3D path, and sweeping a ribbed, rope-like texture along that path while ensuring the final output is a completely manifold mesh ready for 3D printing.


Instead of relying on external libraries for 2D sweeps (which can sometimes produce non-manifold geometry), we can build this by calculating a parametric curve—like a Torus Knot—and using a `hull()` chain between clusters of 3D spheres. This guarantees a solid, printable object.


Here is the OpenSCAD code to generate the sculpture.


### The OpenSCAD Generator


Copy and paste this into a new OpenSCAD file. Be aware that because it calculates hundreds of 3D `hull()` operations to create the smooth sweeping effect, it may take a minute or two to render (`F5`) and fully compile (`F6`).


```openscad

// Parametric Tangled Rope Sculpture

// Generates a continuous, ribbed, twisting manifold mesh


$fn = 16; // Keep resolution low for the spheres to speed up rendering


// --- Path Parameters (The Tangle) ---

// Adjust p and q to change the complexity of the knot

p = 3; // Winds around the symmetry axis

q = 7; // Winds through the central hole

radius = 40;     // Overall width of the sculpture

tube_radius = 8; // Thickness of the main rope path


// --- Texture Parameters (The Rope) ---

strands = 6;           // Number of individual fibers/ribs making up the rope

strand_radius = 3.5;   // Thickness of each individual fiber

twist_rate = 12;       // How tightly the fibers twist along the path


// --- Render Settings ---

steps = 300; // Number of segments. Increase for smoother curves (increases render time)


// Function to calculate a 3D point on a parametric Torus Knot

function knot_point(t) = [

    radius * cos(p * t) + tube_radius * cos(q * t) * cos(p * t),

    radius * sin(p * t) + tube_radius * cos(q * t) * sin(p * t),

    tube_radius * sin(q * t)

];


// Module to draw one cross-sectional "slice" of the rope (a cluster of spheres)

module rope_slice(t) {

    pos = knot_point(t);

    

    // Calculate the tangent vector to orient the slice correctly along the path

    delta = 0.1;

    pos_next = knot_point(t + delta);

    vec = pos_next - pos;

    

    // Convert the vector into Euler rotation angles (Azimuth and Declination)

    azimuth = atan2(vec.y, vec.x);

    declination = atan2(sqrt(pow(vec.x, 2) + pow(vec.y, 2)), vec.z);

    

    translate(pos)

    rotate([0, 0, azimuth])

    rotate([0, declination, 0])

    rotate([0, 0, t * twist_rate]) // Apply the internal twisting of the rope

    for (i = [0 : strands - 1]) {

        angle = (360 / strands) * i;

        // Position each fiber in a ring around the center of the path

        translate([cos(angle) * (tube_radius - strand_radius), sin(angle) * (tube_radius - strand_radius), 0])

        sphere(r = strand_radius);

    }

}


// Assemble the sculpture

union() {

    // Generate the twisted rope using a continuous hull chain

    for (i = [0 : steps - 1]) {

        t1 = i * (360 / steps);

        t2 = (i + 1) * (360 / steps);

        

        hull() {

            rope_slice(t1);

            rope_slice(t2);

        }

    }

    

    // Add the minimalist gallery base 

    translate([0, 0, -radius - tube_radius - 2])

    cylinder(h = 2, r = radius * 1.5, $fn = 64);

}


```


### How to Customize the Aesthetic


By tweaking the variables at the top of the script, you can drastically alter the final look of the mesh:


* **Change the Tangling (`p` and `q`):** These define the mathematical knot. Try setting `p = 2` and `q = 3` for a classic, simpler Trefoil knot, or push them higher (like `p = 4`, `q = 9`) for a much denser, chaotic tangle. Ensure `p` and `q` are coprime (share no common factors) for a single, continuous, unbroken loop.

* **Alter the Texture (`strands` and `strand_radius`):** To get the micro-ribbed fabric look from your reference image, increase `strands` to `12` or `15` and drop the `strand_radius` down to `1.5` or `2`.

* **Adjust the Twist (`twist_rate`):** Increasing this number will tightly coil the fibers around the core path, making it look like high-tension industrial cable. Decreasing it will give it a looser, flowing fabric feel.


No comments:

Post a Comment

Note: only a member of this blog may post a comment.