Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Core / Measure: Introduce QuickMeasure #12217

Merged

Conversation

PaddleStroke
Copy link
Contributor

@PaddleStroke PaddleStroke commented Jan 31, 2024

Introduce quick measure. This adds a small label on the status bar on the right side that gives basic information about selection :

  • lenght of edges
  • Area of faces
  • Volume of solids
  • distances ...

Also as a small thing, it makes the text of the status bar label selectable so you can select it and copy it.

Fixes #12049

@github-actions github-actions bot added the Core Issue or PR touches core sections (App, Gui, Base) of FreeCAD label Jan 31, 2024
@PaddleStroke
Copy link
Contributor Author

Here's how it looks :
image

@chennes
Copy link
Member

chennes commented Feb 1, 2024

There seem to be a couple of small bugs here: in my testing, parallel edges don't show their distance, nor do two selected points.

@PaddleStroke
Copy link
Contributor Author

Bugs are fixed. Order in status bar is fixed too.

@PaddleStroke
Copy link
Contributor Author

@chennes I fixed the end of files and changed to enum class.

@PaddleStroke
Copy link
Contributor Author

The CI is failing for MacOS but I can't understand why. Any idea @chennes ?

@chennes
Copy link
Member

chennes commented Feb 5, 2024

Don't worry about it, that CI has been giving us problems quite frequently due to some sort of timeout. I believe @adrianinsaval in aware of the issue.

@adrianinsaval
Copy link
Member

I'll see if I can manage to reproduce the CI problem on the m1 mac once I get home, for now first just try re triggering the CI if you see mac failing every now and then

@PaddleStroke PaddleStroke marked this pull request as draft February 8, 2024 17:20
@WandererFan
Copy link
Contributor

@hlorus - comments re umf work in progress?

@hlorus
Copy link
Contributor

hlorus commented Feb 10, 2024

@hlorus - comments re umf work in progress?

UMF doesn't utilize the Measurement class in Measurement.h, so conflicts should be minimal. However, there might be some code duplication, which would probably be nice to avoid.

@PaddleStroke
Copy link
Contributor Author

Ah indeed we are bound to have conflicts here, as for a start we both introduce the Measure/Gui module.
And yes we must have some code duplication as its doing something similar

@DanMiel
Copy link

DanMiel commented Feb 17, 2024

I would like to comment on putting the measurements on the bottom or top of the screen. I wrote the QuickMeasure Add-on and had the output going to the status bar. I found it awkward to move my eyes from what I was measuring to the status line and then back up to the part, I found it easier to create the existing text box and put it by what I was measuring, thereby keeping my eyes on the part and on the output.
Dan Miel.

This is copied from pull request #12049 which was closed before I wrote to it.

@prokoudine
Copy link
Contributor

So that it doesn't get lost...

  1. Total length for adjacent edges is 0:

image

  1. Volume is in ml for some reason, shouldn't it be cm^3?

image

@DanMiel
Copy link

DanMiel commented Apr 15, 2024

1 Body is selected
2 Two edges selected
@prokoudine;
I’m using the original Quick Measure WB in these pictures. At this point I am not sure which program you are using.
In picture 1 I have selected a body from the tree. It is a block 3x1x1/2. In the text box it gives the both the volume and the surface area of the body. Your program may be reporting both but missing the ^3.
In picture 2 Two lines are selected. The angle is 90 degrees, total length of the lines is 4 inches, and the closest they come to each other is .5 inches. Your program might be reporting the distance they come to each other which is 0.
Dan Miel

@prokoudine
Copy link
Contributor

@DanMiel I am commenting on the code submitted in this pull request, naturally :)

@PaddleStroke PaddleStroke force-pushed the statusbar_measurements branch 2 times, most recently from ad232f4 to fd12675 Compare April 22, 2024 13:56
@maxwxyz
Copy link
Collaborator

maxwxyz commented Apr 30, 2024

The unified measurement tool is merged now, could this PR be completed now?

@PaddleStroke PaddleStroke marked this pull request as ready for review April 30, 2024 15:14
@PaddleStroke
Copy link
Contributor Author

Rebased on main after the Unified measurement tool merged.
So I'll mark this PR as ready now.

@maxwxyz
Copy link
Collaborator

maxwxyz commented May 2, 2024

I could see a slowdown when changing selection in big documents with complex geometry if always the volume/area is calculated (just selecting/organizing items in the tree view). Maybe selection in the tree view could be excluded?

@PaddleStroke
Copy link
Contributor Author

I think the problem is that the function that gets the volume/area from the shape is a bit slow because its computing them everytime its called.

This also causes some annoying issues in assembly and MBD as well. I'll open an issue about this.

@maxwxyz
Copy link
Collaborator

maxwxyz commented May 2, 2024

@PaddleStroke could we comment out or deactivate COM and Volume for now? Most of the time when selecting objects in the tree view the user is not interested in these measures. When it's needed, the new measurement tool can provide them. COM would also be more relevant if a coordinate system or datum point could be created at it's location.

@PaddleStroke
Copy link
Contributor Author

Yes I think we are going to disable area / volume for solids because there are no obvious way to solve this. And as you say volume/area are not so often needed. When it is the UMT can be used.

@PaddleStroke
Copy link
Contributor Author

@maxwxyz can you please test and feedback if everything is fine now?

@maxwxyz
Copy link
Collaborator

maxwxyz commented May 3, 2024

looks good!

@yorikvanhavre yorikvanhavre merged commit 497ffd3 into FreeCAD:main May 6, 2024
9 checks passed
@0penBrain
Copy link
Contributor

Looks to me as this code makes no use or almost of the new measurement framework. Am I correct ?

@prokoudine
Copy link
Contributor

prokoudine commented May 9, 2024

Well, the framework was merged to main only last week. The Quick Measure feature developed over main is months old.

@0penBrain
Copy link
Contributor

Well, the framework was merged to main only last week. The Quick Measure feature developed over main is months old.

Framework dev is available as a PR for months so doesn't look as a sensible argument.

@prokoudine
Copy link
Contributor

Depending on unmerged patch sounds risky, but now that both are in main, code can be deduplicated

@DrD4ffy
Copy link

DrD4ffy commented May 9, 2024

Why are square millimeters written as mm^2 and not as mm²?

@0penBrain
Copy link
Contributor

Depending on unmerged patch sounds risky

Depending on self-coded things is even more. Trust me on this. 😄

@PaddleStroke
Copy link
Contributor Author

PaddleStroke commented May 10, 2024

I based QuickMeasure on the pre-existing Measurement class and extended it.
At that time I had not seen the UMT work which was a draft PR.

It seems UMT is introducing measurement document objects for each type of measurement. Quickmeasure does not need to create objects. So it can hardly reuse UMT framework.

However it stands that there is duplication of the functions calculating the values (length, area...). But then I would say they do not belong to the measure document objects, as one (such as quickmeasure) can need to calculate measures without needing to create document objects. So those would belong to the pre-existing measurement class, where quickMeasure is using them.

@0penBrain
Copy link
Contributor

0penBrain commented May 10, 2024

It seems UMT is introducing measurement document objects for each type of measurement.

I don't think so. When you use the tool, the result is displayed in the Task panel without any object created. 😉

EDIT: @PaddleStroke I'm wrong here, I just checked and an object is created, then discarded if the measurement isn't validated.

@wwmayer
Copy link
Contributor

wwmayer commented May 10, 2024

The tool is causing some severe problems: https://forum.freecad.org/viewtopic.php?t=87511
I am working on a PR...

@wwmayer
Copy link
Contributor

wwmayer commented May 10, 2024

#13944

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Core Issue or PR touches core sections (App, Gui, Base) of FreeCAD
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature Request] Quick way to see basic measurements on selection