[OpenSCAD] Engineering Fits and Tolerance

Alex Gibson alex at alexgibson.net
Tue Oct 29 19:47:08 EDT 2019

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:




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 <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/

OpenSCAD mailing list
Discuss at lists.openscad.org


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

More information about the Discuss mailing list