Dimension Reference Error Detection and Correction

Discussions about the development of the TechDraw workbench
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
user1234
Veteran
Posts: 3335
Joined: Mon Jul 11, 2016 5:08 pm

Re: Dimension Reference Error Detection and Correction

Post by user1234 »

An other similar testcase, where the angle of not working occurs much faster. Similar file, except in square base. It woks till 82deg back and forth, but in 83deg it works forth, but not back again.

mwe_squarebase_FreeCAD_LTNPAutoCorrect4.FCStd
(18.22 KiB) Downloaded 24 times

version, which i use to test

Code: Select all

OS: Debian GNU/Linux 11 (bullseye) (X-Cinnamon/lightdm-xsession)
Word size of FreeCAD: 64-bit
Version: 0.21.0.32643 (Git)
Build type: Release
Branch: LTNPAutoCorrect4
Hash: cbc9231fc0fef5d8f02d7f851b7eb5f0146309d5
Python 3.9.2, Qt 5.15.2, Coin 4.0.0, Vtk 9.0.1, OCC 7.7.1
Locale: English/United States (en_US)
Installed mods: 
  * QuickMeasure 2022.10.28
  * Assembly4 0.12.6
  * CurvedShapes 1.0.4
  * Curves 0.6.8

Greetings
user1234
user1234
Veteran
Posts: 3335
Joined: Mon Jul 11, 2016 5:08 pm

Re: Dimension Reference Error Detection and Correction

Post by user1234 »

@wandererfan : do not get me wrong, i really really appreciate your work, but i think the conception (issue #8878) to reference dimension without any 3D links, it will not work. I work with many partial rotation symmetric (round with pitches) parts, grating pattern parts, or shape overlapping (round in round in round) parts, where parts of it are not complete symmetric or only partical lattice shaped. Compare only due 2D will not work there. Also when i think about installations plans or assembly plans, where you have without exaggeration >>10000 edges on the narrowest places, how should a compare work there when a simple change the geometric sequence is different? Also what about hidden lines? I think referencing to 3D is unavoidable.


Greetings
user1234
user1234
Veteran
Posts: 3335
Joined: Mon Jul 11, 2016 5:08 pm

Re: Dimension Reference Error Detection and Correction

Post by user1234 »

Sorry for bombing today, but later i will not have time for tests for days.

Here is a simplified typical part of use, without fillets, chamfers, threads, seats for additions elements or whatever, just the pitch holes.
simplified_part.FCStd
(156.92 KiB) Downloaded 24 times



When when i dimension (a bolt hole) the part like the screenshot and rotate the Body around 11deg, it fails in that case. But it could also be, that i changed the pitches in that way (the fit the counter part), that in this specific case it would be correct.

2023-04-02_00-30.png
2023-04-02_00-30.png (294.53 KiB) Viewed 864 times


Or when i dimension the outside of the bolt hole, change Sketch002 in that way, that it fits a bolt ISO4762 M36 (30mm instead 20mm and 20mm instead 13mm) instead of M24, it will also not work.

2023-04-02_00-36.png
2023-04-02_00-36.png (260.61 KiB) Viewed 864 times


When you look at the two holes left and right from the bolt hole, you will see, one is tapered and the other have (not modeled) pull off thread with clearance, that the thread is produceable, which leads to very similar shapes in 2D. Of course it could be, that i have to rotate the pitchholes or the part around 90deg, because of the counter part (in this is also a very simplified task). There is no chance, if you only compare the 2D shape, to fit the dimensions, where it belongs, besides i only could have changed not the pitches, only the dimensions (not the function itself) in the part either, witch could be indeed completely inverted. Even a trained AI could not even get this with only its 2D shape, the usecases and task have way too specific purposes, even real trained people have sometimes troubles with pitchholes changes and their consequences on parts and therefore drawings, even when they know its purpose.



Greetings
user1234
User avatar
wandererfan
Veteran
Posts: 6268
Joined: Tue Nov 06, 2012 5:42 pm
Contact:

Re: Dimension Reference Error Detection and Correction

Post by wandererfan »

user1234 wrote: Sat Apr 01, 2023 6:06 pm The question is, is it about rotation, is it about length to height ratio, or is it about the same as before, that the HLR craps out again and makes b-splines, but i get all center marks (maybe some does not work, but looks like, because the center is the same).
Good test.
The upper left rounded corner has the same center point as the original hole, so it scores high there.
The bounding rectangles of the rounded corner and the original hole overlap, so it scores high there too.
The fact that one is a partial circle and the other is a complete circle should have disqualified the match, but the weight and the test weren't right.

Latest version will not match an arc to a full circle and picks the correct edge for this test.

That's as far as I'm going to get tonight!
User avatar
wandererfan
Veteran
Posts: 6268
Joined: Tue Nov 06, 2012 5:42 pm
Contact:

Re: Dimension Reference Error Detection and Correction

Post by wandererfan »

user1234 wrote: Sat Apr 01, 2023 9:06 pm @wandererfan : do not get me wrong, i really really appreciate your work, but i think the conception (issue #8878) to reference dimension without any 3D links, it will not work. I work with many partial rotation symmetric (round with pitches) parts, grating pattern parts, or shape overlapping (round in round in round) parts, where parts of it are not complete symmetric or only partical lattice shaped. Compare only due 2D will not work there. Also when i think about installations plans or assembly plans, where you have without exaggeration >>10000 edges on the narrowest places, how should a compare work there when a simple change the geometric sequence is different? Also what about hidden lines? I think referencing to 3D is unavoidable.
If you want the best possible results, then yes, you should build your dimensions on 3d geometry. That removes the naming problems introduced by passing through HLR.

I don't know what happens when we get a model with 10000 edges. Maybe this approach turns out too slow on big models. In keeping with the three rules of optimization, there is no attempt at optimization currently.

Hidden lines is a good point. We need to check that we are comparing visible to visible. AFAIK, dimensioning hidden lines is bad practice, so maybe we just ignore hidden lines.

But I think I am missing your point.
User avatar
wandererfan
Veteran
Posts: 6268
Joined: Tue Nov 06, 2012 5:42 pm
Contact:

Re: Dimension Reference Error Detection and Correction

Post by wandererfan »

user1234 wrote: Sat Apr 01, 2023 6:25 pm An other similar testcase, where the angle of not working occurs much faster. Similar file, except in square base. It woks till 82deg back and forth, but in 83deg it works forth, but not back again.
The fix for arcs seems to solve this one too.
User avatar
wandererfan
Veteran
Posts: 6268
Joined: Tue Nov 06, 2012 5:42 pm
Contact:

Re: Dimension Reference Error Detection and Correction

Post by wandererfan »

user1234 wrote: Sat Apr 01, 2023 11:19 pm When when i dimension (a bolt hole) the part like the screenshot and rotate the Body around 11deg, it fails in that case. But it could also be, that i changed the pitches in that way (the fit the counter part), that in this specific case it would be correct.
...
Or when i dimension the outside of the bolt hole, change Sketch002 in that way, that it fits a bolt ISO4762 M36 (30mm instead 20mm and 20mm instead 13mm) instead of M24, it will also not work.

Rotated 11 degrees and changed to M36 picks up the correct edge.
11DegreesAndM36.png
11DegreesAndM36.png (67.85 KiB) Viewed 722 times
There is no chance, if you only compare the 2D shape, to fit the dimensions, where it belongs, besides i only could have changed not the pitches, only the dimensions (not the function itself) in the part either, witch could be indeed completely inverted. Even a trained AI could not even get this with only its 2D shape, the usecases and task have way too specific purposes, even real trained people have sometimes troubles with pitchholes changes and their consequences on parts and therefore drawings, even when they know its purpose.
Not sure I get all of this. If the circle has a centre and radius that is close to the original, it will score high. If the model changes so much that the new circle is a completely different size and location, well, it is going to score low and the algo will likely not pick the right replacement. Even if you only rotate the shape, if there is now an identical circle in the old location, the algo will pick the identical circle. If the shape is symmetrical, with multiple identical features, I don't know how any algo could pick the right one.

We will have to issue a warning when we pick a new edge so the user can verify that our substitution is a good one. We didn't need that in Phase 1 since we were doing exact matches only.
user1234
Veteran
Posts: 3335
Joined: Mon Jul 11, 2016 5:08 pm

Re: Dimension Reference Error Detection and Correction

Post by user1234 »

wandererfan wrote: Sun Apr 02, 2023 4:16 pm Not sure I get all of this. If the circle has a centre and radius that is close to the original, it will score high. If the model changes so much that the new circle is a completely different size and location, well, it is going to score low and the algo will likely not pick the right replacement. Even if you only rotate the shape, if there is now an identical circle in the old location, the algo will pick the identical circle. If the shape is symmetrical, with multiple identical features, I don't know how any algo could pick the right one.
That is the point, from a change from the model it looks from the projection similar, but the function is completely different. Just note, that there often more on the dimensions, like tolerances, marks, notes or whatever. So a reference to 3D face, edge, point are always needed to get it right. When the topology changes, that the references are vanished, then the guessing algo can definitive help.

As i always wonder, how other CADs get this right, one is clear to me, the use 3D references. So how do they get it? I think they get it while dimension it in 2D.

When the 3D and 2D share the same origin point and a same direction from a plane, then while clicking on the 2D line, all underlying 3D references, they fit in the projection in position and length, they are valid to be the references.


2023-04-04_23-21.png
2023-04-04_23-21.png (243.76 KiB) Viewed 665 times


The question is, if only one reference is enough, or a list of priority should be used, like 1. projected faces, 2. all projected edges and 3. all point boundaries, in case, one of the references do not fit in the usage. Example, if a projected face is a line (parallel to the projection line), but get due editing slanted so the projection is a face.


Thoughts?


Greetings
user1234
Attachments
ref_2D_3D.FCStd
(56.27 KiB) Downloaded 22 times
User avatar
wandererfan
Veteran
Posts: 6268
Joined: Tue Nov 06, 2012 5:42 pm
Contact:

Re: Dimension Reference Error Detection and Correction

Post by wandererfan »

user1234 wrote: Tue Apr 04, 2023 9:42 pm [As i always wonder, how other CADs get this right, one is clear to me, the use 3D references. So how do they get it? I think they get it while dimension it in 2D.
I don't know the internal logic of any other CAD, but I suspect that their equivalent of HLR keeps track of which 3d edge generated a given 2d edge. That would make things so much easier.
When the 3D and 2D share the same origin point and a same direction from a plane, then while clicking on the 2D line, all underlying 3D references, they fit in the projection in position and length, they are valid to be the references.
I have something under development that works like this. It looks at the projection of the 3d edges and compares it to the 2d edge. A couple of difficulties so far: there can be multiple 3d edges that are candidates (think of a cube with a dimension on top front edge - both the front top edge and the rear top edge will make the same projection), and the 2d edge may not represent the entire 3d edge if there is a face blocking part of the edge.
The question is, if only one reference is enough, or a list of priority should be used, like 1. projected faces, 2. all projected edges and 3. all point boundaries, in case, one of the references do not fit in the usage. Example, if a projected face is a line (parallel to the projection line), but get due editing slanted so the projection is a face.
Yeah. If we get multiple possible 3d "hints", we're back to a guessing algorithm. Maybe just rewriting HLR would be less work. :(
user1234
Veteran
Posts: 3335
Joined: Mon Jul 11, 2016 5:08 pm

Re: Dimension Reference Error Detection and Correction

Post by user1234 »

wandererfan wrote: Wed Apr 05, 2023 6:02 pm I have something under development that works like this. It looks at the projection of the 3d edges and compares it to the 2d edge.
So you was already thinking about that, so my idea seems not that weird.



wandererfan wrote: Wed Apr 05, 2023 6:02 pm A couple of difficulties so far: there can be multiple 3d edges that are candidates (think of a cube with a dimension on top front edge - both the front top edge and the rear top edge will make the same projection)
If there are multiple edges, they fit 100%, all are valid. If it is a hard visible edge, i would suggest the first from projection view direction, if it is extractable.



wandererfan wrote: Wed Apr 05, 2023 6:02 pm the 2d edge may not represent the entire 3d edge if there is a face blocking part of the edge.
Have you an example?



wandererfan wrote: Wed Apr 05, 2023 6:02 pm f we get multiple possible 3d "hints", we're back to a guessing algorithm.
I would use the guessing algorithm, when the reference is destroyed. I have seen that in other CADs, also before confirming from the user, that the guess was right, they have an other color. So the guessing is not useless, i can share an simple example later, where this is an absolute valid option (which needs in my opinion still confirming from the user anyway).




Greetings
user1234
Post Reply