How to write a texture to a face(Solid ) in a geometric model

classic Classic list List threaded Threaded
32 messages Options
12
Reply | Threaded
Open this post in threaded view
|

How to write a texture to a face(Solid ) in a geometric model

Nageswara rao
This post has NOT been accepted by the mailing list yet.
Hello! I am trying implement one functionality . Please help me in it.

problem statement:

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.
Reply | Threaded
Open this post in threaded view
|

Re: How to write a texture to a face(Solid ) in a geometric model

MichaelAtOz
Administrator
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");

Nageswara rao wrote
Hello! I am trying implement one functionality . Please help me in it.

problem statement:

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.
Admin - email* me if you need anything,
or if I've done something stupid...
* click on my MichaelAtOz label, there is a link to email me.

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!
Reply | Threaded
Open this post in threaded view
|

Re: How to write a texture to a face(Solid ) in a geometric model

MichaelAtOz
Administrator
In reply to this post by Nageswara rao
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, and respond to the registration email.
Admin - email* me if you need anything,
or if I've done something stupid...
* click on my MichaelAtOz label, there is a link to email me.

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!
Reply | Threaded
Open this post in threaded view
|

Re: How to write a texture to a face(Solid ) in a geometric model

Nageswara rao
This post has NOT been accepted by the mailing list yet.
Sorry! I am new to this forum.Just now I have sent a subscription request.Thank you.

Best Regards
Nageswara Ra
Reply | Threaded
Open this post in threaded view
|

Re: How to write a texture to a face(Solid ) in a geometric model

Nageswara rao
This post has NOT been accepted by the mailing list yet.
Hi Michael,
               Thanks a lot.I did not get your approach.Can you please explain in details Kindly. I am trying to implement this functionality using C++,Qt5,Opencascade lib on Windows7.
Regards
Nageswara Rao
Reply | Threaded
Open this post in threaded view
|

Re: How to write a texture to a face(Solid ) in a geometric model

Nageswara rao
Nt only text it could be polygon or model loaded from dxf file.
Reply | Threaded
Open this post in threaded view
|

Re: How to write a texture to a face(Solid ) in a geometric model

Parkinbot
In reply to this post by Nageswara rao
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):



// 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]);
    }
}  
Reply | Threaded
Open this post in threaded view
|

Re: How to write a texture to a face(Solid ) in a geometric model

Nageswara rao
This post was updated on .
Yeah it's working.Is it possible to wrap text taken from .dxf file.I have attached a sample dxf sketch.

Reply | Threaded
Open this post in threaded view
|

Re: How to write a texture to a face(Solid ) in a geometric model

Nageswara rao
In reply to this post by Parkinbot
But for Chinese text it is not translating properly.please find attached picture .
Reply | Threaded
Open this post in threaded view
|

Re: How to write a texture to a face(Solid ) in a geometric model

Neon22
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
Reply | Threaded
Open this post in threaded view
|

Re: How to write a texture to a face(Solid ) in a geometric model

Nageswara rao
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.
Reply | Threaded
Open this post in threaded view
|

Re: How to write a texture to a face(Solid ) in a geometric model

Nageswara rao
In reply to this post by Parkinbot
In above approach
1.export as STL
2. import into OpenScad

results: Text disappears
Reply | Threaded
Open this post in threaded view
|

Re: How to write a texture to a face(Solid ) in a geometric model

Parkinbot
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?
tp3
Reply | Threaded
Open this post in threaded view
|

Re: How to write a texture to a face(Solid ) in a geometric model

tp3
In reply to this post by Nageswara rao
On 03/27/2016 09:15 AM, Nageswara rao wrote:
> 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
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
-- Torsten
tp3
Reply | Threaded
Open this post in threaded view
|

Re: How to write a texture to a face(Solid ) in a geometric model

tp3
In reply to this post by Nageswara rao
On 03/27/2016 07:38 AM, Nageswara rao wrote:
> 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.


_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
-- Torsten
Reply | Threaded
Open this post in threaded view
|

Re: How to write a texture to a face(Solid ) in a geometric model

Neon22
In reply to this post by tp3
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.

On 3/28/2016 12:11 AM, Torsten Paul wrote:

> On 03/27/2016 09:15 AM, Nageswara rao wrote:
>> 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
> [hidden email]
> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
>
>


_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: How to write a texture to a face(Solid ) in a geometric model

runsun
Seems to work fine on my pc (Windows 10):



Generated with the following code:
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: scadx, doctest, faces(git), offline doc(git), runscad.py(2,git), editor of choice: CudaText ( OpenSCAD lexer); $ Tips; $ Snippets
Reply | Threaded
Open this post in threaded view
|

Re: How to write a texture to a face(Solid ) in a geometric model

RobWLakes


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

On 28/03/16 06:32, runsun wrote:
Seems to work fine on my pc (Windows 10):

<http://forum.openscad.org/file/n16753/OpenSCAD_Chinese_font.png> 

Generated with the following code:

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
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org


_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Rob W
Lake Tyers Beach,
Victoria, Australia
Reply | Threaded
Open this post in threaded view
|

Re: How to write a texture to a face(Solid ) in a geometric model

Parkinbot
In reply to this post by Nageswara rao
So, to sum it all up: This is your code and its result:


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]);
    }
}  
Reply | Threaded
Open this post in threaded view
|

Re: How to write a texture to a face(Solid ) in a geometric model

Nageswara rao
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
12