discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

converting svg files from Inkscape to scad files to stl files

TP
Torsten Paul
Sun, Feb 14, 2016 11:58 PM

On 02/14/2016 11:53 PM, Torsten Paul wrote:

There's an older snapshot version for the potrace branch...

Forgot to add the link to the pull request which has an
example screenshot of importing 2 images:

https://github.com/openscad/openscad/pull/1110

ciao,
Torsten.

On 02/14/2016 11:53 PM, Torsten Paul wrote: > There's an older snapshot version for the potrace branch... > Forgot to add the link to the pull request which has an example screenshot of importing 2 images: https://github.com/openscad/openscad/pull/1110 ciao, Torsten.
A
Adam
Mon, Feb 15, 2016 3:33 AM

Carsten,

Thank you very much!

----- Original Message -----

From: arnholm@arnholm.orgmailto:arnholm@arnholm.org

To: OpenSCAD general discussionmailto:discuss@lists.openscad.org

Sent: Wednesday, February 10, 2016 2:46 AM

Subject: Re: [OpenSCAD] converting svg files from Inkscape to scad files to stl files

On 2016-02-10 02:31, adamtimm1 wrote:

I am a photographer and an artist.  I want to create 3D images from my
photos and from artwork so that the blind can touch an image and "see
it."
That is* all *I want to do. I did it once through another venue.

Hi, you may be interested in this
http://arnholm.org/a-reverse-3d-printing-experiment/

Where I convert a 2d image to a printable 3d object. The description is
fairly detailed. Observe that there are different forms of DXF.

Also, this relates to the same issue, but possibly closer to what you
want
http://arnholm.org/angelscript-csg-part-3/

Carsten Arnholm


OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

Carsten, Thank you very much! ----- Original Message ----- From: arnholm@arnholm.org<mailto:arnholm@arnholm.org> To: OpenSCAD general discussion<mailto:discuss@lists.openscad.org> Sent: Wednesday, February 10, 2016 2:46 AM Subject: Re: [OpenSCAD] converting svg files from Inkscape to scad files to stl files On 2016-02-10 02:31, adamtimm1 wrote: > I am a photographer and an artist. I want to create 3D images from my > photos and from artwork so that the blind can touch an image and "see > it." > That is* all *I want to do. I did it once through another venue. Hi, you may be interested in this http://arnholm.org/a-reverse-3d-printing-experiment/ Where I convert a 2d image to a printable 3d object. The description is fairly detailed. Observe that there are different forms of DXF. Also, this relates to the same issue, but possibly closer to what you want http://arnholm.org/angelscript-csg-part-3/ Carsten Arnholm _______________________________________________ OpenSCAD mailing list Discuss@lists.openscad.org http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
A
Adam
Mon, Feb 15, 2016 3:36 AM

Thanks David,

InkScape converted the image into a grey scale for me but the problem was that I could not do the rest of the process which was  Path to openscade.  When I went to the right drop down box the "Path to openscad" was not there to send the image to.

----- Original Message -----

From: David Eccles (gringer)mailto:bioinformatics@gringene.org

To: discuss@lists.openscad.orgmailto:discuss@lists.openscad.org

Sent: Wednesday, February 10, 2016 2:51 AM

Subject: Re: [OpenSCAD] converting svg files from Inkscape to scad files tostl files

Another option is to save the files as a small png image, then use ImageJ
to convert the image to a text image (File->Save As->Text Image). This will
convert greyscale values into numbers, which can be read in by openscad as a
height map. Things are improved by converting to greyscale (8-bit colour)
first, then applying a gaussian blur, but the example image you've provided
doesn't really work in its current form as a height/bump map:

http://forum.openscad.org/file/n16095/4EE5_bumpmap.png

I've had more success in doing this from light-field microscope images,
although it still takes a bit of work to get things working properly:

http://www.thingiverse.com/thing:897505

--
View this message in context: http://forum.openscad.org/converting-svg-files-from-Inkscape-to-scad-files-to-stl-files-tp16084p16095.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

Thanks David, InkScape converted the image into a grey scale for me but the problem was that I could not do the rest of the process which was Path to openscade. When I went to the right drop down box the "Path to openscad" was not there to send the image to. ----- Original Message ----- From: David Eccles (gringer)<mailto:bioinformatics@gringene.org> To: discuss@lists.openscad.org<mailto:discuss@lists.openscad.org> Sent: Wednesday, February 10, 2016 2:51 AM Subject: Re: [OpenSCAD] converting svg files from Inkscape to scad files tostl files Another option is to save the files as a *small* png image, then use ImageJ to convert the image to a text image (File->Save As->Text Image). This will convert greyscale values into numbers, which can be read in by openscad as a height map. Things are improved by converting to greyscale (8-bit colour) first, then applying a gaussian blur, but the example image you've provided doesn't really work in its current form as a height/bump map: <http://forum.openscad.org/file/n16095/4EE5_bumpmap.png> I've had more success in doing this from light-field microscope images, although it still takes a bit of work to get things working properly: http://www.thingiverse.com/thing:897505 -- View this message in context: http://forum.openscad.org/converting-svg-files-from-Inkscape-to-scad-files-to-stl-files-tp16084p16095.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
A
Adam
Mon, Feb 15, 2016 3:39 AM

Neon,

Thank you again.  I will be printing in only one color because 3D printers do not yet do the "inkjet' thing.  So only one color is fine.  Besides if one is blind what is the point of color especially if one has a good friend and the actual painting to describe?

I will be working on your solutions.

Adam

----- Original Message -----

From: Neon22mailto:mschafer@wireframe.biz

To: discuss@lists.openscad.orgmailto:discuss@lists.openscad.org

Sent: Tuesday, February 09, 2016 11:39 PM

Subject: Re: [OpenSCAD] converting svg files from Inkscape to scad filestostl files

ok thanks for the detail. A couple of things first.

  1. Regrettably changing a raster file to a vector file cannot be done by
    just changing the file extension. That would be like changing a car to an
    airplane by swapping the gas caps over. While they are both forms of
    transport, they do different things. So there is no way it'll ever be that
    simple. Sorry.

  2. Your image is going to need to be in several layers. One for each of the
    contour colors you can see in your image. Maybe 8 or more. Oh yes - as you
    can see (way below), the image needs a bit of editing and tidying at the
    borders before you begin to get a good result and no cruft at the edges.

So things to try:

  1. You really should look at lithopanes. The author solved an interesting
    problem and its worth considering if you can use it for what you want.
    The live customiser online version cannot use really big files. But if you
    download the scad then you can use much bigger images.
    Try it:

  2. I'm sorry for your troubles with Inkscape.
    You need 0.91. You also need to download the extension (which what inkscape
    calls plugins) and put it in the right directory. If you're on windows
    that's %APPDATA% then go looking for the inkscape/extensions folder.

The instructable you reference is making a simple black and white one-layer
shape. Your image looks like its maybe > 8 layers.
When you split your image into 8 layers - using the Trace_Bitmap tool -
you'll need to have these settings:

  • choose colors,
  • 8 layers (or however many you need)
  • stack scans off
  • remove_background off (but you can play with this and the previous
    option)
  • smooth on (optional)
    http://forum.openscad.org/file/n16093/bitmap_001315.png
    Then export using the extension (must be v8). force line output must be off.
    Then open in openscad and be disappointed to see a low cube....

But wait....
at the end of the file will be 8 (or whatever you chose) poly_path
statements.
You can toggle visibiility of these on and off using the // comment operator
to check each shape is there.

Anyway - if you translate each one away from the next one (by whatever
height you choose) then you'll end up with a stacked scan like this:
http://forum.openscad.org/file/n16093/profile_001316.png

  • now they won't come in in the exact order you need. You'll have to swap
    them round until they are in correct height order.

The following numbers won't match yours at all but see what I'm doing with
the translates in Z... ?
// The shapes
poly_path4313(height, width);
translate([0,0,-height])
poly_path4319(height, width);
translate([0,0,-height2])
poly_path4311(height, width);
translate([0,0,-height
3])
poly_path4315(height, width);
translate([0,0,-height4])
poly_path4321(height, width);
translate([0,0,-height
5])
poly_path4317(height, width);
translate([0,0,-height6])
poly_path4309(height, width);
translate([0,0,-height
7])
poly_path4307(height, width);

Try again
Cheers...

--
View this message in context: http://forum.openscad.org/converting-svg-files-from-Inkscape-to-scad-files-to-stl-files-tp16084p16093.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

Neon, Thank you again. I will be printing in only one color because 3D printers do not yet do the "inkjet' thing. So only one color is fine. Besides if one is blind what is the point of color especially if one has a good friend and the actual painting to describe? I will be working on your solutions. Adam ----- Original Message ----- From: Neon22<mailto:mschafer@wireframe.biz> To: discuss@lists.openscad.org<mailto:discuss@lists.openscad.org> Sent: Tuesday, February 09, 2016 11:39 PM Subject: Re: [OpenSCAD] converting svg files from Inkscape to scad filestostl files ok thanks for the detail. A couple of things first. 1. Regrettably changing a raster file to a vector file cannot be done by just changing the file extension. That would be like changing a car to an airplane by swapping the gas caps over. While they are both forms of transport, they do different things. So there is no way it'll ever be that simple. Sorry. 2. Your image is going to need to be in several layers. One for each of the contour colors you can see in your image. Maybe 8 or more. Oh yes - as you can see (way below), the image needs a bit of editing and tidying at the borders before you begin to get a good result and no cruft at the edges. So things to try: 1. You really should look at lithopanes. The author solved an interesting problem and its worth considering if you can use it for what you want. The live customiser online version cannot use really big files. But if you download the scad then you can use much bigger images. Try it: - http://www.thingiverse.com/thing:74322 - http://www.thingiverse.com/search?q=lithopane&sa= 2. I'm sorry for your troubles with Inkscape. You need 0.91. You also need to download the extension (which what inkscape calls plugins) and put it in the right directory. If you're on windows that's %APPDATA% then go looking for the inkscape/extensions folder. - you really should use the zip file from here: http://www.thingiverse.com/thing:1065500/#files - unpack it into that extensions folder - http://www.thingiverse.com/thing:25036 - if you unpack it then it should appear on that specific menu - when you restart inkscape. The instructable you reference is making a simple black and white one-layer shape. Your image looks like its maybe > 8 layers. When you split your image into 8 layers - using the Trace_Bitmap tool - you'll need to have these settings: - choose colors, - 8 layers (or however many you need) - stack scans off - remove_background off (but you can play with this and the previous option) - smooth on (optional) <http://forum.openscad.org/file/n16093/bitmap_001315.png> Then export using the extension (must be v8). force line output must be off. Then open in openscad and be disappointed to see a low cube.... But wait.... at the end of the file will be 8 (or whatever you chose) poly_path statements. You can toggle visibiility of these on and off using the // comment operator to check each shape is there. Anyway - if you translate each one away from the next one (by whatever height you choose) then you'll end up with a stacked scan like this: <http://forum.openscad.org/file/n16093/profile_001316.png> - now they won't come in in the exact order you need. You'll have to swap them round until they are in correct height order. The following numbers won't match yours at all but see what I'm doing with the translates in Z... ? // The shapes poly_path4313(height, width); translate([0,0,-height]) poly_path4319(height, width); translate([0,0,-height*2]) poly_path4311(height, width); translate([0,0,-height*3]) poly_path4315(height, width); translate([0,0,-height*4]) poly_path4321(height, width); translate([0,0,-height*5]) poly_path4317(height, width); translate([0,0,-height*6]) poly_path4309(height, width); translate([0,0,-height*7]) poly_path4307(height, width); Try again Cheers... -- View this message in context: http://forum.openscad.org/converting-svg-files-from-Inkscape-to-scad-files-to-stl-files-tp16084p16093.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
TH
Tim Hawkins
Mon, Feb 15, 2016 4:04 AM

If all you want to do is create "height or bump maps" where the height of
the model at X/y is equivalent to the luminance of the image pixel at that
point. then Openscad has a built in function to do that.

if you can convert your artwork to a monochrome 2d png image, then the
following snippet will render it as a height map in OpenSCAD

scale([1, 1, 0.1])
surface(file = "smiley.png", center = true, invert = true);

Change "smiley.png" to be the path to the image you want to use.

Change the scale([x,y,z]) numbers - 1 means 100%, 0.1 means 10%

see:
https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Other_Language_Features#Images

On Wed, Feb 10, 2016 at 9:32 AM adamtimm1 adamtimm1@msn.com wrote:

I hope I do not offend anyone with this request or my stupidity.  This was
supposed to be a simple "thing."

From an "instructable" and a "Thing" in Thingiverse (

http://www.instructables.com/id/Convert-any-2D-image-to-a-3D-object-using-OpenSCAD/
) the instructions said that I could import a 2D jpeg into Inkscape, covert
it into an svg file, click Path>Object to Path  then click extensions

Paths2openscad.  When I opened openscad I was supposed to be able to

easily
convert the file to an extruded stl that I could print on my 3D printer.
REally??  I have been working on it for 2 days.

I am a photographer and an artist.  I want to create 3D images from my
photos and from artwork so that the blind can touch an image and "see it."
That is* all *I want to do. I did it once through another venue.

I did drop a "dxf" file onto the command line but I haven't the foggiest
how
to implement it.  The first time I did it I got a message saying I had
dropped an invalid dxf file onto the command line.

I am told that I have to "correctly escape the string." How do I do that?
I
am totally overwhelmed with things I have to do at the moment and I do not
want more.  I am at a point where everything I do takes me further afield
from my goals.  I know that there is a manual but for the little thing I am
attempting to do I only need a couple of instructions.  I have no intention
of doing any greater things with SCAD.  It is a task I will repeat many
times until something better/easier comes along.

Could someone please tell me how to import the dxf file I want, extrude it
then save it as an STL?  I was thinking I would get an  "import" button,
but
noooo!

Can/would someone please walk me through this?

--
View this message in context:
http://forum.openscad.org/converting-svg-files-from-Inkscape-to-scad-files-to-stl-files-tp16084.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

If all you want to do is create "height or bump maps" where the height of the model at X/y is equivalent to the luminance of the image pixel at that point. then Openscad has a built in function to do that. if you can convert your artwork to a monochrome 2d png image, then the following snippet will render it as a height map in OpenSCAD scale([1, 1, 0.1]) surface(file = "smiley.png", center = true, invert = true); Change "smiley.png" to be the path to the image you want to use. Change the scale([x,y,z]) numbers - 1 means 100%, 0.1 means 10% see: https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Other_Language_Features#Images On Wed, Feb 10, 2016 at 9:32 AM adamtimm1 <adamtimm1@msn.com> wrote: > I hope I do not offend anyone with this request or my stupidity. This was > supposed to be a simple "thing." > > From an "instructable" and a "Thing" in Thingiverse ( > > http://www.instructables.com/id/Convert-any-2D-image-to-a-3D-object-using-OpenSCAD/ > ) the instructions said that I could import a 2D jpeg into Inkscape, covert > it into an svg file, click Path>Object to Path then click extensions > >Paths2openscad. When I opened openscad I was supposed to be able to > easily > convert the file to an extruded stl that I could print on my 3D printer. > REally?? I have been working on it for 2 days. > > I am a photographer and an artist. I want to create 3D images from my > photos and from artwork so that the blind can touch an image and "see it." > That is* all *I want to do. I did it once through another venue. > > I did drop a "dxf" file onto the command line but I haven't the foggiest > how > to implement it. The first time I did it I got a message saying I had > dropped an invalid dxf file onto the command line. > > I am told that I have to "correctly escape the string." How do I do that? > I > am totally overwhelmed with things I have to do at the moment and I do not > want more. I am at a point where everything I do takes me further afield > from my goals. I know that there is a manual but for the little thing I am > attempting to do I only need a couple of instructions. I have no intention > of doing any greater things with SCAD. It is a task I will repeat many > times until something better/easier comes along. > > Could someone please tell me how to import the dxf file I want, extrude it > then save it as an STL? I was thinking I would get an "import" button, > but > noooo! > > Can/would someone please walk me through this? > > > > -- > View this message in context: > http://forum.openscad.org/converting-svg-files-from-Inkscape-to-scad-files-to-stl-files-tp16084.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 >
CA
Carsten Arnholm
Mon, Feb 15, 2016 5:19 PM

On 15. feb. 2016 04:33, Adam wrote:

Carsten,
Thank you very much!

You're welcome. I had fun exploring how to go from an image profile to
an OpenSCAD model. It is not really straightforward.

For the other referece, observe that AngelScript CSG handles the image
-> 3d independently of OpenSCAD. A polyhedron is created directly
instead of relying in the OpenSCAD surface command. Therefore, the
results may become slightly different.

Carsten Arnholm

On 15. feb. 2016 04:33, Adam wrote: > Carsten, > Thank you _very_ much! You're welcome. I had fun exploring how to go from an image profile to an OpenSCAD model. It is not really straightforward. For the other referece, observe that AngelScript CSG handles the image -> 3d independently of OpenSCAD. A polyhedron is created directly instead of relying in the OpenSCAD surface command. Therefore, the results may become slightly different. Carsten Arnholm
J
jpmendes
Tue, Feb 16, 2016 6:36 PM

Hey

If not done already, you should install the Inkscape python script plugin V6
at:

http://www.thingiverse.com/thing:25036/#files

jpmendes

--
View this message in context: http://forum.openscad.org/converting-svg-files-from-Inkscape-to-scad-files-to-stl-files-tp16084p16159.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

Hey If not done already, you should install the Inkscape python script plugin V6 at: http://www.thingiverse.com/thing:25036/#files jpmendes -- View this message in context: http://forum.openscad.org/converting-svg-files-from-Inkscape-to-scad-files-to-stl-files-tp16084p16159.html Sent from the OpenSCAD mailing list archive at Nabble.com.