Sunday, April 1, 2012

Shelling 3d Models

Shelling 3d Models…

I’ve been working on a lot of models which are overpriced when I upload them.  I hunted around for tools that can assist me in shelling the model to lower the cost.  Now my search hasn’t turned up a single solution to shelling a model.  Many software’s, including blender and 3ds max, include integrated tools shell models. I’ve only had limited success with their software as their learning curve is a bit strong.  My personal opinion is that these integrated tools are poor implementations of what we need for solid modeling.

All this comes to a head in a process I’ve developed to shell my models.  It is based on the concepts I found here, https://sites.google.com/site/3dprintfaq/workflows/hollowing-a-model but I’ve modified it to make the process work for my projects.  This guide will be specific to my workflow and hopefully reveal some details which will help you adapt it to your workflow.

The Software I use:

  • Sketchup
  • Netfabb Studio Basic
  • Meshlab

Step 1: Build your model.



The first step is completing your first model.  As I mentioned in another post I use Sketchup as my modeling software of choice.  It’s simple and easy to learn and works especially well for linear designs.

Some important notes regarding working in sketchup

  • Work at 1000 times scale in sketchup.  Sketchup has a minimum line segment limit size that causes errors on small items.
  • Work in millimeters in sketchup and everywhere else.  Working in mm keeps you from having to figure fractions and since shapeways’ uses mm by default for its pricing so it just makes things easier.
  • Remove interior geometry and separate shells.  There is a certain camp at shapeways that says not to worry about separate shells or interior geometry because shapeways will solidify the model on printing.  This stray geometry causes errors when shelling a model and often results in strange aberrations when shapeways solidifies things.  Further it’s just bad design to leave parts laying around that don’t do anything.
  • Export your model as STL.  Sketchup can save STL models in the pro version, there are export plugins you can find on sketchucation for the free version.  STL is the preferred solid model format.  If you can’t export in STL you can export as 3DS to open in netfabb then export it from netfabb as STL.

Step 2: First visit to Netfabb



Netfabb is a fantastic software which is pretty integral to any solid modeling project.  The basic version lets you fix most errors in STL models.  The Pro version can tile models, divide them, and shell them.  Obviously I don’t have the Pro version, its price is excessive for a person like me who does this as a hobby, but for someone making a business of this it could save a lot of time and effort.

Now the important thing to use Netfabb basic for is solving gaps and major errors in the model’s outer surface.

  • Extract Surfaces as Part.  If you have stray geometry in your STL you can extract the surfaces to a new part to eliminate the geometry you don’t want.  Click  “Repair” (the red cross) then choose “Select Shells”.  You can then right click to “Extract Triangles as Part” the new part you create will not include anything you didn’t select.  Once you have the surfaces separated you can remove the original part by right clicking it in the parts list.
  • Run repair on the part.  Selecting the Part that contains your model you can then click “Repair” (the red cross).  The model will highlight holes, degenerate faces, and other errors.  On the “Status” page make note of the “shells” field that tells how many separate shells in your model.  The best thing to do is to run the automated repair.  It goes through the model filling holes, deleting tiny shells, and so on.  It won’t fix everything but it does fix most things.  Once done select “Apply Repair” to replace your repaired model for the unrepaired version.
  • Export as STL. Now right click on the part and select “Export Part” then “as binary STL” give it a name and save.  Occasionally you’ll get a warning that says faces may become degenerate.  If you do it will offer a repair option by merging faces below a certain threshold, set this threshold to something like 0.0025mm.  This will merge nearby points and fix the degenerate face error.  Then just save as intended.

Step 3: Freeing Models of Errors

At this point if you’ve done as directed in Netfabb your model should be free of holes, manifold errors, and multiple shells.  However if errors remain chances are they are severe and difficult to repair.  So severe in fact that you probably can’t fix them on your own.  Usually these errors come from “rats nests” inside your model.  Tangles of geometry that is hidden below the outer surface of your model so you can’t see it but it persists causing gaps, shells and manifold errors none the less.  Services exist to fix these problems.  Two services spring to mind.

Cloud.netfabb.com: made from the manufacturers of netfabb its presently a free service in beta.  It uses netfabbs functionality along with the processing power of the server to purge problems from models and rebuild the geometry. You have to upload your file for the automated process to be performed.  You then are emailed a link to download the processed file.  Netfabb cloud can be buggy and tends to reject files for no apparent reason some times. I don’t expect it to remain free as netfabb is a profitable company that knows the value of its products.

Cadspan.com: this is an independent cad design firm that has developed a specialized tool to make solid STLs.  The Cadspan web service allows you to upload an STL and then process the STL with some options to generate a water tight STL.  It does this by shrink wrapping the model’s geometry and removing everything but the outer faces.  You have to play with the detail settings to get the best results.  Cadspan has both a free service and a paid version. The free version limits the number of polygons in the model uploaded while the paid version is open ended.  They offer a 1 month trial of the paid service with just an email address.  Like netfabb the company seems to know the value of their product so their prices are out of my range but the free service is quite helpful. Cadspan does tend to generate excessive numbers of shells so it will likely fix your geometry error but need processed in netfabb basic after wards.

Step 4: Making the actual shell.

Now that your model is finished and error free we can make the actual shell you’ll use to hollow your model.  This is done in Meshlab. Meshlab is a free software that surfaces models in a huge variety of ways. It’s a bit crash prone and many processes take a lot of ram and processing power but they get the job done.  My workflow in meshlab is convoluted but it’s the only one I’ve found that doesn’t cause meshlab to crash. The crashing could be subject to the 5 computers I’ve tried it on but I doubt it very much.

  • Launch Meshlab and import your error free model. Do this by selecting “File” and “import mesh” then selecting your STL file.
  • Optional: Decimate your model.  If your model has gone through one of the two web services it’s a good idea to run a decimation operation on the model.  The cloud based error repair tools rebuild your mesh and can often generate strange geometry configurations that, even though correct, can cause meshlab to crash. Decimating the surface removes these complex model areas before making your shell thus avoiding the issue.  If you didn’t use the cloud services its likely your model is fine and won’t cause a crash.  To decimate select “filters” then “remeshing, simplification, and reconstruction” then “Quadric Edge Collapse Decimation”  this will collapse edges to form quads simplifying your geometry.  
    • In the Quadric Edge Collapse Decimation dialog insure “Preserve Boundary of the mesh” and “Planar simplification” are selected.   The other settings can be left at default, changing the boxes will generally result in the model being simplified more and more which isn’t helpful for our purposes.
  • Now we can generate the inner shell.  Select “filter” then go back to “remeshing, simplification, and reconstruction” and finally “Uniform Mesh Resampling”  The complex name basically means it takes the mesh you’ve loaded and generates another mesh a set distance away from the first one.
    • In the Uniform Mesh Resambling Dialog you’ll see two sets of two boxes you can fill in. The first line is “Precision” settings, the first box is Absolute and the second is Percentage based precision.  In the Percentage box set the value to 1, the absolute value will change to reflect it.  This is the relative accuracy of the shell you’ll make, if you set this to a tiny decimal the deviation of the shell would be minimal and you’re pretty much guaranteed the software will crash or take a year to finish. 1% deviation is good for our purposes as it isn’t completely accurate but not far off either.
    • The second line Offset with again and Absolute and Percentage entry field.  Here we are going to look at the “Absolute” field.  Any number we put in is the distance from the outer wall it will make our shell.  As I work at 1000 times scale in millimeters I move my decimal places 3 places to the right.  For instance if I’m working in White Detail I’d use “-1050” or 1.05mm after all is done. White Strong and Flexable I’d do “-750” or 0.75mm.  Frosted Detail, “-550” or 0.55mm” and of course for Frosted Ultra Detail “-350” or 0.35mm.  You’ll notice I’ve worked in a tiny bit of padding, this helps alleviate wall thickness errors caused by scaling issues on upload.  The exact thickness will depend on the scale you work at and the material you’re printing in. 
    • Also insure that “Clean Vertices” and “Multisample” boxes are selected. This insure the new shell is made from the best possible points extrapolated from your working model.

Step 5: Pointless busywork.

Now at this point you have an outer model and an inner shell model but the two exist as two separate parts in meshlab.  You can’t export them as one yet.  If you tried to flatten the layers into one at this point meshlab would crash.  Supposedly this is because of how the model exists in memory.  Really it’s just a headache caused by the programs.  So what we have to do is export the model and reimport it, then flatten it.

  • Export the Laters.  You can see the layers by going to “view” then “show layer dialog” a column at the right will appear listing your layers.
  • Select the “Offset Mesh” and go to “File” and then “export mesh as”  select ply from the options and export it someplace. Name it something you’ll remember, doesn’t matter what this is just a temporary holder.
  • Now we can close this project and start a new one in Meshlab.
  • We’ll now import the meshes.  Once more its “File” and “import mesh” then selecting your STL file. Then we’ll do it again this time importing the PLY you exported a second ago.
  • With both meshes imported once more go to “View” and “Show Layer Dialog”.  Now right click on the layer dialog and select “Flatten Visible Layers”  this will merge all your layers into a single layer.
  • Now, finally go to “File” and “export mesh as” and save your mesh as an STL or similar file type for further editing.

Step 6: Yes More Model Editing.

So you built the shell and joined the inner and outer shells into a single file.  Unfortunately since the inner and outer shell overlap shapeways will ignore the inner shell if you uploaded it now. Even if it did pay attention the fact the shell has no opening so material would be trapped inside and you’d still pay for the material.  So at this juncture we need to make an opening from the inner shell to the outside so it’s all one big hollow shell and can be properly printed.

  • Launch Sketchup and import your shelled model. 
  • One of the weird things about working in Meshlab is that when it exports it rescales things.  When you load it into sketchup or other software its generally been made larger.  Scale the model you import by 0.39 in order to return it to its proper size.
  • You can do this a couple of ways.  If you have the pro version of sketchup you can make a cylinder make it a group, make your inner shell one group and your outer model another.  Pose your cylinder where you want it.  Then subtract the cylinder from your outer model.  Then subtract your inner shell from the outer model as well.  This can be time consuming and for complex models may make some errors you’ll need to fix between operations.
  • Alternatively if you don’t have the pro version of sketchup you’ll need to do this a little bit harder.  Start by again making the inner shell one group and the outer model another and creating another cylinder and grouping it.  Position your cylinder where you want it then explode the cylinder group.  Then hide the outer model and explode your inter shell.  Select the cylinder’s outer surface and right click. Select “Intersect faces with model”.  Now go in and erase stray surfaces and edges.  Once the extra geometry is removed triple click the inner shell to select the entire set of geometry.  Now right click and select “reverse faces”.  Once reversed unhide the outer model and explode it as well. Select the extending part of the cylinder and once more right click and choose “Intersect faces with model”.  And once again remove the unwanted geometry.  Finally select everything and group them again.
  • It should be noted that models that are large will warp in some materials if they aren’t thick enough or lack enough support.  This happens particularly when working with materials like FUD at its minimum thickness.  Check your design rules. This is the right time to put in interior supports if you have to.  It’s much easier now than earlier or later in the design process.  A few thick cylinders running as supports through the cavity will prevent the model from warping during printing.  Follow the same process using either Union or Intersect Faces to make the supports part of your model.
  • With everything as one solid it’s time to finalize things for shapeways. Select the model you just made.  Now in the Pro Sketchup you can go to “file” and then “export” and “3d model” in the export dialog box choose STL.  If you don’t have the Pro version go to “Plugins” then “Export STL”  Save your STL file once more.

Step 7: Second visit to Netfabb



So once you’ve built a nicely shelled model you need to error check it and shrink it to the right scale.  Of course netfabb basic is fantastic for that.  If you believe the propaganda from netfabb the pro version would be able to do everything we needed up to now but that isn’t possible on my budget, on MOST people’s budget really.  Anyway lets skip my ruminations on the need for lower cost alternatives to fill these rolls and get back to work. 

Now we need to go through basically the same work we did before but with the addition of scaling the model to its proper size.

  • Scale the Part.  Select your part, then right click and select “scale”. This will open a scale dialog that allows you to type in a percentage to scale the part by.  By default the model should scale uniformly.  In the first box of the  scale dialog type your scale factor.  The other boxes will change to reflect it.  I work at 1000 times scale so I type in 0.001 as a scale factor.  This will take a model that I’ve built at 28000 mm and shrink it to 28mm.
  • Run repair on the part.  Selecting the Part that contains your model you can then click “Repair” (the red cross).  The model will highlight holes, degenerate faces, and other errors. 
  • Remove degenerate faces. Unlike before the model should have lots of orange lines highlighted. These are degenerate faces, faces that have become so small or corrupted they cause errors.  In the repair dialog on the right select the “actions” tab.  Now Select “remove degenerate faces” this will delete all the screwy faces.
  • Automatic Repair. Now we can run the automated repair.  It goes through the model filling holes, deleting tiny shells, and so on.  It won’t fix everything but it does fix most things.  Once done select “Apply Repair” to replace your repaired model for the unrepaired version.
  • Export as STL. Now right click on the part and select “Export Part” then “as binary STL” give it a name and save.  Occasionally you’ll get a warning that says faces may become degenerate.  If you do it will offer a repair option by merging faces below a certain threshold, set this threshold to something like 0.0025mm.  This will merge nearby points and fix the degenerate face error.  Then just save as intended.

Step 8: Upload to Shapeways

That’s it, the models done. Properly shelled, nice and pretty. Scaled to match other minis.  All we need do now is upload.  If things didn’t go right it won’t upload, generally giving you a manifold error.  For the most part though it should work.  Once uploaded you’ll need to limit your materials to the ones you intended it for or those with more stringent guidelines.

5 comments:

  1. I've been back to this page a number of times .. and each time I meant to leave a comment. So. Excellent information. I had looked all over for a way to hollow out my Sketchup meshes. This has suddenly been brought back to my attention when I uploaded a mesh that is some 30+ cm3 which in FUD is over $100 .. sooo .. back again to this article. Thank you .. thank you!

    ReplyDelete
    Replies
    1. I'm really late saying this but thank you for the feedback. :) I haven't updated this blog for a long time because of legal threats but I am very grateful that you appreciated the information.

      Delete
    2. I wandered back over to this article as a friend was asking about hollowing out his Sketchup model. Sorry to hear you had legal threats .. which raised some concerns since I have blogged on using Sketchup, MeshLab and NetFabb .. I am going out on a limb here and thinking that it was probably talking about using Sketchup Make to create a mesh for upload to Shapeways.

      Oh .. you mention having to re-scale by x 39. I looked into that very subject. The problem is that MeshLab exports what appears to be a vanilla COLLADA file. Sketchup uses their own version which adds information such as for materials. the Sketchup DAE file has that line .. < unit meter="0.0254" name="inch" /> which is not in The MeshLab DAE file. Without this Sketchup goes nuts with the sizing as it has no instructions. That 39 you mention .. is actually converting inches to meters .. 39.37 (some rounding there .. confirmed by exporting, importing, converting etc. a 1 inch cube)

      Delete
  2. Does anyone know about what is 3d printing and what to do from 3d printing..??
    STL repair

    ReplyDelete
  3. This comment has been removed by a blog administrator.

    ReplyDelete