View Issue Details

IDProjectCategoryView StatusLast Update
0001739PartGeneralpublic2021-02-06 06:46
Reporterickby Assigned Toickby  
PrioritynormalSeveritymajorReproducibilityalways
Status assignedResolutionopen 
Product Version0.15 
Target Version0.20 
Summary0001739: Sweep tolerances are too high
DescriptionCuts with sweeps often fail, see the example given in thread http://forum.freecadweb.org/viewtopic.php?f=3&t=7612

By investigation it can be shown that this is a tolerance issue which can be fixed from freecad side. Let me explain:

If you use part measure tool to measure the distance between the sweep vertex and the box face gives 7.26nm, which is 7.6290e-06mm (freecad shape tolerances are given in mm). The Vertex itself has a Tolerance value of 1.53e-05 assigned. this means the face is in tolerance of the vertex. However, the edge has a tolerance of 1e-7 assigned (Prcision::Confusion, the standart) and is therefore NOT in region of the face at the vertex location, but it only has a intersection with the face at a different lcoation then the vertex. It is quite clear that this situation must fail.

To resolved this I used the OpenScad increase tolerance tool to increase the sweep tolerances to 1e-7, as it should have been from begining. With this sweep all cuts work nicely.

The sweep should therefore be fixed to use Precision::Confusion per default. Either search for a correct constructor of the c++ class or change the tolerances after creation.

One drawback however stays, but this is somethign for another issue: The distance between the vertex and the cut box is still too high for normal tolerances. OCC creates only one new vertex, not a vertex and a intersection with the edge, which is very sensible. This works by an increased tolerance of the new vertex, which gives the expected result for the user but which is bad for follow-up operations. We have to find out why the distance is bigger then the tolerance and fix this.
Steps To Reproduceload the file feder and recompute the document. To see the working fix load feder_fixed and see the result.
Tagssweep, tolerances
FreeCAD Information

Activities

ickby

2014-09-10 13:16

developer  

feder_fixed.fcstd (130,865 bytes)

ickby

2014-09-10 13:32

developer  

feder.fcstd (129,355 bytes)

tanderson69

2014-09-11 01:00

developer   ~0005085

ickby, glad you are looking into this.

your statement: "To resolved this I used the OpenScad increase tolerance tool to increase the sweep tolerances to 1e-7, as it should have been from begining. With this sweep all cuts work nicely." confuses me. The OpenScad tolerance feature increases the vertex tolerances to 0.1. From DRAWEXE:

Draw[3]> restore first.brep
first
Draw[4]> restore second.brep
second
Draw[5]> tolerance first
Tolerance MAX=1.53540271460213e-05 AVG=8.8165869405836007e-06 MIN=9.9999999999999995e-08
FACE : MAX=9.9999999999999995e-08 AVG=9.9999999999999995e-08 MIN=9.9999999999999995e-08
EDGE : MAX=9.9999999999999995e-08 AVG=9.9999999999999995e-08 MIN=9.9999999999999995e-08
VERTEX : MAX=1.53540271460213e-05 AVG=1.53540271460213e-05 MIN=1.53540271460213e-05

Draw[6]> tolerance second
Tolerance MAX=0.10000000000000001 AVG=0.057142900000000003 MIN=9.9999999999999995e-08
FACE : MAX=9.9999999999999995e-08 AVG=9.9999999999999995e-08 MIN=9.9999999999999995e-08
EDGE : MAX=9.9999999999999995e-08 AVG=9.9999999999999995e-08 MIN=9.9999999999999995e-08
VERTEX : MAX=0.10000000000000001 AVG=0.10000000000000001 MIN=0.10000000000000001

Where "first" is the sweep before the OpenScad tolerance feature and "second" is after. Did I miss something?

You are aware that the bopalgo geometry check is complaining about continuity of swept geometry?

ickby

2014-09-11 05:50

developer   ~0005088

Last edited: 2014-09-11 05:53

did you export the final cut or the sweep to brep? I checked the tolerances on the sweep object and the tolerance_sweep object. The openscad tool allows to set the wanted tolerance and I have set it to 1e-7. When checking it with toelrance_sweep.Shape.Vertexes[0].Toelrance etc. it shows that the tolerance was increased to this value.

The 0.1 tolerance can be observed after the cut and is an issue we have to look further into. that is what I entitled a "further drawback" in my original post. But this is IMHO something seperate and need an own issue.

I was not aware of the continuity issue with this particular sweep, thanks for pointing it out, but have seen this before. I think we should look into this too to understand why this occurs (and why this is a problem), maybe this function helps with fixing this: http://dev.opencascade.org/doc/refman/html/class_b_rep_offset_a_p_i___make_pipe_shell.html#a19bd34665e3f612621cee16271f2d4e9 . But it is also possible that we fix the c0 issue with tighter tolerancey, as it could be possible that the c0 geometry is only c0 because of a lack of precison... but this is wild guessing.

To fix the tolerance issue I think we can use http://dev.opencascade.org/doc/refman/html/class_b_rep_offset_a_p_i___make_pipe_shell.html#a56df032bc1be96f5d41f823cf0114495

tanderson69

2014-09-11 13:38

developer   ~0005089

Whoops. Sweep feature was "first" and Tolerance_Sweep(openscad) was "second". The file you posted had the openscad feature set to 0.1. That was messing me up. So I adjusted the openscad tolerance feature to 1e-07 and the final cut was messed up again. I then exported the 3 breps out to draw again and here is what I got:

Draw[6]> tolerance first
Tolerance MAX=1.53540271460213e-05 AVG=8.8165869405836007e-06 MIN=9.9999999999999995e-08
FACE : MAX=9.9999999999999995e-08 AVG=9.9999999999999995e-08 MIN=9.9999999999999995e-08
EDGE : MAX=9.9999999999999995e-08 AVG=9.9999999999999995e-08 MIN=9.9999999999999995e-08
VERTEX : MAX=1.53540271460213e-05 AVG=1.53540271460213e-05 MIN=1.53540271460213e-05

Draw[7]> tolerance second
Tolerance MAX=1.53540271460213e-05 AVG=8.8165869405836007e-06 MIN=9.9999999999999995e-08
FACE : MAX=9.9999999999999995e-08 AVG=9.9999999999999995e-08 MIN=9.9999999999999995e-08
EDGE : MAX=9.9999999999999995e-08 AVG=9.9999999999999995e-08 MIN=9.9999999999999995e-08
VERTEX : MAX=1.53540271460213e-05 AVG=1.53540271460213e-05 MIN=1.53540271460213e-05

Draw[8]> tolerance finalCut
Tolerance MAX=1.53540271460213e-05 AVG=6.1633279253641203e-06 MIN=9.9999999999999995e-08
FACE : MAX=9.9999999999999995e-08 AVG=9.9999999999999995e-08 MIN=9.9999999999999995e-08
EDGE : MAX=5.0000000000000004e-06 AVG=1.3249999999999998e-06 MIN=9.9999999999999995e-08
VERTEX : MAX=1.53540271460213e-05 AVG=9.5298868763843228e-06 MIN=5.0000000000000004e-06

"first" = the original sweep.
"second" = openscad tolerance feature. set 1e-07
"finalCut" = the last boolean cut feature.

I did this twice to make sure I didn't mess something up. It appears the tolerance feature didn't tighten any tolerances. At least here.




"BRepOffsetAPI_MakePipeShell::SetForceApproxC1" would be simple to try. I don't know if the continuity is the cause of any problems, but it can't help.

we could try "BRepOffsetAPI_MakePipeShell::SetTolerance" to see what happens.

tanderson69

2014-09-11 15:00

developer  

forceC1.brep (1,068,064 bytes)

tanderson69

2014-09-11 15:01

developer   ~0005090

BRepOffsetAPI_MakePipeShell::SetForceApproxC1 doesn't appear to be the answer. See uploaded file.

tanderson69

2014-09-11 15:18

developer   ~0005091

tried "makeSweep.SetTolerance(Precision::Confusion(), Precision::Confusion(), Precision::Angular());"

tolerances from drawexe:
Draw[5]> tolerance tol
Tolerance MAX=1.62647393406168e-06 AVG=9.7227081946381715e-07 MIN=9.9999999999999995e-08
FACE : MAX=9.9999999999999995e-08 AVG=9.9999999999999995e-08 MIN=9.9999999999999995e-08
EDGE : MAX=9.9999999999999995e-08 AVG=9.9999999999999995e-08 MIN=9.9999999999999995e-08
VERTEX : MAX=1.62647393406168e-06 AVG=1.62647393406168e-06 MIN=1.62647393406168e-06

slight change. tried subtraction of 2 cubes and got a different output, but still invalid.

tanderson69

2014-09-11 15:35

developer   ~0005092

Tried both the tolerance and the forceC1 and made some progress. Got a good looking solid that passed the bopalgo check. still failed on the boolean cuts. I am thinking that this is a boolean problem and not a tolerance problem.

construction snippet:

BRepOffsetAPI_MakePipeShell makeSweep(helix);
makeSweep.SetMode(true); //frenet
makeSweep.SetTransitionMode(BRepBuilderAPI_RightCorner);
makeSweep.SetForceApproxC1(true);
makeSweep.SetTolerance(Precision::Confusion(), Precision::Confusion(), Precision::Angular());
makeSweep.Add(circle);
makeSweep.Build();
makeSweep.MakeSolid();
TopoDS_Shape output = makeSweep.Shape();

triplus

2015-09-26 12:38

developer   ~0006461

I can confirm the issue:

http://forum.freecadweb.org/viewtopic.php?f=3&t=12584&p=101155#p101155

industromatic

2017-09-08 15:22

reporter   ~0010092

Here is another example of this bug of leaving out a sliver of tolerance so a PartDesign additive or subtractive pipe will be incomplete.

https://forum.freecadweb.org/viewtopic.php?f=3&t=24266

The work around is to use 2 overlapping sweeps to do a cut operation.

industromatic

2017-09-08 15:31

reporter   ~0010093

Since in two days will be the three year anniversary of this bug, is it time to institute a workaround in the GUI? It seems that one profile to sweep in one location is enough to do a cut successfully using PartDesign subtractive pipe. The method is to sweep clockwise a segments, and also sweep CCW b segments, where n is the total number of segments to make a closed loop, and a + b = n + 1.

A workaround could be to do one sweep with a new GUI button that skips selecting individual segments, and the button is called sweep all segments. It would sweep CW n segments, then add a sweep CCW of 1 segment.

abdullah

2017-12-07 05:08

manager   ~0010529

@kunda1

Hi! This ticket is not "sketcher" related. Is it possible to move it, maybe to project "Part"?

Kunda1

2017-12-07 05:10

administrator   ~0010530

Last edited: 2017-12-07 05:10

@abdullah done ;)

yorik

2022-03-03 13:55

administrator   ~0016429

This ticket has been migrated to GitHub as issue 5594.

Issue History

Date Modified Username Field Change
2014-09-10 13:16 ickby New Issue
2014-09-10 13:16 ickby Status new => assigned
2014-09-10 13:16 ickby Assigned To => ickby
2014-09-10 13:16 ickby File Added: feder_fixed.fcstd
2014-09-10 13:18 ickby Description Updated
2014-09-10 13:22 ickby Description Updated
2014-09-10 13:32 ickby File Added: feder.fcstd
2014-09-10 15:55 shoogen Tag Attached: tolerances
2014-09-11 01:00 tanderson69 Note Added: 0005085
2014-09-11 05:50 ickby Note Added: 0005088
2014-09-11 05:53 ickby Note Edited: 0005088
2014-09-11 13:38 tanderson69 Note Added: 0005089
2014-09-11 15:00 tanderson69 File Added: forceC1.brep
2014-09-11 15:01 tanderson69 Note Added: 0005090
2014-09-11 15:18 tanderson69 Note Added: 0005091
2014-09-11 15:35 tanderson69 Note Added: 0005092
2015-01-25 15:42 yorik Target Version 0.15 =>
2015-09-26 12:38 triplus Note Added: 0006461
2017-02-17 13:54 Kunda1 Tag Attached: sweep
2017-09-08 15:22 industromatic Note Added: 0010092
2017-09-08 15:31 industromatic Note Added: 0010093
2017-12-07 05:08 abdullah Note Added: 0010529
2017-12-07 05:09 Kunda1 Project Sketcher => Part
2017-12-07 05:09 Kunda1 Category Bug => General
2017-12-07 05:10 Kunda1 Note Added: 0010530
2017-12-07 05:10 Kunda1 Note Edited: 0010530
2021-02-06 06:46 abdullah Target Version => 0.20