Commit Graph

1503 Commits

Author SHA1 Message Date
Chris Hennes
95a7dfd515 Remove boost::filesystem includes 2025-07-18 20:26:56 +02:00
Kacper Donat
a32594faea Gui: Add ThemeTokenManager class to contain theme parameters
This class aims to implement Design Token idea into FreeCAD themes. It
allows themes to use generic variables with generic values so we could
use one qss theme and change the style based on values from preference
packs.
2025-07-07 00:07:31 +02:00
Kacper Donat
38ec685f2d CAM: Fix origin indicator for Job
This commit fixes how origin (coordinate system) indicator looks. Before
it showed as disc, and now it shows as point which is more approperiate
given the context.
2025-07-05 18:46:01 +02:00
wmayer
abe64f7576 Base: Use nested std::array for Matrix4D class 2025-06-16 10:05:43 +02:00
wmayer
74a22df884 Base: Simplify Base::Matrix4D
As discussed in https://forum.freecad.org/viewtopic.php?t=65959 reduce code duplications
2025-06-16 10:05:43 +02:00
wmayer
4634e62867 Base: Use i,j consistently for iterations Matrix4D
As discussed in https://forum.freecad.org/viewtopic.php?t=65959
use consistently i,j to iterate over rows and columns
2025-06-16 10:05:43 +02:00
wmayer
2f736ded84 Base: Do not use short int in Matrix4D
As discussed in https://forum.freecad.org/viewtopic.php?t=65959
replace short with int.
2025-06-16 10:05:43 +02:00
Chris Hennes
9714e2f87a Base: Disable XML external entity expansion
Addresses https://github.com/FreeCAD/FreeCAD/security/code-scanning/29
2025-06-13 10:44:01 +02:00
Benjamin Nauck
7105a2332e Merge pull request #21147 from 3x380V/units
Units rework II
2025-06-04 15:58:00 +02:00
wmayer
edc8013670 Base: Fix size in array 2025-06-04 14:14:20 +02:00
wmayer
9a7646ab74 Base: Fix typo 2025-06-04 14:14:20 +02:00
wmayer
753130de56 Base: Remove weird error parameter from encode 2025-06-04 14:14:20 +02:00
wmayer
7358ef9b9f Base: Allow to also throw exception by given Python type 2025-06-04 14:14:20 +02:00
wmayer
0576c129cd Base: Improve Python exception handling
If the Python profiler is activated then transporting the dict as
exception object is broken where InteractiveInterpreter::runCode()
fails to restore it.
To fix the problem use Exception::setPyException() instead inside
the macto PY_CATCH and the generated wrapper code.

This also improves exception handling in command line mode.
2025-06-04 14:14:20 +02:00
bofdahof
847e2f5c85 Base: Units: refactor
Refactor Units making it constexpr, immutable, with repetition reduced.
Separate data from code.

Constexpr constructed units allow constructing predefined Quantities
from predefined unit types.
2025-06-03 09:31:38 +02:00
Ladislav Michl
f8d2789a43 Base: Units: introduce unit one
Dimensionless quantities have all exponents equal to zero.
Such quantities are simply numbers. The associated unit is
the unit one, symbol 1, although this is rarely explicitly
written.

See chapter 2.3.3 Dimensions of quantities, The International
System of Units, 9th edition.
2025-06-03 09:31:38 +02:00
Ladislav Michl
913c30429c Base: Quantity: use isDimensionless whenever feasible
Quantity is often queried for Unit just to see if it has a dimension.
Ask Quantity directly using isDimensionless() method and modify that
method not to care about Quantity value validity; no user was ever
asking for value validity.
2025-06-03 09:31:38 +02:00
Ladislav Michl
8fe73e1f2c Base: minor refactoring of UnitsSchema::toLocale 2025-06-03 09:31:38 +02:00
Ladislav Michl
bcd23743f4 Base: fix UnitsSchema::translate
Schema translation previously returned factor 0 and unit string
of input quantity if there was no translation match. Restore
that behaviour as well as returned factor and unit string of
imperial schemas.

Fixes: 1155f0d752 ("Base: simplify UnitsSchemas management")
2025-06-03 09:31:38 +02:00
samrg472
1025beed8e Fix compiling ProgressIndicator with precompiled headers 2025-06-02 16:35:10 -05:00
Kacper Donat
c6130552ca Merge pull request #21427 from tritao/async-occt-progress
Part: Introduce `OCCTProgressIndicator` and port operations to support it.
2025-06-02 18:04:38 +02:00
David Carter
77ce4e0aed Core: Fix Thermal Conductivity units conversion
It appears that unit conversions for thermal conductivity were reversed
when migrating to the new system versus conversions in 1.0 and earlier.
2025-06-02 11:03:46 -05:00
Yorik van Havre
94144ecd99 Translations: Merged crowdin translations 2025-06-02 11:48:26 +02:00
Yorik van Havre
bba4a7b990 Translations: updated ts files 2025-06-02 11:07:28 +02:00
James Stanley
db02e43ad3 Base: Add Base::ProgressIndicator for OCCT progress reporting
Introduce a new `ProgressIndicator` base class
(`ProgressIndicator.h`/`.cpp`) with a singleton-managed, no-op default
implementation matching OCCT’s `Message_ProgressIndicator` interface.
Update `CMakeLists.txt` to include the new sources.
2025-05-30 14:10:28 +01:00
David Carter
0ed426a60b Core: Correct unit merge errors
Several units were merged our of order. This corrects the ordering.
2025-05-20 19:45:09 +02:00
Benjamin Nauck
9efd6baee9 Base: Fix use after free in unit error message 2025-05-20 12:34:00 +02:00
Andrea
f8b327fffc Removed empty functions
Removed empty functions
2025-05-19 18:25:17 +02:00
Ladislav Michl
76ce8ccfd5 Base: fix conversion to kilometers in Standart unit schema
Fixes: 1155f0d752 ("Base: simplify UnitsSchemas management")
2025-05-19 12:15:51 +02:00
Ladislav Michl
c0963a9277 Base: align unit format to Quantity parser expectations
Quantity parser is unable to deal with exponents written in
supersript, so change it back to ^n.

The micro prefix is expected to be U+00B5, not U+03BC, so change
it back as well. Note, that \x escape sequence reads till the
whitespace or the end of string, thus microFarad becomes
  "\xC2\xB5""F

Fixes: 1155f0d752 ("Base: simplify UnitsSchemas management")
2025-05-19 12:15:51 +02:00
Ladislav Michl
d80e5d0a8a Base: fix QuantityPy::getValueAs
Fixes: 77f4515963 ("Base: refactor QuantityPy class")
2025-05-19 12:15:51 +02:00
bofdahof
285a930d70 Base: restore output format of imperial fraction units
Fixes: 1155f0d752 ("Base: simplify UnitsSchemas management")
2025-05-19 12:15:51 +02:00
Kohei Takahashi
b54898f05f Base: Fixed segfault on destructing cached string (#20563)
* Base: Fixed segfault on destructing cached string

Xerces default memory manager is deleted before destructing static local
variable and segfault.

---------

Co-authored-by: Chris Hennes <chennes@pioneerlibrarysystem.org>
2025-05-15 17:23:03 +00:00
Luz Paz
5d052cc043 Fix various typos
Missed by the codespell CI not being functional for a period of time.
2025-05-15 10:59:48 -05:00
Ladislav Michl
beccce4d3c Base: revert to using ASCII chararacters for imperial lengths
The new unit schema management is using U+2032 and U+2033 characters
for feet and inches while parser is expecting only ' and ", while
U+2032 and U+2033 are used for arcminute and arcsecond.

While this is not an ideal solution and parser should deal with both,
revert back to ASCII for now.

Fixes: 1155f0d752 ("Base: simplify UnitsSchemas management")
2025-05-14 11:39:09 +02:00
Syres916
a075bf8c34 Base: fix default unit schema
Fix the transcription error which occured while moving into
single structure. Default schema now uses milimeters again.

Fixes: 1155f0d752 ("Base: simplify UnitsSchemas management")
2025-05-14 10:25:47 +02:00
Ladislav Michl
1d62b8372b Base: fix Python interface for Unit schema selection
Fixes: 1155f0d752 ("Base: simplify UnitsSchemas management")
2025-05-14 10:20:49 +02:00
Ladislav Michl
9c6cdcaa01 Base: sort returned Unit schema description
Return schemas name and description vectors sorted by number, so
index can be used later to select particular schema.

Fixes: 1155f0d752 ("Base: simplify UnitsSchemas management")
2025-05-14 10:20:49 +02:00
Chris Hennes
f5806841b6 Merge pull request #19907 from benj5378/getAttribute
Base: make getAttribute template
2025-05-12 10:39:55 -05:00
Benjamin Bræstrup Sayoc
492b8312b3 Base: make getAttribute template 2025-05-09 15:54:57 +02:00
bofdahof
998f4e4d45 Console: rename PascalCase named methods to camelCase 2025-05-06 17:50:21 +02:00
bofdahof
d4ecf95ca5 Console: misc refactors
- use C++20 contains where appropriate
- add nolint redundant qualifier
- remove old todo
- remove redundant enum name
- add const
- remove redundant classname
- remove redundant inline
- remove redundant namespace
2025-05-06 17:50:21 +02:00
Ladislav Michl
c293d74566 Base: rename Exception's PascalCase methods to camelCase 2025-05-05 23:50:01 +02:00
bofdahof
838178bb1c Base: simplify Exception
Remove repetition. Add functions to replace macros, but keep macros
in use for now as some compilers have broken std::source_location
support.
2025-05-05 23:50:01 +02:00
Jacob Oursland
8f57c46f3a Base: use nullptr instead of 0 in Base. 2025-05-05 12:12:15 -05:00
bofdahof
1155f0d752 Base: simplify UnitsSchemas management
Fixes: Maintaining schemas is difficult and error-prone

- Facilitate easy schemas add, remove, change, etc.
- Remove 14 files containing approx 2,190 lines of if/else code and data
- Place data in one file (UnitsSchemasData.h) using a normalized structure (including special functions)
- Isolate and simplify data operations (code)
- Remove schemas enum to keep data independent of code
- Separate responsibilities: Specifications, data, schemas, schema
- Add schema data 'isDefault'
- Add schema data name
- Prefer algorithms to raw loops
- Add schemas unit tests
- Tweak quantity unit tests
2025-04-27 00:45:54 +02:00
bofdahof
77f4515963 Base: refactor QuantityPy class 2025-04-27 00:45:47 +02:00
bofdahof
7c5ce9d256 Base: cleanup Quantity class 2025-04-27 00:42:47 +02:00
Ladislav Michl
47c1565edf Base: remove explicit namespace-name qualifier from *PyImp.cpp
Explicit Base namespace-name is used randomly across PyImp sources.
Remove it.
2025-04-27 00:05:32 +02:00
Ladislav Michl
24d55dc616 Base: cleanup includes in *PyImp.cpp
Sort includes and implicitely add missing ones. While there
consistently explain where generated files some from.
2025-04-27 00:05:32 +02:00