discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

Place holes on a circle

RW
Ray West
Fri, Aug 28, 2020 9:15 PM

Hi Andy, If you are 3d printing, I guess you are aware that holes
generally come out smaller than the size you give, them, depending on
quite few factors, so you can't be that precise, without a bit of
testing. If you are drilling, then holes come out bigger! If you are
designing, then holes come out at exactly the correct size.

On 28/08/2020 20:11, AndyY via Discuss wrote:

The holes arround the circle are getting screws for holding the magnet. So if
I have the holes in a little bigger size it does not matter if there are
some errors of the position.

Concerning you post @JordanBrown: This is a very important post for me!
Thank you. I guess the error comes from the calcuation in the OpenSCAD
engine? Which means that this is the error of the exactly position of the
holes. As I wrote in the previous post I immediatelly need to check the vars
($fs/$fa) for further designs. If you have some more internal informations,
I'd like to know it...

--
Sent from: http://forum.openscad.org/


OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

Hi Andy, If you are 3d printing, I guess you are aware that holes generally come out smaller than the size you give, them, depending on quite few factors, so you can't be that precise, without a bit of testing. If you are drilling, then holes come out bigger! If you are designing, then holes come out at exactly the correct size. On 28/08/2020 20:11, AndyY via Discuss wrote: > The holes arround the circle are getting screws for holding the magnet. So if > I have the holes in a little bigger size it does not matter if there are > some errors of the position. > > Concerning you post @JordanBrown: This is a very important post for me! > Thank you. I guess the error comes from the calcuation in the OpenSCAD > engine? Which means that this is the error of the exactly position of the > holes. As I wrote in the previous post I immediatelly need to check the vars > ($fs/$fa) for further designs. If you have some more internal informations, > I'd like to know it... > > > > -- > Sent from: http://forum.openscad.org/ > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
NH
nop head
Fri, Aug 28, 2020 9:36 PM

I get precise 3D printed holes every time, see
https://github.com/nophead/NopSCADlib#Polyholes  for vertical holes and
https://github.com/nophead/NopSCADlib#Horiholes for horizontal holes.

And for holes printed in mid air without support
https://github.com/nophead/NopSCADlib#hanging_hole

On Fri, 28 Aug 2020 at 22:16, Ray West raywest@raywest.com wrote:

Hi Andy, If you are 3d printing, I guess you are aware that holes
generally come out smaller than the size you give, them, depending on
quite few factors, so you can't be that precise, without a bit of
testing. If you are drilling, then holes come out bigger! If you are
designing, then holes come out at exactly the correct size.

On 28/08/2020 20:11, AndyY via Discuss wrote:

The holes arround the circle are getting screws for holding the magnet.

So if

I have the holes in a little bigger size it does not matter if there are
some errors of the position.

Concerning you post @JordanBrown: This is a very important post for me!
Thank you. I guess the error comes from the calcuation in the OpenSCAD
engine? Which means that this is the error of the exactly position of the
holes. As I wrote in the previous post I immediatelly need to check the

vars

($fs/$fa) for further designs. If you have some more internal

informations,

I get precise 3D printed holes every time, see https://github.com/nophead/NopSCADlib#Polyholes for vertical holes and https://github.com/nophead/NopSCADlib#Horiholes for horizontal holes. And for holes printed in mid air without support https://github.com/nophead/NopSCADlib#hanging_hole On Fri, 28 Aug 2020 at 22:16, Ray West <raywest@raywest.com> wrote: > Hi Andy, If you are 3d printing, I guess you are aware that holes > generally come out smaller than the size you give, them, depending on > quite few factors, so you can't be that precise, without a bit of > testing. If you are drilling, then holes come out bigger! If you are > designing, then holes come out at exactly the correct size. > > On 28/08/2020 20:11, AndyY via Discuss wrote: > > The holes arround the circle are getting screws for holding the magnet. > So if > > I have the holes in a little bigger size it does not matter if there are > > some errors of the position. > > > > Concerning you post @JordanBrown: This is a very important post for me! > > Thank you. I guess the error comes from the calcuation in the OpenSCAD > > engine? Which means that this is the error of the exactly position of the > > holes. As I wrote in the previous post I immediatelly need to check the > vars > > ($fs/$fa) for further designs. If you have some more internal > informations, > > I'd like to know it... > > > > > > > > -- > > Sent from: http://forum.openscad.org/ > > > > _______________________________________________ > > OpenSCAD mailing list > > Discuss@lists.openscad.org > > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org >
JB
Jordan Brown
Fri, Aug 28, 2020 9:36 PM

On 8/28/2020 12:11 PM, AndyY via Discuss wrote:

Concerning you post @JordanBrown: This is a very important post for
me! Thank you.

Glad to be of assistance.

I guess the error comes from the calculation in the OpenSCAD engine?

No.  It's that OpenSCAD (and every other tool that generates STL)
approximates circles as polygons.

The more sides that you give the polygon, the smaller the difference is
between the approximation and a true circle.

The error, as a fraction, is (cos(360/n/2)-1).

If you approximate a circle as a triangle, the error is -50%.  That is,
considering the distance from the center to the vertices to be
"correct", the distance from the center of the "circle" to the middles
of the edges is 50% less than that.

Continuing:

sides

Error %

3
-50%
4
-29%
6
-13%
10
-5%
15
-2%
30
-0.5%
60
-0.1%
120
-0.03%

The question there is how much inaccuracy you can tolerate, versus the
processing costs of the increasing complexity of the figure.

Which means that this is the error of the exactly position of the holes.

No.  The exact position is quite precise, far more precise than you need
to care about for most purposes.[*]

[*] There are occasionally rendering issues that are related to
precise positioning and sizing of objects, but those are
mathematical / computational issues; they have no direct bearing on
the practical position of the objects in a physical object.

The errors are in the difference between the diameter that you ask for,
and the diameter (in some senses) that you get.

If we assume that your fabrication process is perfect - that your 3D
printer will produce exactly the object that you model - then if you ask
for a circle with a diameter of 10, and approximate it with three sides,
the largest rod that you can put through that hole has a diameter of 5. 
If you approximate it with 15 sides, the largest rod you can put through
it has a diameter of 9.78.  With 120 sides, it has a diameter of 9.997.

I believe my 3D printer has an X-Y positioning resolution of 0.1mm.  It
has a 0.4mm nozzle, and the plastic squishes out a bit.  I don't know
exactly how those will translate into dimensional accuracy, but for
discussion purposes it doesn't seem unreasonable to guess that my
dimensional accuracy is no better than 0.1mm - that is, if I ask for a
10x10x10mm cube, the X and Y sides will be somewhere between 9.9 and
10.1mm.  (It's probably not really that good.)

With 15 sides, the error from the polygon approximation on a 10mm circle
is about 0.2mm, or twice the theoretical accuracy of the device.  With
30 sides, the error is about 0.05mm, or half the accuracy of the
device.  That's saying that going from 3 sides to 15 is a big win, and
going from 15 to 30 is a small win, but more than 30 (actually, more
than something in the low 20s)  is pointless because the other errors in
the system will swamp this one.

If you're using some other fabrication technology - if, for instance,
you are milling and polishing metal - then your system will likely be
more accurate and you may have correspondingly tighter restrictions on
the modeling errors.

As I wrote in the previous post I immediately need to check the vars
($fs/$fa) for further designs. If you have some more internal
informations, I'd like to know it...

$fn is easy.  It says how many sides a circle has, period.

That's easy, but it's not what you really want.  A 10mm circle with 15
sides is awfully close to a perfect circle - you might not be able to
see the polygon-ness when printed - but on a 100mm circle it would very
much look like a polygon.  On the other hand, if you ask for 100 sides,
your 10mm circle will have sides that are only 0.3mm long, not quite
imperceptibly small.  No one setting will work for both small and large
circles.

$fa and $fs are an attempt to let you define values that will "work" at
all sizes.

$fa means "don't bother adding sides if the angle is less than this".
$fs means "don't bother adding sides if each side is less than this".
OpenSCAD uses whichever yields fewer sides.

For typical values, $fa controls the behavior on large circles, and $fs
controls the behavior on small circles.

Note:  $fn is very useful for a different purpose.  It is how you
explicitly ask OpenSCAD for a regular polygon.  If you want an octagon,
you can use circle(d=<whatever>, $fn=8) and you will get an octagon, no
matter how large the circle is.

Note:  none of this is "internal".  It is all part of how OpenSCAD is
defined to model circles.


I realized there was an error in my previous tables - I missed that the
actual diameter of the big circle was 34+10 = 44, not 34.  Here's
corrected tables:

For the default values ($fs=2, $fa=12):

Sides
Vertices

Diameter
Edges
Diameter
Error
Error
Percent
Outer
30
44 43.76
-0.24
-0.5%
Inner
10
6
5.71
-0.29
-4.9%

With $fs=1 and $fa=8:

Sides
Vertices

Diameter
Edges
Diameter
Error
Error
Percent
Outer
45
44
43.89
-0.11
-0.2%
Inner
19
6
5.92
-0.08
-1.4%

On 8/28/2020 12:11 PM, AndyY via Discuss wrote: > > Concerning you post @JordanBrown: This is a very important post for > me! Thank you. > Glad to be of assistance. > I guess the error comes from the calculation in the OpenSCAD engine? > No.  It's that OpenSCAD (and every other tool that generates STL) approximates circles as polygons. The more sides that you give the polygon, the smaller the difference is between the approximation and a true circle. The error, as a fraction, is (cos(360/n/2)-1). If you approximate a circle as a triangle, the error is -50%.  That is, considering the distance from the center to the vertices to be "correct", the distance from the center of the "circle" to the middles of the edges is 50% less than that. Continuing: # sides Error % 3 -50% 4 -29% 6 -13% 10 -5% 15 -2% 30 -0.5% 60 -0.1% 120 -0.03% The question there is how much inaccuracy you can tolerate, versus the processing costs of the increasing complexity of the figure. > Which means that this is the error of the exactly position of the holes. > No.  The exact position is quite precise, far more precise than you need to care about for most purposes.[*] [*] There are occasionally rendering issues that are related to precise positioning and sizing of objects, but those are mathematical / computational issues; they have no direct bearing on the practical position of the objects in a physical object. The errors are in the difference between the diameter that you ask for, and the diameter (in some senses) that you get. If we assume that your fabrication process is perfect - that your 3D printer will produce exactly the object that you model - then if you ask for a circle with a diameter of 10, and approximate it with three sides, the largest rod that you can put through that hole has a diameter of 5.  If you approximate it with 15 sides, the largest rod you can put through it has a diameter of 9.78.  With 120 sides, it has a diameter of 9.997. I believe my 3D printer has an X-Y positioning resolution of 0.1mm.  It has a 0.4mm nozzle, and the plastic squishes out a bit.  I don't know exactly how those will translate into dimensional accuracy, but for discussion purposes it doesn't seem unreasonable to guess that my dimensional accuracy is no better than 0.1mm - that is, if I ask for a 10x10x10mm cube, the X and Y sides will be somewhere between 9.9 and 10.1mm.  (It's probably not really that good.) With 15 sides, the error from the polygon approximation on a 10mm circle is about 0.2mm, or twice the theoretical accuracy of the device.  With 30 sides, the error is about 0.05mm, or half the accuracy of the device.  That's saying that going from 3 sides to 15 is a big win, and going from 15 to 30 is a small win, but more than 30 (actually, more than something in the low 20s)  is pointless because the other errors in the system will swamp this one. If you're using some other fabrication technology - if, for instance, you are milling and polishing metal - then your system will likely be more accurate and you may have correspondingly tighter restrictions on the modeling errors. > As I wrote in the previous post I immediately need to check the vars > ($fs/$fa) for further designs. If you have some more internal > informations, I'd like to know it... > $fn is easy.  It says how many sides a circle has, period. That's easy, but it's not what you really want.  A 10mm circle with 15 sides is awfully close to a perfect circle - you might not be able to see the polygon-ness when printed - but on a 100mm circle it would very much look like a polygon.  On the other hand, if you ask for 100 sides, your 10mm circle will have sides that are only 0.3mm long, not quite imperceptibly small.  No one setting will work for both small and large circles. $fa and $fs are an attempt to let you define values that will "work" at all sizes. $fa means "don't bother adding sides if the angle is less than this". $fs means "don't bother adding sides if each side is less than this". OpenSCAD uses whichever yields *fewer* sides. For typical values, $fa controls the behavior on large circles, and $fs controls the behavior on small circles. Note:  $fn is very useful for a different purpose.  It is how you explicitly ask OpenSCAD for a regular polygon.  If you want an octagon, you can use circle(d=<whatever>, $fn=8) and you will get an octagon, no matter how large the circle is. Note:  none of this is "internal".  It is all part of how OpenSCAD is defined to model circles. --- I realized there was an error in my previous tables - I missed that the actual diameter of the big circle was 34+10 = 44, not 34.  Here's corrected tables: For the default values ($fs=2, $fa=12): Sides Vertices Diameter Edges Diameter Error Error Percent Outer 30 44 43.76 -0.24 -0.5% Inner 10 6 5.71 -0.29 -4.9% With $fs=1 and $fa=8: Sides Vertices Diameter Edges Diameter Error Error Percent Outer 45 44 43.89 -0.11 -0.2% Inner 19 6 5.92 -0.08 -1.4%
A
arnholm@arnholm.org
Sat, Aug 29, 2020 6:20 AM

On 2020-08-28 20:54, Ray West wrote:

Where's the naughty step?

There is nothing "naughty" about it. This thread shows various examples
on how to model a simple case using scripting languages. Regardless of
language being used, for most people the goal is to express it in a
efficient, but expressive way that feels natural. What feels natural is
highly subjective, so there will be many different solutions, even
within the same language.

Carsten Arnholm

On 2020-08-28 20:54, Ray West wrote: > Where's the naughty step? There is nothing "naughty" about it. This thread shows various examples on how to model a simple case using scripting languages. Regardless of language being used, for most people the goal is to express it in a efficient, but expressive way that feels natural. What feels natural is highly subjective, so there will be many different solutions, even within the same language. Carsten Arnholm