Hi Neon22,
Very nice Python script, far superior to my hacked together MS Word VB
macro! One issue I noticed while testing it is that OpenSCAD appears to list
the facet vertices in anti-clockwise order (looking from outside) in its AMF
export files, but polyhedron() likes the facets in clockwise order...?
(My macro has the same issue.)
-Trygon
--
View this message in context: http://forum.openscad.org/Wrapping-text-around-a-complex-geometry-tp18145p18180.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
Trygon,
I felt no offense neither had the intention to offend. Besides, it was not
my approach but an usual one. To tell you the truth, I don't like it. The
imperfections will be tiny if you discretize the strip a lot, but they are
there anyway. And the render times grow drastically.
Alex,
A different approach avoids to break the text in pieces to adjust it to the
surface. Instead, it breaks the string in characters. Since the Moebius
strip is almost plane on the footprint of one character, it would be
preferable to print each character at a time adjusting its position and
orientation to the surface. This seems to be the approach of text_on.scad
https://github.com/brodykenrick/text_on_OpenSCAD . The code is a lot
complex and I confirm it running examples. For inprinting, it is virtually
imperceptible.
http://forum.openscad.org/file/n18181/text_on_sphere.png
Despite the small radius of the sphere, it is hardly seen the inprint bottom
is plane.
The hard issue of this the approach is to deal with character spacing. The
code of text_on.scad seems to choose mono-spacing.
--
View this message in context: http://forum.openscad.org/Wrapping-text-around-a-complex-geometry-tp18145p18181.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
@Trygon - thanks very much for catching that.
I added an option to invert faces - default to true. Looks better now.
https://github.com/Neon22/amf-to-openscad-polyhedron
--
View this message in context: http://forum.openscad.org/Wrapping-text-around-a-complex-geometry-tp18145p18182.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
Hi Alex,
Some more ideas for you...
/l=170; w=10; d=2; // strip size
s=6; // text size
difference(){
translate([l/2,0,0]) cube([l,w,d],center=true);
translate([0,0,0.5]) linear_extrude(height=1)
text("If music be the food of love, play on. So full
of",size=s,valign="center");
rotate([180,0,0]) translate([0,0,0.5]) linear_extrude(height=1)
text("shapes is fancy that it alone is high
fantastical.",size=s,valign="center");
}
/
http://forum.openscad.org/file/n18183/FlatStrip1.png
http://forum.openscad.org/file/n18183/FlatStrip2.png
Export and reimport as an OpenSCAD script - see Neon22's excellent Python
script above.
Using a non-affine transformation twist the strip 180 degrees along its axis
(i.e. along the x-axis):
http://forum.openscad.org/file/n18183/TwistedStrip.png
Then using a second non-affine transformation roll the twisted strip around
a circle on the x-z plane centred on the origin:
http://forum.openscad.org/file/n18183/MobiusBand.png
The script I used for both transformations combined is:
/include<FlatStrip_convert.scad>;
l=170; w=10; d=2; // strip size
eps=0.001;
l2=l+2eps; // +2eps => avoid self intersecting polyhedron
r1=l2/(2*PI);
points2=[ for(i=points) let( a1=360*(i[0]+eps)/l2,
a2=a1/2,
rm1=[cos(a1),-sin(a1)],
rm2=[[cos(a2),-sin(a2)],[sin(a2),cos(a2)]],
p1=[i[1],i[2]]*rm2+[0,r1],
p2=p1[1]*rm1 )
[p2[0],p1[0],p2[1]] ];
union(){
polyhedron(points2,triangles,convexity=10);
translate([r1,0,0]) cube([d,w,4*eps],center=true); // join strip
}
/
This method is the same way you could go about making a mobius band out of a
strip of paper.
Cheers,
Trygon
--
View this message in context: http://forum.openscad.org/Wrapping-text-around-a-complex-geometry-tp18145p18183.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
Nice solution. I would expect a refined discretization of the imported
polyhedron before the transformations.
2016-08-20 10:55 GMT-03:00 Trygon db5765@outlook.com:
Hi Alex,
Some more ideas for you...
/l=170; w=10; d=2; // strip size
s=6; // text size
difference(){
translate([l/2,0,0]) cube([l,w,d],center=true);
translate([0,0,0.5]) linear_extrude(height=1)
text("If music be the food of love, play on. So full
of",size=s,valign="center");
rotate([180,0,0]) translate([0,0,0.5]) linear_extrude(height=1)
text("shapes is fancy that it alone is high
fantastical.",size=s,valign="center");
}
/
http://forum.openscad.org/file/n18183/FlatStrip1.png
http://forum.openscad.org/file/n18183/FlatStrip2.png
Export and reimport as an OpenSCAD script - see Neon22's excellent Python
script above.
Using a non-affine transformation twist the strip 180 degrees along its
axis
(i.e. along the x-axis):
http://forum.openscad.org/file/n18183/TwistedStrip.png
Then using a second non-affine transformation roll the twisted strip around
a circle on the x-z plane centred on the origin:
http://forum.openscad.org/file/n18183/MobiusBand.png
The script I used for both transformations combined is:
/include<FlatStrip_convert.scad>;
l=170; w=10; d=2; // strip size
eps=0.001;
l2=l+2eps; // +2eps => avoid self intersecting polyhedron
r1=l2/(2*PI);
points2=[ for(i=points) let( a1=360*(i[0]+eps)/l2,
a2=a1/2,
rm1=[cos(a1),-sin(a1)],
rm2=[[cos(a2),-sin(a2)],[sin(a2),cos(a2)]],
p1=[i[1],i[2]]*rm2+[0,r1],
p2=p1[1]*rm1 )
[p2[0],p1[0],p2[1]] ];
union(){
polyhedron(points2,triangles,convexity=10);
translate([r1,0,0]) cube([d,w,4*eps],center=true); // join strip
}
/
This method is the same way you could go about making a mobius band out of
a
strip of paper.
Cheers,
Trygon
--
View this message in context: http://forum.openscad.org/
Wrapping-text-around-a-complex-geometry-tp18145p18183.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
You people are great, these discussions always leave me feeling very
stupid, but smiling. Hopefully the algorithms you are hashing out can be
imported to standard OpenSCAD someday. I too would like to map text to
something other than a flat surface. But now I realize that it wasn't my
tensor math that wasn't good enough, but my coding as well.
Well done, all.
On Sat, Aug 20, 2016 at 12:53 PM, Ronaldo Persiano rcmpersiano@gmail.com
wrote:
Nice solution. I would expect a refined discretization of the imported
polyhedron before the transformations.
2016-08-20 10:55 GMT-03:00 Trygon db5765@outlook.com:
Hi Alex,
Some more ideas for you...
/l=170; w=10; d=2; // strip size
s=6; // text size
difference(){
translate([l/2,0,0]) cube([l,w,d],center=true);
translate([0,0,0.5]) linear_extrude(height=1)
text("If music be the food of love, play on. So full
of",size=s,valign="center");
rotate([180,0,0]) translate([0,0,0.5]) linear_extrude(height=1)
text("shapes is fancy that it alone is high
fantastical.",size=s,valign="center");
}
/
http://forum.openscad.org/file/n18183/FlatStrip1.png
http://forum.openscad.org/file/n18183/FlatStrip2.png
Export and reimport as an OpenSCAD script - see Neon22's excellent Python
script above.
Using a non-affine transformation twist the strip 180 degrees along its
axis
(i.e. along the x-axis):
http://forum.openscad.org/file/n18183/TwistedStrip.png
Then using a second non-affine transformation roll the twisted strip
around
a circle on the x-z plane centred on the origin:
http://forum.openscad.org/file/n18183/MobiusBand.png
The script I used for both transformations combined is:
/include<FlatStrip_convert.scad>;
l=170; w=10; d=2; // strip size
eps=0.001;
l2=l+2eps; // +2eps => avoid self intersecting polyhedron
r1=l2/(2*PI);
points2=[ for(i=points) let( a1=360*(i[0]+eps)/l2,
a2=a1/2,
rm1=[cos(a1),-sin(a1)],
rm2=[[cos(a2),-sin(a2)],[sin(a2),cos(a2)]],
p1=[i[1],i[2]]*rm2+[0,r1],
p2=p1[1]*rm1 )
[p2[0],p1[0],p2[1]] ];
union(){
polyhedron(points2,triangles,convexity=10);
translate([r1,0,0]) cube([d,w,4*eps],center=true); // join strip
}
/
This method is the same way you could go about making a mobius band out
of a
strip of paper.
Cheers,
Trygon
--
View this message in context: http://forum.openscad.org/Wrap
ping-text-around-a-complex-geometry-tp18145p18183.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org