discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

Text on a dodecahedron

U
unkerjay
Wed, Jan 6, 2016 2:11 PM

Just curious.

Reading up, a little, and wondering.

Would it be possible to embed cr/lf (carriage return / line feed)
or "Enter" in the text (would Unicodes work for this)?

Something like:

"A-U000D-Partridge-U000D-in a-U000D-Pear Tree"

Probably got the syntax off.

Would something like that work?

--
View this message in context: http://forum.openscad.org/Text-on-a-dodecahedron-tp15409p15514.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

Just curious. Reading up, a little, and wondering. Would it be possible to embed cr/lf (carriage return / line feed) or "Enter" in the text (would Unicodes work for this)? Something like: "A-U000D-Partridge-U000D-in a-U000D-Pear Tree" Probably got the syntax off. Would something like that work? -- View this message in context: http://forum.openscad.org/Text-on-a-dodecahedron-tp15409p15514.html Sent from the OpenSCAD mailing list archive at Nabble.com.
TP
Torsten Paul
Wed, Jan 6, 2016 2:34 PM

On 01/06/2016 03:11 PM, unkerjay wrote:

Would it be possible to embed cr/lf (carriage return / line feed)
or "Enter" in the text (would Unicodes work for this)?

No, right now only the text shaping level is supported (using
the harfbuzz library). This means support for ligatures, script
languages and combining characters but no layouting.

Adding a newline to the text is no problem (e.g. using chr(13))
but it will just render the glyph that's defined in the selected
font, not produce an actual line break. In most cases that will
just be a dummy rectangle, some fonts may have a special glyph.

ciao,
Torsten.

On 01/06/2016 03:11 PM, unkerjay wrote: > Would it be possible to embed cr/lf (carriage return / line feed) > or "Enter" in the text (would Unicodes work for this)? > No, right now only the text shaping level is supported (using the harfbuzz library). This means support for ligatures, script languages and combining characters but no layouting. Adding a newline to the text is no problem (e.g. using chr(13)) but it will just render the glyph that's defined in the selected font, not produce an actual line break. In most cases that will just be a dummy rectangle, some fonts may have a special glyph. ciao, Torsten.
U
unkerjay
Wed, Jan 6, 2016 3:19 PM

In for a penny, in for a pound.

Here's what I'm shooting for.

It sort of works.  Sort of.

Not getting the third line.


strings = [["A Partridge","in a","Pear Tree"], ["2"," Turtle Doves"],
["3","French Hens"], ["4","Calling Birds"],
["5","Golden", "Rings"], ["6","Geese", "a-laying"],
["12","Drummers", "drumming"],["7","Swans", "a-swimming"],
["8","Maids", "a-milking"], ["9","Ladies",
"Dancing"],["10","Lords", "a-leaping"],["11","Pipers Piping"] ];

t_height = 7;

dodekaeder(40);

module dodekaeder(r = 40)
{
w = acos(1/sqrt(5));
rotate([0, 0, 180])
twosides(r, 0);
for(i=[0:4])
rotate([0, -w, i*72])  // tricky!
twosides(r, i+1);
}

module twosides(r=1, i=1)
{
h = r*2.618;
linear_extrude(height = h, twist = 36, center = true) // tricky twist
circle(r, $fn=5);

// text for upper and lower surface
translate([0, t_height, h/2])
linear_extrude(height = 1)
text(strings[i][0],halign = "center", valign = "center",
size=t_height);
translate([0, -t_height, h/2])
linear_extrude(height = 1)
text(strings[i][1],halign = "center", valign = "center",
size=t_height);
translate([1, -t_height, h/2])
linear_extrude(height = 1)
text(strings[i][2],halign = "center", valign = "center",
size=t_height);
//
rotate([0, 180, 0]) {
translate([0, t_height, h/2])
linear_extrude(height = 1)
text(strings[i+6][0],halign = "center", valign = "center",
size=t_height);
translate([0, -t_height, h/2])
linear_extrude(height = 1)
text(strings[i+6][1],halign = "center", valign = "center",
size=t_height);
translate([0, -t_height, h/2])
linear_extrude(height = 1)
text(strings[i+6][2],halign = "center", valign = "center",
size=t_height);
}
}

--
View this message in context: http://forum.openscad.org/Text-on-a-dodecahedron-tp15409p15516.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

In for a penny, in for a pound. Here's what I'm shooting for. It sort of works. Sort of. Not getting the third line. --- strings = [["A Partridge","in a","Pear Tree"], ["2"," Turtle Doves"], ["3","French Hens"], ["4","Calling Birds"], ["5","Golden", "Rings"], ["6","Geese", "a-laying"], ["12","Drummers", "drumming"],["7","Swans", "a-swimming"], ["8","Maids", "a-milking"], ["9","Ladies", "Dancing"],["10","Lords", "a-leaping"],["11","Pipers Piping"] ]; t_height = 7; dodekaeder(40); module dodekaeder(r = 40) { w = acos(1/sqrt(5)); rotate([0, 0, 180]) twosides(r, 0); for(i=[0:4]) rotate([0, -w, i*72]) // tricky! twosides(r, i+1); } module twosides(r=1, i=1) { h = r*2.618; linear_extrude(height = h, twist = 36, center = true) // tricky twist circle(r, $fn=5); // text for upper and lower surface translate([0, t_height, h/2]) linear_extrude(height = 1) text(strings[i][0],halign = "center", valign = "center", size=t_height); translate([0, -t_height, h/2]) linear_extrude(height = 1) text(strings[i][1],halign = "center", valign = "center", size=t_height); translate([1, -t_height, h/2]) linear_extrude(height = 1) text(strings[i][2],halign = "center", valign = "center", size=t_height); // rotate([0, 180, 0]) { translate([0, t_height, h/2]) linear_extrude(height = 1) text(strings[i+6][0],halign = "center", valign = "center", size=t_height); translate([0, -t_height, h/2]) linear_extrude(height = 1) text(strings[i+6][1],halign = "center", valign = "center", size=t_height); translate([0, -t_height, h/2]) linear_extrude(height = 1) text(strings[i+6][2],halign = "center", valign = "center", size=t_height); } } -- View this message in context: http://forum.openscad.org/Text-on-a-dodecahedron-tp15409p15516.html Sent from the OpenSCAD mailing list archive at Nabble.com.
DB
David Boyd
Wed, Jan 6, 2016 3:41 PM

Lines 37 and 51 should be -t_height*2.  The 2nd and 3rd lines are
overwriting each other.

On 1/6/16 10:19 AM, unkerjay wrote:

strings = [["A Partridge","in a","Pear Tree"], ["2"," Turtle Doves"],
["3","French Hens"], ["4","Calling Birds"],
["5","Golden", "Rings"], ["6","Geese", "a-laying"],
["12","Drummers", "drumming"],["7","Swans", "a-swimming"],
["8","Maids", "a-milking"], ["9","Ladies",
"Dancing"],["10","Lords", "a-leaping"],["11","Pipers Piping"] ];

t_height = 7;

dodekaeder(40);

module dodekaeder(r = 40)
{
w = acos(1/sqrt(5));
rotate([0, 0, 180])
twosides(r, 0);
for(i=[0:4])
rotate([0, -w, i*72])  // tricky!
twosides(r, i+1);
}

module twosides(r=1, i=1)
{
h = r*2.618;
linear_extrude(height = h, twist = 36, center = true) // tricky twist
circle(r, $fn=5);

// text for upper and lower surface
translate([0, t_height, h/2])
linear_extrude(height = 1)
      text(strings[i][0],halign = "center", valign = "center",

size=t_height);
translate([0, -t_height, h/2])
linear_extrude(height = 1)
text(strings[i][1],halign = "center", valign = "center",
size=t_height);
translate([1, -t_height, h/2])
linear_extrude(height = 1)
text(strings[i][2],halign = "center", valign = "center",
size=t_height);
//
rotate([0, 180, 0]) {
translate([0, t_height, h/2])
linear_extrude(height = 1)
text(strings[i+6][0],halign = "center", valign = "center",
size=t_height);
translate([0, -t_height, h/2])
linear_extrude(height = 1)
text(strings[i+6][1],halign = "center", valign = "center",
size=t_height);
translate([0, -t_height, h/2])
linear_extrude(height = 1)
text(strings[i+6][2],halign = "center", valign = "center",
size=t_height);
}
}

--
========= mailto:david.boyd@usstem.org ============
David W. Boyd
7371 Atlas Walk Way, #242
Gainesville, Va 20155
fax:    +1-703-656-4829
cell:    +1-703-402-7908
============== http://usstem.org/ ============
First Robotic Mentor - FRC, FTC - www.iliterobotics.org
Board Member- USSTEM Foundation - www.usstem.org
Program Assistant - USFIRST - www.usfirst.org

The information contained in this message may be privileged
and/or confidential and protected from disclosure.
If the reader of this message is not the intended recipient
or an employee or agent responsible for delivering this message
to the intended recipient, you are hereby notified that any
dissemination, distribution or copying of this communication
is strictly prohibited.  If you have received this communication
in error, please notify the sender immediately by replying to
this message and deleting the material from any computer.

Lines 37 and 51 should be -t_height*2. The 2nd and 3rd lines are overwriting each other. On 1/6/16 10:19 AM, unkerjay wrote: > strings = [["A Partridge","in a","Pear Tree"], ["2"," Turtle Doves"], > ["3","French Hens"], ["4","Calling Birds"], > ["5","Golden", "Rings"], ["6","Geese", "a-laying"], > ["12","Drummers", "drumming"],["7","Swans", "a-swimming"], > ["8","Maids", "a-milking"], ["9","Ladies", > "Dancing"],["10","Lords", "a-leaping"],["11","Pipers Piping"] ]; > > t_height = 7; > > dodekaeder(40); > > module dodekaeder(r = 40) > { > w = acos(1/sqrt(5)); > rotate([0, 0, 180]) > twosides(r, 0); > for(i=[0:4]) > rotate([0, -w, i*72]) // tricky! > twosides(r, i+1); > } > > module twosides(r=1, i=1) > { > h = r*2.618; > linear_extrude(height = h, twist = 36, center = true) // tricky twist > circle(r, $fn=5); > > // text for upper and lower surface > translate([0, t_height, h/2]) > linear_extrude(height = 1) > text(strings[i][0],halign = "center", valign = "center", > size=t_height); > translate([0, -t_height, h/2]) > linear_extrude(height = 1) > text(strings[i][1],halign = "center", valign = "center", > size=t_height); > translate([1, -t_height, h/2]) > linear_extrude(height = 1) > text(strings[i][2],halign = "center", valign = "center", > size=t_height); > // > rotate([0, 180, 0]) { > translate([0, t_height, h/2]) > linear_extrude(height = 1) > text(strings[i+6][0],halign = "center", valign = "center", > size=t_height); > translate([0, -t_height, h/2]) > linear_extrude(height = 1) > text(strings[i+6][1],halign = "center", valign = "center", > size=t_height); > translate([0, -t_height, h/2]) > linear_extrude(height = 1) > text(strings[i+6][2],halign = "center", valign = "center", > size=t_height); > } > } > -- ========= mailto:david.boyd@usstem.org ============ David W. Boyd 7371 Atlas Walk Way, #242 Gainesville, Va 20155 fax: +1-703-656-4829 cell: +1-703-402-7908 ============== http://usstem.org/ ============ First Robotic Mentor - FRC, FTC - www.iliterobotics.org Board Member- USSTEM Foundation - www.usstem.org Program Assistant - USFIRST - www.usfirst.org The information contained in this message may be privileged and/or confidential and protected from disclosure. If the reader of this message is not the intended recipient or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify the sender immediately by replying to this message and deleting the material from any computer.
P
Parkinbot
Wed, Jan 6, 2016 4:04 PM

It is always better to do a bit more structured programming to get more of
it. This code allowes for any number of centered lines ...

strings = [["A Partridge","in a","Pear Tree", "and a", "Unicorn"], ["2","
Turtle Doves"],
["3","French Hens"], ["4","Calling Birds"],
["5","Golden", "Rings"], ["6","Geese", "a-laying"],
["12","Drummers", "drumming"],["7","Swans", "a-swimming"],
["8","Maids", "a-milking"], ["9","Ladies",
"Dancing"],["10","Lords", "a-leaping"],["11","Pipers Piping"] ];

t_height = 7;

dodekaeder(40);

module dodekaeder(r = 40)
{
w = acos(1/sqrt(5));
rotate([0, 0, 180])
twosides(r, 0);
for(i=[0:4])
rotate([0, -w, i*72])  // tricky!
twosides(r, i+1);
}

module twosides(r=1, i=1)
{
h = r*2.618;
linear_extrude(height = h, twist = 36, center = true) // tricky twist
circle(r, $fn=5);

// text for upper and lower surface
translate([0, 0, h/2+1])
multilinetext(strings[i]);
rotate([0, 180, 0])
translate([0, 0, h/2])
multilinetext(strings[i+6]);
}

module multilinetext(t)
for(i=[0:len(t)-1])
translate([0, (len(t)/2-i)*t_height, 0])
linear_extrude(height = 1)
text(t[i],halign = "center", valign = "center", size=t_height);

--
View this message in context: http://forum.openscad.org/Text-on-a-dodecahedron-tp15409p15518.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

It is always better to do a bit more structured programming to get more of it. This code allowes for any number of centered lines ... > strings = [["A Partridge","in a","Pear Tree", "and a", "Unicorn"], ["2"," > Turtle Doves"], > ["3","French Hens"], ["4","Calling Birds"], > ["5","Golden", "Rings"], ["6","Geese", "a-laying"], > ["12","Drummers", "drumming"],["7","Swans", "a-swimming"], > ["8","Maids", "a-milking"], ["9","Ladies", > "Dancing"],["10","Lords", "a-leaping"],["11","Pipers Piping"] ]; > > t_height = 7; > > dodekaeder(40); > > module dodekaeder(r = 40) > { > w = acos(1/sqrt(5)); > rotate([0, 0, 180]) > twosides(r, 0); > for(i=[0:4]) > rotate([0, -w, i*72]) // tricky! > twosides(r, i+1); > } > > module twosides(r=1, i=1) > { > h = r*2.618; > linear_extrude(height = h, twist = 36, center = true) // tricky twist > circle(r, $fn=5); > > // text for upper and lower surface > translate([0, 0, h/2+1]) > multilinetext(strings[i]); > rotate([0, 180, 0]) > translate([0, 0, h/2]) > multilinetext(strings[i+6]); > } > > module multilinetext(t) > for(i=[0:len(t)-1]) > translate([0, (len(t)/2-i)*t_height, 0]) > linear_extrude(height = 1) > text(t[i],halign = "center", valign = "center", size=t_height); -- View this message in context: http://forum.openscad.org/Text-on-a-dodecahedron-tp15409p15518.html Sent from the OpenSCAD mailing list archive at Nabble.com.
U
unkerjay
Wed, Jan 6, 2016 4:39 PM

When I look at the code in my console, it ends at line 47.

So, not sure which lines you're referring to.

--
View this message in context: http://forum.openscad.org/Text-on-a-dodecahedron-tp15409p15519.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

When I look at the code in my console, it ends at line 47. So, not sure which lines you're referring to. -- View this message in context: http://forum.openscad.org/Text-on-a-dodecahedron-tp15409p15519.html Sent from the OpenSCAD mailing list archive at Nabble.com.
U
unkerjay
Wed, Jan 6, 2016 4:40 PM

Code works.

How to adjust the line spacing?

--
View this message in context: http://forum.openscad.org/Text-on-a-dodecahedron-tp15409p15520.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

Code works. How to adjust the line spacing? -- View this message in context: http://forum.openscad.org/Text-on-a-dodecahedron-tp15409p15520.html Sent from the OpenSCAD mailing list archive at Nabble.com.
U
unkerjay
Wed, Jan 6, 2016 4:46 PM

If THIS:

      translate([0, -t_height, h/2]) 

is the line you're referring to,

I changed that.

Lines 2 and 3 aren't overwriting each other anymore.

But, I now get no line 3.

So, one problem solved, I think.

--
View this message in context: http://forum.openscad.org/Text-on-a-dodecahedron-tp15409p15521.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

If THIS: translate([0, -t_height, h/2]) is the line you're referring to, I changed that. Lines 2 and 3 aren't overwriting each other anymore. But, I now get no line 3. So, one problem solved, I think. -- View this message in context: http://forum.openscad.org/Text-on-a-dodecahedron-tp15409p15521.html Sent from the OpenSCAD mailing list archive at Nabble.com.
U
unkerjay
Wed, Jan 6, 2016 5:02 PM

Figured it out.

  translate([0, (len(t)/2-i)*t_height*1.5, 0]) 

Thanks.

--
View this message in context: http://forum.openscad.org/Text-on-a-dodecahedron-tp15409p15522.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

Figured it out. translate([0, (len(t)/2-i)*t_height*1.5, 0]) Thanks. -- View this message in context: http://forum.openscad.org/Text-on-a-dodecahedron-tp15409p15522.html Sent from the OpenSCAD mailing list archive at Nabble.com.
U
unkerjay
Wed, Jan 6, 2016 5:03 PM

P.S.

Nice touch "Unicorn"

:)

--
View this message in context: http://forum.openscad.org/Text-on-a-dodecahedron-tp15409p15523.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

P.S. Nice touch "Unicorn" :) -- View this message in context: http://forum.openscad.org/Text-on-a-dodecahedron-tp15409p15523.html Sent from the OpenSCAD mailing list archive at Nabble.com.