Discussion:
[OpenSCAD] How to write a texture to a face(Solid ) in a geometric model
MichaelAtOz
2016-03-25 22:30:21 UTC
Permalink
OpenSCAD doesn't do textures. Neither does STL format.

You could add raised text, protruding from the model.


import("your_stl.stl");
translate([x,y,z]) // to move to the position where you want text
rotate([x,y,z]) // to align with the face of the stl
linear_extrude(height=3, convexity=6)
text("your text");
Hello! I am trying implement one functionality . Please help me in it.
How to write a text on 3d model surface which is imported from STL file .
Added image for reference. please anyone give me an idea.
<Loading Image...>




-----
Admin - PM me if you need anything, or if I've done something stupid...

Unless specifically shown otherwise above, my contribution is in the Public Domain; to the extent possible under law, I have waived all copyright and related or neighbouring rights to this work. Obviously inclusion of works of previous authors is not included in the above.

The TPP is no simple “trade agreement.” Fight it! http://www.ourfairdeal.org/ time is running out!
--
View this message in context: http://forum.openscad.org/How-to-write-a-texture-to-a-face-Solid-in-a-geometric-model-tp16718p16726.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
MichaelAtOz
2016-03-25 22:31:35 UTC
Permalink
p.s. Your post is still flagged as "This post has NOT been accepted by the
mailing list yet", so nobody gets it unless they look.
You need to subscribe to the mailing list
<http://forum.openscad.org/mailing_list/MailingListOptions.jtp?forum=1> ,
and respond to the registration email.




-----
Admin - PM me if you need anything, or if I've done something stupid...

Unless specifically shown otherwise above, my contribution is in the Public Domain; to the extent possible under law, I have waived all copyright and related or neighbouring rights to this work. Obviously inclusion of works of previous authors is not included in the above.

The TPP is no simple “trade agreement.” Fight it! http://www.ourfairdeal.org/ time is running out!
--
View this message in context: http://forum.openscad.org/How-to-write-a-texture-to-a-face-Solid-in-a-geometric-model-tp16718p16727.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
Nageswara rao
2016-03-26 11:31:12 UTC
Permalink
Nt only text it could be polygon or model loaded from dxf file.



--
View this message in context: http://forum.openscad.org/How-to-write-a-texture-to-a-face-Solid-in-a-geometric-model-tp16718p16732.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
Parkinbot
2016-03-26 17:48:17 UTC
Permalink
As Michael wrote, OpenSCAD has no support for pinning a texture to a solid.
Also any color information gets lost when CGAL rendering (F6) is done for
STL export.

But if you have a dual or multiple head printer and a slicer that can handle
multiple STLs, one for each filament color, you can use OpenSCAD to produce
distinct STLs, one for each color and get a colored print.
Here some code that carves colored text (or any other texture) like a tarsia
into a solid. (Text is projected):

<Loading Image...>

// mode = "shape"; // uncomment to view/export shape only
// mode = "text"; // uncomment to view/export text only

textonshape(mode = mode, textcolor = "red")
{
// here is your shape
cylinder(r=10.01, 71, center = true);

// here is your texture, must intersect with your shape
translate([3,6,30]) // to move to the position where you want text
rotate([0,90,90]) // to align with the face of the stl
linear_extrude(height=6, convexity=9)
text("your text");
}

module textonshape(mode = "view", textcolor = "green")
{
if(mode != "shape")
color(textcolor)
intersection() // just the text
{
scale([.999, .999, .999]) children([0]); children([1]);
}
if(mode != "text")
difference() // just the shape
{
children([0]); children([1]);
}
}



--
View this message in context: http://forum.openscad.org/How-to-write-a-texture-to-a-face-Solid-in-a-geometric-model-tp16718p16734.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
Nageswara rao
2016-03-27 02:16:44 UTC
Permalink
Yeah it's working.Is it possible to wrap text taken from .dxf file.I have
attached a sample dxf sketch.



--
View this message in context: http://forum.openscad.org/How-to-write-a-texture-to-a-face-Solid-in-a-geometric-model-tp16718p16743.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
Nageswara rao
2016-03-27 05:38:19 UTC
Permalink
But for Chinese text it is not translating properly.please find attached
picture . <Loading Image...>



--
View this message in context: http://forum.openscad.org/How-to-write-a-texture-to-a-face-Solid-in-a-geometric-model-tp16718p16744.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
Neon22
2016-03-27 06:13:03 UTC
Permalink
A second approach is to import the DXF into Inkscape and use the openscad
export plugin to export as an object.

Then intersect() and difference() it with cylinder (maybe 6 sides) to get
the wrapped text.
- http://www.thingiverse.com/thing:1065500



--
View this message in context: http://forum.openscad.org/How-to-write-a-texture-to-a-face-Solid-in-a-geometric-model-tp16718p16745.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
Nageswara rao
2016-03-27 07:08:24 UTC
Permalink
Hello! Cant we do it with out importing into third party software. I would
like to add above functionality locally to OpenScad.Can you please provide
me in details.Thank you.



--
View this message in context: http://forum.openscad.org/How-to-write-a-texture-to-a-face-Solid-in-a-geometric-model-tp16718p16746.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
Torsten Paul
2016-03-27 11:50:47 UTC
Permalink
Post by Nageswara rao
But for Chinese text it is not translating properly.please find
attached picture. <http://forum.openscad.org/file/n16744/ch.png>
text() should be able to handle that, but it needs the
matching font. It will not try to automatically substitute
glyphs from other fonts if one is missing in the selected
font like most text editors do.

For example the following will do Braille

cube([65,12,.5]);
linear_extrude(1)
text("\u2820\u2813\u2811\u2807\u2807\u2815", font="DejaVu Sans");

but that only works with a small number of fonts that have
the actual glyphs (on Linux "DejaVu Sans", on Windows that
could be "Segoe UI Symbol").

If you find it's still not working, please report an issue
on github. We'd need some help from people how know the
languages and have the appropriate fonts installed.

ciao,
Torsten.
Parkinbot
2016-03-28 11:55:06 UTC
Permalink
So, to sum it all up: This is your code and its result:
<Loading Image...>
mode = "all";
// mode = "shape"; // uncomment to view/export shape only
// mode = "text"; // uncomment to view/export text only
textonshape(mode = mode, textcolor = "red")
{
// here is your shape
cylinder(r=10.01, 71, center = true);
// here is your texture, must fully intersect with your shape
translate([3,6,30]) // to move to the position where you want text
rotate([0,90,90]) // to align with the face of the stl
linear_extrude(height=6, convexity=9)
text( "興誠科技", font="SimHei");
}
module textonshape(mode = "view", textcolor = "green")
{
if(mode != "shape")
color(textcolor)
intersection() // just the text
{
scale([.999, .999, .999]) children([0]); children([1]);
}
if(mode != "text")
difference() // just the shape
{
children([0]); children([1]);
}
}
--
View this message in context: http://forum.openscad.org/How-to-write-a-texture-to-a-face-Solid-in-a-geometric-model-tp16718p16758.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
Nageswara rao
2016-03-29 00:11:28 UTC
Permalink
yeah! it was working fine for me.As I mentioned in previous reply is it
possible to wrap a dxf model on solid face.Like attached picture.I would be
thankful for any help <Loading Image...>



--
View this message in context: http://forum.openscad.org/How-to-write-a-texture-to-a-face-Solid-in-a-geometric-model-tp16718p16779.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
Nageswara rao
2016-03-29 01:23:20 UTC
Permalink
Is it possible to project curves,polygons etc on to the surface.?



--
View this message in context: http://forum.openscad.org/How-to-write-a-texture-to-a-face-Solid-in-a-geometric-model-tp16718p16785.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
Parkinbot
2016-03-29 13:49:41 UTC
Permalink
Your question is very general. What answer do expect? You can use the given
code pattern to linear_extrude() an imported dxf by replacing the 'extrude
text' command with
linear_extrude(height = h) import (file = "my.dxf");
Is it that what you are asking for? You can compose a 2D shape (also from a
polygon), extrude and project it. It's all the same pattern.
Why don't you post a code frame for your solid and some data (not only
images) you want to be projected.

Again: a *projection* to a surface is possible (and straight forward as I
have shown), but no winding of a 2D shape around some 3D surface.



--
View this message in context: http://forum.openscad.org/How-to-write-a-texture-to-a-face-Solid-in-a-geometric-model-tp16718p16793.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
Nageswara rao
2016-03-30 00:21:30 UTC
Permalink
Hi its working perfect.

May I know how to get new vertices of polygon which is projected on
surface.3d coordinate?

What do you mean by "no winding of a 2D shape around some 3D surface" can
you please explain.

<Loading Image...>



--
View this message in context: http://forum.openscad.org/How-to-write-a-texture-to-a-face-Solid-in-a-geometric-model-tp16718p16805.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
Parkinbot
2016-03-30 17:31:45 UTC
Permalink
Post by Nageswara rao
May I know how to get new vertices of polygon which is projected on
surface.3d coordinate?
all you can do is to use this line.
Post by Nageswara rao
mode = "text"; // uncomment to view/export text only
What do you mean by "no winding of a 2D shape around some 3D surface" can
you please explain.
<Loading Image...>







--
View this message in context: http://forum.openscad.org/How-to-write-a-texture-to-a-face-Solid-in-a-geometric-model-tp16718p16825.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
Nageswara rao
2016-03-31 00:51:42 UTC
Permalink
ok understood.I am developing CAD application using C++ and Qt,OpenGL.How can
I use OpenSCAD futures in my project?

Regards




--
View this message in context: http://forum.openscad.org/How-to-write-a-texture-to-a-face-Solid-in-a-geometric-model-tp16718p16836.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
Nageswara rao
2016-03-31 01:48:31 UTC
Permalink
Hi Please find the attache screenshot.I have to wrap letter T on 3D model.
<Loading Image...>



--
View this message in context: http://forum.openscad.org/How-to-write-a-texture-to-a-face-Solid-in-a-geometric-model-tp16718p16838.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
Nageswara rao
2016-04-01 10:33:18 UTC
Permalink
The STL mode surface is not flat.is it possible in openscad to wrap(2d
polygon) on uneven 3d surface.? Can anyone provide a solution?



--
View this message in context: http://forum.openscad.org/How-to-write-a-texture-to-a-face-Solid-in-a-geometric-model-tp16718p16883.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
Andrew Plumb
2016-04-01 10:45:38 UTC
Permalink
This post might be inappropriate. Click to display it.
Parkinbot
2016-04-01 12:15:31 UTC
Permalink
There is no (trivial) solution for that. OpenSCAD is not equipped for this
and the task is NOT just a snip with two fingers.

You better switch to Blender, 3s Max or a product that supports texturing
first hand.




--
View this message in context: http://forum.openscad.org/How-to-write-a-texture-to-a-face-Solid-in-a-geometric-model-tp16718p16887.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

Nageswara rao
2016-03-29 07:33:06 UTC
Permalink
Below text is created by connected points(lines,curves) on the view.
<Loading Image...>



--
View this message in context: http://forum.openscad.org/How-to-write-a-texture-to-a-face-Solid-in-a-geometric-model-tp16718p16790.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
Nageswara rao
2016-03-29 05:36:33 UTC
Permalink
Is there anyway to get position of text that wrapped around the cylinder. 3d
coordinates of text?



--
View this message in context: http://forum.openscad.org/How-to-write-a-texture-to-a-face-Solid-in-a-geometric-model-tp16718p16788.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
Ronaldo
2016-03-29 06:03:03 UTC
Permalink
I don't see any way to wrap a text or a 2D form around an object. It seems
that it would require some kind of morphing or non-linear deformation we
don't have in OpenSCAD. The best I can imagine is to stamp a form with fixed
depth like in:

engrave.PNG <Loading Image...>

The dxf I used was taken from http://www.thingiverse.com/thing:35439/#files
<http://www.thingiverse.com/thing:35439/#files>

engrave(depth=1) {
rotate([0,0,90])
engrave(depth=1.5) {
rotate([0,0,-90])
engrave(depth=1)
{
cylinder(r=10.01, 71, center = true);

translate([5,0,20])
rotate([0,90,0])
linear_extrude(height=10, convexity=9)
stamp1();
}
translate([6,0,30])
rotate([0,90,0])
linear_extrude(height=6, convexity=9)
text( "興誠科技", font="SimHei");
}
translate([0,0,-20])
rotate([0,90,0])
linear_extrude(height=12, convexity=9)
stamp2();
}

module stamp2(){
scale(10/40)
import(file="recursive_snowflake_hexagons.dxf", convexity=20);
}

module stamp1(n=4){
if( n==1 )
polygon([ [7,0], [0,5], [0,-5] ] );
else {
translate([ 3.4, 0]) scale(1/2) stamp(n-1);
translate([ 0, 2.4]) scale(1/2) stamp(n-1);
translate([ 0,-2.4]) scale(1/2) stamp(n-1);
}
}

module engrave(depth)
{
difference()
{
children([0]);
translate([-depth,0,0])
difference()
{
translate([depth,0,0]) children([1]);
children([0]);
}
}
}




--
View this message in context: http://forum.openscad.org/How-to-write-a-texture-to-a-face-Solid-in-a-geometric-model-tp16718p16789.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
Nageswara rao
2016-03-27 07:15:56 UTC
Permalink
In above approach
1.export as STL
2. import into OpenScad

results: Text disappears



--
View this message in context: http://forum.openscad.org/How-to-write-a-texture-to-a-face-Solid-in-a-geometric-model-tp16718p16747.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
Parkinbot
2016-03-27 09:06:29 UTC
Permalink
Does it appear at all - in mode "text"? Maybe your exporter is not working
properly. Why don't you post the relevant parts of your code?



--
View this message in context: http://forum.openscad.org/How-to-write-a-texture-to-a-face-Solid-in-a-geometric-model-tp16718p16748.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
Torsten Paul
2016-03-27 11:11:23 UTC
Permalink
Post by Nageswara rao
In above approach
1.export as STL
2. import into OpenScad
results: Text disappears
Just using text("something") produces a 2D object, to combine
it with a STL you need to make it 3D, using linear_extrude().
Could that be the problem?

ciao,
Torsten.
Mark Schafer
2016-03-27 11:50:59 UTC
Permalink
the reason the text() is not working is the particular font selected
does not have those Kanji characters in it.
This means your choice of font is limited. Which is why I suggested
using Inkscape - where you can employ any system font.
Best wishes.
Post by Torsten Paul
Post by Nageswara rao
In above approach
1.export as STL
2. import into OpenScad
results: Text disappears
Just using text("something") produces a 2D object, to combine
it with a STL you need to make it 3D, using linear_extrude().
Could that be the problem?
ciao,
Torsten.
_______________________________________________
OpenSCAD mailing list
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
runsun
2016-03-27 19:32:39 UTC
Permalink
Seems to work fine on my pc (Windows 10):

<Loading Image...>
fonts = ["SimHei", "SimSun", "Microsoft JhengHei", "Microsoft YaHei"];
for (i=[0:len(fonts)-1])
{ t = str(fonts[i], ": 興誠科技");
translate( [0,15*i,0]) text( t, font=fonts[i]);
}
-----

$ Runsun Pan, PhD $ libs: doctest , faces ( git ), offline doc ( git ), runscad.py( 1 , 2 , git ), synwrite( 1 , 2 ); $ tips: hash( 1 , 2 ), matrix( 1 , 2 ),sweep( 1 , 2 ), var( 1 , 2 ), lerp , animation ( gif , prodVid ), precision( 1 , 2 ), xl-control , type , rounded polygon





--
View this message in context: http://forum.openscad.org/How-to-write-a-texture-to-a-face-Solid-in-a-geometric-model-tp16718p16753.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
Rob Ward
2016-03-27 23:12:20 UTC
Permalink
Produced on my XUbuntu 14.4.4 LTS, which has "inherited fonts files"
from my defunct MS-XP. It looks as though I have got 3 out of the 4 by
accident rather than intentionally. I simply copied my XP Fonts folder
to my <user>/.fonts on the Linux box and the vast majority worked
straight off. However there is one caveat, as I found out with my
Arduino IDE, there can be some rogue fonts in amongst the XP font
versions that do not have all the characters, even though they share the
same font name (but not the same filename). As the font used in that
part of the IDE was not listed, it took some searching to find and
eliminate the incomplete font, and allow the native Linux version do the
right job. So probably better to copy the Chinese font files over one
by one, and check them out individually rather than do I what I did. I
do not deeply understand the complexities of font definitions, so there
maybe other explanations.
Rob
Post by runsun
<http://forum.openscad.org/file/n16753/OpenSCAD_Chinese_font.png>
fonts = ["SimHei", "SimSun", "Microsoft JhengHei", "Microsoft YaHei"];
for (i=[0:len(fonts)-1])
{ t = str(fonts[i], ": 興誠科技");
translate( [0,15*i,0]) text( t, font=fonts[i]);
}
-----
$ Runsun Pan, PhD $ libs: doctest , faces ( git ), offline doc ( git ), runscad.py( 1 , 2 , git ), synwrite( 1 , 2 ); $ tips: hash( 1 , 2 ), matrix( 1 , 2 ),sweep( 1 , 2 ), var( 1 , 2 ), lerp , animation ( gif , prodVid ), precision( 1 , 2 ), xl-control , type , rounded polygon
--
View this message in context: http://forum.openscad.org/How-to-write-a-texture-to-a-face-Solid-in-a-geometric-model-tp16718p16753.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
_______________________________________________
OpenSCAD mailing list
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Continue reading on narkive:
Search results for '[OpenSCAD] How to write a texture to a face(Solid ) in a geometric model' (Questions and Answers)
7
replies
i want all the specifications of the ps2 ?
started 2006-10-09 07:32:39 UTC
video & online games
Loading...