Commit Graph

1359 Commits

Author SHA1 Message Date
tritao
e94d1cf872 Base: Remove Boost-based filesystem and switch to standard <filesystem> 2025-02-10 10:48:54 -06:00
Chris Hennes
6b59e4b2ec Merge pull request #19479 from tritao/base-cleanup-xml-generation
Base: Minor cleanups to base XML bindings generation
2025-02-10 09:34:50 -06:00
tritao
90374c641b Base: Minor cleanups to base XML bindings. 2025-02-08 13:14:22 +00:00
tritao
10513144d9 Base: Standardize on Py::Long type for Python bindings. 2025-02-08 13:14:22 +00:00
tritao
19fd9e6c7e Base: Clean documentation for PyObjectBase.h. 2025-02-08 13:14:22 +00:00
tritao
3b47599e43 Gui: Minor cleanups. 2025-02-05 22:13:07 +00:00
wandererfan
61b90ed98b [Units]fix bad length multiplier in MeterDecimal 2025-01-28 01:55:25 -06:00
Chris Hennes
d38b6fc3c5 Merge pull request #19011 from marioalexis84/fem-electromagnetic_boundary_condtion 2025-01-27 15:15:59 -06:00
Benjamin Nauck
d3fa11a77c Add constraints to templates in BaseClass using static_asserts 2025-01-27 16:08:18 +01:00
André Kapelrud
39a5fdc315 Base: Add surface charge density unit 2025-01-22 11:17:59 -03:00
Yorik van Havre
fe60505c17 Translations (#18923)
* Updated ts files

* Merged crowdin translations

* [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>
2025-01-13 21:30:30 -06:00
Tobias Frost
7a5a3d1ffc spelling fixes (#18688)
* Fixes spelling of "Allow to" to "Allow one to"

and those variants:
Allows to -> Allows one to
allow to -> allow one to
allows to -> allows one to

* Fix "Let's -> Lets"

(and lower case variant.)

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

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

* Update src/3rdParty/salomesmesh/inc/MED_Wrapper.hxx

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

* Update src/Base/PyObjectBase.cpp
Update src/App/ExtensionContainer.h
Update src/App/PropertyContainer.h

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

* Use gerund in user-facing texts.

* Use gerund for two more user-facing strings.

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

* Update src/Mod/Fem/App/FemMeshShapeNetgenObject.cpp

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

* Update src/Mod/Fem/App/FemMeshShapeNetgenObject.cpp

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

* Update src/Mod/Fem/App/FemMeshShapeNetgenObject.cpp

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

---------

Co-authored-by: Tobias Frost <tobi@debian.org>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Chris Hennes <chennes@pioneerlibrarysystem.org>
2025-01-13 11:22:20 -06:00
Chris Hennes
7bb4302eaf Merge pull request #17564 from kadet1090/new-transform-dialog
Gui: New transform dialog
2025-01-13 11:18:26 -06:00
Kevin Martin
6c6904453d Address the poor performance of the existing unique-name generation (part 1) (#18589)
* Change Address the poor performance of the existing unique-name generation

As described in Issue 16849, the existing Tools::getUniqueName method
requires calling code to form a vector of existing names to be avoided.

This leads to poor performance both in the O(n) cost of building such a
vector and also getUniqueName's O(n) algorithm for actually generating
the unique name (where 'n' is the number of pre-existing names).

This has  particularly noticeable cost in documents with large numbers
of DocumentObjects because generating both Names and Labels for each new
object incurs this cost. During an operation such as importing this
results in an O(n^2) time spent generating names.

The other major cost is in the saving of the temporary backup file,
which uses name generation for the "files" embedded in the Zip file.
Documents can easily need several such "files" for each object in the
document.

This is the first part of the correction, adding an efficient class for
managing sets of unique names.

New class UniqueNameManager keeps a list of existing names organized in
a manner that eases unique-name generation. This class essentially acts
as a set of names, with the ability to add and remove names and check if
a name is already there, with the added ability to take a prototype name
and generate a unique form for it which is not already in the set.

a new unit test for UniqueNameManager has been added as well.

There is a small regression, compared to the existing unique-name code,
insofar as passing a prototype name like "xyz1234" to the old code would
yield "xyz1235" whether or not "xyz1234" already existed, while the new
code will return the next name above the currently-highest name on the
"xyz" model, which could be "xyz" or "xyz1" or "xyz0042"..
2025-01-13 10:57:53 -06:00
Kacper Donat
1df3b5be6c Gui: Rework TaskCSysDragger into new Transform Dialog
This commit refactor ViewProviderDragger and TaskCSysDragger to be more
modern and to support selecting TransformOrigin.
2025-01-04 16:32:52 +01:00
Kacper Donat
88141d6dce Part: Add midpoint attachement mode
This adds midpoint attachement mode to Attacher. It works just like
method for finding placement of JCS in Assembly.
2025-01-04 16:32:52 +01:00
Kacper Donat
23bdfeb672 ServiceProvider: Use std::string as key for services map
This fixes potantial crash that can happen on certain platforms like
macOS due to `typeid(T).name()` returning different pointers to string
which does not happen on all platforms.
2025-01-04 16:32:47 +01:00
Kacper Donat
878dd55ed0 ServiceProvider: Better naming of methods
This commit renames methods of ServiceProvider to be easier to
understand. It also replaces the misleading singleton with more correct
here global instance of class.
2025-01-04 16:32:47 +01:00
Ladislav Michl
c0f0376ac6 Base: Quantity: use std::nan 2024-12-23 17:48:42 +01:00
Ladislav Michl
4d6ed9d531 Base: UnitsSchema: return std::string 2024-12-23 17:48:42 +01:00
Ladislav Michl
2ea8a633ac Base: Quantity: return std::string 2024-12-23 17:48:42 +01:00
Ladislav Michl
c11b37e312 Base: Units: remove unused defines 2024-12-23 17:48:42 +01:00
Ladislav Michl
0907c7bfda Base: Units: return std::string 2024-12-23 17:48:42 +01:00
Ladislav Michl
6b6e1fbd26 Base: Units: reimplement getTypeString() using container 2024-12-23 17:48:42 +01:00
Ladislav Michl
2d0ce24496 Base: Units: hide internals 2024-12-23 17:48:42 +01:00
wmayer
44065bfff4 Core: Format Placement::toString() and fix const correctness 2024-12-19 11:15:50 +01:00
PaddleStroke
8e0bf192df Placement::tostring Fix fmt expression 2024-12-18 11:31:22 +01:00
PaddleStroke
1289997dfd Placement: Adds a helper to print the value of the placement. 2024-12-16 12:30:25 -05:00
Benjamin Nauck
a2c980f7d6 Revert "Address the poor performance of the existing unique-name generation (#17944)"
This reverts commit 83202d8ad6.

# Conflicts:
#	src/Base/Tools.cpp
#	src/Base/Tools.h
2024-12-16 17:31:43 +01:00
Chris Hennes
1500264079 Base: Add missing PCH include to ServiceProvider 2024-12-13 20:28:42 -05:00
wmayer
5a6535d908 Fix several compiler warnings:
* Fix [-Wsign-compare]
* Fix [-Wc++20-designator]: designated initializers are a C++20 extension
* Fix [-Wunused-parameter]
2024-12-13 20:28:04 -05:00
Kacper Donat
aed305da64 Base: Add Services and ServiceProvider
This is intended to be used for intra-module communication. Modules can
specify service that are then implemented by other modules. This way
we can use features from for example part in Core without relying on the
Part module explicitly.

Base does provide Service definition - which is basically an abstract
class with pure virtual methods. This service then can be implemented
in other modules and accessed in runtime via ServiceProvider class that
stores all implementations.

ServiceProvider does store multiple implementations so in theory it is
possible to use it to provide granular implementations. For example,
part can provide CenterOfMass service that provides center of mass for
part features, mesh can implement another one for meshes and then we can
iterate over all implementations and find one that can provide center of
2024-12-13 12:01:13 -05:00
Kevin Martin
83202d8ad6 Address the poor performance of the existing unique-name generation (#17944)
* Address the poor performance of the existing unique-name generation

As described in Issue 16849, the existing Tools::getUniqueName method
requires calling code to form a vector of existing names to be avoided.

This leads to poor performance both in the O(n) cost of building such a
vector and also getUniqueName's O(n) algorithm for actually generating
the unique name (where 'n' is the number of pre-existing names).

This has  particularly noticeable cost in documents with large numbers
of DocumentObjects because generating both Names and Labels for each new
object incurs this cost. During an operation such as importing this
results in an O(n^2) time spent generating names.

The other major cost is in the saving of the temporary backup file,
which uses name generation for the "files" embedded in the Zip file.
Documents can easily need several such "files" for each object in the
document.

This update includes the following changes:

Create UniqueNameManager to keep a list of existing names organized in
a manner that eases unique-name generation. This class essentially acts
as a set of names, with the ability to add and remove names and check if
a name is already there, with the added ability to take a prototype name
and generate a unique form for it which is not already in the set.

Eliminate Tools::getUniqueName

Make DocumentObject naming use the new UniqueNameManager class

Make DocumentObject Label naming use the new UniqueNameManager class.
Labels are not always unique; unique labels are generated if the
settings at the time request it (and other conditions). Because of this
the Label management requires additionally keeping a map of counts
for labels which already exist more than once.
These collections are maintained via notifications of value changes on
the Label properties of the objects in the document.

Add Document::containsObject(DocumentObject*) for a definitive
test of an object being in a Document. This is needed because
DocumentObjects can be in a sort of limbo (e.g. when they are in the
Undo/Redo lists) where they have a parent linkage to the Document but
should not participate in Label collision checks.

Rename Document.getStandardObjectName to getStandardObjectLabel
to better represent what it does.

Use new UniqueNameManager for Writer internal filenames within the zip
file.

Eliminate unneeded Reader::FileNames collection. The file names
already exist in the FileList collection elements. The only existing
use for the FileNames collection was to determine if there were any
files at all, and with FileList and FileNames being parallel
vectors, they both had the same length so FileList could be used
for this test..

Use UniqueNameManager for document names and labels. This uses ad hoc
UniqueNameManager objects created on the spot on the assumption that
document creation is relatively rare and there are few documents, so
although the cost is O(n), n itself is small.

Use an ad hoc UniqueNameManager to name new DymanicProperty entries.
This is only done if a property of the proposed name already exists,
since such a check is more-or-less O(log(n)), almost never finds a
collision, and avoids the O(n) building of the UniqueNameManager.
If there is a collision an ad-hoc UniqueNameManager is built
and discarded after use.
The property management classes have a bit of a mess of methods
including several to populate various collection types with all
existing properties. Rather than introducing yet another such
collection-specific method to fill a UniqueNameManager, a
visitProperties method was added which calls a passed function for
each property. The existing code would be simpler if existing
fill-container methods all used this.
Ideally the PropertyContainer class would keep a central directory of
all properties ("static", Dynamic, and exposed by ExtensionContainer and
other derivations) and a permanent UniqueNameManager. However the
Property management is a bit of a mess making such a change a project
unto itself.

The unit tests for Tools:getUniqueName have been changed to test
UniqueNameManager.makeUniqueName instead.
This revealed a small regression insofar as passing a prototype name
like "xyz1234" to the old code would yield "xyz1235" whether or
not "xyz1234" already existed, while the new code will return the next
name above the currently-highest name on the "xyz" model, which could
be "xyz" or "xyz1".

* Correct wrong case on include path

* Implement suggested code changes
Also change the semantics of visitProperties to not have any short-circuit return

* Remove reference through undefined iterator

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

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

* Fix up some comments for DOxygen

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-12-13 10:54:46 -06:00
Chris Hennes
0416ec1b4e Merge pull request #18405 from FreeCAD/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2024-12-13 11:52:03 -05:00
marioalexis
7550d54a01 Base: Add electromagnetic potential unit 2024-12-13 11:49:44 -05:00
pre-commit-ci[bot]
9caa6d2c7b [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2024-12-09 17:29:33 -05:00
Ladislav Michl
0ee3c9f8e6 Base: Drop QString-std::string conversion functions from Tools
Convenience helpers function Tools::toStdString and Tools::fromStdString
were implemented for Qt4 or older to perform utf8 aware conversion as
QString::toStdString/QString::fromStdString were using toAscii/fromAscii
internally (see https://dreamswork.github.io/qt4/classQString.html).

Since Qt5 QString uses toUtf8/fromUTf8, which makes the helper functions
obsolete (see https://doc.qt.io/qt-5/qstring.html#fromStdString).
2024-12-02 23:30:53 -05:00
mosfet80
be3ad26140 Disable python2 support
Disable python2 support
2024-12-01 10:39:48 +01:00
wmayer
8f18cfaf3a Mesh: Workaround to load 3mf files not supported by zipios library 2024-11-28 17:07:34 +01:00
wmayer
6f8abe880c Core: Fix flaw in XMLReader class
Remove implementation details of the Document class from the XMLReader class.
Instead keep an array of failed files and check them in the calling instance.
2024-11-17 08:34:03 +01:00
Syres916
224c25b770 [Base] Give user feedback on failing to read StringHasherTable 2024-11-15 12:19:25 -05:00
Yorik van Havre
a9b4cb5611 Translations (#17725)
* Translations: updated ts files

* Translations: merged crowdin translations

* [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-11-11 17:01:52 +01:00
Yorik van Havre
e8fc9cf45f crowdin translations 2024-10-14 17:56:08 +02:00
Yorik van Havre
abd5c3ca31 Translations (#16754)
* Updated ts files

* merged crowdin translations

* [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-23 14:09:56 -04:00
supermixed
f763425b4f Core: Import STEP: Cancel button does not cancel (#16499)
* Fix importing .step file when user cancelled import settings dialog
* Refactor object loading python code, fix not using settings when STEP options dialog not shown
* Use custom exception type for user cancelling import instead of `RuntimeError`
* Pull python code out to external file
2024-09-20 08:25:23 -05:00
Yorik van Havre
56dbb6532a Translations (#16582)
* updated ts files

* merged crowdin translations

* [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-19 09:36:54 +02:00
Zheng, Lei
64ff5ac078 Base: fix XMLReader non-closing character stream 2024-09-18 12:58:41 -05:00
Chris Hennes
5fb2361d63 Merge pull request #15262 from Rexbas/fix-alignment-direction
Move getGlobalPlacement() and fix alignment direction for transformed objects
2024-09-13 13:09:23 -06:00
Jacob Oursland
b6ac2b2920 Base: switch header include type for consistency with codebase. 2024-09-13 12:27:18 -06:00
Yorik van Havre
7b3eca8396 Translations (#16389)
* Translations: Updated ts files

* Translations: Merged crowdin translations

* [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-09 18:25:52 +02:00