GSoC 2023: Unified Measurement Facility

Contributions from the participants, questions and answers to their projects.
Discussions of proposals for upcoming events.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
dan-miel
Posts: 391
Joined: Thu Sep 13, 2018 12:29 am
Location: Spokane WA. USA

Re: GSoC 2023: Unified Measurement Facility

Post by dan-miel »

adrianinsaval wrote: Tue Jun 06, 2023 4:13 am I think it's the other way around, element information is shown if there is no measurement type available and if there is only one element selected. And btw, in many situations is not actually necessary to select multiple elements to do measurements, if you select a line you would want the length of that line, if you select a circle you would want it's radius, if you select a face you would want it's area and maybe even moment of inertia and such.
So I think his flowchart looks good.
Yea, I can see it that way. Even though a line goes from one point to another point: my train of thought is that distance from point to another point is a measurement, where the length of a line is some informataion about the line. A small difference but a difference that through me off.
Dan
User avatar
adrianinsaval
Veteran
Posts: 5541
Joined: Thu Apr 05, 2018 5:15 pm

Re: GSoC 2023: Unified Measurement Facility

Post by adrianinsaval »

That brings up a good question, what is the info that would be displayed?
User avatar
wandererfan
Veteran
Posts: 6265
Joined: Tue Nov 06, 2012 5:42 pm
Contact:

Re: GSoC 2023: Unified Measurement Facility

Post by wandererfan »

hlorus wrote: Sat Jun 03, 2023 8:42 pm The plan is to have one command defined in the core of FreeCAD which can be placed in a global toolbar.
- when we talk about FreeCAD core, it doesn't necessarily mean just App. Base, Gui, and maybe Part would all be considered part of FreeCAD core.
- commands are usual defined in either Gui or individual modules as appropriate.
- if measurements are to be persistent objects in the document, they would (probably) inherit from App/DocumentObject, but might not be defined in App.
hlorus
Posts: 30
Joined: Sun Oct 17, 2021 9:47 am

Re: GSoC 2023: Unified Measurement Facility

Post by hlorus »

adrianinsaval wrote: Tue Jun 06, 2023 10:29 pm That brings up a good question, what is the info that would be displayed?
I'd say position, length and area. But indeed in the case where a single line is selected there should already be a measurement IMO. I've proposed that in order to make the tool as interactive as possible and avoid the situation where nothing is displayed.

An alternative might be to add measurements types which already work with a single point or face, something like an absolute position and area measurement.
User avatar
adrianinsaval
Veteran
Posts: 5541
Joined: Thu Apr 05, 2018 5:15 pm

Re: GSoC 2023: Unified Measurement Facility

Post by adrianinsaval »

I think single selection measurements is very much desired, measuring length of an edge, radius of circles and area of faces are very common operations IMO, probably other things too.
hlorus
Posts: 30
Joined: Sun Oct 17, 2021 9:47 am

Re: GSoC 2023: Unified Measurement Facility

Post by hlorus »

I've created a PR with the changes i have so far. This is obviously nowhere near complete but i thought it's good if you have insight into what i'm doing.

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

At this point i've added a simple tool which spawns a TaskDialog and displays information about the element you're clicking on. As described i'm planning to use this behavior in case there's no valid measurement type to display.

A few points i could use feedback:
- Does it make sense to use a 3dInventor callback for the tool or would it be better to use a SelectionObserver?
- I'm using the taskdialog as a parent which handles the selection callback, viewprovider etc. Any thoughts on that?
- What do you think about the registration mechanic of the MeasurementHandler, is it alright to put it into Application.cpp?
User avatar
onekk
Veteran
Posts: 6144
Joined: Sat Jan 17, 2015 7:48 am
Contact:

Re: GSoC 2023: Unified Measurement Facility

Post by onekk »

adrianinsaval wrote: Tue Jun 06, 2023 10:29 pm That brings up a good question, what is the info that would be displayed?
As example you select:
  • Vertex: probably the coordinate only
  • Edge: Start and ending point, length, (a line), but if edge is an arc or a BSpline? maybe Curvetype, FirstParameter, LastParameter?
  • Face: ???
  • Solid: ???
From what I could see in GUI you could select these things.

Regards

Carlo D.
GitHub page: https://github.com/onekk/freecad-doc.
- In deep articles on FreeCAD.
- Learning how to model with scripting.
- Various other stuffs.

Blog: https://okkmkblog.wordpress.com/
User avatar
adrianinsaval
Veteran
Posts: 5541
Joined: Thu Apr 05, 2018 5:15 pm

Re: GSoC 2023: Unified Measurement Facility

Post by adrianinsaval »

onekk wrote: Fri Jun 09, 2023 4:33 pm [*] Edge: Start and ending point, length, (a line), but if edge is an arc or a BSpline? maybe Curvetype, FirstParameter, LastParameter?
length is a measurement, and btw it's relevant for all edge types not just lines.

btw, what's the plan when multiple measurement types are available? (such as radius, arc length, center position for circles)
User avatar
onekk
Veteran
Posts: 6144
Joined: Sat Jan 17, 2015 7:48 am
Contact:

Re: GSoC 2023: Unified Measurement Facility

Post by onekk »

adrianinsaval wrote: Sat Jun 10, 2023 8:27 pm ...
length is a measurement, and btw it's relevant for all edge types not just lines.

btw, what's the plan when multiple measurement types are available? (such as radius, arc length, center position for circles)
For this reason I have made the list, as usually you could select these entities, so for each of them it will be interesting to see maybe on the status line some informations.

These infos could be displayed when a single element is selected, and it would be interesting to see them in Python Console, like Selection echoes, this will make easy as example to copy and paste them say in python code.

The measurement button could be used to display more extended informations and task panel could be a decent option, maybe into a dedicated Tab, to not crowd the interface.

But question could be how much informations to put as measurement, to use properly the real estate of the task panel.

It will be interesting as example if you select two entities like circles to have the distance between the two centers, I have found them useful whem modelling to align two superimposed holes to mate things when making complex assemblies starting from old drawings with incomplete informations.

But I would not go too "out of scope" of a measurement tool.

Regards

Carlo D.
GitHub page: https://github.com/onekk/freecad-doc.
- In deep articles on FreeCAD.
- Learning how to model with scripting.
- Various other stuffs.

Blog: https://okkmkblog.wordpress.com/
dan-miel
Posts: 391
Joined: Thu Sep 13, 2018 12:29 am
Location: Spokane WA. USA

Re: GSoC 2023: Unified Measurement Facility

Post by dan-miel »

onekk wrote: Fri Jun 09, 2023 4:33 pm As example you select:
Vertex: probably the coordinate only
Edge: Start and ending point, length, (a line), but if edge is an arc or a BSpline? maybe Curvetype, FirstParameter, LastParameter?
Face: ???
Solid: ???
From what I could see in GUI you could select these things.
@onekk I added to your list but im sure it is not complete. Lines and edges are interchangable.

*Single element info
Points and vertexes: x, y, z coordinate
Straight Edges: Length
Circle Edges: Radius and length of edge
Partial circles: Radius, length and angle of arc
Cylinder (such as hole): Radius when possible length, area
Face: Area and length of perimeter
Part: Volume, surface area
Spheres: Volume, radius and surface area
Cones: Radius of both ends, volume, surface area

*Two selections (measurements)
Points and vertexes: distance between them in x, y and z axis plus distance in straight line.
Circles: Distance between centers in x, y and z axis and distance in straight line
Spheres: Same as Circles
Parallel Edges: Distance between edges
Non-parallel Edges: Angle between edges and closest distance between edges
Parallel planes: Distance between planes
Non-parallel planes: Angle between planes
Parallel Cylinders: Distance between centerlines of cylinders
Non-parallel Cylinders: Angle between centerlines and closest distance between centerlines
Plane and point: Closest distance from point to plane
Line and point: Closest distance from line to point
Plane and Parallel line: Distance between
Plane and Non-parallel line: Angle of line to plane

*Two or more selections (if all selected elements contain the following):
Note: If these options are turned on all the time they may cause FC to slow if many parts were selected due to the measurements being added.
Area: Total of selected areas
Length: Total of selected lengths
Volume: Total of selected volumes

Dan
Post Reply