Commit Graph

1510 Commits

Author SHA1 Message Date
xtemp09
887e7bd595 Simplify repr() function 2025-08-25 10:38:39 -05:00
Kacper Donat
203e2e5f1c Base: Allow constexpr Color
This changes Base::Color class so it can be used as constexpr, useful
for defining various defaults.
2025-08-12 21:25:41 +02:00
Andrés Barreiro
2ee0dd9936 Add deduction guide for Base::Overloads 2025-08-11 11:53:23 +02:00
Chris Hennes
77263e73af Base: Clean up ParameterManager::LoadDocument 2025-08-04 18:04:59 +02:00
Chris Hennes
5a8b042fda Base: Disable default entity resolution
Fixes CWE-611, guards agains XML external entity attacks.
2025-07-24 22:23:39 +02:00
Chris Hennes
773fc3c5b2 Base: Add missing header to PCH 2025-07-22 08:59:03 +02:00
Chris Hennes
297f9ee5ba Base: Switch from toTimeSpec to toTimeZone for Qt 6.9 compatibility 2025-07-20 22:48:48 +02:00
Chris Hennes
787c190368 Remove boost::filesystem includes 2025-07-18 20:26:56 +02:00
Kacper Donat
8d3f41059f 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
e65f69715b 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
11a05b71b7 Base: Use nested std::array for Matrix4D class 2025-06-16 10:05:43 +02:00
wmayer
13232cbc7b 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
7998f57048 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
e9ef35c53d 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
c134c05e8b 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
92bf6e5f2a Merge pull request #21147 from 3x380V/units
Units rework II
2025-06-04 15:58:00 +02:00
wmayer
d1e9c7b013 Base: Fix size in array 2025-06-04 14:14:20 +02:00
wmayer
a4d971020d Base: Fix typo 2025-06-04 14:14:20 +02:00
wmayer
2fe7b30ee9 Base: Remove weird error parameter from encode 2025-06-04 14:14:20 +02:00
wmayer
231680c9ce Base: Allow to also throw exception by given Python type 2025-06-04 14:14:20 +02:00
wmayer
2c60e83f25 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
2e0df80e84 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
a0917bcc7c 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
0c9584ab2d 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
4a9eccf530 Base: minor refactoring of UnitsSchema::toLocale 2025-06-03 09:31:38 +02:00
Ladislav Michl
16d736fb96 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
03006b706a Fix compiling ProgressIndicator with precompiled headers 2025-06-02 16:35:10 -05:00
Kacper Donat
df6949dcde 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
0603113ba2 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
640642eed2 Translations: Merged crowdin translations 2025-06-02 11:48:26 +02:00
Yorik van Havre
26e16765b0 Translations: updated ts files 2025-06-02 11:07:28 +02:00
James Stanley
a2de481445 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
7927977bf8 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
1b6ac3408e Base: Fix use after free in unit error message 2025-05-20 12:34:00 +02:00
Andrea
0f9a16260d Removed empty functions
Removed empty functions
2025-05-19 18:25:17 +02:00
Ladislav Michl
baad73f0e3 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
d69a143a17 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
3e09bf975c Base: fix QuantityPy::getValueAs
Fixes: 77f4515963 ("Base: refactor QuantityPy class")
2025-05-19 12:15:51 +02:00
bofdahof
d4a031583f Base: restore output format of imperial fraction units
Fixes: 1155f0d752 ("Base: simplify UnitsSchemas management")
2025-05-19 12:15:51 +02:00
Kohei Takahashi
0a78771733 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
ee4fa234c9 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
602880ed80 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
67d0345870 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
e577bebe56 Base: fix Python interface for Unit schema selection
Fixes: 1155f0d752 ("Base: simplify UnitsSchemas management")
2025-05-14 10:20:49 +02:00
Ladislav Michl
2e35afd6e0 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
952485dcbb Merge pull request #19907 from benj5378/getAttribute
Base: make getAttribute template
2025-05-12 10:39:55 -05:00
Benjamin Bræstrup Sayoc
2b1aec0041 Base: make getAttribute template 2025-05-09 15:54:57 +02:00
bofdahof
ba2c2ca5ad Console: rename PascalCase named methods to camelCase 2025-05-06 17:50:21 +02:00
bofdahof
1dbc0638c3 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
9683cf1e4f Base: rename Exception's PascalCase methods to camelCase 2025-05-05 23:50:01 +02:00