a curve logo

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

a curve logo

Johan Jonker
I like to have a handwritten logo in my 3D printed objects.
With surface it is possible to convert a png file into a 3D logo that you can add or substract from flat surfaces. But I liked to have to logo on a curved object.
So I made a curved logo in this way:



The code is as follows:
//------------------------------------------------
// module to make a curved logo from a png file
//------------------------------------------------


curvedlogo(20,20);


module curvedlogo(diameter,lenght)
{
   
    $fn=60;
   
    translate([0,0,-diameter/2])
    intersection()
        {
            // create a tube with 2* lenght and diameter
            difference()
            {
                rotate(90,[1,0,0])
                  translate([0,0,-lenght])
                    cylinder(lenght*2,diameter/2+4,diameter/2+4,center=false);
                rotate(90,[1,0,0])
                    translate([0,0,-lenght-0.1])
                        cylinder(lenght*2+0.2,diameter/2,diameter/2,center=false);
            }
            // create a 3D logo with height diameter*2
            translate([0,0,diameter])
            resize([lenght, lenght, diameter])
            surface(file = "logob.png", center = true, invert=true, convexity = 5);

       
    }

}
Reply | Threaded
Open this post in threaded view
|

Re: a curve logo

Parkinbot
Good approach! If there was a function importing data into a matrix, one could do really crazy things!
Reply | Threaded
Open this post in threaded view
|

Re: a curve logo

kintel
Administrator
In reply to this post by Johan Jonker
> On Dec 21, 2015, at 07:57 AM, Johan Jonker <[hidden email]> wrote:
>
> I like to have a handwritten logo in my 3D printed objects.
> With surface it is possible to convert a png file into a 3D logo that you
> can add or substract from flat surfaces. But I liked to have to logo on a
> curved object.

surface() tends to be very slow.
A better approach would be to trace the png into a vector outline.

We’re working on such a built-in function, see here: https://github.com/openscad/openscad/pull/1110

There are also external tools for this:
http://aggregate.org/MAKE/TRACE2SCAD/
http://chaaawa.com/stencil_factory_js/

 -Marius


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

Re: a curve logo

Johan Jonker
This post was updated on .
That's right it is very slow. It helped when I reduced the complexity of the logo and first made a separate .slt file of the logo, simplified it using Meshlab and then import it.

Here is the result (a logo on a curved clarinet barrel):
Reply | Threaded
Open this post in threaded view
|

Re: a curve logo

Neon22
In reply to this post by Johan Jonker
Looks good. Another approach is to use Inkscape and its tools, to vectorise your bitmap, and then export to openSCAD using a special extension.
- in inkscape the tool is under the Path menu and is called "Trace bitmap".
   (POTrace does the work and its code is avilable for other projects to include).
- The Extension is under "Generate from Paths" / "Paths to openSCAD".
- you need to install the Inkscape extension from here:
    - http://www.thingiverse.com/thing:1065500