Warning and Notice:
- There are some inconsistencies in this piece since it has been written in 2010. Newer versions of Meshlab makes merging two positioned objects really easy. Import the two models, then flatten, then save.
- Aligning objects in Meshlab remains difficult and we rather suggest to do this with Netfabb or a similar tool.
- Most of the Meshlab "how to" is relevant for any 3D printing, but some of the original text only concerned the RapMan, e.g. slicer settings.
No time for serious updating, sorry - Daniel K. Schneider 17 December 2011, updated October 2012, updated March 2016, updated Feb 2017
This little tutorial was made in 2010 to cover first steps of using Meshlab for creating printable RapMan .STL files. 3D printable objects are also called models or meshes. Meshlab calls them "meshes", no surprise here.
We will cover:
- File format conversion
- Merging already aligned meshes
- Aligning and merging of meshes
- There are simpler ways for aligning .STL objects, i.e. with Netfab or by using OpenScad (the latter requires typing skills).
- You also could import to Meshlab, save as .3DS, then import to Google sketchup, then align there. However importing/export may alter the object.
- The most easy way to align and merge objects is to buy Netfabb studio Pro ....
Importing 3D modeling formats and exporting to .stl
Some 3D modeling tools can't export to .STL. Google sketchup (free version) only can export to .DAE, the collada format, unless you install a so-called plugin. For most [Slicers and user interfaces for 3D printers slicers], you need an .STL. Some can read *.obj or *.ply formats. I suggest using .STL, since it is the standard for exchanging open source printable 3D objects.
Example to import a .dae file
- File -> Import Mesh
You then could fix meshes and do other manipulations like changing size and position, but for beginners it's easier to use NetFabb for this. Therefore just export the model under the STL format.
To export as .stl:
- File -> Export Mesh as
Triangle reduction and repair
Meshlab includes several interesting algorithm for repairing and simplifying meshes.
Menu File -> Import Mesh
- Tick the Wireframe Icon on top
Step 3: Select the (maybe) best triangle reduction filter
Menu Filters -> Remeshing, simplification, and Reconstruction Quadric Edge Collapse Decimation
Now in the small popup
- Tick "preserve Normal" and "Preserve Toplogy"
- Enter target number of faces or enter a fraction, e.g. 0.25
Warning: It can takes a long time (hours) to reduce complex models. Time it takes seems to grow exponentially. In that case, we suggest using a different procedure than Quadric Edge Collapse Decimation. You also can try different software.
For example, a file with over 5 Mio faces.
- Quadratic Edge collapse took hours
- Netfabb Pro managed to reduce a 5Mio faces terrain model to a 0.5Mio faces model in a fraction of the time (minutes)
- Meshlab clustering decimation filter took a few seconds.
Reducing very large files
Menu Filters -> Remeshing, simplification and reconstruction Clustering Decimation
In the popup, try a value between 0.1 and 1, e.g. 0.3.
Clean up work
- Decimation usually creates some errors, that you will have to repair. Use either Meshlab (see below) or another tool like Netfabb.
Many things can be wrong, here is a list of popular operations made by https://www.cis.uab.edu/jj/soYouWantTo/cleanMesh.txt John K. Johnstone (retrieved oct. 2015) and Kraftwurz Design
Import the model (as usual) and display the layers panel
File>Import Mesh , click OK to Unify Duplicate Vertices if necessary. Click "Show Layers Dialog" icon (Next to camera icon, looks like layers). The panel should appear to the right.
Check the quality of the model
Filters -> Quality Measures and computations>Compute Geometric Measures
- You should see a volume for the mesh in the Layers Dialog box to the right if you do not, try the steps below.
Close vertices, remove duplicate faces and vertices:
Filters ->Cleaning and Repairing -> Merge Close Vertices Filters -> Cleaning and Repairing -> Remove Duplicate Faces Filters -> Cleaning and Repairing -> Remove Duplicated Vertex
Filters -> Clearning and Repairing -> Remove Faces from Non Manifold Edges Filters -> Remeshing, Simplification and Reconstruction -> Close Holes
Orient faces (all faces must point outwards)
Filters->Normals, Curvatures and Orientation->Re-Orient All Faces Coherently
Once you got a good method to reduce and clean up a kind of mesh, you could save the procedure as a script. To do so:
Menu Filters -> Show current filter script.
- Remove unwanted items
See an example in here
Merging models into a single one (mashups)
Now let's assume that you have two or more objects that you would like to merge, i.e. in the simple sense of fusioning models that already in the right position. Aligning models and more complex "Mesh merging" are much more difficult procedures. Anyhow aligning with a tool like Netfabb or even Google sketchup is simple. In Netfab, align the models, then export each one separately. Then open each model in Meshlab.
Merging the easy way
In the most simple case, objects already are in the right position, e.g. you positioned each object you made in the right x/y/z position using a tool like Netfabb or sketchup.
- Import the STL Files (two or more)
File -> Import Mesh File -> Import Mesh
- Menu Filters->Layer and Attribute Management->Flatten Visible Layers
- File->Export Mesh as
... done :)
Merging the difficult way
According to the Layer Management Meshlab wiki page:
- You can add an external mesh to a new layer by going in File > Open As New Layer.
- Then open the layers tool. Click on the 5th icon from the left and that looks a like a pile of paper (or layers).
- Either right-click on the layer box that will popup, or go in Filters > Layers Management. Then flatten your layers, click on Flatten visible Layers The options are explicit.
- Then File->Save as
- Again, you could import to Netfabb again for repair or directly import to skeinforge, depends how much you trust your STL files. When you export from sketchup to .DAE, repair is mandatory I believe.
Example - paper clip with a name
(1) Get the paper clip from Thingyverse
(2) Create a 3D Text Then, for creating the text we played with two options (pick either one):
(2a) Create a 3D text with Google Sketchup and save as .DAE (collada), then transform to .STL with Meshlab
(2b) Create a 3D text with netfabb (click on the second icon from the left)
For both options, size doesn't really matter, but it's easier to create something in the 1 to 10 cm range and about 2mm high.
However, the kind of chosen font does matter. Pick a regular bold font. In addition (if you have the patience, you could explode the text group and space out the letters. The RapMan has trouble printing narrow fonts or letters that are too close !
(3) Align and resize with netfab
- Load both models in netfabb
- Make the Paperclip size correct, e.g. use Menu: Part->Scale (or click on the icon). I made the paper clip a bit bigger and about 2mm high (Z-axis).
- Then rotate the letters, resize and approximatly position, etc.
- Then (important) position the paperclip at origin (Menu: Part->Move to origin). Verify by clicking the "information" icon
- Then position the letters on top. E.g. if height of the paperclip is 2.2mm, position it at z=2.2mm
- Then look at the object from top and move the text into final position
- Finally, export both files as STL, e.g. clip.stl and name.stl
Notice: In the pro version of Netfabb you can merge, in the free version you can't.
(4) Merge with Meshlab as explained above
- Import the paperclip
- Import the text
- Flatten the layers
- Export as new STL (file: nameclip.stl)
(5) Repair the final STL with netfab
- Import nameclip.stl to netfabb
- Repair by clicking on the red + sign (I just used default repair). Apply the repairs.
- Export part as .STL
- Import to skeinforge
- Print ...
Here is a first result. No so good, since I used an inappropriate font (the default in netfabb)
Sorry for the bad picture quality. My cellphone can't handle close-up pictures of plastic and that's the only camera at hand at work.
Here is a result for another girl:
The next picture shows a version that was way to fat (2 to 3 mm for clip is enough). The fat one can go to a keyring ...
The best results come from paperclips that are about 10cm long and about 3mm thick (without counting the letters). Make sure to print a hot and large lines raft !
Moving and aligning meshes
In order create a single model from several imported misplaced and mis-sized models within Meshlab, you need to dig into Meshlab commands first.
- By default, e.g. when MeshLab starts, you are in the so-called camera mode where the mouse actions are used to change the way in which you look at the model.
- When you use Interactive editing tools, the mouse actions are interpreted in a different way (e.g. for painting the mesh), but you can always switch back to the camera mode by pressing ESC; in this case the edinting tool is just suspended and you can go back to editing by pressing again ESC.
- To exit from an editing tool, you have to press again the toolbar button that started it.
Obviously for mac users, you should substitute the ctrl with the command key.
|left drag||Rotate the object. Click far from the center to rotate around the line of view.|
|ctrl+left drag||Pan (move right/left)|
|wheel||Zoom in or out|
|shift+left drag||Zoom (if you do not have a mouse wheel or if you want smooth zoom)|
|ctrl+shift+left drag||Light rotate, to interactively change the default light setting.|
|left double click||center and zoom on clicked point; subsequent rotations and zooms will be centered on the chosen point. E.g. if you want to rotate an mesh arount its center, double click in the center.|
|alt+left drag||Z translate; moves the camera along the viewing direction, (the effect can be similar to zoom, but it allows to more precisely navigate in the space around the object)|
|shift+wheel||change field of view and move the camera to keep the model of approximately the same dimension (in practice increase/decrease the perspective deformation, much alike the Hitchcock zoom depicted in the Vertigo movie).|
|ctrl+wheel||move near plane back and forth to section the object and reveal its interior.|
|alt+wheel||change point size when rendering mode is Points. Use Points rendering to display interactively huge meshes.|
Other useful key combinations for mesh inspecting are:
- ctrl+d toggle double sided lighting
- ctrl+k toggle backface culling
- ctrl+f toggle blue-red back=front lighting
With align tool enabled and one mesh selected, the selected mesh will change position, rotate, change size etc. using different commands
The Align tool:
- Click on the A - align tool
- In the Align tool popup window, select one of the Meshes
- Click on "Manual Rough Glue"
- Then use the key+mouse combinations below to change position, size and orientation
- Click on "Store transform".
In the align tool mode there are both camera mode and object move/resize commands. Note: You also could hit ESC to go to camera mode, and hit ESC again to come back.
|left drag||Rotate orbit around the current center of the object. Click far from the center to rotate around the line of view.|
|ctrl+left drag||Pan (move the object right/left with respect to the others|
|wheel||Zoom in/out the whole scene (camera mode)|
|middle drag||Pan the whole scene (camera mode)|
|ALT-middle drag||Rotate the whole scene (camera mode)|
|shift+left drag||Make the objects bigger/smaller in or out|
With one of the two selection tool enabled on can edit meshes. Click = click left button of the mouse
|click||Select all the faces in the direction (including the hidden ones behind)|
|ctrl+click||Add faces to selection|
|shift+click||Remove faces to selection|
|alt+click||Select only the front faces (without the hidden ones behind)|
|ctrl+alt+click||Add only the front faces (without the hidden ones behind) to selection|
|shift+alt+click||Remove only the front faces (without the hidden ones behind) to selection|
|middle mouse button||Translate mesh|
|alt+ middle mouse button||Rotate mesh|
Moving axis and pivot point (origin) of the object
Remark: conter-intuitively, the sphere does not correspond to the axis and point of origin of the object, they are hidden and you will be surprised that translating the object regarding to the phere won't have any influence on the position of the object in another program.
To move the axis you have to do 3 things:
- show the axis:
- Render > Show axis
- move the axis:
- activate the manipulator: Edit > Manipulators tool (or icon in the tool bar)
- press "T" for translate
- either free translate with the mouse or alongside a specific axis by pressing "X" (green), "Y" (yellow) or "Z" (blue)
- press "Enter" to apply your changes (ortherwise they will be lost)
- Freeze the matrix (otherwise your changes will be lost upon saving):
- Filters > Normals, Curvatures and Orientations > Freeze current matrix
Scaling an object
You can scale an objet with
- Filters > Normals, Curvatures and Orientations > Tranform: Scale
- either select a scalling factor or check "Scale to unit box"
- when scalling to unit box, the object is scaled to a 1x1x1 proportion, which is very usefull to ensure various objects imported from various sources end up with the same scale.
- beware that the object often seems to disapear because meshlab do not adujst the zooming factor. So don't panic and zoom in or out to get the object in the display again (or save, close and reopen the object)
- usually, you would first scale to unit boy, then apply another scaling factor to get to the size you want.
- beware that the scaling is apply by clicking on apply (very fast) and since the window is obscuring the view, it is easy to apply it twice by mistake.
Example - create a Lego-compatible duck
Warning: This will take many hours to print. Also overhangs are too strong at the bottom. Some filing needed...
We use two ingredients:
- Open the Lego brick
- Open the duck as new layer
- Click on the align tool
- Click on Manual Rough Glue
- Make the duck bigger and align it with the commands explained above.
- Click on "store transformation"
- Then use the layer tool to merge the two layers as explained above
- In principle, one then could use Meshlab to improve the mesh, but I used netfabb for this (easier to understand)
- So just "save as" some *.STL
- Align the duck to Z=0 !
- (keep its size or else it will not be DUPLO compatible)
- Repair it with the + tool
- Export part as .STL
Then import to skeinforge and print :)
Of course, an expert would simply the mesh, i.e. there is not need to have Lego structures be printed inside the duck, but then nobody will ever see what's inside ;)
- Anyhow I know that I should "gut" the insides of the duck (i.e. the head of the duplo brick) with a 3D rubber ... sometimes soon if I find time. Right now it will print like this:
At some later stages of the print you would see:
The final object is quite amazing. It took about 10 hours to print though. The only "bad" areas are underneath, where the overhang is really big.
And it can stand on a real DUPLO plate:
Example - DUPLO plus Pantherwoman
This time I decided I had to rid of the caps. With Meshlab this is fairly simple:
- Turn the DUPLO sideways so that you can see all the caps
- Click on "Select Faces in rectangular region" (make sure that they are all red and nothing else, you can hit ESC and turn the object, then hit ESC again)
- Then delete the current faces (second last button)
- Then go repair with NetLab (don't know how to do this with Meshlab yet)
- This Duplo brick is available as source code for OpenScad and: “Commenting out the caps in the openscad file and recompiling/exporting would probably have be a easier way to remove the caps” (Domonoky).
- Even better: I downloaded OpenScad, added a forth parameter to the scad file, recompiled and saved it as .STL. You can get my modified version from Thingyverse.
Included is the scad file and 3 examples. All you need to do is to change a line on top of the file, e.g.
- menu: Design-> Compile and render
- menu: Design-> Export as .STL
A more powerful set of OpenScad scripts is available under the name of Doblo factory.
Back to our project. I created the duplo pink panther women with the procedure explained for the Duck (aligning with Meshlab and fixing the .STL with netfabb). I also used a different polymer. The Duck was in ABS ("Lego"-like plastic). This one uses PLA which is prettier and is printed at 205 degrees only.
At the time of writing she is still being printed, but I got a half-sized version done:
For RapMan printing. This object really needs a raft. Without it warped (the brick in the picture below) and worse the print head moved it (the unfinished one to the right).
I used an infill of 0.25 (means that about 0.25 of the inside is filled with honey combs. According to Bogdan Kecman this is way too much. I'll try a version with only 0.05 sometimes.
Here is the final result with two different types of printing parameters:
- Skeinforge parameters for green woman / blue woman
- Temperature: 205 all over
- Infill: 0.25 / 0.05 (blue vs. green)
- Flow rate: 400.0 / 380
- Feed rate: 16.0
- Max cool: 2.0
- Min. layer time: 1.0
- Minimum Orbital Radius: 20.0
- Base Lyer Thickness over Layer Thickness: 2.0 / 2.5
- Base Nozzle Lift over Base Layer Thickness 0.37
- Interface Layer Thickness over Layer Thickness: 1.5
- Raft Margin: 5.0
- MeshLab is the open source, portable, and extensible system for the processing and editing of unstructured 3D triangular meshes. Can import/export STL (for 3D printers like the RapMan))
- Netfabb “is a software tailored for additive fabrication, rapid prototyping and 3D printing. It includes the ability of viewing, editing, repairing and analyzing stl-files or slice-based files in various formats.” Base version is free.
- Sketchup (optional)
- Find more printable objects: 3D assets
Meshlab documentation is rather sparse and there is no good easy to understand documentation on its various plugins