<p>I can't say if this is better than your method, but it is a library resource specific to your requirements.</p>
<p><a href="https://github.com/brodykenrick/text_on_OpenSCAD" rel="nofollow noreferrer">Text_on OpenSCAD</a></p>
<p>The library covers various shapes, including cylindrical:</p>
<p><a href="https://i.sstatic.net/PAvVb.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/PAvVb.png" alt="text on cylinders" /></a></p>
<p>Image from linked site. Also from the site: &quot;Only works with OpenSCAD v 2014.xx and later...&quot;</p>
<p>Pursuant to the comments, another step may provide the desired result. Thinking for the cylinder primitive, once the text is placed and protruding a sufficient amount, creating a difference() with the inner cut location an appropriate distance from the primary cylinder should create curved surfaces to the text.</p>
<p>Envision a cylinder slightly smaller in diameter than an appropriate piece of pipe. As the pipe is lowered onto the cylinder, the text is &quot;shaved&quot; away. The &quot;shaving pipe&quot; outer diameter is insignificant, as long as it's not too thin, and the inner diameter of that pipe is dependent on the diameter of the primitive and the desired height of the curved text.</p>

CC BY-SA 4.0
2022-05-12T22:04:34.127Z
As far as I can see it doesn't bend characters, it just puts each character on it's own plane, that's not what I want.
mugiseyebrows
CC BY-SA 4.0
2022-05-12T22:45:43.373Z
That's a distinction I overlooked, thanks for the clarification. It makes your creation all the more impressive. Is there a means to remove the slices from the creation?
fred_dot_u
CC BY-SA 4.0
2022-05-13T07:43:01.490Z
yes, slices can be removed, I have used cube to split text to pieces, I should've used triangle prism
mugiseyebrows
CC BY-SA 4.0
2022-05-12T21:56:01.647Z
2023-10-12T19:22:44.590Z
2023-10-12T19:22:44.590Z
fred_dot_u
<p>The workflow you're using is the only way I'm aware of, and it's at least respectable. You can abstract it as a module to apply to arbitrary children to make it somewhat less ugly and more reusable.</p>
<p>In theory, I think it should be possible to make an openscad transformation (in openscad itself, not in the scad language) that applies to arbitrary 3D objects by performing a 2D conformal map in each cross section perpendicular to a given axis, to achieve effects like this, without the possibility of breaking geometry. But I'm not aware of anyone working on that. I'll probably propose it at some point, and hopefully it won't get shot down as mathematically unsound (which it might be; I'm not sure).</p>

CC BY-SA 4.0
2022-05-12T21:55:31.493Z
2022-05-12T21:55:31.493Z
R.. GitHub STOP HELPING ICE
<p>another way may be a simple <code>intersection()</code>
(inspired by this discussion: <a href="https://stackoverflow.com/questions/54115749/how-to-a-make-a-curved-sheet-cube-in-openscad">How to a make a curved sheet (cube) in OpenSCAD?</a>)</p>
<pre><code>$fn=200;
w = 30;       // width of rectangle
h = 1;       // height of rectangle
l = 10;      // length of chord of the curve
dh = 10;           // delta height of the curve

module curve(width, height, length, dh) {
    r = (pow(length/2, 2) + pow(dh, 2))/(2*dh);
    a = 2*asin((length/2)/r);
    translate([-(r -dh), 0, -width/2]) rotate([0, 0, -a/2])         rotate_extrude(angle = a) translate([r, 0, 0]) square(size = [height, width], center = true);
}

intersection(){
    rotate([0,270,0]) curve(w, h, l, dh);
    translate([2,-3,0]) linear_extrude (height = 15) text(&quot;TEST&quot;, size = 6 );
}
</code></pre>
<p><a href="https://i.sstatic.net/cUefNsgY.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/cUefNsgY.png" alt="before intersection" /></a>
<a href="https://i.sstatic.net/6MsZHpBM.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/6MsZHpBM.png" alt="final result" /></a></p>

CC BY-SA 4.0
2024-06-23T09:37:19.380Z
2024-06-23T09:37:19.380Z
julien
<p>I want to put relief text on curved surface but can't find way to do that in OpenSCAD. I'm aware it's possible to bend text in Blender and then <code>import stl</code>, but I don't like this workflow. I found sort of working solution but it's not perfect.</p>
<pre><code>$fn=50;

module bend_text(caption, angle, text_height, text_width, text_depth, steps=10, k=1) {
    dh = text_height / steps;
    r = text_height / (angle * PI / 180);
    h0 = - text_height / 2;
    translate([0, 0, -r])
    rotate([angle / 2, 0, 0])
    for(i=[0:steps-1]) {
        rotate([-i * angle/steps, 0, 0])
        translate([0, -(dh * i + h0), r / k])
        intersection() {
            linear_extrude(text_depth) 
                text(caption, valign=&quot;center&quot;, halign=&quot;center&quot;);
            translate([0, dh * i + h0, 0]) 
                cube([text_width, dh, text_width], center=true);
        }
    }
}

bend_text(&quot;test&quot;, angle=90, text_height=9, text_width=30, text_depth=1, steps=10, k=1.1);
</code></pre>
<p><a href="https://i.sstatic.net/0zq1h.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/0zq1h.png" alt="test" /></a></p>
<p>Is there better way?</p>

CC BY-SA 4.0
2022-05-16T11:46:59.310Z
This is a 3DPrinting stack not a CAD stack, mentioning the relevance to 3D printing is required, from [on-topic](https://3dprinting.stackexchange.com/help/on-topic) :`If a CAD question is related to 3D printing then it is on-topic. However, general CAD questions, unrelated to 3D printing, are not on-topic.` Very interesting question though! Mentioning that bending the text is required when text is projected onto small radii else there might be gaps under the letters that prevent proper printing.
0scar
<openscad>
Can OpenSCAD bend text (project it on curved surface)?
mugiseyebrows
# Can OpenSCAD bend text (project it on curved surface)?

(Asked by: username_0 on 2022-05-12)

I want to put relief text on curved surface but can't find way to do that in OpenSCAD. I'm aware it's possible to bend text in Blender and then `import stl`, but I don't like this workflow. I found sort of working solution but it's not perfect.

```
$fn=50;

module bend_text(caption, angle, text_height, text_width, text_depth, steps=10, k=1) {
    dh = text_height / steps;
    r = text_height / (angle * PI / 180);
    h0 = - text_height / 2;
    translate([0, 0, -r])
    rotate([angle / 2, 0, 0])
    for(i=[0:steps-1]) {
        rotate([-i * angle/steps, 0, 0])
        translate([0, -(dh * i + h0), r / k])
        intersection() {
            linear_extrude(text_depth) 
                text(caption, valign="center", halign="center");
            translate([0, dh * i + h0, 0]) 
                cube([text_width, dh, text_width], center=true);
        }
    }
}

bend_text("test", angle=90, text_height=9, text_width=30, text_depth=1, steps=10, k=1.1);

```

[![test](https://i.sstatic.net/0zq1h.png)](https://i.sstatic.net/0zq1h.png)

Is there better way?

**Tags:** openscad

> **Comments:**
> **username_1**: This is a 3DPrinting stack not a CAD stack, mentioning the relevance to 3D printing is required, from [on-topic](https://3dprinting.stackexchange.com/help/on-topic) :`If a CAD question is related to 3D printing then it is on-topic. However, general CAD questions, unrelated to 3D printing, are not on-topic.` Very interesting question though! Mentioning that bending the text is required when text is projected onto small radii else there might be gaps under the letters that prevent proper printing.  

---

## 3 answers

### Answer by username_4 on 2024-06-23. Score: 4 | Accepted answer

another way may be a simple `intersection()`
(inspired by this discussion: [How to a make a curved sheet (cube) in OpenSCAD?](https://stackoverflow.com/questions/54115749/how-to-a-make-a-curved-sheet-cube-in-openscad))

```
$fn=200;
w = 30;       // width of rectangle
h = 1;       // height of rectangle
l = 10;      // length of chord of the curve
dh = 10;           // delta height of the curve

module curve(width, height, length, dh) {
    r = (pow(length/2, 2) + pow(dh, 2))/(2*dh);
    a = 2*asin((length/2)/r);
    translate([-(r -dh), 0, -width/2]) rotate([0, 0, -a/2])         rotate_extrude(angle = a) translate([r, 0, 0]) square(size = [height, width], center = true);
}

intersection(){
    rotate([0,270,0]) curve(w, h, l, dh);
    translate([2,-3,0]) linear_extrude (height = 15) text("TEST", size = 6 );
}

```

[![before intersection](https://i.sstatic.net/cUefNsgY.png)](https://i.sstatic.net/cUefNsgY.png)
[![final result](https://i.sstatic.net/6MsZHpBM.png)](https://i.sstatic.net/6MsZHpBM.png)


---

### Answer by username_2 on 2022-05-12. Score: 3

I can't say if this is better than your method, but it is a library resource specific to your requirements.

[Text\_on OpenSCAD](https://github.com/brodykenrick/text_on_OpenSCAD)

The library covers various shapes, including cylindrical:

[![text on cylinders](https://i.sstatic.net/PAvVb.png)](https://i.sstatic.net/PAvVb.png)

Image from linked site. Also from the site: "Only works with OpenSCAD v 2014.xx and later..."

Pursuant to the comments, another step may provide the desired result. Thinking for the cylinder primitive, once the text is placed and protruding a sufficient amount, creating a difference() with the inner cut location an appropriate distance from the primary cylinder should create curved surfaces to the text.

Envision a cylinder slightly smaller in diameter than an appropriate piece of pipe. As the pipe is lowered onto the cylinder, the text is "shaved" away. The "shaving pipe" outer diameter is insignificant, as long as it's not too thin, and the inner diameter of that pipe is dependent on the diameter of the primitive and the desired height of the curved text.

> **Comments:**
> **username_0**: As far as I can see it doesn't bend characters, it just puts each character on it's own plane, that's not what I want.  
> **username_2**: That's a distinction I overlooked, thanks for the clarification. It makes your creation all the more impressive. Is there a means to remove the slices from the creation?  
> **username_0**: yes, slices can be removed, I have used cube to split text to pieces, I should've used triangle prism  

---

### Answer by username_3 on 2022-05-12. Score: 2

The workflow you're using is the only way I'm aware of, and it's at least respectable. You can abstract it as a module to apply to arbitrary children to make it somewhat less ugly and more reusable.

In theory, I think it should be possible to make an openscad transformation (in openscad itself, not in the scad language) that applies to arbitrary 3D objects by performing a 2D conformal map in each cross section perpendicular to a given axis, to achieve effects like this, without the possibility of breaking geometry. But I'm not aware of anyone working on that. I'll probably propose it at some point, and hopefully it won't get shot down as mathematically unsound (which it might be; I'm not sure).


---

