discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

Chiseled Font?

AC
A. Craig West
Tue, Feb 18, 2020 8:01 PM

I usually scale by -1 in the appropriate dimension for things like this

On Tue, 18 Feb 2020, 14:40 , lar3ry@sasktel.net wrote:

On 18 Feb 2020 at 13:10, Lee A wrote:

I have wanted to play with something similar. The issue is this will be
read from the bottom, so each letter has to be flipped over. If you just
rotate the slope goes the wrong way. So how do you make the letter
appear backwards?

Just add a rotate() before the text.

res = 2;    // Levels per unit height
slope=0.2;  // Units out per vertical unit
size=20;    // Height of font
height=10;  // Height of extruded letters

levels = height * res;

for (i=[0:levels-1]) {
linear_extrude(height=(height-i/res))
offset((i/res)*slope)
rotate([180,0,0])
text("hello", size=size);
}


OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

I usually scale by -1 in the appropriate dimension for things like this On Tue, 18 Feb 2020, 14:40 , <lar3ry@sasktel.net> wrote: > On 18 Feb 2020 at 13:10, Lee A wrote: > > > I have wanted to play with something similar. The issue is this will be > > read from the bottom, so each letter has to be flipped over. If you just > > rotate the slope goes the wrong way. So how do you make the letter > > appear backwards? > > Just add a rotate() before the text. > > res = 2; // Levels per unit height > slope=0.2; // Units out per vertical unit > size=20; // Height of font > height=10; // Height of extruded letters > > levels = height * res; > > for (i=[0:levels-1]) { > linear_extrude(height=(height-i/res)) > offset((i/res)*slope) > rotate([180,0,0]) > text("hello", size=size); > } > > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org >
LA
Lee A
Tue, Feb 18, 2020 8:15 PM

Duh, I did it wrong.
Thanks

On 2/18/2020 1:39 PM, lar3ry@sasktel.net wrote:

res = 2;    // Levels per unit height
slope=0.2;  // Units out per vertical unit
size=20;    // Height of font
height=10;  // Height of extruded letters

levels = height * res;

for (i=[0:levels-1]) {
linear_extrude(height=(height-i/res))
offset((i/res)*slope)
rotate([180,0,0])
text("hello", size=size);
}

Duh, I did it wrong. Thanks On 2/18/2020 1:39 PM, lar3ry@sasktel.net wrote: > res = 2; // Levels per unit height > slope=0.2; // Units out per vertical unit > size=20; // Height of font > height=10; // Height of extruded letters > > levels = height * res; > > for (i=[0:levels-1]) { > linear_extrude(height=(height-i/res)) > offset((i/res)*slope) > rotate([180,0,0]) > text("hello", size=size); > }
JB
Jordan Brown
Tue, Feb 18, 2020 11:50 PM

On 2/18/2020 12:01 PM, A. Craig West wrote:

I usually scale by -1 in the appropriate dimension for things like this

The manual specifically warns against negative scales.

https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Transformations#scale

Note: Do not use negative scale values. Negative scale values appear
to work for previews, but they lead to unpredictable errors when
rendering through CGAL. Use the mirror() function instead.

And indeed, sticking a "mirror" on the front does the right thing.

res = 2;    // Levels per unit height
slope=0.2;  // Units out per vertical unit
size=20;    // Height of font
height=10;  // Height of extruded letters

levels = height * res;

mirror([0,0,1]) {
    for (i=[0:levels-1]) {
        linear_extrude(height=(height-i/res))
            offset((i/res)*slope)
            text("hello", size=size);
    }
}

Although the shape produced is the same, I'd prefer this to rotating the
text, for two reasons:

1)  The result is readable.  Yes, you'd then want to rotate it to put it
on the bottom, but you could also use it on the top or some other
surface, with more obvious transformations.

2)  text() yields a 2D object.  Rotating a 2D object around X or Y, so
that it comes out of the Z=0 plane, seems ... wrong.  It seems like it
yields an object that is in some sense no longer 2D.  Yes, it ends up
back at Z=0, but it seems like an incorrect operation to perform on a 2D
object.

Here's an example of using this pattern on all sides of a cube:

res = 2;    // Levels per unit height
slope=0.15;  // Units out per vertical unit
size=20;    // Height of font
height=10;  // Height of extruded letters

levels = height * res;

epsilon = 0.01;

module engrave(t) {    
    mirror([0,0,1]) {
        for (i=[0:levels-1]) {
            linear_extrude(height=(height-i/res))
                offset((i/res)*slope)
                text(t, size=size, halign="center", valign="center");
        }
    }
}

difference() {
    cube(60, center=true);
    translate([0,0,30+epsilon]) engrave("hello");
    translate([0,30+epsilon,0]) rotate([-90,0,0]) engrave("hello");
    translate([0,-(30+epsilon),0]) rotate([90,0,0]) engrave("hello");
    translate([30+epsilon,0,0]) rotate([0,90,0]) engrave("hello");
    translate([-(30+epsilon),0,0]) rotate([0,-90,0]) engrave("hello");
    translate([0,0,-(30+epsilon)]) rotate([180,0,0]) engrave("hello");
}

Note:  that was very slow to display in preview, and took almost 17
minutes to render.  I haven't tried to figure out exactly why.

On 2/18/2020 12:01 PM, A. Craig West wrote: > I usually scale by -1 in the appropriate dimension for things like this The manual specifically warns against negative scales. https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Transformations#scale Note: Do not use negative scale values. Negative scale values appear to work for previews, but they lead to unpredictable errors when rendering through CGAL. Use the mirror() function instead. And indeed, sticking a "mirror" on the front does the right thing. res = 2; // Levels per unit height slope=0.2; // Units out per vertical unit size=20; // Height of font height=10; // Height of extruded letters levels = height * res; mirror([0,0,1]) { for (i=[0:levels-1]) { linear_extrude(height=(height-i/res)) offset((i/res)*slope) text("hello", size=size); } } Although the shape produced is the same, I'd prefer this to rotating the text, for two reasons: 1)  The result is readable.  Yes, you'd then want to rotate it to put it on the bottom, but you could also use it on the top or some other surface, with more obvious transformations. 2)  text() yields a 2D object.  Rotating a 2D object around X or Y, so that it comes out of the Z=0 plane, seems ... wrong.  It seems like it yields an object that is in some sense no longer 2D.  Yes, it ends up back at Z=0, but it seems like an incorrect operation to perform on a 2D object. Here's an example of using this pattern on all sides of a cube: res = 2; // Levels per unit height slope=0.15; // Units out per vertical unit size=20; // Height of font height=10; // Height of extruded letters levels = height * res; epsilon = 0.01; module engrave(t) { mirror([0,0,1]) { for (i=[0:levels-1]) { linear_extrude(height=(height-i/res)) offset((i/res)*slope) text(t, size=size, halign="center", valign="center"); } } } difference() { cube(60, center=true); translate([0,0,30+epsilon]) engrave("hello"); translate([0,30+epsilon,0]) rotate([-90,0,0]) engrave("hello"); translate([0,-(30+epsilon),0]) rotate([90,0,0]) engrave("hello"); translate([30+epsilon,0,0]) rotate([0,90,0]) engrave("hello"); translate([-(30+epsilon),0,0]) rotate([0,-90,0]) engrave("hello"); translate([0,0,-(30+epsilon)]) rotate([180,0,0]) engrave("hello"); } Note:  that was very slow to display in preview, and took almost 17 minutes to render.  I haven't tried to figure out exactly why.
P
Parkinbot
Wed, Feb 19, 2020 4:36 PM

JordanBrown wrote

On 2/18/2020 12:01 PM, A. Craig West wrote:

I usually scale by -1 in the appropriate dimension for things like this

The manual specifically warns against negative scales.

This opinion has come up several times in different threads - and I never
understood why, or found an example, why it shouldn't work. That it is
mentioned in the manual, doesn't prove that it is correct. Look at the
following:

mirror([0,0,1])
cube(1);

scale([1,1,-1])
cube(1);

after F5 the cfg file reads like this:

multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, -1, 0], [0, 0, 0, 1]]) {
cube(size = [1, 1, 1], center = false);
}
multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, -1, 0], [0, 0, 0, 1]]) {
cube(size = [1, 1, 1], center = false);
}

You can also check the other dimensions.
If negative values for such basic operation like scale were "forbidden" for
some reason, OpenSCAD should give at least a warning - and not rely on a
dubious "best practice" hint in the manual.

--
Sent from: http://forum.openscad.org/

JordanBrown wrote > On 2/18/2020 12:01 PM, A. Craig West wrote: >> I usually scale by -1 in the appropriate dimension for things like this > > The manual specifically warns against negative scales. This opinion has come up several times in different threads - and I never understood why, or found an example, why it shouldn't work. That it is mentioned in the manual, doesn't prove that it is correct. Look at the following: mirror([0,0,1]) cube(1); scale([1,1,-1]) cube(1); after F5 the cfg file reads like this: multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, -1, 0], [0, 0, 0, 1]]) { cube(size = [1, 1, 1], center = false); } multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, -1, 0], [0, 0, 0, 1]]) { cube(size = [1, 1, 1], center = false); } You can also check the other dimensions. If negative values for such basic operation like scale were "forbidden" for some reason, OpenSCAD should give at least a warning - and not rely on a dubious "best practice" hint in the manual. -- Sent from: http://forum.openscad.org/
T
TLC123
Wed, Feb 19, 2020 5:32 PM

Have a look at this:
Linear extrude offset
https://github.com/openscad/openscad/pull/2079

--
Sent from: http://forum.openscad.org/

Have a look at this: Linear extrude offset https://github.com/openscad/openscad/pull/2079 -- Sent from: http://forum.openscad.org/
N
NateTG
Wed, Feb 19, 2020 5:45 PM

I did some fancy stuff generating text chamfers, but OpenSCAD doesn't give
good access to text geometry so I had to extract that from postscript.

http://forum.openscad.org/Chamfered-3D-text-td23162.html

--
Sent from: http://forum.openscad.org/

I did some fancy stuff generating text chamfers, but OpenSCAD doesn't give good access to text geometry so I had to extract that from postscript. http://forum.openscad.org/Chamfered-3D-text-td23162.html -- Sent from: http://forum.openscad.org/
NH
nop head
Wed, Feb 19, 2020 5:55 PM

Doesn't scale with -1 turn the object inside out because it flips the
vertices without fixing the winding order that gets reversed by the flip?

On Wed, 19 Feb 2020 at 17:45, NateTG nate-openscadforum@pedantic.org
wrote:

I did some fancy stuff generating text chamfers, but OpenSCAD doesn't give
good access to text geometry so I had to extract that from postscript.

http://forum.openscad.org/Chamfered-3D-text-td23162.html

--
Sent from: http://forum.openscad.org/


OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

Doesn't scale with -1 turn the object inside out because it flips the vertices without fixing the winding order that gets reversed by the flip? On Wed, 19 Feb 2020 at 17:45, NateTG <nate-openscadforum@pedantic.org> wrote: > I did some fancy stuff generating text chamfers, but OpenSCAD doesn't give > good access to text geometry so I had to extract that from postscript. > > http://forum.openscad.org/Chamfered-3D-text-td23162.html > > > > > > -- > Sent from: http://forum.openscad.org/ > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org >
JB
Jordan Brown
Wed, Feb 19, 2020 6:28 PM

On 2/19/2020 8:36 AM, Parkinbot wrote:

If negative values for such basic operation like scale were
"forbidden" for some reason, OpenSCAD should give at least a warning -
and not rely on a dubious "best practice" hint in the manual.

I agree.  I'm only reporting what it says.  Indeed, I'd expect a
negative scale to be exactly equivalent to a mirror, once you turn it
all into a transformation matrix.

The caution was added by an anonymous user in January 2017.  It's
entirely possible that they ran into some rendering problem that was
unrelated, and blamed the wrong piece.

https://en.wikibooks.org/w/index.php?title=OpenSCAD_User_Manual/Transformations&diff=prev&oldid=3173552

Perhaps one of the people who is familiar with the internals can comment.

On 2/19/2020 8:36 AM, Parkinbot wrote: > If negative values for such basic operation like scale were > "forbidden" for some reason, OpenSCAD should give at least a warning - > and not rely on a dubious "best practice" hint in the manual. I agree.  I'm only reporting what it says.  Indeed, I'd expect a negative scale to be exactly equivalent to a mirror, once you turn it all into a transformation matrix. The caution was added by an anonymous user in January 2017.  It's entirely possible that they ran into some rendering problem that was unrelated, and blamed the wrong piece. https://en.wikibooks.org/w/index.php?title=OpenSCAD_User_Manual/Transformations&diff=prev&oldid=3173552 Perhaps one of the people who is familiar with the internals can comment.
JB
Jordan Brown
Wed, Feb 19, 2020 6:48 PM

On 2/19/2020 9:55 AM, nop head wrote:

Doesn't scale with -1 turn the object inside out because it flips the
vertices without fixing the winding order that gets reversed by the flip?

That was my guess, but I didn't see any evidence of it when I flipped a
cube and looked at Thrown Together.  But I don't really understand that
aspect of the system.

On 2/19/2020 9:55 AM, nop head wrote: > Doesn't scale with -1 turn the object inside out because it flips the > vertices without fixing the winding order that gets reversed by the flip? > That was my guess, but I didn't see any evidence of it when I flipped a cube and looked at Thrown Together.  But I don't really understand that aspect of the system.
AC
A. Craig West
Wed, Feb 19, 2020 6:51 PM

Mirror is likely to have the same effect, though. Unless it explicitly
reverses the winding order, which would only be required depending on
exactly how it is mirrored

On Wed, 19 Feb 2020, 13:48 Jordan Brown, openscad@jordan.maileater.net
wrote:

On 2/19/2020 9:55 AM, nop head wrote:

Doesn't scale with -1 turn the object inside out because it flips the
vertices without fixing the winding order that gets reversed by the flip?

That was my guess, but I didn't see any evidence of it when I flipped a
cube and looked at Thrown Together.  But I don't really understand that
aspect of the system.


OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

Mirror is likely to have the same effect, though. Unless it explicitly reverses the winding order, which would only be required depending on exactly how it is mirrored On Wed, 19 Feb 2020, 13:48 Jordan Brown, <openscad@jordan.maileater.net> wrote: > On 2/19/2020 9:55 AM, nop head wrote: > > Doesn't scale with -1 turn the object inside out because it flips the > vertices without fixing the winding order that gets reversed by the flip? > > > > That was my guess, but I didn't see any evidence of it when I flipped a > cube and looked at Thrown Together. But I don't really understand that > aspect of the system. > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org >