Friday, May 22, 2009

 

Want to Slice Step files or bad STL Files?


Summary
I have produced a script that will slice STEP files. It will also handle really bad STL files, which is a nice bonus.

The script generates an svg file that is both human viewable and contains the path information for the slices. This file can be imported into skeinforge to generate the gcode.

Here's an example of an output file. Open with firefox or a javascript-enabled viewer, and you can scroll through the layers.

If you have been frustrated by the "create STL-->have skeinforge/rr host puke because there are holes/etc--> fix by black magic" dance, this is the tool for you.

Is it the solution for you? You can download the tool here:

Give it a try, and let me know your thoughts! Fair warning, installation requires a few dependencies; they are documented in the install.txt file in the zip file.

More Detail
As soon as I started playing with the RepRap host software and skeinforge, the first thing that I realized was that my modelling tool ( and old student version of solidworks ) creates horrible STL. Neither skeinforge nor the host would handle it my STL.

The next thing i realized is that STEP is a much better format for storing solid objects-- smaller, more accurate, etc.

I set out to make a slicing program that would handle STEP and bad STL files, and, ideally handle them very fast.

I did not want to re-invent the work Enrique has done-- what was needed was a file I could create that had only the hard part--the slicing-- and then let his tools do the rest.

Enrique and I collaborated on the slice file format. It seemed like a good idea to use a standard way to communicte 2D paths, and to provide a way for humans to understand the files contents.

Needless to say, reading STEP files and fixing bad STL is quite hard-- I needed to avoid writing this. So, I ended up getting involved in www.pythonocc.org -- a python binding to the OpenCasecade open source modelling kernel. This is really the tool for this job-- an open source full-fledged modelling kernel!

For the cost of having to install OCC, i got lots of benefits-- including a really handy, really fast viewer for 3d objects that can handle STL, STEP, and IGES!

Going Forward
I hope to expand the tool to provide a more interactive environment for slicing and getting objects ready to build. i would like to integrate skeinforge into the tool.

Comments:
Kickass. I've noticed my old version of Solidworks will make SkeinForge choke and die.

Can't wait to play around with this.

For me, parametric modelling is the killer app, and going back to sketchup or similar was a real pain. All modelling should be parametric.

Thanks Dave!
 
excellent! let me know about your experiences...
 
Geez, that dependency chain is a killer.

Having to register to download the components, then downgrade my python version. Urgh.

I'll pass for now. I'd be interested to hear anyone else's experiences though.
 
Dave, this is utterly wonderful. I love the level of detail work you put into the svg generation: I didn't know you could put javascript in there. Awesome stuff!

Also, I'm really glad that skeinforge alternatives are popping up and that your work validates OCC as a good base to build on.

One suggestion, would you set up a public source control repository for the code? Hacking on stuff is so much easier if the code can be forked on github (or google code or wherever).
 
@antifuchs:

I've been working with the pythonocc guys-- my hope is to include the tool in the samples distribution for pythonocc-- that way, when you install pythonocc you get my tool.

@Gav-- try with your current version of python first-- Thomas @occ indicated that python 2.6 and probably v 3 worked.

Which components did you have to register to download? Didn't think you needed to register to get pythonocc or cheetah-- i guess OpenCascade itself?
 
Yep, it was open cascade I think.

I'll have another look in the future, but I'm a bit pressed a the moment and I can't take the time to work through the dependency chain.
 
Gav, I understand...
 
I *really* like where this is going!

Your svg+javascript viewer is a textbook example of how powerful open standards are. Very well executed, couldn't have thought of a better way to do it than this!

I'd love to see skeinforge integrated at some point. I'm just learning what everything means right now (a lot to learn there). Since despite it's sophistication, it's usability is rather underdeveloped. I'd love to see the workflow of printing 3D models improved.
 
Hi, Erik:

Were you able to successfully slice any models? I am anxious to hear stories of success, as one of the biggest concerns i have is 'strange problems' with complex models.

My test models are pretty simple, so though the scripts work well for those, I would love some feedback for more complex models.

In particular:
(1) Do complex models work?
(2) how does slicing speed compare to skeinforge or host software speed

Integrating skeinforge should not be hard-- that's the primary reason I used python.
 
@Dave:
I'm using Ubuntu Linux (Jaunty, 9.04). OpenCascade is an installable package. But the latest version of pythonOCC didn't compile. I've tried it via SCONS and with the ordinary method "sudo python setup.py build"

Of course this software would be valuable enough to make a nice installer, including a debian/ubuntu repository to stay up to date automatically. I'm willing to offer hosting for it (for free!) on a linux box (gigabit connection online) where you can also build the package (fast hardware).

Instructions for getting it running on windows would be a good start, since the majority still uses that. I guess that that would be a bit easier.
 
Hi, Erik:

I put instructions for installing my slicer into the module. As for installing OpenCascade and pythonOCC, the windows installers worked for me-- i used the wo-0.2 release. I found the windows installation pretty painless- there was a wizard-like installer for both OpenCascade and the pythonocc latest stable release.


Thomas @pythonocc has gotten a linux distro working. You could post to the mailing list there.
 
Hello Dave.
Thank yoou very much for your script.
I try the script, but it doesn´t run. The error is the next:
C:\Python25>python OccSliceLib.py
Traceback (most recent call last):
File "OccSliceLib.py", line 62, in
import wx
ImportError: No module named wx

Can you help me?
Thank you
 
Emmerich,

Had the same problem, I downloaded and installed wx from here http://www.wxpython.org/download.php#prerequisites

I also had to go back and download v2.2.1 of cheetah (the windows installer version is only 2.0b4 apparently). I unzipped the .tz file and copied the contents of "src" to C:\Python26\Lib\site-packages\Cheetah

Seems to work now but haven't tried slicing anything yet.

-Zomboe
 
This is a powerful tool! I just sliced a fairly complicated STL of a boomerang from taken from a 3D scanner and it appears to have smoothed a few things out.

I was wondering how you recommend using the generated SVG files however. Is there are way to convert these slices into splines or something that can be imported back into CAD software?

Thanks.
 
Post a Comment

Links to this post:

Create a Link



<< Home

This page is powered by Blogger. Isn't yours?

Subscribe to
Posts [Atom]