Commit Graph

138 Commits

Author SHA1 Message Date
wmayer
04a6f38ec8 Measure: When measuring the distance between circles then use the center points as reference
See forum: https://forum.freecad.org/viewtopic.php?t=91570
2024-10-23 21:52:37 +02:00
pre-commit-ci[bot]
925335d5c1 [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2024-10-22 22:37:01 -05:00
wmayer
9a66ad7302 Measure: Use Base::toDegrees to convert radian to degree 2024-10-22 22:37:01 -05:00
hlorus
cd55faf04e MeasureGui: Revert temporary measure object creation (#17109)
* MeasureGui: Revert temporary measure object creation

Reverts the temporary creation of measurement objects that was added in #15122

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* MeasureGui: Adress review comments

- Remove _mDocument and _mGuiDocument
- Replace c-style casts with dynamic_cast
- Add file guard
- Remove leftover canAnnotate method

* MeasureGui: Fix crash when selecting elements from different documents

* MeasureGui: Add additional type check in ensureGroup

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-10-14 17:54:13 +02:00
Eric Price
2d0fc0a177 Changed QuickMeasurement to be conservative (#17060)
* Changed QuickMeasurement to be conservative

QuickMeasurement should not measure while tool dialogs are open
this includes but is not limited to editing sketches
also changed several other sanity checks to be opt-in vs opt-out, as discussed.

* move the test if it is safe to measure to when the measurement actually happens - avoids any potential race conditions
2024-10-07 08:33:31 -05:00
PaddleStroke
6c494623d4 QuickMeasure: Prevent crash by limiting selection to Part::Features (#16921)
* QuickMeasure: Prevent crash by limiting selection to Part::Features

* chennes' fix

Co-authored-by: Chris Hennes <chennes@pioneerlibrarysystem.org>

---------

Co-authored-by: Chris Hennes <chennes@pioneerlibrarysystem.org>
2024-10-03 09:49:09 -05:00
Benjamin Nauck
9913d6a1aa Fix macos crashes when unhandled exceptions reaches qt 2024-10-02 21:11:41 -06:00
hlorus
813ee36cb8 MeasureGui: Also hide delta measurements 2024-09-30 18:24:19 +02:00
hlorus
1f081cd15e MeasureGui: Remove leftover reset of _mMeasureObject
This was introduced in af9097ce87 due to a faulty resolve of a merge conflict
2024-09-30 18:22:58 +02:00
Eric Price
69676a0f9d Measurement: Avoid null shapes to be returned in all code branches (Fix #16820)
Returning a null shape would have triggered an exception in the bottom branch but not in the top one - which later leads to a segfault - solution - raise an exception. OOC doesn't like null shapes.
2024-09-25 12:29:48 -05:00
Eric Price
54c278c123 Measurement: Correctly handle unknown selections to avoid segfaults (Fix 16794)
The measurement code did not handle mixed selections of known and unknown types correctly. Although a unknown selected object would leave the type at Invalid, selecting both known and unknown objects would have the type determined by the known object type and treat the unknown as the same. This causes exceptions and - worst case a segmentation fault.

This fix introduces a new category "other" which - if present in a selection always forces type to Invalid. This should be forward compatible in case new types are introduced in the future.
2024-09-25 07:48:56 -05:00
hlorus
af9097ce87 MeasureGui: Move _mMeasureType member to local variable
Fixes #16565
2024-09-22 20:34:45 -05:00
PaddleStroke
0be29b11b7 Measure: Fix quickmeasure globalplacement. 2024-09-19 08:47:57 -05:00
hlorus
a54a9e2e1e MeasureGui: Auto close task on document deletion 2024-09-18 13:03:56 -05:00
Benjamin Bræstrup Sayoc
a6975c8cef Revert "[Measure] Fix redundant variable assignment"
Fixes #16564. This reverts commit a7831eee4b.

Co-authored-by: Murmele <Murmele@users.noreply.github.com>
2024-09-18 08:36:22 -05:00
Benjamin Bræstrup Sayoc
e20ab85fd3 [Measure] Redirect enter key press to apply button
Fixes #16401. Now call of the save function is dependent on whether the apply button is enabled. The button is only enabled if valid objects to save.
2024-09-12 16:23:17 +02:00
Benjamin Bræstrup Sayoc
a7831eee4b [Measure] Fix redundant variable assignment 2024-09-12 16:17:29 +02:00
Murmele
6270d73bab Measure: Show delta option also in interactive mode (#16379)
* Initial commit to apply delta also for interactive measurement
* Not required special logic to check if possible, it can be easily checked if the property exists
* remember setting so it is not required to turn it always on
2024-09-09 21:39:27 -05:00
Syres916
cf2b98b519 [Measure] Disable QuickMeasure for TechDraw, Spreadsheet, Part Container and Origin objects (#16225)
* [Measure] Disable QuickMeasure for TechDraw objects
* [Measure] Add spreadsheet, Part containers and origins to the exemptions
2024-09-08 16:50:26 -05:00
hlorus
62a44a94f6 Measure: Fix crash when removing referenced element
Also improve error messages
Fixes #16183
2024-09-02 12:39:05 -04:00
mosfet80
3b60bf7194 clean Measurement.cpp
clean Measurement.cpp
2024-09-02 18:04:24 +02:00
hlorus
16cfe2f499 [MeasureGui] Use temporary measure object creation (#15122)
* MeasureGui: Store measure type in TaskMeasure

* MeasureGui: Avoid adding measurement to document during command interaction

* [Gui] Add check for document in VPDocumentObject::getActiveView

* MeasureGui: Track the document when adding objects

* MeasureGui: Cleanup python measurement creation

* [Gui] Add isAnnotationViewProvider method

* [Gui] Check if viewprovider is added as an annotation in getActiveView

* [Gui] Add takeAnnotationViewprovider method to Gui::Document

* [Gui] Make addViewProvider public

* [MeasureGui] Add existing view provider to document when storing measurement

* [MeasureGui] Fix invocation of initial label placement

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-09-02 11:54:05 -04:00
pre-commit-ci[bot]
73cb5bafe0 [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2024-08-26 23:55:17 +02:00
pre-commit-ci[bot]
0797cd2f00 [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2024-08-25 11:42:43 +00:00
wmayer
16e56d6694 Measure: Prepare for clang-format 2024-08-25 13:39:38 +02:00
luzpaz
05c90f398a Measure: fix linting TaskMeasure.cpp
Adds missing whitespace before opening brackets (observed in #15907)
2024-08-22 18:54:45 -05:00
hlorus
0b8c8ceab0 MeasureGui: Return the relative label offset for the initial position 2024-08-19 12:25:05 -04:00
hlorus
d11f710252 MeasureGui: Explicitly trigger the initial positioning of measurements 2024-08-19 12:25:05 -04:00
hlorus
01611c6a1c [MeasureGui] Fix order of setting properties to avoid update with outdated data 2024-08-19 12:16:19 -04:00
luzpaz
a71f49f4f6 Fix trailing newlines and minor typo fixes 2024-07-23 16:16:30 +02:00
Chris Hennes
a7d32d3dcc Merge pull request #15481 from Syres916/Measure_Restrict_Availability
[Measure] Correctly restrict command availability
2024-07-20 23:33:03 -05:00
Syres916
a9d690d6d0 [Measure] Fix Lint Feedback 2024-07-17 18:18:13 +01:00
hlorus
572235cff8 Measure: Resolve App::Link elements 2024-07-17 17:56:37 +02:00
hlorus
bb7f84c32a Measure: Reduce boilerplate code by adding some helper methods 2024-07-17 17:53:12 +02:00
Syres916
23de5b7083 [Measure] Correctly restrict availability 2024-07-17 14:43:09 +01:00
wmayer
6a464d80e6 PyObject_CallObject returns new reference 2024-07-15 18:05:30 +02:00
PaddleStroke
0cb9a44e4e Measure: Quickmeasure: disable for sketch in edit mode due to incorrect behavior. 2024-07-15 10:08:31 -05:00
Chris Hennes
463b2d9451 Merge pull request #15010 from hlorus/measure_distance_components
MeasureGui: Add MeasureDistance X, Y and Z components back
2024-07-14 23:46:04 -05:00
wmayer
14ec1e6603 Measure: Fix memory leak in MeasureDistanceInfo
Fixes #15349
2024-07-14 15:21:47 +02:00
Chris Hennes
de3579bf7c Merge pull request #15190 from hlorus/measure_dependency_violation
MeasureGui: Fix measure dependency violation
2024-07-13 19:56:23 -05:00
Chris Hennes
c29cb8464d Correct typo 2024-07-10 08:08:15 -05:00
luzpaz
9a1f487cdb Fix various typos throughout the codebase 2024-07-08 17:19:20 -05:00
Chris Hennes
dd8a4cc435 Measure: Fix repeated element name in UI file 2024-07-08 12:20:15 -04:00
hlorus
33802f48c4 MeasureGui: Insert measure command into menu & toolbar 2024-07-05 10:54:38 +02:00
hlorus
8ab537863a [MeasureGui] Move measure cmd and task into measure module
...to avoid core depending on modules
2024-07-04 14:56:49 +02:00
hlorus
3389251599 MeasureGui: Use SoFrameLabel to display delta dimensions in MeasureDistance 2024-07-01 18:14:33 +02:00
hlorus
29a7fdec1b MeasureGui: Add colon after symbol of delta dimensions 2024-07-01 18:14:24 +02:00
hlorus
84d3669888 MeasureGui: Paint icons in textcolor 2024-07-01 17:51:51 +02:00
hlorus
6257fe266c MeasureGui: Show delta symbol in front of component dimensions 2024-07-01 08:25:03 -05:00
hlorus
a1316567d2 MeasureGui: Optionally show delta components in VPMeasureDistance 2024-07-01 08:25:03 -05:00