Change Part workbench measure arrows?

Post here for help on using FreeCAD's graphical user interface (GUI).
Forum rules
and Helpful information
IMPORTANT: Please click here and read this first, before asking for help

Also, be nice to others! Read the FreeCAD code of conduct!
chrisf
Posts: 210
Joined: Fri Jan 03, 2014 10:20 am

Change Part workbench measure arrows?

Postby chrisf » Thu Jul 24, 2014 9:50 am

Is it possible to change the size of the arrows for the Part workbench measure tool?

For small distances, they can be a little difficult to decipher.
Selection_208.png
Selection_208.png (14.68 KiB) Viewed 1537 times
Selection_209.png
Selection_209.png (52.78 KiB) Viewed 1537 times
jmaustpc
Posts: 9556
Joined: Tue Jul 26, 2011 6:28 am
Location: Australia

Re: Change Part workbench measure arrows?

Postby jmaustpc » Thu Jul 24, 2014 10:09 am

the opposite is also true for large distance, they need to be scaled, I think.
analog999
Posts: 7
Joined: Mon Jan 30, 2017 6:46 pm

Re: Change Part workbench measure arrows?

Postby analog999 » Mon Jan 30, 2017 6:48 pm

Anyone ever come up with a solution? I checked the preferences and couldn't find anything to modify this. I think just removing the arrows all together would help too.
User avatar
Kunda1
Posts: 5121
Joined: Thu Jan 05, 2017 9:03 pm

Re: Change Part workbench measure arrows?

Postby Kunda1 » Mon Jan 30, 2017 8:02 pm

analog999 wrote:Anyone ever come up with a solution? I checked the preferences and couldn't find anything to modify this. I think just removing the arrows all together would help too.
It's been issue #2034 and reported in 03-2015
The bug links to https://forum.freecadweb.org/viewtopic.php?f=10&t=20175 for discussion
Want to contribute back to FC? Checkout:
#lowhangingfruit | Use the Source, Luke. | How to Help FreeCAD | How to report FC bugs and features
analog999
Posts: 7
Joined: Mon Jan 30, 2017 6:46 pm

Re: Change Part workbench measure arrows?

Postby analog999 » Tue Jan 31, 2017 1:54 am

Kunda1 wrote:
analog999 wrote:Anyone ever come up with a solution? I checked the preferences and couldn't find anything to modify this. I think just removing the arrows all together would help too.
It's been issue #2034 and reported in 03-2015
The bug links to https://forum.freecadweb.org/viewtopic.php?f=10&t=20175 for discussion

Thanks. This seems like it would be fairly easy to fix. Does anyone know offhand where it is in the code? I'll take a look at it if someone can point me to the right file. I run into this problem all the time when developing new parts.
User avatar
NormandC
Posts: 18534
Joined: Sat Feb 06, 2010 9:52 pm
Location: Québec, Canada

Re: Change Part workbench measure arrows?

Postby NormandC » Tue Jan 31, 2017 4:02 am

wandererfan
Posts: 2881
Joined: Tue Nov 06, 2012 5:42 pm

Re: Change Part workbench measure arrows?

Postby wandererfan » Tue Jan 31, 2017 1:37 pm

Measure doesn't have a Gui component, so I think it's more likely to be:
App/MeasureDistance.cpp and/or Gui/ViewProviderMeasureDistance.cpp
User avatar
tanderson69
Posts: 1495
Joined: Thu Feb 18, 2010 1:07 am

Re: Change Part workbench measure arrows?

Postby tanderson69 » Tue Jan 31, 2017 2:24 pm

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 ... n.cpp#L380
https://github.com/FreeCAD/FreeCAD/blob ... .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 ... r.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 ... nslation.h
analog999
Posts: 7
Joined: Mon Jan 30, 2017 6:46 pm

Re: Change Part workbench measure arrows?

Postby analog999 » Wed Feb 01, 2017 6:14 am

tanderson69 wrote: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 ... n.cpp#L380
https://github.com/FreeCAD/FreeCAD/blob ... .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 ... r.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 ... nslation.h

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.