[FIXED] FC#3006: PartDesign Mirrored bugs
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Be nice to others! Respect the FreeCAD code of conduct!
Re: FC#3006: PartDesign Mirrored bugs
For a couple of days I will be working on DAG cyclic detection and recomputes.
This is post for self about checkIntersection to save the context.
The problem:
1. https://www.freecadweb.org/tracker/view.php?id=3065
2. CheckIntersection is not called for the output of the previous transformation, so in some cases it can not detect an intersection between successive transformations not even if it would work perfectly.
3. If we can not fix extrema and boolean fails on edge, sgrogan's Glitter idea of using fuzzy boolean may be worth a try (where the linked OCC supports it).
This is post for self about checkIntersection to save the context.
The problem:
1. https://www.freecadweb.org/tracker/view.php?id=3065
2. CheckIntersection is not called for the output of the previous transformation, so in some cases it can not detect an intersection between successive transformations not even if it would work perfectly.
3. If we can not fix extrema and boolean fails on edge, sgrogan's Glitter idea of using fuzzy boolean may be worth a try (where the linked OCC supports it).
Re: FC#3006: PartDesign Mirrored bugs
Those two commits:kkremitzki wrote: ↑Thu Jun 01, 2017 10:23 pm Yup, Abdullah and I came to this conclusion as well and divided up the investigation, with me taking the first and him taking the second.
https://github.com/abdullahtahiriyo/Fre ... on_failure
fix the problem with the intersection.
The first commit reverts the intersection detection method to boolean, as the extrema method fails sometimes on touching.
The second commit modifies the way the transformation feature operates and fuses each individual transformation after a successful "checkintersection". This enables to extend the support to the result of this individual transformation, as it may be this extension what actually intersects with the next individual transformation.
In the way, I have dropped the creation of the compound and that second optional fuse that I think it is a consequence of the creation of the compound. I am not certain of it. I would be grateful if anybody with a better understanding of OCC gives it a look to ensure it is ok.
In my tests it works a treat, but I have not extensively tested it. If somebody feels energetic enough to do some more/extensive testing FC will be grateful.
Kurt, you can cherry-pick those two commits into your branch and I think this should enable you now to fix that annoying mesh bug. It is not only inversion also misses some kind of translation, see:
This is a transformation about the Horizontal sketch axis that should appear at the other side of the X axis, so the red mesh should not touch the original block, not even one edge, it should be totally apart, which is not...
The transformation about the Vertical axis, of course, succeeds: A double mirror transformation gives a weird result with the red mesh, with one displaced and the other not:
- kkremitzki
- Veteran
- Posts: 2511
- Joined: Thu Mar 03, 2016 9:52 pm
- Location: Illinois
Re: FC#3006: PartDesign Mirrored bugs
Looks good! Here's the commit that fixes the failure mesh: https://github.com/FreeCAD/FreeCAD/comp ... zki:pd3006abdullah wrote: ↑Wed Jun 07, 2017 5:40 pmThose two commits:kkremitzki wrote: ↑Thu Jun 01, 2017 10:23 pm Yup, Abdullah and I came to this conclusion as well and divided up the investigation, with me taking the first and him taking the second.
https://github.com/abdullahtahiriyo/Fre ... on_failure
fix the problem with the intersection.
It turns out that gp_Trsf::VectorialPart is already including the scale factor, so the multiplication was happening twice.
Now there is some strange behavior with the failure mesh not being colored red in all cases:
Previously, even when there was a failure, the messages box in the task window would say "... shapes do not intersect support. Transformation succeeded."
So I think there is actually a 3rd bug in here, and we're seeing new behavior from it now that the first two have been fixed!
- kkremitzki
- Veteran
- Posts: 2511
- Joined: Thu Mar 03, 2016 9:52 pm
- Location: Illinois
Re: FC#3006: PartDesign Mirrored bugs
I should note that previous to cherry-picking your commits, the failure mesh was always showing up in black and not red. Time to dig further...
- kkremitzki
- Veteran
- Posts: 2511
- Joined: Thu Mar 03, 2016 9:52 pm
- Location: Illinois
Re: FC#3006: PartDesign Mirrored bugs
https://github.com/kkremitzki/FreeCAD/tree/pd3006 now has your commits plus one that fixes the failure mesh being in the wrong location, as well as a commit that fixes the "shapes do not intersect... transformation succeeded" message issue. Now all that's left for PartDesign Mirror to be fixed is getting the red error coloring back!
Re: FC#3006: PartDesign Mirrored bugs
There is another one at least, that when after having entered some transformations, if you click "close" FC segfaults. It has happened to me a couple of times. Not sure what exactly has to be done before pressing close.kkremitzki wrote: ↑Thu Jun 08, 2017 3:45 am https://github.com/kkremitzki/FreeCAD/tree/pd3006 now has your commits plus one that fixes the failure mesh being in the wrong location, as well as a commit that fixes the "shapes do not intersect... transformation succeeded" message issue. Now all that's left for PartDesign Mirror to be fixed is getting the red error coloring back!
LGTM.kkremitzki wrote: ↑Wed Jun 07, 2017 8:38 pm Here's the commit that fixes the failure mesh: https://github.com/FreeCAD/FreeCAD/comp ... zki:pd3006
It turns out that gp_Trsf::VectorialPart is already including the scale factor, so the multiplication was happening twice.
This one is really funny. Without your commit it is out of place but red, with your commit it is in place but black. And it gets better:kkremitzki wrote: ↑Wed Jun 07, 2017 8:38 pm Now there is some strange behavior with the failure mesh not being colored red in all cases:
Now with 3 transformation Vertical axis, bottom face, Horizontal axis, I get two red and two black... time to go to the casino
Re: FC#3006: PartDesign Mirrored bugs
If the last transformation fails, and the user nevertheless hits ok, he sees the effect of the n-1 transformations before (there is not even a red exclamation mark on the feature). So the full transformation is failing, indeed, but a partial result is shown. I am unsure what is best. Maybe the current behaviour is the best and we should arrange so that the red exclamation mark appears when not all the transformations succeeded.kkremitzki wrote: ↑Thu Jun 08, 2017 3:45 am https://github.com/kkremitzki/FreeCAD/tree/pd3006 now has your commits plus one that fixes the failure mesh being in the wrong location, as well as a commit that fixes the "shapes do not intersect... transformation succeeded" message issue. Now all that's left for PartDesign Mirror to be fixed is getting the red error coloring back!
I have changed one of my commits to clean up (remove unused variables). The new branch with all your commits on top of this here:
https://github.com/abdullahtahiriyo/Fre ... r_issues_1
- kkremitzki
- Veteran
- Posts: 2511
- Joined: Thu Mar 03, 2016 9:52 pm
- Location: Illinois
Re: FC#3006: PartDesign Mirrored bugs
Hmm, you should check in the case of a single Mirrored command on your example with the cube offset by 30mm in the Y direction. If you try to mirror it about the horizontal sketch axis, you'll get the not-red failed mesh, and if you try to click ok, you'll be prevented:abdullah wrote: ↑Thu Jun 08, 2017 4:43 amIf the last transformation fails, and the user nevertheless hits ok, he sees the effect of the n-1 transformations before (there is not even a red exclamation mark on the feature). So the full transformation is failing, indeed, but a partial result is shown. I am unsure what is best. Maybe the current behaviour is the best and we should arrange so that the red exclamation mark appears when not all the transformations succeeded.kkremitzki wrote: ↑Thu Jun 08, 2017 3:45 am https://github.com/kkremitzki/FreeCAD/tree/pd3006 now has your commits plus one that fixes the failure mesh being in the wrong location, as well as a commit that fixes the "shapes do not intersect... transformation succeeded" message issue. Now all that's left for PartDesign Mirror to be fixed is getting the red error coloring back!
I have changed one of my commits to clean up (remove unused variables). The new branch with all your commits on top of this here:
https://github.com/abdullahtahiriyo/Fre ... r_issues_1
Re: FC#3006: PartDesign Mirrored bugs
Yup. You are right. I complained about the exclamation mark because it was late at night and I forgot to compile after cherry-picking. But your code does also indirectly set the exclamation mark, because it returns a non StdReturn DocumentObjectExecReturn.kkremitzki wrote: ↑Thu Jun 08, 2017 5:31 am Hmm, you should check in the case of a single Mirrored command on your example with the cube offset by 30mm in the Y direction. If you try to mirror it about the horizontal sketch axis, you'll get the not-red failed mesh, and if you try to click ok, you'll be prevented:
Re: FC#3006: PartDesign Mirrored bugs
I just tested the branch with OCE:
OS: Ubuntu 16.04.2 LTS
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.17.11211 +4 (Git)
Build type: Debug
Branch: mirror_issues_1
Hash: d164c4a53f91530584a1b9ac8a88e1d2b8ce14bb
Python version: 2.7.12
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 6.8.0.oce-0.17
The bug fixes work as good as with OCC 7.1.
OS: Ubuntu 16.04.2 LTS
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.17.11211 +4 (Git)
Build type: Debug
Branch: mirror_issues_1
Hash: d164c4a53f91530584a1b9ac8a88e1d2b8ce14bb
Python version: 2.7.12
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 6.8.0.oce-0.17
The bug fixes work as good as with OCC 7.1.