Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sweep tolerances are too high #5594

Closed
FreeCAD-Bug-Importer opened this issue Feb 7, 2022 · 0 comments
Closed

Sweep tolerances are too high #5594

FreeCAD-Bug-Importer opened this issue Feb 7, 2022 · 0 comments
Assignees
Labels
WB Part Related to the Part Workbench

Comments

@FreeCAD-Bug-Importer
Copy link
Collaborator

Issue imported from https://tracker.freecad.org/view.php?id=1739

  • Reporter: ickby
  • Date submitted: 9/10/2014
  • FreeCAD version: 0.15
  • Category: General
  • Status: assigned
  • Tags: sweep, tolerances

Original report text

Cuts 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 reproduce

load the file feder and recompute the document. To see the working fix load feder_fixed and see the result.

Other bug information

  • Priority: normal
  • Severity: major
  • Category: General
  • Updated: 2/6/2021

Discussion from Mantis ticket

Comment by tanderson69 2014-09-11 01:00

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?


Comment by ickby 2014-09-11 05:50

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


Comment by tanderson69 2014-09-11 13:38

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.


Comment by tanderson69 2014-09-11 15:01

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


Comment by tanderson69 2014-09-11 15:18

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.


Comment by tanderson69 2014-09-11 15:35

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();


Comment by triplus 2015-09-26 12:38

I can confirm the issue:

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


Comment by industromatic 2017-09-08 15:22

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.


Comment by industromatic 2017-09-08 15:31

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.


Comment by abdullah 2017-12-07 05:08

kunda1

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


Comment by Kunda1 2017-12-07 05:10

abdullah done ;)

@FreeCAD-Bug-Importer FreeCAD-Bug-Importer added the WB Part Related to the Part Workbench label Feb 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
WB Part Related to the Part Workbench
Projects
None yet
Development

No branches or pull requests

3 participants