Geometric accuracy parameter

Here's the place for discussion related to CAM/CNC and the development of the Path module.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
ian.rees
Posts: 696
Joined: Sun Jun 15, 2014 3:28 am
Contact:

Geometric accuracy parameter

Post by ian.rees »

I'd like to add a parameter to Job objects, and a corresponding setting in Path Preferences, for the geometric tolerance to use when calculating paths.

The current use case for this is in surface path generation; we need to tesselate the geometry before feeding it in to OCL, and there is a tradeoff between computer resources (read: time) and the path accuracy.

I think this should be a fairly low-impact addition; could set the default value to 0.01mm. Any thoughts/objections? -Ian-
User avatar
sliptonic
Veteran
Posts: 3459
Joined: Tue Oct 25, 2011 10:46 pm
Location: Columbia, Missouri
Contact:

Re: Geometric accuracy parameter

Post by sliptonic »

ian.rees wrote:I'd like to add a parameter to Job objects, and a corresponding setting in Path Preferences, for the geometric tolerance to use when calculating paths.

The current use case for this is in surface path generation; we need to tesselate the geometry before feeding it in to OCL, and there is a tradeoff between computer resources (read: time) and the path accuracy.

I think this should be a fairly low-impact addition; could set the default value to 0.01mm. Any thoughts/objections? -Ian-
sounds good. Give some thought to giving it a user friendly label and tool tip. I think you did a good job of describing the function/trade-off and I hate to see things get labels like 'tolerance' where the user has no clue what changing it will do.
ian.rees
Posts: 696
Joined: Sun Jun 15, 2014 3:28 am
Contact:

Re: Geometric accuracy parameter

Post by ian.rees »

https://github.com/FreeCAD/FreeCAD/pull/666 submitted. In addition to adding the parameter, the second commit changes the meshing slightly to control resolution based on deflection rather than maximum length - it's considerably faster. -Ian-
herbk
Veteran
Posts: 2660
Joined: Mon Nov 03, 2014 3:45 pm
Location: Windsbach, Bavarya (Germany)

Re: Geometric accuracy parameter

Post by herbk »

Hi Ian,
with what tolerance it is calculating now?

On working with metall 0,01mm tolerance is to big if you think for professinal use to... There should be a posibility where to go down to a tolerance of at least 0,001mm somwhere, but i'm with sliptonic: not with an allways visible "selection field".
Gruß Herbert
GeneFC
Veteran
Posts: 5373
Joined: Sat Mar 19, 2016 3:36 pm
Location: Punta Gorda, FL

Re: Geometric accuracy parameter

Post by GeneFC »

I agree with herbk that the proposed default tolerance is probably a bit too coarse for many applications.

Does this change really improve anything other than meshes and surfaces? Should the new tolerance be applied only to those cases?

For me, other Path operations such as profiling, pocketing, drilling, contouring, facing, etc. are essentially instantaneous with the current tolerance. No obvious need for a change in those functions.

As long as it can be set in preferences it should not cause a big problem, but I am sure I will want to make my "default" a lot tighter.

Gene
chrisb
Veteran
Posts: 54177
Joined: Tue Mar 17, 2015 9:14 am

Re: Geometric accuracy parameter

Post by chrisb »

I agree with Gene that it is desirable to keep the tolerance for the non-surface operations as they are. They are useful and not expensive. For surfacing I don't have a problem with a configurable parameter. I would call it e.g. surfacing_tolearance to make things clear.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
ian.rees
Posts: 696
Joined: Sun Jun 15, 2014 3:28 am
Contact:

Re: Geometric accuracy parameter

Post by ian.rees »

herbk wrote: with what tolerance it is calculating now?
Currently, the mesh generation is done by setting a maximum length parameter, which if I'm understanding correctly, limits the length of the sides of facets in the mesh. I changed it to use deflection; how far vertices are allowed to land away from the source surface, which is more like a traditional linear machining tolerance. The two schemes are relatable only with more information about the shape.

That facet edge length limit is currently set to 2mm. Here's an example showing the source part, and the two different meshing schemes with the discussed parameters. On my machine, with a release build of FreeCAD and this shape, the old way takes ~8 seconds, the new one is maybe 1.5.
Screen Shot 2017-04-03 at 6.57.30 AM.png
Screen Shot 2017-04-03 at 6.57.30 AM.png (225.82 KiB) Viewed 1707 times
Screen Shot 2017-04-03 at 7.01.18 AM.png
Screen Shot 2017-04-03 at 7.01.18 AM.png (8.16 KiB) Viewed 1707 times
Screen Shot 2017-04-03 at 7.01.22 AM.png
Screen Shot 2017-04-03 at 7.01.22 AM.png (9.86 KiB) Viewed 1707 times
herbk wrote: On working with metall 0,01mm tolerance is to big if you think for professinal use to...
Sure, that's not a good enough final tolerance for some jobs. But, there's a lot more that goes in to precision (especially at that level) than this meshing parameter.

For example - the drop cutter algorithm uses just enough passes to cover the part with the selected cutter. So, the tolerance of the machined part is a function of the diameter of the cutter. If you want a part finished to 0.1mm using the surfacing operation, you'll need a cutter that's approximately that diameter. Have fun with your 0.001mm endmill ;).
herbk wrote: There should be a posibility where to go down to a tolerance of at least 0,001mm somwhere
The vast majority of the PR is about creating a parameter and a preference to set the default value. Change it to whatever you want.
herbk wrote:but i'm with sliptonic: not with an allways visible "selection field"
Sorry, I'm not understanding what this means?
ian.rees
Posts: 696
Joined: Sun Jun 15, 2014 3:28 am
Contact:

Re: Geometric accuracy parameter

Post by ian.rees »

GeneFC wrote:Does this change really improve anything other than meshes and surfaces?
At this point, the new parameter is only used for the generation of meshes that are used inside the surfacing operation. I suspect that Path will end up with other scenarios where a similar parameter is required, so I think the answer to your question is "yes, but nothing else is changed".
GeneFC wrote:For me, other Path operations such as profiling, pocketing, drilling, contouring, facing, etc. are essentially instantaneous with the current tolerance. No obvious need for a change in those functions.
Some problems have closed-form solutions where there's no need for a tolerance, others don't. Tesselation of curved shapes is inherently an approximation problem, so there will always be a tradeoff where a parameter like this is required. This is just about exposing that tradeoff to the user (and using a form of the parameter that's a little more intuitive and a lot more efficient - see my previous post).
ian.rees
Posts: 696
Joined: Sun Jun 15, 2014 3:28 am
Contact:

Re: Geometric accuracy parameter

Post by ian.rees »

chrisb wrote:I would call it e.g. surfacing_tolearance to make things clear.
I think that will end up causing problems, because next time we need a similar tolerance (and I suspect that will be sooner than later) this one will have to be renamed or a new one added.
herbk
Veteran
Posts: 2660
Joined: Mon Nov 03, 2014 3:45 pm
Location: Windsbach, Bavarya (Germany)

Re: Geometric accuracy parameter

Post by herbk »

Hi Ian,
hm, it seams that we are talking about different things, I have had in mind the dimensions of the produced part only... :) :)
For example - the drop cutter algorithm uses just enough passes to cover the part with the selected cutter.
As my picture in viewtopic.php?f=15&t=21308#p165402 shows, it does not...

But if you change in PathSurface.py in the lines

Code: Select all

   def _dropcutter(self, obj, s, bb):
        import ocl
        import time

        cutter = ocl.CylCutter(self.radius * 2, 5)
        pdc = ocl.PathDropCutter()   # create a pdc
        pdc.setSTL(s)
        pdc.setCutter(cutter)
        pdc.minimumZ = 0.25
        pdc.setSampling(obj.SampleInterval)
the "cutter = ocl.CylCutter(self.radius * 2, 5)" to "cutter = ocl.CylCutter(self.radius * 0.0x, 5)" (could be anything else of course) you get a stepover in the size you need and a nice surface. ;)
Gruß Herbert
Post Reply