Lobo's Blender Page

Batch STL

I have been learning Blender for a while and have found it to be an amazing application.
We use Blender for rendering products we design at Formworks Product Design where I work. Our products are modelled using parametric cad packages (we use both Solidworks and ProEngineer) so we can generate part files to send them out for tooling.
The easiest way to get an assembly out of our cad packages and into blender as a mesh is using the .stl format which is meant for rapid prototyping but in my experience has given the best results for transferring files to rendering packages.
The main problem I have faced in using Blender to render our products is lack of a batch import function, some of our products have several hundred components so it can get a bit boring/frustrating importing them using File>Import>STL...


As Blender has support for python writing your own import script is pretty easy. I hacked together the batch_stl.py script by creating a loop around an stl import fucntion.
I couldn't find an stl import script for binary stl files (which are smaller and my preferred format over ASCII) so I wrote my own which turned out to be very easy even with my lack of python and blender api experience.
I borrowed some code from the .slp import function which does a nice job of eliminating duplicate vertices (thanks Anthony D'Agostino) and ended up with this batch_stl.py script.

Here it is batch_stl.py I hope someone else finds it useful.

batch_stl.py - Batch Import Binary .stl files
Add the script to your blender/scripts directory. Execute this script from the "File->Import" menu and choose an STL Batch file, select a file in the directory you would like to batch import .stl files from.
batch_stl.py 1.0 Added fix for Ascii STL files code supplied by Christoph Conrad, Thanks!
batch_stl.py 0.9 Added support for Ascii STL files code supplied by Billy Araujo, Thanks!
batch_stl.py 0.8 Minor fix when importing long names.
batch_stl.py 0.7 Updated for Blender 2.40
Got rid of dependancy on meshtools to stop an error if you did not have a full python install
Added options to replace existing meshes with the same name and to turn off the progress bar which makes it faster.
batch_stl.py 0.6 Updated for Blender 2.40 Alpha2
Added option to import a single file
batch_stl.py 0.5 Updated for Blender 2.37 (use 0.4 for 2.36)
batch_stl.py 0.4 Added options to "Set Smooth" and "AutoSmooth" imported meshes
batch_stl.py 0.3 Now supports windows aswell as linux, not tested on OSX. Removed regular expression module import so now works without full python install
batch_stl.py 0.2 Added Gui & ability to Scale imported meshes.
batch_stl.py 0.1 No gui

 


Blender WebRing Home Next Site List Random Previous
We use third-party advertising companies to serve ads when you visit our website. These companies may use information (not including your name, address, email address, or telephone number) about your visits to this and other websites in order to provide advertisements about goods and services of interest to you. If you would like more information about this practice and to know your choices about not having this information used by these companies, click here.