View Issue Details

IDProjectCategoryView StatusLast Update
0002034PartBugpublic2019-07-30 22:48
Reportertoehser Assigned Toyorik  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionreopened 
PlatformUbuntu 14.04.2 x64OSLinuxOS Version3.13.0-49-generi
Product Version0.17 
Fixed in Version0.18 
Summary0002034: Measurement arrowheads are ridiculously out of proportion at some scales/zooms/measurements.
DescriptionSee http://www.toms.net/FreeCAD/fc2.png (attached to ticket)
Steps To Reproducemeasure something small
Additional Informationarrowheads even overlap into hourglasses
Tags#lowhangingfruit, #pending
FreeCAD Information

Relationships

related to 0002520 closedyorik Drawing Dimension Arrows incorrectly scaled or placed in Export PDF (fixed in Qt5) 

Activities

Kunda1

2017-01-24 00:28

administrator   ~0007941

Last edited: 2017-01-30 20:03

Please retest on 0.16
Forum thread: https://forum.freecadweb.org/viewtopic.php?f=10&t=20175

Edit: Another thread found at https://forum.freecadweb.org/viewtopic.php?f=3&t=7126

normandc

2017-01-24 04:15

manager   ~0007943

I confirm this bug in current master.

Steps to reproduce:

1. Create a Part Cube of dimensions 0.1 x 0.1 x 0.1 mm
2. Select two vertices
3. Click on "Measure Linear" from the Measure toolbar in the Part workbench
4. The measurement arrows are disproportionally huge.

OS: Ubuntu 14.04.5 LTS
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.17.9747 (Git)
Build type: None
Branch: master
Hash: f5c0f579cbd7ce668727f8835946e4e9abc0eec6
Python version: 2.7.6
Qt version: 4.8.6
Coin version: 4.0.0a
OCC version: 6.8.0.oce-0.17

Kunda1

2017-01-30 13:39

administrator   ~0008102

Changing status to 'confirmed'

Kunda1

2017-03-10 00:16

administrator   ~0008601

Last edited: 2017-03-10 00:18

Copypasta from https://forum.freecadweb.org/viewtopic.php?f=3&t=7126#p157425


    Been several iterations so can be hard to find. The part measure entities are not document objects and live as pure coin3d objects. This means they have no view provider. The arrow head creation is at:
    https://github.com/FreeCAD/FreeCAD/blob/bcc2e45195601744f269d1c05b2b40abbe4c2732/src/Mod/Part/Gui/TaskDimension.cpp#L380
    https://github.com/FreeCAD/FreeCAD/blob/bcc2e45195601744f269d1c05b2b40abbe4c2732/src/Mod/Part/Gui/TaskDimension.cpp#L1060

    setting up 'autoscale' in coin3d seems harder than it should be, at least to me. Anyway I did make it work for the default reposition dragger. You can use it by double clicking on a primitive. You can find the code here.
    https://github.com/FreeCAD/FreeCAD/blob/bcc2e45195601744f269d1c05b2b40abbe4c2732/src/Gui/SoFCCSysDragger.cpp#L942

    luke parry added a custom node, but I have never used it to know if it does what you want.
    https://github.com/FreeCAD/FreeCAD/blob/bcc2e45195601744f269d1c05b2b40abbe4c2732/src/Gui/Inventor/SoAutoZoomTranslation.h

tanderson69


Thanks for the pointers. I don't have the build platform set up, hell I don't even know what you guys recommend, gcc or something I'm assuming. Anyway, just looking at TaskDimension.cpp, the cone size of the arrow, which is the problem, not the arrow itself, is set with these lines:

cone->bottomRadius.setValue(0.25);
cone->height.setValue(0.5);

(similar for the cones at line 1060)

I don't know the correct method for calling the function, but couldn't you could calculate the scale factor off the vector at around line 432:

textVecCalc->dot(A,B) // should return length of the 3D arrow

And again, at around line 1137.

Then you know based on the size of the vectors that make the arrow length, say are fine at 20mm (just guessing), you could then scale the cone size based on that dot product in relation to 20mm.

Of course, maybe I'm missing something here? I am not familiar with the code, or with Coin3D, just a brief look at both, but it looks like an easy fix to me.

The reason this is OK is that if you are looking at a small area, the cones NEED to be small. Even if you were zooming out and looking at the part in a wider view, it doesn't help to have the cones be big and overlapping. Basically, I'm saying scale the cone based on the arrow length, NOT the camera view.

The other option is how about just not displaying the arrow cones at all? It could be a checkbox in the preferences. I don't see why they're really necessary anyway. With that, you just make it a conditional based on the global preference around lines:

384
387
1064
1067

Anyone who has the build environment already set up care to test or implement either of these suggested changes?

I realize that this may not be as important as implementing a much cooler feature, but as a novice user (at this point I might call myself novice->intermediate as there are many features I stil am not familiar with), the arrow cone issue is one of the first things that I ran into that has bugged me from probably the first or second part I made, and continues to bug me pretty much anytime I am working on something with tight tolerances. If it's that easy and annoying of a "bug" for someone to find, and at least just having the option to turn them off is available, that might keep someone from getting really frustrated and saying "f-this, I'll just go back to whatever-cad"

I think FreeCAD is awesome, by the way. Thank you guys so much for creating / working on it. I will be happy to make the change myself, but getting the build environment all set up is going to take some time that I don't have at the moment. I don't know if this really matters to anyone who is doing the regular builds / code merges or what have you.

analog999

Kunda1

2017-05-01 23:00

administrator   ~0008841

Re-added attached photo
IMG_0010.PNG (31,319 bytes)   
IMG_0010.PNG (31,319 bytes)   

craig9

2019-03-11 02:05

reporter   ~0012878

I have made an attempt to fix this bug. The code is available at:

https://github.com/craig9/FreeCAD/tree/bug2034

Please let me know if I haven't followed the standard procedure in any way. (Or if the fix is no good)

Cheers,
Craig

yorik

2019-03-12 13:38

administrator   ~0012894

The fix looks good, I just merged it. Thanks!

yorik

2019-03-12 13:39

administrator   ~0012895

https://github.com/FreeCAD/FreeCAD/commit/690774c0effe4fd7b8d2b5e2fb2b8c8d145e21ce

wmayer

2019-03-12 16:54

administrator   ~0012897

Unfortunately, this issue is not correctly solved. When creating a cube of size 0.1 x 0.1 x 0.1 then the arrows are not correctly placed. The peaks of the arrows should lie on the selected points.

craig9

2019-03-12 21:31

reporter   ~0012903

Last edited: 2019-03-12 22:30

Thanks wmayer for pointing that out.

I looked into it a little further, and there was a precision error, so I've increased that by four decimals, which gives good results at 0.1mm, and acceptable results at 10nm. Going much further would require using a double instead of a float, and I'm not sure whether there would be any knock-on effects.

https://github.com/FreeCAD/FreeCAD/pull/2016

Update: Please excuse the git mess, I neglected to rebase first, so there are a few commits that may not make sense, but the end result should be good. I'm learning git as I go, and there seems to be a bit of an art to fetching and merging and pushing from/to different sources. If you'd like me to create a new branch to keep the history clean, that's fine, just let me know.

wmayer

2019-03-14 22:40

administrator   ~0012907

Thanks for providing a fix. I think it's sufficient the way how it works now because when entering value of 1nm or lower (or for very huge values) then the whole scene starts to behave weirdly. This is because OpenInventor only uses floats.

About git: I was able to cherry-pick the last commit which includes the relevant changes.

craig9

2019-03-14 22:43

reporter   ~0012908

Thanks wmayer. And - thanks for the reminder about the cherry pick feature within git. I will look into that.

wmayer

2019-03-14 22:49

administrator   ~0012909

https://github.com/FreeCAD/FreeCAD/commit/23ecb8eace2f59049bf52106f694c3b4c2d6eb7a

Related Changesets

FreeCAD: releases/FreeCAD-0-18 690774c0

2019-03-11 02:00:30

Craig Marshall


Committer: Yorik van Havre Details Diff
Fixes Bug 2034. Made Part dimensional arrows proportional to line length and radius Affected Issues
0002034
mod - src/Mod/Part/Gui/TaskDimension.cpp Diff File
mod - src/Mod/Part/Gui/TaskDimension.h Diff File

Issue History

Date Modified Username Field Change
2015-03-31 12:57 toehser New Issue
2017-01-24 00:21 Kunda1 File Added: fc2.png
2017-01-24 00:21 Kunda1 Description Updated
2017-01-24 00:28 Kunda1 Note Added: 0007941
2017-01-24 00:28 Kunda1 Status new => feedback
2017-01-24 00:29 Kunda1 Tag Attached: #pending
2017-01-24 04:15 normandc Note Added: 0007943
2017-01-30 13:39 Kunda1 Note Added: 0008102
2017-01-30 13:39 Kunda1 Status feedback => confirmed
2017-01-30 20:03 Kunda1 Note Edited: 0007941
2017-02-01 23:56 Kunda1 Tag Attached: #lowhangingfruit
2017-03-10 00:16 Kunda1 Note Added: 0008601
2017-03-10 00:18 Kunda1 Note Edited: 0008601
2017-03-10 00:21 Kunda1 Product Version => 0.17
2017-03-10 00:21 Kunda1 Target Version => 0.17
2017-05-01 22:59 Kunda1 File Deleted: fc2.png
2017-05-01 23:00 Kunda1 File Added: IMG_0010.PNG
2017-05-01 23:00 Kunda1 Note Added: 0008841
2017-06-27 11:31 Kunda1 Relationship added related to 0002520
2017-10-18 14:21 wmayer Project FreeCAD => Part
2018-01-05 21:11 wmayer Target Version 0.17 => 0.18
2019-02-14 21:29 wmayer Target Version 0.18 => 0.19
2019-03-11 02:05 craig9 Note Added: 0012878
2019-03-12 13:38 yorik Note Added: 0012894
2019-03-12 13:39 yorik Assigned To => yorik
2019-03-12 13:39 yorik Status confirmed => closed
2019-03-12 13:39 yorik Resolution open => fixed
2019-03-12 13:39 yorik Fixed in Version => 0.18
2019-03-12 13:39 yorik Note Added: 0012895
2019-03-12 16:54 wmayer Status closed => new
2019-03-12 16:54 wmayer Resolution fixed => reopened
2019-03-12 16:54 wmayer Note Added: 0012897
2019-03-12 21:31 craig9 Note Added: 0012903
2019-03-12 21:33 craig9 Note Edited: 0012903
2019-03-12 22:30 craig9 Note Edited: 0012903
2019-03-14 22:40 wmayer Note Added: 0012907
2019-03-14 22:43 craig9 Note Added: 0012908
2019-03-14 22:49 wmayer Status new => closed
2019-03-14 22:49 wmayer Note Added: 0012909
2019-07-30 22:48 Kunda1 Changeset attached => FreeCAD releases/FreeCAD-0-18 690774c0