Printing separated parts that can fit

by whitemousegary, published

Printing separated parts that can fit by whitemousegary Oct 27, 2012
1 Share
Download All Files

Thing Apps Enabled

Order This Printed View All Apps


Liked By

View All

Give a Shout Out

If you print this Thing and display it in public proudly give attribution by printing and displaying this tag.

Print Thing Tag


Thing Statistics

13222Views 1846Downloads Found in 3D Printing


Please refer to http://www.thingiverse.com/thing:52946 instead. That is a better solution. (2013-02-27)

Printing separated parts that couldn't fit has always been a problem to me. I tweaked the skeinforge engine in ReplicatorG to add an offsetting 3D model inward funtionality. Here is the result http://www.youtube.com/watch?v=ieMXp1h0iM0 .


Result0: http://www.youtube.com/watch?v=BKLQPbExpu4, inward offset (0.3mm, 0.3mm, 0.0mm)
Result1: http://www.youtube.com/watch?v=ieMXp1h0iM0
Result2: http://www.youtube.com/watch?v=JbhVv7fzkfc, inward offset (0.15mm, 0.15mm, 0.0mm)
The plugin for skeinforge-35: http://www.thingiverse.com/download:95789
The plugin for skeinforge-50: http://www.thingiverse.com/download:95790

The 3D models downloaded from thingiverse.com (or internet) come with a variety of quality. Some are more thoughtful, and some are not. In case you got a less elaborated 3D model which having multiple parts that are too tight to fit, it would be intuitive to just have the model offsetting inward a little bit directly, such that parts can fit. (There are some good reasons why parts are likely to be too tight, see http://reprap.org/wiki/ArcCompensation and http://hydraraptor.blogspot.hk/2011/02/polyholes.html.)

I googled and waited for a such a solution. Finally, I went out of patience, and... here we go...

1) Download the file "skeinforge-50-carve.zip" in this post, and
replace "YOUR_REPLICATORG_FOLDER/skein_engines/skeinforge-50/skeinforge_application/skeinforge_plugins/craft_plugins/carve.py" Please remember to backup the origin one, they are just python scripts, basically safe to be switched. (For skeinforge-35, please download "skeinforge-35-carve.zip" and replace the "carve.py" in "skeinforge-35" folder instead.)

2) Restart your ReplicatorG, go to MENU>Gcode>Edit Slicing Profiles, choose your profile and click Edit.

3) Go to Carve Tab under Craft Tab, you will now see a new set of setting "Offset model inward". In the setting, you have four choices. They are enable/disable, x, y, and z offsets (mm). X/Y offsets should be the same value normally, I separated them is just to make it more general. The Z axis is usually fine, so you can just leave it zero. In case you really want to change it. Do so. I'm calculating the z-offset correctly there. Be reminded that, the enable/disable state is disabled by default, please enable it before you use it.

In case you think it is too invasive to make change to the application, you can use the standalone version, shrinkmodel.py, instead. Download shrinkmodel.py in this page, put it in the folder "YOUR_REPLICATORG_FOLDER/skein_engines/skeinforge-50". Open it, you will see a dialog, choose your .stl file by click "Open file to shrink" button; A shrinked .stl file with name FILENAME_shrink.stl will be saved to the folder of the input .stl file.

This is it. Let's see some results now.

There is a .stl file "test.stl" in this page. It is a pair of hole and plug directly come out from Google Sketchup, edge to edge touching each other. Here is what I got http://www.youtube.com/watch?v=BKLQPbExpu4 , and they fit.

By the way, there is a bonus came with this plugin. The same adjustment is still valid after scaling. So, a design can be scaled freely, and a plug will still fit into its hole. For instance, http://www.youtube.com/watch?v=ieMXp1h0iM0 .

For the record, I'm using a MakerBot Mk7 with HBP, 0.4mm nozzle. The two models in this post were printed with model inward offset (0.3mm, 0.3mm, 0.0mm). If you want to make parts fits tighter, you can lower the offset values of X Y dimension to achieve it.

More from 3D Printing

view more

All Apps

3D Print your file with 3D Hubs, the world’s largest online marketplace for 3D printing services.

App Info Launch App

Auto-magically prepare your 3D models for 3D printing. A cloud based 3D models Preparing and Healing solution for 3D Printing, MakePrintable provides features for model repairing, wall thickness...

App Info Launch App

Kiri:Moto is an integrated cloud-based slicer and tool-path generator for 3D Printing, CAM / CNC and Laser cutting. *** 3D printing mode provides model slicing and GCode output using built-in...

App Info Launch App
KiriMoto Thing App

With 3D Slash, you can edit 3d models like a stonecutter. A unique interface: as fun as a building game! The perfect tool for non-designers and children to create in 3D.

App Info Launch App

Print through a distributed network of 3D printing enthusiasts from across the US, at a fraction of the cost of the competitors. We want to change the world for the better through technology, an...

App Info Launch App

Quickly Scale, Mirror or Cut your 3D Models

App Info Launch App

3D Print a wide range of designs with Treatstock. Easy to use tools to get the perfect result. The global 3D printing network that connects you with high-quality and fast working print services nea...

App Info Launch App

I just installed the stand alone script. It made the part (planetary gears) non-manifold in a few places, but I sent it through Netfabb. I'm excited to see how this works out!!! 

This corrupts my SF50, and crashes out during slicing.
Is this just scaling the whole interior or is it offset scaling internal perimeters? If I ran this on a fan mount, would the mount hole be correctly located?

It is done by moving the surface inward into the model.  Not just a simple scaling.  If you ran this on a fan mount, the mount hole will still be the same location, and with a bigger hole.

 Are you using ReplicatorG?

 Using SFact with SF50.

On scaling, I mean does this individually scale internal perimeters, or the interior as a hole.
Would the 4 holes for fan screws still be correctly located?

 Thanks, that's what I needed to know, will try a different SF setup, definitely need this feature.

I really don't recommend you trying it this way.  It probably won't work.  If you can do python scripting, just take my function shrinkmodel() and put it in your http://carve.pycarve.py.  There is just around 40 lines of code.

I tried this using Cura 12.08 as the front end.  When using the replacement http://carve.pycarve.py file my g-code is always centered around the origin point and I can't seem change it. Any thoughts?

If you fuckup your Cura with this 'patch' then you are on your own.

Whitemousgary has done some assumptions on SF which are wrong. His code will also fuck up some models, and throwing it out like this as a 'solution' like this is irresponsible.

a) He assumes SF doesn't do insetting, while it does (I already pointed out the code locations below)
b) His code offsets all vertexes with the normals. He assumes SF already has a proper list of connecting faces (this is not the case, especially not when loading STL files) so his normal calculation starts off wrong. Then his normal calculation assumes the vertexes of the faces are always in the correct order. Surprise, they are not.

If you want extra inset, this could be done. But not like this.

 "If you want extra inset, this could be done. But not like this."

May I ask... how?

http://Inset.pyInset.py, line 400, add an extra value to the halfLineWidth, this is the 'default' offset.
I just tested this, works fine.

 Thanks, it's what I'm looking for.

I rewrote the script a little bit.  Please download "Cura 12.08 patch.zip" in this page and follow the instruction inside "readme.htm".  You need to replace four files in this case.  Also, I don't have a Ultimaker, so I can't really test it thoroughly.  If you didn't test it, please drop me some comments here.  Thanks.

As developer of Cura, can I ask you to take this patch offline? As you might have noticed, I'm not agreeing with how you do things. (Another assumption spotted! Cura is not only for Ultimakers, you can use it on any GCode accepting RepRap)

 Oh... I see...

Does this account for different shrink rates of different materials?  That's the main reason why my parts don't always fit together with the exact dimensions and why I design a little "slop" into my parts.  Otherwise the printer does a damn fine job with dimensions.

Ok, I watched your videos. It seems to me that if your parts were touching each other in sketchup, then they should have an extremely tight fit in real life. Your videos demonstrate a very loose fit.  If I want a loose fit, I design it into the model.

It is a neat idea to be able to adjust tollerances in the slicer, just a little weird :)

You can make it arbitrary tighter.  This one http://www.youtube.com/watch?v=JbhVv7fzkfc&feature=plcphttp://www.youtube.com/watch?v... is printed with model inward offset (0.15mm, 0.15mm, 0.0mm), which I can't really separate them without a tool after they plugged.

Forgive my ignorance, but isn't this what inset does?

I tried to vary inset setting to make parts fit before, but no luck.  May I ask, how do you set inset setting so that parts can fit?

You can't. It's always inset by 50% of the line width. The infill plugin handles this for the first line (check line 400 of http://inset.pyinset.py), but the rest of the shells is added by the fill plugin (around line 900 I think).

You are full of bull. Skeinforge doesn't lay lines on the borders. Cura's mixed GCode-model preview clearly shows this.

Your code will also make a mess of models with lots of fine details.

 I downloaded Cura just to try this out, (since it doesn't seem possible to attach images in the comments), added it as an "I made one" to this object.

 Mmm... maybe I'm really oversimplified the underlining causes of the situation.  You can find more info about it at http://reprap.org/wiki/ArcCompensationhttp://reprap.org/wiki/ArcComp... , http://hydraraptor.blogspot.hk/2011/02/polyholes.htmlhttp://hydraraptor.blogspot.hk... and http://reprap.org/wiki/CSGOffsettinghttp://reprap.org/wiki/CSGOffs... .  By the way, being able to adjust tolerance to a .stl file will be very handy if you are using some readily made .stl file, which editing on you own in some case is not an practical option.

It is also true that this plugin is not necessary if skeinforge had exposed such an option in the first place.  Indeed, they can do it quite easily (I just added 40 lines of code to the original http://carve.pycarve.py to do it).

 Yeah, totally handy for pre-existing STLs that are a bit tight -- I would have killed for a plugin like this when I tried to print out this escher lizard: http://www.thingiverse.com/thing:19235http://www.thingiverse.com/thi... which turned out a bit tighter than ideal

M.C.Escher Happy Lizard

You saved all our lives! Just hope that this is being integrated asap into all other slicers! 

Can anybody with good connection to any of the slicer devs send them this link? I'll do that for Cura and Kisslicer right now.

Todo: - MakerWare

  • Slic3r
  • What else?

I have long suspected that SF was not compensating for the thread width
on the perimeter. Most people "dial in" their printer by adjusting the
x/y steps/mm to force the outside measurement to be true as in the case
of a testcube. But lowering the steps/mm to get the outside measurement
exact means that the inside dims (holes) are now even smaller. Glad to
see someone tackle this annoying problem, one step closer to commercial
grade 3d printing. Very well done.  

Would it make more sense to have the settings as fractions of a thread with? That way, the setting would be roughly the same regardless of what thread width you print at. 

Just tried it out on your test piece.  Works like a charm!