Navigation Menu

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Link to 3d-printer spec files #168

Closed
ralphbean opened this issue Aug 12, 2013 · 22 comments
Closed

Link to 3d-printer spec files #168

ralphbean opened this issue Aug 12, 2013 · 22 comments
Labels

Comments

@ralphbean
Copy link
Contributor

In addition to "export to open badges" we need an "export to reality" button if and only if a 3d-printing spec file for the badge exists.

We can cook up a way to mostly script the creation of such spec files from .svg files, but it may take some manual intervention. Once they are created, verified and vetted, they should be uploaded to thingiverse, and the link to that object should be recorded in our tahrir DB by hand (or automatically?) so users can have easy access.

@hroncok
Copy link

hroncok commented Aug 29, 2013

How can I help with this? I got some experience :)

@ralphbean
Copy link
Contributor Author

@spotrh and @ryanlerch have been talking about it/working on it. The latest update was on the badges mailing list -> https://lists.fedoraproject.org/pipermail/badges/2013-August/000010.html

@hroncok
Copy link

hroncok commented Aug 30, 2013

badge3d

I was able to create this by thresholding the image in GIMP to just black and white and than processing the png with png23D.

I believe that if higher resolution is used (and all the badges comes from SVG, right?) and we require also monochromatic variant when a new badge is proposed, we can automate this process (some polishing is still needed trough).

@ralphbean
Copy link
Contributor Author

I played with png23D the other day and it was pretty neat.

One badge I tried that did not work out was one from the copr series:

The colors in the rainbow, and especially the gradient in the background gave png23d a really hard time.

Question - @hroncok, could you get it to work with multiple levels of depth at all? That would probably make for the most interested 3d printed badges (ones that actually have depth and texture).

@hroncok
Copy link

hroncok commented May 9, 2014

Well I think it might be possible to get grey-scale translated to highmap. At least should be pretty simple to script it with input like png (with vector it might be harder).

This looks ok http://www.thingiverse.com/thing:11981

@hroncok
Copy link

hroncok commented May 9, 2014

@hroncok
Copy link

hroncok commented May 9, 2014

badge3d

I've used the GIMP plugin.

It would need:

  • higher resolution of the badge (should be ok, we have vectors)
  • no shadow of the badge (looks bad)
  • a shape to intersection() with tha badge to cut it around the border (on time work for all the badges)

@ralphbean
Copy link
Contributor Author

other than the shadow... I bet we can automate that! This is going to be amazing :D

@ralphbean
Copy link
Contributor Author

Do you know you can find (almost all) of the svgs and pngs here: https://git.fedorahosted.org/cgit/badges.git

@hroncok
Copy link

hroncok commented May 9, 2014

I don't know if using the GIMP plugin is possible to automate, but other things can be automatic.

The shadow can stay, if we intersect the badge with other shape, the shadow would go away anyway.

  1. from svg export png with specified resolution (e.g. 1000x1000) (with inkscape command line)
  2. from png generate dat (maybe gimp can be run from command line as well?)
  3. run openscad on a template that does the intersection (can be run form command line)
  4. profit

@hroncok
Copy link

hroncok commented May 9, 2014

And the GIMP plugin can be rewritten to be standalone script, of course.

@hroncok
Copy link

hroncok commented May 9, 2014

resize([50,50,5])
  mirror()
    intersection() {
      scale([1,1,10])
        surface(file = "badge.dat", convexity = 5);
      translate([0,0,-300]) scale([1,1,1000])
        surface(file = "badge-shape.dat", convexity = 5);
    }

This generates a nice badge. badge-shape.dat is the shape of the badge (white on black).

@hroncok
Copy link

hroncok commented May 9, 2014

But even with a resolution 200x200 the geneartion of the badge eats a lot of resources (few gigs of ram and few minutes). I was not able to generate 1000x1000 badge :(

@ralphbean
Copy link
Contributor Author

which process eats the memory? gimp? or openscad?

@hroncok
Copy link

hroncok commented May 9, 2014

Opensacd.

Ok, so here it is:

#!/bin/python
from __future__ import print_function
import sys
import png

image = png.Reader(sys.argv[1])

width, height, pixels, metadata = image.asRGBA()

for row in pixels:
    for pixel in range(0, width*4, 4):
        gray = (row[pixel] + row[pixel+1] + row[pixel+2]) / 3
        norm = (gray-127.5)/255.0
        print(' ', end='')
        print(norm, end='')
    print()
#!/bin/bash
inkscape --export-png=badge.png --export-width=$1 --export-height=$1  badge.svg
inkscape --export-png=badge-shape.png --export-width=$1 --export-height=$1  badge-shape.svg
python png2highmap.py badge.png > badge.dat
python png2highmap.py badge-shape.png > badge-shape.dat
openscad badge.scad -o badge.stl

Put the badge.svg and badge-shape.svg (white badge on white bg) to the same folder and run tha bash script with resolution as argument. Watch the magic.

@hroncok
Copy link

hroncok commented May 9, 2014

And badge.scad from the previous comment as well.

@hroncok
Copy link

hroncok commented May 9, 2014

Adding

admesh --write-binary-stl=badge.stl badge.stl

to the end of the script reduces the filesize a lot.

@ralphbean
Copy link
Contributor Author

Scripts moved to be kept here

STL files are kept here

@ralphbean
Copy link
Contributor Author

#281 has the code to add this to the web interface.

@ralphbean
Copy link
Contributor Author

Oo.. we have a process and code to do this. Can we close this issue as done?

@hroncok
Copy link

hroncok commented Nov 15, 2014

I guess so.

@pypingou
Copy link
Member

Let's do it then :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants