software to make a hole in an object using 2d image

Have questions or comments about Simplify3D, Slic3r, Cura, Reptier, etc? Or wondering about which CAD software to use...discuss it here...
Post Reply
User avatar
boep777
Posts: 43
Joined: Sun Oct 18, 2015 2:41 pm
Location: Chicago
Contact:

software to make a hole in an object using 2d image

Post by boep777 » Thu Mar 31, 2016 8:47 pm

Hi, i need to make a hole in an object (e.g. slab) according to 2D image.

I tried using OpenScad surface command and it works fine but very slow for large image
This is may be because surface uses image intensity as Z, while I do not need it at all ...
This job will be repeated multiple time and I need speed

Any suggestions ?

User avatar
ednisley
Posts: 993
Joined: Fri Apr 11, 2014 5:34 pm
Location: Halfway up the Hudson
Contact:

Re: software to make a hole in an object using 2d image

Post by ednisley » Thu Mar 31, 2016 9:45 pm

boep777 wrote:Any suggestions ?
Option 1) Crisp up the image, extract its borders, extrude the shape

Preprocess the image to convert the grayscale to monochrome: black + white, nothing in between. That will eliminate most of the irrelevant detail, but you'll still have polygons along the edge. This image prep checklist for my cookie press script should get you from gray to monochrome.
http://softsolder.com/2012/11/29/automa ... checklist/

Align that shape across the Z=0 plane, project a slice onto Z=0 as a 2D object, then linear_extrude as far as you need. The polygons will be gone, you'll have a clean shape, and it ought to come pretty close to what you need. The Projection doc explains how to slice an object:
https://en.wikibooks.org/wiki/OpenSCAD_ ... Projection

Given a bunch of original images, you can automate that entire process. I used a grayscale height map image to produce both a cookie cutter (which is basically what you want) and a cookie press (which takes forever to process, as you discovered).

Option 2) Convert an image to DXF, import, extrude

If you have only a few images, you can convert them to DXF manually using Inkscape. I did that for a special-purpose cookie cutter, then fed the resulting shape into the cutter script:
http://softsolder.com/2013/08/28/creati ... ie-cutter/

----

Either of those processes should give you a clean linear_extrude shape that exports into an STL file like this:
Image

You can then punch that shape out of a slab without any hassle:
Image

jsc
Posts: 1863
Joined: Thu Apr 10, 2014 4:00 am

Re: software to make a hole in an object using 2d image

Post by jsc » Fri Apr 01, 2016 2:24 am

I just checked out your cookie cutter link, Ed. It appears things have improved since you wrote that. I used Inkscape autotrace (https://inkscape.org/en/doc/tracing/tut ... acing.html) and the Inkscape to OpenSCAD dxf tutorial you disparaged (http://repraprip.blogspot.com/2011/05/i ... orial.html) and ended up with this:
Screen Shot 2016-03-31 at 9.19.09 PM.png
In Step 6 of the tutorial, I opted for the Extensions - Modify Path - Flatten Beziers option, which worked great.

If you want a through hole shape through your entire slab, you can even export an inverse path by differencing in Inkscape and extruding that instead of differencing within OpenSCAD.

User avatar
Tim
Posts: 1188
Joined: Thu Apr 10, 2014 2:19 pm
Location: Poolesville, Maryland
Contact:

Re: software to make a hole in an object using 2d image

Post by Tim » Fri Apr 01, 2016 3:02 am

jsc wrote:the Inkscape to OpenSCAD dxf tutorial you disparaged (http://repraprip.blogspot.com/2011/05/i ... orial.html)
I tried to follow what that tutorial is doing, and (however much it may have been improved since Ed was ragging on it) it seems to be more complicated than necessary. I have been using the Export-to-OpenSCAD-DXF plug-in described in http://www.thingiverse.com/thing:14221, in which you just do "Save As..." and select "OpenSCAD DXF" and it's done. I have a more complicated procedure in which I use xcircuit (because, hey, I wrote it) to draw an outline to match some photographic image that I put in the background, export SVG, then load that into inkscape and export the OpenSCAD-compatible DXF. Obviously, if you're familiar with drawing in inkscape, that's much more direct.

User avatar
ednisley
Posts: 993
Joined: Fri Apr 11, 2014 5:34 pm
Location: Halfway up the Hudson
Contact:

Re: software to make a hole in an object using 2d image

Post by ednisley » Fri Apr 01, 2016 12:23 pm

Tim wrote:select "OpenSCAD DXF" and it's done
The wizards have been improving OpenSCAD's DXF import (and export!) capabilities, making it much more robust these days. It's still not a general-purpose CAD program, but smart folks have performed amazing feats with the 2D features.
jsc wrote: It appears things have improved since you wrote that.
Not only that: nearly everything I know is obsolete... [grin]

User avatar
Jules
Posts: 3150
Joined: Wed Jan 21, 2015 1:36 am

Re: software to make a hole in an object using 2d image

Post by Jules » Fri Apr 01, 2016 3:09 pm

ednisley wrote:Not only that: nearly everything I know is obsolete... [grin]
Yeah, well me too now.....move on over guys......is there room on the shelf for one more? :lol:

User avatar
boep777
Posts: 43
Joined: Sun Oct 18, 2015 2:41 pm
Location: Chicago
Contact:

Re: software to make a hole in an object using 2d image

Post by boep777 » Sat Apr 02, 2016 5:32 am

Thanks! got the idea. BTW there is a trace to openscad export plugin - convenient.
since my image was in MATLAB,i made in ML similar tracer and exporter like in inkscape + called openscad as command line to make STL - works fast and nice.

User avatar
zemlin
Posts: 439
Joined: Thu Feb 04, 2016 9:32 pm
Location: Indianapolis, Indiana

Re: software to make a hole in an object using 2d image

Post by zemlin » Fri Apr 08, 2016 2:54 pm

This web site will take a 5000x5000 raster image and convert it to several different vector formats including DXF.
I used it recently to create a file for a vinyl cutter and it worked well.
http://www.autotracer.org/

Post Reply