FreeCAD / FreeCAD

This is the official source code of FreeCAD, a free and opensource multiplatform 3D parametric modeler.
https://www.freecad.org
Other
19.33k stars 3.99k forks source link

TechDraw: Area dimension doesn't work the first time it's applied #14038

Closed FEA-eng closed 2 months ago

FEA-eng commented 4 months ago

Is there an existing issue for this?

Problem description

13525 introduced the great new smart dimension tool but also the individual area dimension tool. The former works perfectly but the latter fails the first time it's applied. Steps to reproduce:

  1. Add Part Cube.
  2. Add TechDraw view of the cube.
  3. Select the face and apply the Area Dimension (not the old Area Annotation).

It shows 0 mm^2 and the following error message:

<Exception> getGeomTypeFromName - empty geometry name

Just retrying should make it work then.

Btw. do we still need the area annotation? If yes, these 2 tools should have different icons:

icons

Full version info

OS: Windows 10 build 19045
Word size of FreeCAD: 64-bit
Version: 0.22.0dev.37302 (Git)
Build type: Release
Branch: main
Hash: 0e24e121eb3e5708c380596e0a9fd583befac977
Python 3.11.9, Qt 5.15.13, Coin 4.0.2, Vtk 9.2.6, OCC 7.7.2
Locale: Polish/Poland (pl_PL)

Subproject(s) affected?

Techdraw

Anything else?

No response

Code of Conduct

maxwxyz commented 4 months ago

@PaddleStroke FYI

FEA-eng commented 3 months ago

@maxwxyz Can you add the 1.0 label? The tool doesn't work properly.

PaddleStroke commented 3 months ago

I have tested and this is not specific to area dimension. It's a bug for all type of dimension. What happens is that when you selected the face, the object itself is still selected from when you created the view. So when you add the dimension the part ends up in 'reference 3d' : image

Removing it and the dimension works.

PaddleStroke commented 3 months ago

@WandererFan can you please weight in what needs to be done here? Here's a video : https://github.com/FreeCAD/FreeCAD/assets/19984177/50f9c2fd-7370-406b-98b3-2f349f6e2ade

PaddleStroke commented 3 months ago

Ok so I checked it anyway. And so getReferencesFromSelection is putting the solid object (part in my case) into references3d. Which is not cleared and is added by setReferences3d.

PaddleStroke commented 3 months ago

Ok so the fix seems pretty simple (see https://github.com/FreeCAD/FreeCAD/pull/15084). Just add

    else {
        references3d.clear();
    }

to the if :

    if (geometryRefs2d == TechDraw::isViewReference && !references3d.empty()) {
        ...
    }
    else {
        references3d.clear();
    }

@WandererFan please check if this solution is OK.

FEA-eng commented 3 months ago

@PaddleStroke Thanks for taking care of this. What do you think about the second part of the issue - duplicated icons/tools?

PaddleStroke commented 3 months ago

Removing stuff has proved to be tedious in the past so I prefered to just skip it. But I agree it makes not much sense keeping the annotation tool.

FEA-eng commented 3 months ago

Removing stuff has proved to be tedious in the past so I prefered to just skip it. But I agree it makes not much sense keeping the annotation tool.

Maybe for now, they should at least have slightly different icons. It's confusing when they are identical.

Reqrefusion commented 3 months ago

14878 Since it is mentioned here, let me write that with the icon revision, a difference in nuance was added between the icons. But this difference is not enough to overcome this confusion.