[OpenSCAD] Engineering Fits and Tolerance

Alex Gibson alex at alexgibson.net
Tue Oct 29 21:45:19 EDT 2019

So it’s quite likely we are independently doing very similar things, and I know others are, so there’s an opportunity to at least define a useful common approach.


If tolerance factors should be built into OpenSCAD, it would need to be in a way that is universally meaningful and constant.  For example ISO standards.


Even then, I think there are a few tensions.


Tolerances are to me a completely different concept than adjustments for specific CAM applications.  They are used to communicate to somebody else what is acceptable when making the item you have described perfectly in CAD.  So they must be a range. 


Whereas if I know my kerf or spread factor from precise measurement, and apply this as an offset to my perfect model, I’m expecting the resulting rendered model to explicitly be a distorted rendering of my part, and that if I slice and print this using one very specific configuration, it will print/cut something closer to the perfect shape than if we’d used the ‘nominal’ part. 

Especially in 3D printing, you get different tolerances in different axes- if I took a part I’d optimised for spread in x and Y, and rotated it about X, I could end up with an awfully distorted part.


I have some designs which have complex arrangements of laser cut parts, and the variations in thickness of the Perspex could make or break the fit.  So I have a test piece that is designed to be cut and measured, to feed into OpenSCAD the top level measurements of kerf, material thickness etc.  This is then picked up as a factor by all relevant parts of the design, which shuffles itself to fit.  


I would call this (from ignorance of the proper term) ‘tuning’ – and it’s set apart from tolerance – perhaps the flip side.


Finally there’s also things like spacings – allowance for material expansion, air gap between moving parts etc.  To me that’s handled separately from tolerance and tuning, but often all 3 might be present in a single radius…!


Not sure how this chimes with your thinking and practice?  


Alex Gibson


admg consulting


edumaker limited


·         Project management

·         Operations & Process improvement 

·         3D Printing


From: Discuss [mailto:discuss-bounces at lists.openscad.org] On Behalf Of Hugo Jackson
Sent: 30 October 2019 00:53
To: OpenSCAD general discussion
Subject: Re: [OpenSCAD] Engineering Fits and Tolerance


Thanks for your input Alex.


As I mentioned in my original post my thought was to add more CAM to the CAD… I agree that OpenSCAD gives you theoretically perfect shapes, and that’s appropriate for a pure CAD application, but if it’s true that the majority of OpenSCAD users are using the program to create files for 3D printers then it misses the opportunity to extend the application of the OpenSCAD environment to actual machine ‘control’.

The addition of engineering fit capability would/could be entirely invisible to the user, as it would share a profile similar to that of $fn, $fa and $fe. If you never specify a tolerance you would continue to code and receive the theoretically perfect objects you specify.

As you say, we could “hard code” all the dimensions, but better to define variable upfront… likewise, you could hard code all the tolerances up front, or you could simple create your projects with the perfect shapes and with the inclusion of a tolerance factor in the core language ‘magically’ have your parts fits together the way you want them to.

I think there are other advantages as well… if we start to produce OpenSCAD programs with a facility for tolerances, then tuning parts for a specific manufacturing process becomes intrinsic to the basic design. It also provides a mechanism for successful shared project printing. With a standardized approach and system for tolerances then you simply require that parts be within the tolerances specified.

As I’ve mentioned previously, I already code all of my projects with tolerance in mind, so it’s not a “gotta have” feature I’m looking for, I just thought I’d bring the matter up because I was interested in the communities thoughts on the subject, and perhaps someone might provide some insight that had escaped me in my current implementation.

On Oct 29, 2019, at 4:47 PM, Alex Gibson <alex at alexgibson.net> wrote:


I think what you are after is something I already use myself, and have built into my own libraries, but it does not need to be a vital part of the language itself – it’s just one of many ways you can use the programmatical nature of OpenSCAD.


In OpenSCAD we are creating ‘pure’ solid shapes (my own terminology only) – the theoretical perfect object.  


You could hard code all the dimensions, but it’s much better to define variables upfront – if we were drawing a nut and bolt, why not start with defining the ‘nominal’ diameter.  Then, each diameter could be either a modification of that, or a specific D or d value.  Now, because it’s coded, there’s nothing stopping you also adding another modifier to each dimension, for the nozzle spread of your 3D printer, or the kerf of a laser cutter or mill.  These things are independent of one another, and you can choose to turn these factors on or off depending on whether you are rendering a drawing to be annotated and sent to a machine shop, or making a model to 3D print yourself – effectively this is stepping out of CAD and into CAM, by compensating for limitations in slicers.


If you are struggling to tune tolerances one thing to note if not already obvious:  all circles/cylinders in OpenSCAD are polygon approximations, with points on the circumference, so the middle of the flats is a lower diameter than the tips – an OpenSCAD hole will always be narrower than it should be.  This can be worked around by using the global $fn= value to increase the number of facets for the final render before printing, but keep it lower during design to improve rendering speed.


So there are several different factors at play on all dimensions depending on what stage of the design process you are.  Rather than force these into the language, why not build a library where you define these tolerance values, and include it in your subsequent models?  




Alex Gibson


admg consulting


edumaker limited


·         Project management

·         Operations & Process improvement 

·         3D Printing


From: Discuss [mailto:discuss-bounces at lists.openscad.org] On Behalf Of Hugo Jackson
Sent: 29 October 2019 23:25
To: OpenSCAD general discussion
Subject: Re: [OpenSCAD] Engineering Fits and Tolerance


This is the wikipedia article on the matter:


 <https://en.wikipedia.org/wiki/Engineering_fit> https://en.wikipedia.org/wiki/Engineering_fit


It doesn’t apply to just threads, but to holes and shafts as well, and is easily expanded to include regularly shaped polygons as well (cause like in triangle world a rectangle is just a 4 sides circle :) ) and it’s used to specify the clearance between two mating objects.


The ISO specification uses capital letters to specify the tolerance range for holes, and lower case letters for shafts. Although the system could be used to fudge for over/under extrusion situations, that’s not it’s intended usage. It’s purpose is to remove the ambiguity of expressions like “loose fitting” and “tight fitting” and you often encounter both the ISO and ANSI tolerances in blue prints and machine drawings.


A pointed out in the article, for example, a paired specification like “H7/k6” on a nominal 50 mm diameter would identify a tolerance range of

+0.000 mm to +0.025 mm and a tolerance range of -0.018 mm to +0.002 mm for the shaft.


I find that I can generally hold my most often used FDM 3d printer to a +/- 0.03 range, so while “H8/f7” would be too exacting a specification for my machine, there are tolerance ranges that could be used for most FDM and certainly DLP printing.



On Oct 29, 2019, at 4:07 PM, adrianv < <mailto:avm4 at cornell.edu> avm4 at cornell.edu> wrote:


Well, if it's supposed to be like a screw thread tolerance then the letter
specifies a "tolerance position", which gives a maximum diameter for the
bolt shaft.  The number gives the tolerance range below this maximum.  One
could imagine using this to shrink models to compensate for overextrusion. 
But this is a specific standard for machine screw threads and the value of
the tolerance even depends on the screw shaft diameter.   It doesn't apply
broadly to arbitrary objects.  (It doesn't even apply to nuts, which use
capital letters.)  

Even if you could figure out how to define it for arbitrary objects, how
would OpenSCAD know whether a component needed to be enlarged or shrunk?  I
don't see that there's any way to do this automatically.  

nophead wrote

Not sure I understand. h7 specifies a tolerance, i.e. a range of possible
sizes that can be tested with a limit gauge or a micrometer. How can that
be expressed in a model, which always has a definite size?

On Tue, 29 Oct 2019 at 22:00, Hugo Jackson <


> wrote:

Has any thought been given to incorporating engineering fits and
tolerances into OpenSCAD? As I understand it, OpenSCAD was originally
conceived for the creation of STL files for a 3D printer and I’ve been
thinking that the base functionality might be improved by a little more
in the CAD.

Sent from:  <http://forum.openscad.org/> http://forum.openscad.org/

OpenSCAD mailing list
 <mailto:Discuss at lists.openscad.org> Discuss at lists.openscad.org


OpenSCAD mailing list
 <mailto:Discuss at lists.openscad.org> Discuss at lists.openscad.org
 <http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscad.org/pipermail/discuss_lists.openscad.org/attachments/20191030/66163229/attachment.html>

More information about the Discuss mailing list