Compare commits

...

475 Commits

Author SHA1 Message Date
Chris Hennes 9fc7709969 Build: Update sign tool installation command in workflow
Cannot pin to a specific version since it is perpetually a "pre-release".
2026-03-18 14:41:41 -05:00
Kacper Donat 12cced51f1 Merge pull request #21978 from theo-vt/document_transaction
GSOC Multi file editing
2026-03-18 18:37:38 +01:00
Chris Hennes 439c50c5c4 Build: Pin Eigen to fix weekly build failure (#28421)
Pin version to >=3.3,<5 because of PCL incompatibility
2026-03-18 17:10:27 +00:00
Petter Reinholdtsen 87a3bcf9db Gui: Don't add redundant == or != to nullptr conditions
Follow C++ Core Guidelines ES.87: Don't add redundant == or != to conditions.
2026-03-18 11:15:45 -05:00
Benjamin Nauck 8910345149 Merge pull request #28033 from chennes/azureCodeSigning3
Packaging: Add Azure-based artifact signing on Win
2026-03-18 16:05:33 +01:00
PaddleStroke af4e54a6b7 Assembly: Fix datum typo in isBodySubObject (#28415) 2026-03-18 07:36:12 -05:00
wandererfan 90a0132533 [TD]fix selection order prevents area dimension 2026-03-17 14:18:03 -05:00
Chris Hennes fe425c3f57 Merge pull request #27747 from WandererFan/SmoothEdges
TechDraw: Draw smooth edges with thin line
2026-03-17 13:51:57 -05:00
dependabot[bot] 8098d72bb2 Bump step-security/harden-runner from 2.15.1 to 2.16.0
Bumps [step-security/harden-runner](https://github.com/step-security/harden-runner) from 2.15.1 to 2.16.0.
- [Release notes](https://github.com/step-security/harden-runner/releases)
- [Commits](https://github.com/step-security/harden-runner/compare/58077d3c7e43986b6b15fba718e8ea69e387dfcc...fa2e9d605c4eeb9fcad4c99c224cee0c6c7f3594)

---
updated-dependencies:
- dependency-name: step-security/harden-runner
  dependency-version: 2.16.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-03-17 12:50:09 -05:00
dependabot[bot] ebde1e3d9a Bump actions/dependency-review-action from 4.8.2 to 4.8.3
Bumps [actions/dependency-review-action](https://github.com/actions/dependency-review-action) from 4.8.2 to 4.8.3.
- [Release notes](https://github.com/actions/dependency-review-action/releases)
- [Commits](https://github.com/actions/dependency-review-action/compare/3c4e3dcb1aa7874d2c16be7d79418e9b7efd6261...05fe4576374b728f0c523d6a13d64c25081e0803)

---
updated-dependencies:
- dependency-name: actions/dependency-review-action
  dependency-version: 4.8.3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-03-17 12:47:55 -05:00
dependabot[bot] d9b4006aa1 Bump geekyeggo/delete-artifact from 5.1.0 to 6.0.0
Bumps [geekyeggo/delete-artifact](https://github.com/geekyeggo/delete-artifact) from 5.1.0 to 6.0.0.
- [Release notes](https://github.com/geekyeggo/delete-artifact/releases)
- [Changelog](https://github.com/GeekyEggo/delete-artifact/blob/main/CHANGELOG.md)
- [Commits](https://github.com/geekyeggo/delete-artifact/compare/f275313e70c08f6120db482d7a6b98377786765b...176a747ab7e287e3ff4787bf8a148716375ca118)

---
updated-dependencies:
- dependency-name: geekyeggo/delete-artifact
  dependency-version: 6.0.0
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-03-17 12:43:27 -05:00
Chris Hennes 0b78b5ade8 Merge pull request #28247 from hyarion/various-text-fixes
Sketcher: Fix minor text tool issues
2026-03-17 11:44:40 -05:00
Benjamin Nauck 4750f06058 Build: Add harfbuzz to pixi.toml
It is already in pixi.lock
2026-03-17 11:28:13 -05:00
Chris Hennes 0cb8f7e240 Sketcher: Add backwards-compat path for external geo
Before 0aed23c (PR #19582), external geometry projection used a different algorithm and produced slightly different geometry for some kinds of projections (B-splines in particular). This adds a backwards-compatibility path that allows old files to continue to use the old algorithm, while using the new and improved algorithm with new files.
2026-03-17 15:22:11 +01:00
Chris Hennes 49d7d77274 PD: Add migration to handle reversed TwoLengths prism
Commit a346c266 (PR #21794) was a major refactoring of the extrusion code, and one consequence of it was that the 'TwoLengths' extrusion was deprecated and replaced. The code that replaced it generated the same final geometry, but in the opposite direction, changing the face order and breaking the element names. This commit adds a backwards-compatibility branch to the file loading code that flips the direction of the inputs, so the final output matches the original.
2026-03-17 02:06:42 +01:00
Bas Ruigrok d443d5b065 Gui: Combine getFocalPoint() and getCenterPointOnFocalPlane() 2026-03-16 23:10:11 +01:00
tarman3 013a1d5f3a CAM: Job Stock - Exclude PartDesign elements 2026-03-16 22:23:48 +01:00
Alfredo Monclus 180c39709a PartDesign: thread texture (#22573)
* PD: Hole Thread texture

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

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

* refactor: vp-texture remove logging

* refactor: vp-hole cleanup unused declaration

* refactor: vp-hole remove logging

* refactor: vp-hole use convertTo

* refactor: vp-hole use freecad_cast

* refactor: make unwrapsurface private

* fix: logic error with model-thread handling

* fix: modelthreadchanged issues

threaddepth doesnt depend on modeled or not so remove it

* fix: model thread getting disabled when it shouldnt

* revert: use base-0 poly triangulation

previously had issues, but all is good now

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2026-03-16 21:52:36 +01:00
marioalexis 601bcd5e3d App: Fix separator path in safe mode 2026-03-16 21:03:28 +01:00
PaddleStroke dcb380e1ca Sketcher: Text position OVP fix 2026-03-16 19:15:09 +01:00
Alfredo Monclus cfe641fb7d Gui: improve quantitySpinbox / Sketcher OVP (#25978)
* Gui: fix quantity spinbox size not adapting to number of decimals

* Gui: fix quantity spinbox units getting cut (force max chars)

* Gui: editableDatumLabel remove hardcoded values

* fixes

* Gui: sketcher ovp auto adjust size

* Gui: ovp fix cursor jumping behind the unit

* Gui: Refactor changes to QuantitySpinBox

The QuantitySpinBox uses d-pointer (pimpl) to store its private data -
this commit ensures that all state is stored here and exposed via
getters and setters + qproperties.

* Gui: sketcher ovp fix cursor jumping after the unit

* Gui: allow quantitySpinBox to set max digits allowed

Useful for adjustable width in the Sketcher OVP

---------

Co-authored-by: Kacper Donat <kadet1090@gmail.com>
2026-03-16 18:41:00 +01:00
PaddleStroke d384c9d8cb Link : Fix transparent face regression 2026-03-16 18:32:36 +01:00
PaddleStroke 3620b68b21 Assembly: Command: Select joints of component (#27530)
* Assembly: Command: Select joints of component https://github.com/FreeCAD/FreeCAD/issues/23721

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

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

* Update src/Mod/Assembly/Gui/Commands.cpp

Co-authored-by: Chris Hennes <chennes@pioneerlibrarysystem.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>
2026-03-16 18:25:05 +01:00
tarman3 20e70f84e1 CAM: ToolController - Default RampFeed after migration (#27191) 2026-03-16 13:10:34 -04:00
Nishendra Singh e28b1ce1ad techdraw: added supplementary angle display 2026-03-16 18:07:32 +01:00
Alfredo Monclus c8efc26982 PartDesign: fix the range of the custom clearance of threads (#26296)
* PartDesign: fix the range of the custom clearance of threads

* PartDesign: hole ensure diameter is on the correct range
2026-03-16 18:02:31 +01:00
Loke Strøm 9abe7b4af1 Sketcher: Fix: Arc of Hyperbola (#27656)
* Sketcher: Fix: Arc of Hyperbola

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

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

* Added minor grater than major radius support

* Fixed merge errors

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

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

* Improved comments and added a confused points check for S1 and S2 distance.

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

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

* Added compile check for occ version and check before getting minor radius.

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

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

* Apply suggestions from code review

OCC version check

Co-authored-by: Chris Hennes <chennes@pioneerlibrarysystem.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>
2026-03-16 17:49:34 +01:00
Timothy Miller 27f077c62b Part: Fix AttacherEngine property not synced with AttacherType (#15716)
When Part2DObject (e.g., Sketch) is created, it calls setAttacher() to
set up AttachEnginePlane. This updated the internal AttacherType property
but left the user-visible AttacherEngine enum at its default "Engine 3D".

Now setAttacher() also updates AttacherEngine for non-base attachers,
keeping the visible property in sync with the actual engine type.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-03-16 17:42:36 +01:00
PaddleStroke eabd052c17 Core: Fix freecad when windows path has non ASCII characters (#28222)
* Core: Fix freecad when Windows username has non ASCII characters

* Update ApplicationDirectories.cpp

* Tests: Add tests of pathToString/stringToPath

Validates the fix for non-ASCII characters in filesystem paths (e.g.
Windows usernames with umlauts). Includes Windows-specific tests that
verify pathToString produces UTF-8 from wide-string paths and that
the naive fs::path::string() does not. On Linux these functions are
effectively a no-op, so the tests themselves are only really useful
on Windows.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Chris Hennes <chennes@pioneerlibrarysystem.org>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-16 17:37:43 +01:00
freecad-gh-actions-translation-bot 706b01f607 Update translations from Crowdin 2026-03-16 17:31:49 +01:00
dependabot[bot] 8a2f665430 Bump github/issue-metrics from 4.1.0 to 4.1.1
Bumps [github/issue-metrics](https://github.com/github/issue-metrics) from 4.1.0 to 4.1.1.
- [Release notes](https://github.com/github/issue-metrics/releases)
- [Commits](https://github.com/github/issue-metrics/compare/41a7961f701cc64490f32e143af8ef479b93e87d...6a35322ff89cee3e1a594d282c27eb34bffa9174)

---
updated-dependencies:
- dependency-name: github/issue-metrics
  dependency-version: 4.1.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-03-16 14:05:28 +01:00
sliptonic 9fe630e0c3 Merge pull request #23093 from Connor9220/UpdateCircularHoleBaseGUI
CAM: Circular Hole Improvements - GUI sorting enhancements, and migration fixes
2026-03-15 15:02:28 -05:00
Ladislav Michl 91f015b132 Gui: {get,set}Camera expects utf-8 encoding
Python interface to the setCamera() is using 's' format string, which
converts Unicode object to C string using 'utf-8' encoding. Reflect
that for QString conversion as well.
2026-03-15 20:38:42 +01:00
theo-vt ad630cbb9c Use new transaction methods in dlgmaterial 2026-03-14 12:35:31 -04:00
theo-vt 51ac15b375 Allow one clipping plane dock widget per document 2026-03-14 12:15:47 -04:00
theo-vt db1469f219 Add dialog for link insertion when selection buffer is empty 2026-03-14 12:15:47 -04:00
theo-vt 1665dec4e4 Adress review 2026-03-14 12:15:47 -04:00
theo-vt 99e414efab Return string instead of const char* in Selection::getSelectedElement 2026-03-14 12:15:47 -04:00
theo-vt 7cb3815fb1 Filter events per document at the SelectionObserver level 2026-03-14 12:15:47 -04:00
theo-vt 5c6bf5461d Remove most activate-deactivate 2026-03-14 12:15:47 -04:00
theo-vt 3076ce66be Scope the selection per document 2026-03-14 12:15:47 -04:00
theo-vt d59471b6bd Gui: Allow a selection gate per document 2026-03-14 12:15:47 -04:00
theo-vt 4ba5504e7a Remove dupplicate clone code causing crash 2026-03-14 12:15:46 -04:00
theo-vt 7db3f901fd Fix diapearing sketcher tools 2026-03-14 12:15:46 -04:00
theo-vt f4665aa7b5 Core: support multiple active transactions 2026-03-14 12:15:46 -04:00
sliptonic 6d8b98d471 block delete logic 2026-03-14 11:19:14 -04:00
tarman3 03f506c5a5 fix onDocumentRestored 2026-03-14 11:18:54 -04:00
Turan Furkan Topak d90c88f0fc make polar and circular arrays aware of the active working plane (#28324) 2026-03-14 13:18:00 +01:00
Bojan Pejic df8c6b5db9 BIM: fix zero level height warning dialog (#28065)
* BIM: fix zero level height warning dialog
2026-03-14 11:48:49 +00:00
Yash Suthar 5455306a4a Draft: fix angular mode extension lines creation (#27987)
* Draft: fix angular mode extension lines creation

Signed-off-by: Yash Suthar <yashsuthar983@gmail.com>

* Draft: update the agularDimension extlines svg representation

Signed-off-by: Yash Suthar <yashsuthar983@gmail.com>

---------

Signed-off-by: Yash Suthar <yashsuthar983@gmail.com>
2026-03-14 12:34:58 +01:00
Furgo d1476c819c BIM: refactor link processing, add BIM_Link wrapper command (#28104)
* BIM: refactor, introduce link properties override helper

* BIM: add Link support to Arch_Add, Arch_Remove

Fixes: https://github.com/FreeCAD/FreeCAD/issues/26255
Fixes: https://github.com/FreeCAD/FreeCAD/issues/28139

Co-authored-by: Roy-043 <70520633+Roy-043@users.noreply.github.com>

* BIM: add link command wrapper

* BIM: add link addition and removal tests

---------

Co-authored-by: Roy-043 <70520633+Roy-043@users.noreply.github.com>
2026-03-14 12:22:02 +01:00
Billy Huddleston 88a74cfa3a Fix Drag'n drop for QT6.10
Fix Merge conflicts
2026-03-13 18:09:12 -04:00
Billy Huddleston 5e818e961c CAM: Remove "Automatic TSP" mode and improve natural sorting
CAM: CircularHoleBase - Fix onDocumentRestored

Removed the expermental "Automatic TSP" sorting mode and ensured legacy
files are migrated to "Automatic". Start using C++ TSP sorting for
"Automatic" mode for better performance. Refactored natural sorting for
table columns, relocating the utility class for reuse and using a robust
sort key.

src/Mod/CAM/Path/Op/CircularHoleBase.py:
- Removed "Automatic TSP" from SortingMode options and logic
- Added migration logic for legacy "Automatic TSP" values
- Cleaned up redundant assignments

src/Mod/CAM/Path/Op/Gui/CircularHoleBase.py:
- Updated to use relocated NaturalSortTableWidgetItem for feature and
diameter columns
- Improved sorting behavior for mixed text/number columns

src/Mod/CAM/Path/Base/Gui/Util.py:
- Added NaturalSortTableWidgetItem using the existing natural_sort_key
for robust sorting
2026-03-13 15:57:13 -04:00
Billy Huddleston fdef6c35e7 GUI sorting enhancements, and migration fixes
This update enhances the GUI with new sorting modes and manual reordering, and
adds migration logic to ensure robust property

src/Mod/CAM/Gui/Resources/panels/PageBaseHoleGeometryEdit.ui:
- Add Sorting mode combo box with "Automatic", "Automatic TSP", and "Manual" options
- Add UI improvements for hole sorting, selection, and filtering

src/Mod/CAM/Path/Op/CircularHoleBase.py:
- Add migration logic to ensure SortingMode property exists and is up to date
- Use sort_locations_tsp when SortingMode is "Automatic TSP"

src/Mod/CAM/Path/Op/Gui/CircularHoleBase.py:
- Add RowMoveTableWidget for manual row reordering in the GUI
- Update TaskPanelHoleGeometryPage to support new sorting modes and improved UI behavior
2026-03-13 15:56:14 -04:00
Chris Hennes 4ac848aab0 Merge pull request #26031 from pjcreath/split-sketchobject
Split monolithic SketchObject.cpp
2026-03-13 14:37:49 -05:00
sliptonic e1fdc27e7c Merge pull request #28321 from davidgilkaufman/roadmap_clipper
[CAM] Clipper upgrade roadmap epic
2026-03-13 13:35:07 -05:00
sliptonic 0caccde398 Merge pull request #25667 from tarman3/boundary_threshold
CAM: DressupBoundary - RetractThreshold
2026-03-13 12:52:59 -05:00
sliptonic 244dffcfb7 Merge pull request #27514 from tarman3/holes_diameter
CAM: CircularHoleBase - Fix holeDiameter() for face
2026-03-13 12:45:43 -05:00
David Kaufman 5328e74e3d link FPA grant proposal 2026-03-13 13:27:54 -04:00
sliptonic 3c48b4a950 CAM: Machine-based postprocessing (#27507)
CAM: Add template dropdown below machine name in editor

Adds a template selection dropdown to the Machine Editor dialog,
positioned below the machine name field. Dropdown lists user and
built-in templates for new machines only. Adds MachineFactory
template discovery and ensures templates are copied to build directory.

src/Mod/CAM/CMakeLists.txt:
- Copy machine templates to build directory for runtime access

src/Mod/CAM/Machine/models/machine.py:
- Add MachineFactory.list_builtin_templates() for template discovery
- Use FreeCAD install path for built-in templates

src/Mod/CAM/Machine/ui/editor/machine_editor.py:
- Add template dropdown below name field for new machines
- Populate dropdown with user and built-in templates
- Update UI fields when template is selected

Major improvements to the GenericPlasma postprocessor with new dialog-based
mode selection and robust plasma cutting features.

New Features:
- Add pre_processing_dialog() for interactive mode selection
- Replace persistent mark_entry_only property with runtime dialog
- User-friendly choice between Normal Cutting and Mark Entry Points Only
- Enhanced torch control with pierce height movement
- Complete mark_entry_only implementation with proper marking sequence
- Improved error handling and state management

Technical Improvements:
- Add _reset_plasma_state() for clean per-operation tracking
- Fix Z direction detection with proper null checking
- Enhanced height extraction from StartDepth/FinalDepth/ClearanceHeight
- Better error handling with debug logging
- Graceful fallback when GUI not available

Bug Fixes:
- Fix torch control to move to pierce height before ignition
- Fix force_rapid_feeds to remove F parameters (revert from override)
- Fix state tracking initialization and null value handling
- Add proper state reset for each operationUses a dialog to set mark_only.

Co-authored-by: tarman3 <joice501790018@tutamail.com>
2026-03-13 13:18:45 -04:00
sliptonic a78c31be69 Merge pull request #28274 from Connor9220/FixToolbitSubClass
CAM: Fix saving of _shape_type for toolbits
2026-03-13 12:11:19 -05:00
sliptonic c2495411b7 Merge pull request #28173 from tarman3/linking_opti
CAM: Linking - Minor optimization for simple solid
2026-03-13 12:01:50 -05:00
sliptonic 1a8e2fb333 Merge pull request #28172 from tarman3/maneuver_toCommand
CAM: Maneuver - Move instruction_to_command() to class
2026-03-13 12:00:07 -05:00
sliptonic 73c3c78474 Merge pull request #28167 from tarman3/machinestate
CAM: MachineState - Allow process list of commands
2026-03-13 11:57:49 -05:00
sliptonic 509c881ea0 Merge pull request #28140 from tarman3/linking_tolerance
CAM: Linking - Tolerance in get_linking_moves()
2026-03-13 11:55:08 -05:00
David Kaufman d690dcb1d3 Clipper upgrade roadmap 2026-03-13 11:47:33 -04:00
dependabot[bot] 493829b376 Bump actions/download-artifact from 8.0.0 to 8.0.1
Bumps [actions/download-artifact](https://github.com/actions/download-artifact) from 8.0.0 to 8.0.1.
- [Release notes](https://github.com/actions/download-artifact/releases)
- [Commits](https://github.com/actions/download-artifact/compare/70fc10c6e5e1ce46ad2ea6f2b72d43f7d47b13c3...3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c)

---
updated-dependencies:
- dependency-name: actions/download-artifact
  dependency-version: 8.0.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-03-12 21:46:11 -05:00
pre-commit-ci[bot] 0819d776d7 [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2026-03-12 20:25:01 +00:00
pjcreath 79aca8950f Sketch: [5/5] Fix up files after splitting SketchObject.cpp
Remove stale includes and make other adjustments for compilation.
2026-03-12 16:17:08 -04:00
pjcreath 8efe9964e7 Sketch: [4/5] Move code from SketchObject.cpp to SketchObjectExternal.cpp.
This is a purely mechanical reorganization with no functional changes.
Use "git blame -C --minimal" to trace line origins prior to this commit.
2026-03-12 16:17:08 -04:00
pjcreath eda87a7efe Sketch: [3/5] Move code from SketchObject.cpp to SketchObjectGeometry.cpp.
This is a purely mechanical reorganization with no functional changes.
Use "git blame -C --minimal" to trace line origins prior to this commit.
2026-03-12 16:17:08 -04:00
pjcreath e1815f10ff Sketch: [2/5] Move code from SketchObject.cpp to SketchObjectConstraints.cpp.
This is a purely mechanical reorganization with no functional changes.
Use "git blame -C --minimal" to trace line origins prior to this commit.
2026-03-12 16:17:08 -04:00
pjcreath 7d39a9d59a Sketch: [1/5] Move code from SketchObject.cpp to SketchObjectOperations.cpp.
This is a purely mechanical reorganization with no functional changes.
Use "git blame -C --minimal" to trace line origins prior to this commit.
2026-03-12 16:17:08 -04:00
wmayer baa47bd606 Sketch: Refactor SketchObject::getPoint
Add the helper class SketchGeometryType and the interface SketchGeometry with the needed sub-classes to
remove the cascaded if-else construct
2026-03-12 16:17:08 -04:00
wmayer 51b37da53e Sketch: Fix crash when moving sketch with hidden constraints
Clicking the eye icon on the constraints panel hides all constraints. This calls SketchObject::setVirtualSpace where the existing Constraint
objects will be replaced. However, the Constraint objects are also stored inside the member 'solvedSketch' but won't be replaced so that the
pointers there will become dangling.

If the user starts to drag the sketch the pointers are still dangling and cause a crash when calling 'solvedSketch.moveGeometries'.

The crash can be reproduced with:
1. Create a sketch
2. Add a single line
3. Set a length constraint
4. Make it a non-driving constraint
5. Hide it with the eye icon or by unticking the check box
6. Move the line

The same crash also occurs when calling the methods setLabelDistance() or setLabelPosition() from Python and then trying to move the sketch.

Solution:

To fix the problem add the lightweight method 'Sketch::updateConstraints' and call it inside SketchObject::setVirtualSpace to quickly update
the pointers after invalidating them.

This fixes issue 19566
2026-03-12 16:17:08 -04:00
André Lopes 8ce3c4a1cc Fix #24079: clarify TechDraw Scale tooltip (#28293) 2026-03-12 18:12:02 +00:00
Roy-043 037ce3bffd BIM: update tooltips in BIM Setup to match current prefs
Related to #25004

Updated the tooltips to point to correct pref pages.

Additionally:
* Minor text tweaks.
* Replaced "Gui::PrefColorButton" with "Gui::ColorButton".
2026-03-12 18:28:48 +01:00
Roy-043 b9306c6f63 BIM: fix BuildingPart color issues including v1.0 regressions (#28001)
* BIM: fix BuildingPart color issues including v1.0 regressions

Fixes #27136.

* [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>
2026-03-12 14:39:24 +00:00
tarman3 7b2b972efa CAM: MachineState - Allow process list of commands 2026-03-12 10:28:31 +02:00
filippor 6d66721582 fix CAM missing python file in cmake 2026-03-11 22:03:23 -04:00
Billy Huddleston 448235cd2b CAM: Fix saving of _shape_type for toolbits
Corrects logic so that the _shape_type is saved properly and not always
defaulted to the primary toolbit type. Ensures subclass/alias
information is preserved when saving toolbits.

src/Mod/CAM/Path/Tool/toolbit/models/base.py:
- Fix fallback logic for _shape_type to correctly save subclass/alias
when present
- Only default to primary type if _shape_type is missing or matches the
main class

src/Mod/CAM/Path/Tool/docobject/ui/docobject.py:
- Improve label formatting by handling underscores, hyphens, and extra
spaces

src/Mod/CAM/Path/Tool/toolbit/ui/typefilter.py:
- Simplify type filter mapping and display logic for toolbit subtypes
2026-03-11 21:58:32 -04:00
Bojan a729bb4bc1 Material: add transaction support to Std_SetMaterial task 2026-03-11 20:00:39 -05:00
Chris Hennes 03fc08d02e Revert "[Weekly Build] Update IfcOpenShell to 0.8.4"
This reverts commit 5e7bbe15e3.
2026-03-11 08:18:44 +01:00
WandererFan e44c1ce75a TechDraw: Allow 3d dimension references to use point objects (#28199)
* [TD]fix 3d point object reference in dimension

* [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>
2026-03-11 06:08:35 +01:00
marioalexis 4083c7c616 Fem: Add name to examples dock widget 2026-03-11 06:05:07 +01:00
PaddleStroke 76a84f63ab Sketcher: Dimension tool: don't update distance type based on position for horizontal/vert 2026-03-11 05:36:10 +01:00
WandererFan 065315d7a4 TechDraw: fix crash in area dim for face with nested voids (#28097) 2026-03-10 22:57:59 -05:00
Chris Hennes 6206ed2c51 Packaging: Add Azure-based artifact signing on Win
Sign all *.exe, *.dll, and *.pyd files in the bin directory of the
build, as well as the two Chocolatey stubs and the installer. Requires
the use of several environment variables and secrets, documented at
https://github.com/FreeCAD/DevelopersHandbook/blob/main/technical/codesigning.md#windows
2026-03-10 22:25:02 -05:00
PaddleStroke 451072f0d7 Sketcher : arc with symmetric + 2 coincidence fix (#28120) 2026-03-10 22:13:02 -05:00
Roy-043 0b232ac1ff Draft: Avoid import of whole Draft module (#25386) 2026-03-10 21:59:36 -05:00
Grzegorz Kwacz 737cab44f2 Gui/View: Move (get|set)Camera to methods (#27801) 2026-03-10 21:57:34 -05:00
Benjamin Nauck a06be5de68 Sketcher: Fix void bounding box fall-through in constraint visualization
Add missing break after hiding rectangle points for a void bounding box,
preventing fall-through to CornerMin()/CornerMax() which would produce
undefined values.
2026-03-10 19:11:48 +01:00
Benjamin Nauck 0ea238f90c Sketcher: Fix dangling command context on double-click text edit
Remove the openCommand() call in editDoubleClicked() since
EditTextDialog already manages its own command lifecycle. The redundant
outer command was never closed when the user cancelled the dialog.
2026-03-10 19:11:48 +01:00
Benjamin Nauck 5ae85148cc Merge pull request #22217 from PaddleStroke/sk_texttool
Sketcher: Text tool
2026-03-10 18:07:50 +01:00
tarman3 1182be91bc CAM: Maneuver - Move instruction_to_command() to class 2026-03-10 15:52:35 +02:00
Benjamin Nauck cd5876dc54 Sketcher: Escape text and font path in EditTextDialog
Escape user-provided text and font path strings before inserting them
into the Python command string, preventing breakage or injection from
strings containing quotes or backslashes.
2026-03-10 12:54:45 +01:00
Benjamin Nauck ca4660167e Sketcher: Add .ttc (TrueType Collection) to font file discovery 2026-03-10 12:54:45 +01:00
Benjamin Nauck a0c97a102e Part: Add HarfBuzz text shaping for proper kerning in makeTextWires
Replace the character-by-character positioning loop with HarfBuzz
text shaping. The old code used FT_Get_Kerning which only reads
legacy kern tables. HarfBuzz handles both GPOS kerning and legacy
kern tables, as well as ligatures and complex script shaping.
2026-03-10 12:54:45 +01:00
Roy-043 90c83636cb Draft: update GUI text in Draft_SelectPlane
After #27979, the Draft_SelectPlane code also accepts 1 or 2 vertices. This PR updates the task panel text accordingly.
2026-03-10 10:33:23 +01:00
tarman3 e561950ff8 CAM: Linking - Minor optimization for simple solid 2026-03-10 09:06:14 +02:00
PaddleStroke e7e5e39e7b Sketcher: Change default text to Text 2026-03-10 07:22:26 +01:00
paddle d842e4151c Sketcher: Text: Fixes 2026-03-10 07:22:25 +01:00
paddle 320bd61156 Sketcher: Text tool - review changes 2026-03-10 07:22:25 +01:00
PaddleStroke fed11359d9 Update SketcherToolDefaultWidget.h 2026-03-10 07:22:09 +01:00
paddle fdf0013dcb Sketcher: Text tool 2026-03-10 07:21:04 +01:00
tarman3 bf98221885 CAM: Linking - Tolerance in get_linking_moves() 2026-03-10 06:52:28 +02:00
Bojan d214306d1b PartDesign/Part: prevent chamfer crash on OCC kernel failure 2026-03-10 01:52:57 +01:00
PaddleStroke a0af0d2b85 Link: Fix mirror twice color issue (#28071) 2026-03-09 22:12:34 +01:00
Turan Furkan Topak ee27de857a Contribution Standards: Adding new rules, mostly around AI discussions (#24646) 2026-03-09 15:55:49 -05:00
sliptonic 4afbadec04 Merge pull request #26605 from tarman3/inspect_title
CAM: Inspect and Export - Window title
2026-03-09 15:25:18 -05:00
sliptonic cdd9d685fe CAM: Improvements to machine (#28011)
* CAM:  Improvements to machine

* CAM: SPDX

* lint and translation string problems

* fixing headers and missing toolhead tests

---------

Co-authored-by: tarman3 <joice501790018@tutamail.com>
2026-03-09 14:02:31 -04:00
Krish Sharma a34bad7da4 Add status bar hints for modifier keys in Std_Measure (#26568)
* Add status bar hints for modifier keys in Std_Measure

* Align status bar hints according to design guide

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

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

* Update src/Mod/Measure/Gui/TaskMeasure.cpp

Co-authored-by: Max Wilfinger <6246609+maxwxyz@users.noreply.github.com>

* Update src/Mod/Measure/Gui/TaskMeasure.cpp

Co-authored-by: Max Wilfinger <6246609+maxwxyz@users.noreply.github.com>

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

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

* Replace 'invert' with 'toggle' to improve readability

* Added missing namespace qualifier

* Fix MSVC list assignment errors with explicit std::list<InputHint>

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

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

* fix InputHint': undeclared identifier

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Max Wilfinger <6246609+maxwxyz@users.noreply.github.com>
2026-03-09 18:24:54 +01:00
PaddleStroke e20b42e484 Assembly: fix joint creation not working on draft links (#26085)
* Assembly: add support for draft links

* Update AssemblyObject.cpp

* Update ViewProviderAssembly.cpp

* Update GeoFeature.cpp

* Update JointObject.py

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

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

* [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>
2026-03-09 18:15:01 +01:00
PaddleStroke 79923c16f3 Gui: Fix shortcut warning (#28217) 2026-03-09 18:00:22 +01:00
Bojan 004927e16e TechDraw: clear selection after editing Annotation from 2D page Fixes FreeCAD#27983 2026-03-09 17:59:17 +01:00
Yorik van Havre e8d9f30c10 Merge pull request #28020 from Roy-043/BIM-remove-switch-to-beam-creation-based-on-dimensions
BIM: remove switch to profile beam creation based on dimensions
2026-03-09 16:52:18 +00:00
dependabot[bot] f06dfa5af8 Bump github/issue-metrics from 3.25.5 to 4.1.0
Bumps [github/issue-metrics](https://github.com/github/issue-metrics) from 3.25.5 to 4.1.0.
- [Release notes](https://github.com/github/issue-metrics/releases)
- [Commits](https://github.com/github/issue-metrics/compare/67526e7bd8100b870f10b1c120780a8375777b43...41a7961f701cc64490f32e143af8ef479b93e87d)

---
updated-dependencies:
- dependency-name: github/issue-metrics
  dependency-version: 4.1.0
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-03-09 14:22:17 +01:00
Jonas Voigt dc1e96c46a Gui: Add styling to spreadsheet color picker (#28191) 2026-03-09 13:11:44 +00:00
freecad-gh-actions-translation-bot 96afba8351 Update translations from Crowdin 2026-03-09 07:28:51 +01:00
Chris Hennes 72b9a91337 Materials: Correct missing or incorrect licenses and authors
During conversion of some materials from the originals, in some cases authorship
was lost, or licensing mistaken. In addition, during their creation some files
had incorrect licenses applied. Files previously licensed LGPL-2.1.-or-later had
that license restored. Other files were re-licensed by agreement of their
author.

Co-Authored-By: David Carter <dcarter@davidcarter.ca>
2026-03-09 06:02:07 +01:00
WandererFan c468a622e6 TechDraw: Trap attempt to write to held file (#25716) 2026-03-09 04:32:27 +00:00
marioalexis edde9fb18e Fem: Remove transparency from equation icons 2026-03-09 05:15:36 +01:00
Roy-043 5754c66a55 BIM: do not process shapes of BuildingParts for TD BIMViews
Fixes #17661.
Fixes #27396.

In ArchSectionPlane.py the shape of BuildingParts was also processed. This resulted in duplicate geometry as BuildingParts inherit their shape from their (also processed) content.

This PR requires some testing, it should not be backported to v1.1.
2026-03-08 22:11:20 -05:00
Roy-043 146ed0d704 Draft: allow more than 1 character for in-command shortcuts (#26950) 2026-03-08 22:08:57 -05:00
Chris Hennes e807d2d421 Part: Fix dangling pointer in getElementSource() 2026-03-08 22:50:47 +01:00
Parag Debnath 0e83500531 Core: Fix the visibility of bounding boxes (#28123)
Co-authored-by: Parag Debnath <paragforwork@gmail.com>
2026-03-08 22:48:04 +01:00
Chris Hennes 143c1737af Merge pull request #25200 from pieterhijma/doc-formatting
Doc: Improve the formatting of doxygen output
2026-03-08 15:32:15 -05:00
tarman3 f7939beee0 CAM: Linking - Tolerance in get_linking_moves() 2026-03-08 21:30:24 +02:00
marioalexis84 c6aeec9146 Fem: Add method to create custom arrays in pipeline (#26076)
Co-authored-by: Chris Hennes <chennes@pioneerlibrarysystem.org>
2026-03-08 19:25:48 +00:00
marioalexis 9e065cdb7f Fem: Add command to clear mesh groups 2026-03-08 13:58:12 -05:00
marioalexis b55dd47120 Spreadsheet: Include missing header <QTextDocument> 2026-03-08 13:42:34 -05:00
Gaurang-2005 11dd9d8870 Fix Collada exporter skipping App::Link geometry (#27974)
* Fix Collada exporter skipping App::Link geometry

Resolve App::Link objects recursively during export so referenced
geometry is included in the .dae output while preserving link placement.

* Arch: Fix Collada export for App::Link objects

The Collada exporter skipped geometry for App::Link instances because
it only handled objects directly present in the document.

This change resolves Link objects using getLinkedObject() and exports
their referenced geometry while applying the placement of the exporting
instance.

The original App::Part expansion behavior is preserved.

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

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

* Arch: fix placement handling for App::Link and primitives in Collada export

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

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

* final change

* [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>
2026-03-08 17:31:54 +00:00
marioalexis 88940fb375 Fem: Fix crash in pipeline 2026-03-08 11:24:52 -05:00
dependabot[bot] aa5feb3df0 CI: Pin actions/github script to 8.1.0 by hash 2026-03-08 11:15:35 -05:00
dependabot[bot] dee9d5a498 Bump step-security/harden-runner from 2.13.3 to 2.14.0
Bumps [step-security/harden-runner](https://github.com/step-security/harden-runner) from 2.13.3 to 2.14.0.
- [Release notes](https://github.com/step-security/harden-runner/releases)
- [Commits](https://github.com/step-security/harden-runner/compare/df199fb7be9f65074067a9eb93f12bb4c5547cf2...20cf305ff2072d973412fa9b1e3a4f227bda3c76)

---
updated-dependencies:
- dependency-name: step-security/harden-runner
  dependency-version: 2.14.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-03-08 11:12:32 -05:00
marioalexis 8c18208c97 Fem: Add log verbosity preference to Elmer 2026-03-08 11:09:37 -05:00
Bojan Pejic d68b0c087e Draft: move working plane to vertex when pre-selected (#27979) 2026-03-08 11:53:13 +00:00
Chris 35b77bc069 bim: attempt to fix crash with issue #27984 bim text in td doc (#28135) 2026-03-08 12:30:51 +01:00
tarman3 0702616895 CAM: BoundaryDressup - RetractThreshold 2026-03-08 12:47:43 +02:00
theo-vt f36aeef878 Sketcher.planegcs: don't check for constraint update in solve routine 2026-03-07 17:41:35 -06:00
Syres916 5e7bbe15e3 [Weekly Build] Update IfcOpenShell to 0.8.4 2026-03-07 16:50:58 -06:00
Maik-0000FF 687c75e5bc Gui: Fix Linux SpaceMouse performance: event coalescing, camera batching, per-axis deadzone (#28110)
* Fix Linux SpaceMouse jerkiness: coalesce spnav events and batch camera updates

On Linux, pollSpacenav() posts every spnav motion event individually
(125-250Hz from spacenavd), each triggering a full scene redraw. Combined
with camera->orientation and camera->position each triggering separate
Coin3D notifications, this results in up to 500 redraws/sec.

Fix 1 - Event coalescing (GuiNativeEventLinux.cpp):
The drain loop now keeps only the latest motion state and posts once after
all pending events are consumed. SpaceMouse events are absolute deflection
(current puck position), not deltas, so the latest event always contains
the complete state.

Fix 2 - Batched camera updates (NavigationStyle.cpp):
Wrap camera property changes in enableNotify(false/true) + touch() so
Coin3D fires a single redraw instead of two per event.

Together this reduces redraws from ~500/sec to ~60/sec (display refresh),
eliminating the jerky navigation that Linux users experience with complex
models.

Fixes #25926

* Add per-axis deadzone filtering for Linux SpaceMouse

Each SpaceMouse axis has different sensitivity and noise characteristics.
A single global deadzone is too coarse — rotation axes may need different
thresholds than translation axes.

Read per-axis deadzone values from user.cfg (BaseApp/Spaceball/Motion)
using keys PanLRDeadzone, PanUDDeadzone, ZoomDeadzone, TiltDeadzone,
RollDeadzone, SpinDeadzone. Values default to 0 (no filtering).

Axis values below their individual threshold are zeroed before posting
the motion event, preventing unintended drift from sensor noise while
preserving intentional small movements.

This is the Linux equivalent of deadzone handling that NavLib provides
on Windows/macOS.

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

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

* Use std::array for axisDeadzoneKeys to avoid magic number

Replace C-style array with std::array and use .size() instead of
hardcoded loop bound, as suggested in code review.

* Cache deadzone values with ParameterGrp Observer instead of polling

Replace per-event GetParameterGroupByPath + GetInt calls with a static
DeadzoneCache that loads values once and updates them via
ParameterGrp::ObserverType when user.cfg changes. Also use
static constexpr for the keys array and std::abs for readability.

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

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

* Move DeadzoneCache from static local to member variable

Replace the static local DeadzoneCache in pollSpacenav() with a
std::unique_ptr<DeadzoneCache> member of GuiNativeEvent, initialized
in initSpaceball() after the spnav connection is established.
Forward-declare in the header to keep includes minimal.

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

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

---------

Co-authored-by: Maik-0000FF <Maik-0000FF@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2026-03-07 22:37:59 +01:00
PaddleStroke 36dd4b983c Sketcher: Dimension tool: Filter coincident points (#27630) 2026-03-07 15:34:56 -06:00
Chris cee71e1fb1 CMake: Add check for Qt/PySide version mismatch (#27156)
* CMake: fixes issue #27065 check for Qt/PySide version mismatches
* lint / format several PySide related CMake files
2026-03-07 15:12:57 -06:00
mosfet80 baed171ec5 PD: Remove unused variable from TaskRevolutionParameters.cpp (#26009) 2026-03-07 14:19:05 -06:00
PeterfoxUwU ecb188fe4c Base: Added Quantities for Optic/Chemical mechanics (#27944)
* Base: Added Quantities for Optic/Chemical mechanics

* [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>
2026-03-07 21:10:40 +01:00
Grzegorz Kwacz 1027be1efa Spreadsheet: Decrease default size (#27152)
* Spreadsheet: dynamic row and coulumn counts

* Spreadsheet: test distant cell

* Spreadsheet: fix removeColumns condition

* Spreadsheet: Fix zoom detachment

* Spreadsheet: Fix SheetModel::containInView

* Spreadsheet: Make sure the number of rows/cols decreases correctly after removal

* Spreadsheet: Code quality fixes

* Spreadsheet: Fix typo

* Spreadsheet: Move sheet->insert/remove outside Qt signals

* Update src/Mod/Spreadsheet/Gui/SheetTableView.cpp

Co-authored-by: Benjamin Nauck <benjamin@nauck.se>

* Update src/Mod/Spreadsheet/Gui/SheetModel.h

Co-authored-by: Benjamin Nauck <benjamin@nauck.se>

* Spreadsheet: Add comment about nesting beginInsertColumn

* Spreadsheet: Remove c-style Qt header

---------

Co-authored-by: Benjamin Nauck <benjamin@nauck.se>
2026-03-07 20:59:49 +01:00
Andrea d2b84db105 Sketcher: Cleanup commented-out code
Remove the TestSketcherGui file entirely, it contained only commented
lines. Delete commented out debugging output. Remove other commented-out
code that didn't have any explanation or justification for leaving it
in.
2026-03-07 13:55:52 -06:00
Benjamin Nauck c263d8f51c Merge pull request #18678 from chennes/applicationAddTranslatableExportType 2026-03-07 17:03:09 +01:00
Chris Hennes 0f0d2c849f Points: Add translation tags to export formats 2026-03-07 00:47:05 -06:00
Chris Hennes 025d4a9f5c Part: Add translation tags to export formats 2026-03-07 00:47:05 -06:00
Chris Hennes 8140957413 OpenSCAD: Add translation tags to export formats 2026-03-07 00:47:05 -06:00
Chris Hennes 6ad2206595 Mesh: Add translation tags to export formats 2026-03-07 00:47:05 -06:00
Chris Hennes dff7fc6ca8 Import: Add translation tags to export formats 2026-03-07 00:47:00 -06:00
Chris Hennes 1671ecb902 FEM: Add translation tags to export formats 2026-03-07 00:46:53 -06:00
Chris Hennes 8a17ca36a4 Draft: Add translation tags to export formats 2026-03-07 00:46:53 -06:00
Chris Hennes b8929f279f BIM: Add translation tags to export formats 2026-03-07 00:46:53 -06:00
Chris Hennes 07540ad3ba Gui: Add translation tags to export formats 2026-03-07 00:46:53 -06:00
Chris Hennes c387a4b5c9 App: Create addTranslatableExportType method
This method aims to solve the problem of untranslatable description
strings on file types. Some, but not all, file format description
strings contain translatable elements. For example, some languages
may translate "FEM mesh formats". Many format descriptions include
the words "file," "format," or "mesh" -- these could potentially be
replaced with localized versions.
2026-03-07 00:46:47 -06:00
Chris Hennes 21ef29bb82 Merge pull request #27969 from 3x380V/pd_cleanup
PartDesign: Minor cleanup
2026-03-07 00:27:26 -06:00
Chris Hennes 8cb06956d0 Merge pull request #27759 from dhruvjamwal/main
Fix #27741: Prevent camel case splitting on numbers in Property Editor.
2026-03-07 00:08:47 -06:00
Benjamin Nauck 17651fbfa4 Part: Fix signal handler compatibility with OCCT 8
OCCT 8.0.0 removed the NewInstance/Jump API from signal exception
classes in favor of Standard_ErrorHandler::Abort.
2026-03-06 23:58:26 -06:00
Yurii Sokolovskyi 87651cdd4c Autoconstraints redundancy error message fix
Report view now shows which sketch caused the 'Autoconstraints cause redundancy, Removing them' error
2026-03-06 23:26:26 -06:00
dependabot[bot] d34969f7d6 Bump actions/download-artifact from 7.0.0 to 8.0.0
Bumps [actions/download-artifact](https://github.com/actions/download-artifact) from 7.0.0 to 8.0.0.
- [Release notes](https://github.com/actions/download-artifact/releases)
- [Commits](https://github.com/actions/download-artifact/compare/37930b1c2abaa49bbe596cd826c3c89aef350131...70fc10c6e5e1ce46ad2ea6f2b72d43f7d47b13c3)

---
updated-dependencies:
- dependency-name: actions/download-artifact
  dependency-version: 8.0.0
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-03-06 23:19:22 -06:00
Chris Hennes 60ebafd0b3 Gui: Tweak comment for clarity
Co-authored-by: Pieter Hijma <pieterhijma@users.noreply.github.com>
2026-03-06 22:36:12 -06:00
Chris Hennes 15dd009f13 Tests: Add test for PropertyItem setName() behavior 2026-03-06 22:34:42 -06:00
marioalexis dbb6cbe335 Fem: Add property to set pipeline and filters color if Field is None - fixes #21352 2026-03-06 22:25:42 -06:00
Ladislav Michl 2dcb495a67 TD: Fix warnings 2026-03-06 22:23:46 -06:00
Pieter Hijma a102c8a359 Gui: Prevent unhandled exception adding properties
This commit prevents unhandled exceptions to be thrown in the Add
Property dialog.  When the user provides a valid name, for example 'Abc'
and then an invalid name, for example 'Abc^', an exception is thrown
that is caught by Qt's notify which may lead to a crash.  This is caused
by the fact that the editor is still bound to the old property that has
been removed.  The main idea was to preserve values that were provided
by the user as long as possible, also when a property name changes.
This design goal tried to preserve the user provided value even if the
property name is not valid.  Although the underlying property item is
explicitly unbound in that situation, the editor is not.

The solution is to also explicitly unbind the editor if there is an
editor that can have bindings.  Unbinding an editor does not
automatically hide the f(x) symbol in the editor (leading to errors on
unbound editors), so this commit also adds a bit of logic to hide
the f(x) symbol when an editor is unbound.
2026-03-06 22:12:49 -06:00
Kristian Rekstad 8fda540e1a Idf: improve dox 2026-03-06 20:50:45 -06:00
PaddleStroke bbd1266398 PartDesign: Fix wireframe not working on external link to body 2026-03-06 20:34:17 -06:00
Petter Reinholdtsen 087522528b Base: Corrected delete() call in XMLTools.
The memory is allocated using new() with alignment requirements, and
should be deleted using the same alignment requirement.  See
issue #27781 for the valgrind error.
2026-03-06 19:18:01 -06:00
marioalexis 18cf24e1d9 Fem: Show all solvers in tool bar - fixes #27703 2026-03-06 17:17:25 -06:00
Connor9220 f0a70d5468 Merge pull request #23747 from tarman3/selectside
CAM: Path.Op.Area - Fix offer side
2026-03-06 17:50:15 -05:00
tarman3 26357db694 CAM: Inspect and Export gcode window title 2026-03-06 21:46:58 +02:00
PaddleStroke 83d14b785e Sketcher: Fix crash on external deletion (#27717)
* Sketcher: Fix crash on external deletion

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

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

* Update SketchObject.pyi

* Update SketchObjectPyImp.cpp

* Update ViewProviderSketch.cpp

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

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

* Update SketchObjectPyImp.cpp

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

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

* Sketcher: Fix last external not being removed from ref 27719

* Update SketchObject.cpp

* Update SketchObject.cpp

* Update SketchObject.h

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

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

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

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

* rename fixMissingAxisInExternalGeo

* Update SketchObject.cpp

* Update SketchObjectPyImp.cpp

* [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>
2026-03-06 19:19:13 +00:00
PaddleStroke bc0d94d7a7 RTGroup 2: App: add PropertyListsT::removeIf() (#26173)
* App: add PropertyListsT::removeIf()

For convenient list value filtering.
Co-authored-by: Zheng Lei <realthunder.dev@gmail.com>

* Update Property.h

* Update Property.h
2026-03-06 19:15:33 +00:00
Connor9220 840122a358 Merge pull request #26976 from tarman3/points_coincide_list
CAM: Path.Geom.pointsCoincide - allow list and tuple
2026-03-06 12:36:09 -05:00
FilippoR a18f77f3b8 fix CAMTests.TestPathOpUtil.TestPathOpUtil.test46 & test47 (#28038)
* fix CAMTests.TestPathOpUtil.TestPathOpUtil.test46

* fix CAMTests.TestPathOpUtil.TestPathOpUtil.test47

* disable CAMTests.TestTestPost.TestTestPost.test00190
2026-03-06 12:31:05 -05:00
Connor9220 eb522b52dc Merge pull request #26507 from tarman3/save_gcode
CAM: Exporting G-code - Buttons text
2026-03-06 12:13:22 -05:00
tarman3 04e0518051 CAM: LeadInOut - Fix positive overtravel for open profile (#25482)
* CAM: LeadInOut - Replace G01 by G1

* CAM: LeadInOut - Fix positive overtravel for open profile
2026-03-06 12:08:10 -05:00
Connor9220 dac4062d54 Merge pull request #27960 from petterreinholdtsen/cam-fanuc-new-improved
CAM: Improved Fanuc support (header, python warnings).
2026-03-06 11:56:22 -05:00
PaddleStroke 949c5421cf Sketcher: refactor removeAxesAlignment (#27451) 2026-03-06 17:29:52 +01:00
PaddleStroke 912fd47b5f Merge pull request #27531 from PaddleStroke/asm_gotolink
Assembly: Command: Got to linked assembly
2026-03-06 15:50:59 +01:00
kkocdko b098f3ad44 Linux: use exec command in AppRun 2026-03-06 15:45:51 +01:00
PaddleStroke f65dda922f Assembly: Fix JCS position if assembly is transformed (#28089)
* Assembly: Fix JCS position if assembly is transformed

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

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

* redrawJointPlacement & showPreviewJCS Refactor to avoid duplicate code

* Assembly: JointObject: Simplify setJCSPosition

Co-authored-by: Benjamin Nauck <benjamin@nauck.se>

* Update JointObject.py

* Update src/Mod/Assembly/JointObject.py

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Benjamin Nauck <benjamin@nauck.se>
2026-03-06 09:41:15 +00:00
Petter Reinholdtsen 4c6eed1e63 CAM: Improved Fanuc support (header, python warnings).
Adjusted G code output to include FreeCAD body and job information.
The first comment in the G code is shown on the machine controller,
and should contain useful information for operators to to identify
jobs.  Fetch the body and job label using findParentJob and insert it
into the G code.  For some reason the body and job information is not
available when called from TestFanucPost.py, so handle case where it
is undefined as earlier.  This new use of findParentJob exposes error
in mock code used in code tests.  This is fixed in a different pull
request to make this patch easily backportable to the 1.1 branch.

Fixed issues with Fanuc post processor discovered by lint.  Made sure
global variables used are declared.  This fixes issue updating the
postamble and preamble introduced in
ef794c31bd

Added docstrings, adjusted import statements and wrapped long line to
keep linter happy.

Reformatted code with black for consistent formatting.

Also reverted obsolete setText() workaround from commit
9c78ced00c now
that https://github.com/FreeCAD/FreeCAD/pull/26008 is merged.
2026-03-06 09:09:11 +01:00
Benjamin Nauck 6238fe1081 Merge pull request #26172 from PaddleStroke/patch-985354 2026-03-06 07:10:59 +01:00
sliptonic b20a6acc26 CAM: Consolidates tapping into Drilling as a new strategy. (#27506) 2026-03-05 21:46:32 +01:00
Devanshi Bhatt c6b99363d6 #25004: change the tooltip contents for correct line width location (#28057)
* #25004: change the tooltip contents for correct line width location

* #25004 : Update the tooltip contents for correct line width location
2026-03-05 19:50:22 +00:00
Benjamin Nauck 26435d03fd Merge pull request #27845 from marioalexis84/fem-pipelinepy_time_info 2026-03-05 17:32:45 +01:00
marioalexis 3c56c164ee Fem: Fix start page example 2026-03-05 09:30:04 -06:00
Zheng Lei 6ea74652c9 App: fix PropertyLinkBase::getLinkedObjects() 2026-03-05 08:31:53 +01:00
Parag Debnath 2db12d8a66 added conflict free shortcuts (#28036)
Co-authored-by: Parag Debnath <paragforwork@gmail.com>
2026-03-04 20:57:30 +01:00
Benjamin Nauck 637463ac35 Merge pull request #27746 from furgo16/bim-add-options-task-boxes
BIM: add quick-access options task boxes to all relevant objects
2026-03-03 23:57:35 +01:00
Ladislav Michl e516eae53b Part: Remove deprecated cutFaces 2026-03-03 23:55:29 +01:00
paul e12d8fd01e [ArchWall] Multi-Material width return to Width Property (#27972)
* [ArchWall] Multi-Material width return to Width Property

Fix #27804
- BIM: Wall with MultiMaterial assigned reports wrong Width

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

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

* [ArchWall] Multi-Material width return to Width Property (rev.)

Fix #27804

- BIM: Wall with MultiMaterial assigned reports wrong Width

(rev.
Better algorithm - https://github.com/FreeCAD/FreeCAD/issues/27804#issuecomment-3986056788)

* [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>
2026-03-03 04:53:33 +00:00
Chris Hennes e1644a7310 Merge pull request #27879 from kadet1090/fix-checked-state
Part: Make 3D View properly checkable
2026-03-02 19:22:01 -06:00
marioalexis 3ae8d45506 Fem: Read material info from .frd file 2026-03-02 23:17:45 +01:00
Furgo 2777999d03 BIM: Fix placement jump when uncloning objects (#27597)
* BIM: Fix placement jump when uncloning objects

The Unclone command incorrectly multiplied the parent's placement by the
clone's placement. Since Arch clones store absolute placement (not
relative to the parent), this resulted in a double transform.

This caused baseless walls to jump to a new position upon uncloning.
Standard base-backed walls often masked this bug because their local
placement is usually Identity (0,0,0), but they would also fail if moved
independently of their base.

This fix assigns the clone's current placement directly to the new
object, preserving its position.

Fixes https://github.com/FreeCAD/FreeCAD/issues/26929

* BIM: do placement assignment and recompute only once
2026-03-02 21:58:45 +01:00
Roy-043 64a4cee116 BIM: remove switch to profile beam creation based on dimensions
Fixes #28013.

When creating a structure from a profile the code could ignore `self.bmode` (beam-mode) and create a beam even if the user selected the column option in the task panel.

Rounding errors due to the conversion of numerical values read from the input boxes triggered the bug (89mm -> 3.5" -> 88.89999999999999mm).

But beyond that, it is IMO not correct to disregard user input. If the column option is specified, a column should be created irrespective of the dimensions.
2026-03-02 21:17:56 +01:00
jffmichi fe25d8d0f7 CAM: Fix new CAM simulator on macOS 2026-03-02 11:32:02 -06:00
Florian Foinant-Willig be1ec84709 Sketcher: extend Perpendicular constraint to point point line 2026-03-02 11:30:55 -06:00
Roy-043 ffab288f4e Draft: fix clone diffuse color regression
Fixes #27958.

Delay formatting of clone object to ensure shape availability.
2026-03-02 17:13:13 +00:00
Kacper Donat 2fb271ff28 Gui: Clear cached shape after change to Deviation 2026-03-02 11:12:36 -06:00
marioalexis 617db3a2d4 Fem: Remove deprecated Calculix implementation 2026-03-02 11:09:34 -06:00
nishi 2d6e49cb7f Measurement: label drag when infront of model (#27832)
Co-authored-by: Nishendra Singh <snishendra@student.ethz.ch>
2026-03-02 11:08:54 -06:00
chris jones @ipatch 7d454121de core: fix issue #26478 select all instances even in group with mirror'd objects + unit tests 2026-03-02 11:05:45 -06:00
Grzegorz Kwacz ba404c03ef Spreadsheet: Don't show overlay 2026-03-02 11:04:47 -06:00
sliptonic 8faaa60a0a Merge pull request #27860 from petterreinholdtsen/cam-fanuc-post-crash-fix
CAM: Implemented Fanuc thread tapping and fixed crash in post processor.
2026-03-02 10:59:12 -06:00
chris jones @ipatch 7e7045577f fixes #27968 material: sunset usage of reinterpret_cast 2026-03-02 10:53:08 -06:00
Roy-043 93e537f3b3 BIM: BIM_DrawingView: always create Cut lines view
Fixes #27803.

As suggested by @semhustej: always create the "Cut lines" view, even of there are no solids (yet) that intersect the section plane.
2026-03-02 15:03:28 +00:00
Roy-043 da584c2c84 BIM: fix window hinge direction if edge has no delta Z
Fixes #24903.

If the global Z-coordinates of the endpoints of the hinge edge are equal, compare the local Z-, Y- or X-coordinates instead.
2026-03-02 15:02:22 +00:00
Roy-043 d6479d055d BIM: change TD BIMView linecaps to square 2026-03-02 15:00:54 +00:00
Roy-043 1f848b4d78 BIM: remove superfluous transaction handling when editing IFC props
As pointed out here:
https://github.com/FreeCAD/FreeCAD/pull/26758#issuecomment-3830289031
2026-03-02 14:59:47 +00:00
freecad-gh-actions-translation-bot b78b0a7d60 Update translations from Crowdin 2026-03-02 08:17:01 +01:00
Furgo d321a330ee squash with structure 2026-03-02 07:01:48 +01:00
Furgo 6a4697c74d BIM: _Equipment uses generic options task box on edit 2026-03-02 07:01:48 +01:00
Furgo f329584eb5 BIM: _Structure uses generic options task box on edit 2026-03-02 07:01:48 +01:00
Furgo 6a76d22d76 BIM: _Space uses generic options task box on edit 2026-03-02 07:01:48 +01:00
Furgo 6c85e4a6a2 BIM: Truss uses generic options task box on edit 2026-03-02 07:01:48 +01:00
Furgo d9dc07c890 BIM: _CurtainWall uses generic options task box on edit 2026-03-02 07:01:48 +01:00
Furgo 5199c47c2d BIM: _Panel uses generic options task box on edit 2026-03-02 07:01:48 +01:00
Furgo aade9e1eed BIM: Component provides a reusable options task box 2026-03-02 07:01:39 +01:00
sliptonic 07cc653e66 Merge pull request #27990 from jffmichi/cam_remove_dogbone
CAM: Remove remaining reference to deprecated Dogbone dressup
2026-03-01 21:43:14 -06:00
jffmichi 3a05cb2756 CAM: Remove remaining reference to deprecated Dogbone dressup 2026-03-02 00:19:40 +01:00
Parag Debnath 230b64f2f5 Gui: Add shortcut for save a copy (#27966)
* added shortcut for save copy

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

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

* Ctrl+Alt+Shift+S to save a copy

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

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

---------

Co-authored-by: Parag Debnath <paragforwork@gmail.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2026-03-01 19:42:54 +01:00
Ladislav Michl 1e982cae1f PD: Remove unused remapSupportShape 2026-02-28 23:20:31 +01:00
Ladislav Michl 1ed0e153dc PD: Remove unused parameter from getTopoShapeVerifiedFace 2026-02-28 23:20:17 +01:00
Petter Reinholdtsen 263bfe9948 CAM: Updated Fanuc test and support methods to match working post script.
The thread tapping is corrected and the test code is adjusted to match.
2026-02-28 22:11:15 +01:00
Chris Hennes 61418544a5 Base: Fix typo unexpection->unexpected 2026-02-28 19:57:41 +01:00
Petter Reinholdtsen df1a1ab981 CAM: Implemented Fanuc thread tapping and fixed crash in post processor.
The current post processor fail completely for any operation because the
ShapeName attribute no longer exist.  Changed code to look for attributes
present in FreeCAD 1.1 and master branch.  Rewrote thread tapping code
to work with new tapping support. Switched thread tapping to use feed in
distance per minute (G94) instead of earlier distance per revolution to
avoid switching between mm/min and mm/rev for different operations.

Fixes #27814
2026-02-28 19:38:19 +01:00
Wiljam Holmes 6dfe193428 Sketch: Rename "Attachment Editor" to "Edit Attachment" in context menu 2026-02-28 11:12:01 -06:00
sliptonic ec4dcde60c Merge pull request #27585 from tarman3/holes_auto
CAM: Drillable - Auto-select optimizations
2026-02-28 09:26:33 -06:00
sliptonic df3809e66b Original dogbone dressup has been deprecated for more than 4 years.
Dogbone II is stable.
Removing the deprecated code and tests
2026-02-28 08:47:38 -06:00
FilippoR 8653d94287 App: Add #include <climit> and switch to std::numeric_limits (#27742)
* add missing include to fix compilation on Fedora 44
* change short limit notation
2026-02-28 08:02:23 -06:00
Benjamin Nauck 93f76a8991 Merge pull request #27854 from 3x380V/signal
Part: Use signal handlers based on OCC's implementation
2026-02-28 13:58:19 +01:00
Syres916 34d03ebee6 [Mesh] Stop repeated /home/username/freecad-daily-source/src/Mod/Mesh/App/WildMagic4/Wm4MathMCR.h:30:50: warning: backslash-newline at end of file 2026-02-28 13:45:12 +01:00
wmayer 512cf349f9 Part: Use Part::SignalException in FCBRepAlgoAPI_BooleanOperation::Build
This avoids a hard crash as reported in issue 19403 and still shows the stack trace
2026-02-28 10:11:03 +01:00
wmayer 2eb4dc7c73 Part: Use signal handlers based on OCC's implementation 2026-02-28 10:11:03 +01:00
wmayer be5e657a61 Core: Refactor code to install new and SIGSEGV handlers 2026-02-28 10:11:00 +01:00
PaddleStroke 821596140d Assembly: Show Solver Task only when in Assembly workbench (#27502) 2026-02-28 08:17:43 +01:00
Chris Hennes 0c66d18c21 Wide character support for env vars on windows (#27626)
* Base: Move wstring conversion into Base::Tools

* App: Switch Windows calls from getenv to GetEnvironmentVariableW

* Apply suggestion from @kadet1090

---------

Co-authored-by: Kacper Donat <kadet1090@gmail.com>
2026-02-28 04:02:30 +00:00
Krish Sharma 9ac1b960a6 App: Improve clarity of out-of-scope link error message (#26776) 2026-02-27 21:53:57 -06:00
theo-vt 68b3d8d6e4 App.DocumentObserver: set toPython in all constructors 2026-02-27 21:30:00 -06:00
Adam Spontarelli 88787b11d1 Changed Insert Component parts list to be collapsed by default (#27658)
* Changed Insert Component parts list to be collapsed by default

* only collapse large assemblies and only expand first child.

---------

Co-authored-by: Adam Spontarelli <adam@vector-space.org>
2026-02-27 18:43:28 -06:00
wmayer 8caa218950 Sketcher: Handle exception in DrawSketchHandlerOffset::drawOffsetPreview
Do not let exception slip through Qt event handlers as this is known to cause a crash on macOS.

This fixes issue 19587
2026-02-28 01:33:35 +01:00
wmayer 61d17a6122 Part: Fix crash in Revolution::execute()
If a datum line is used as base shape then it causes a segmentation
fault because the shape is infinite that the CAD kernel fails with.

Solution:
Explicitly check beforehand if the shape is infinite or null.

This fixes issue 21429
2026-02-28 00:38:21 +01:00
wmayer d588e89d1d Gui: Do not allow to activate disabled workbench
Change Command::_assureWorkbench to check if the passed workbench is
disabled or not. If yes then do nothing.

This fixes issue 21477.

Hint: The method Application::activateWorkbench() is still able to
activate a disabled workbench
2026-02-27 23:45:37 +01:00
Chris Hennes 92ebf00cc4 Gui: Add attempted lock file name when IPC fails 2026-02-27 23:37:33 +01:00
Chris Hennes b37da5b3cc App: Check for empty path component name before appending 2026-02-27 23:37:03 +01:00
Chris Hennes 3d60531390 TD: Migrate version check to ProgramVersion class
Eliminates a use of deprecated `sscanf`
2026-02-27 23:30:37 +01:00
Chris Hennes ac576bc05e Part: Migrate version check to ProgramVersion class
Also add v1.2 to the recognized program version enumeration.
2026-02-27 23:30:11 +01:00
Chris Hennes 07e94dfaae Part: Eliminate use of sscanf
Replace with safer modern C++ `std::from_chars` (plus some additional
validation for expected inputs). Includes unit tests for new function.
2026-02-27 23:29:31 +01:00
Chris Hennes b4325de672 Core: Allow implicit construction of QString from ASCII 2026-02-27 23:21:17 +01:00
tarman3 b9b8d4023f CAM: Exporting G-code - Buttons text 2026-02-27 22:56:40 +02:00
tarman3 eb0d7ba6a5 CAM: CircularHoleBase.holeDiameter() - Remove useless obj 2026-02-27 20:43:56 +02:00
tarman3 eaf76e4d0a CAM: CircularHoleBase.holeDiameter() - Fix face 2026-02-27 20:41:07 +02:00
sliptonic b8f98e2842 Merge pull request #27040 from Dimitris75/CAM-Waterline-OCL-Adaptive-Add-Optimize-Linear-Paths
CAM: Waterline OCL Adaptive - Adding Optimize Linear Paths - Removing BoundBox ComboBox
2026-02-27 11:57:53 -06:00
sliptonic 2b98e80313 Merge pull request #27091 from Connor9220/ToolbitSubClass
CAM: Refactor shape type handling for aliases and subtypes
2026-02-27 11:53:47 -06:00
Chris Hennes 659780c31b Tests: Add QtTests run to CI 2026-02-27 11:30:55 -06:00
Dhruv Singh Jamwal 7be33f496e Gui: Prevent camel case splitting on numbers/symbols in Property Editor 2026-02-27 11:30:21 -06:00
sliptonic 51cff10dcc Merge pull request #24849 from tarman3/leadinout_arcz
CAM: LeadInOut - ArcZ following profile
2026-02-27 11:28:06 -06:00
sliptonic c9517011d2 Merge pull request #27504 from tarman3/holes_face_multiple_edges
CAM: CircularHoleBase - Fix holePosition() for face with several arcs
2026-02-27 11:25:20 -06:00
sliptonic 7deca678ca Merge pull request #27686 from tarman3/base_addgeometry_apply
CAM: Base Task Panel - Fix Apply after adding geometry
2026-02-27 11:14:21 -06:00
sliptonic 8a011392bc Merge pull request #27178 from davidgilkaufman/fix_big_arcs
[CAM] separate tolerance variable used for arc fitting from tolerance used for section height offsets
2026-02-27 10:43:50 -06:00
Chris Hennes 0872d45827 Merge pull request #27099 from timpieces/expressionparser-improvements
ExpressionParser: Return unique_ptr from public interface (#27098)
2026-02-27 09:51:08 -06:00
dependabot[bot] e292f96feb Bump actions/upload-artifact from 6.0.0 to 7.0.0
Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 6.0.0 to 7.0.0.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](https://github.com/actions/upload-artifact/compare/v6...v7)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-version: 7.0.0
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-02-27 09:48:11 -06:00
FEA-eng 46dd3badbd Replace "Change Image" option name for clarity (#27913) 2026-02-27 13:46:21 +01:00
Benjamin Nauck 8694ccf754 Merge pull request #27862 from marioalexis84/fem-material_nonlinear
Fem: MaterialMechanicalNonlinear grouped under MaterialSolid
2026-02-26 21:32:02 +01:00
sliptonic 4878248572 Merge pull request #27859 from Doriangaensslen/d_dev
CAM: Move ThreadMilling and Tapping from experimental to standard
2026-02-26 14:08:31 -06:00
Furgo 2ee49e0647 BIM: _Wall options task box gains expressions and units support 2026-02-26 20:20:40 +01:00
Parag Debnath ca575acf1e Renamed '3d View' to 'Pick Position'. 2026-02-26 20:11:34 +01:00
marioalexis 046be9efc5 Fem: Update examples 2026-02-26 15:07:57 -03:00
marioalexis a1acc9cf38 Fem: Improve nonlinear properties 2026-02-26 15:07:57 -03:00
Roy-043 bfb0e203da Revert " Draft: fix ghost preview of Arch_SectionPlane and Draft_WorkingPlane…"
This reverts commit 37600b85a0.
2026-02-26 17:17:44 +01:00
Benjamin Nauck f319a57252 Merge pull request #27835 from 3x380V/fem 2026-02-26 17:09:50 +01:00
wmayer e1b9cbf48a FEM: Fix build warnings 2026-02-26 13:44:40 +01:00
wmayer d60deb6fb6 Fem: Optimize netgen mesh creation
When pressing the Apply button the fem mesh feature is computed but still
marked as touched. When pressing the OK button it will be recomputed even
if nothing has changed. To avoid the superfluous recompute purge the
touched flag when the Apply button is pressed.
2026-02-26 13:34:58 +01:00
tarman3 7cb5c2663d CAM: CircularHoleBase.holePosition() - Remove useless obj 2026-02-26 13:43:39 +02:00
tarman3 5e0695d150 CAM: CircularHoleBase.holePosition() - Fix for face with several arcs 2026-02-26 13:43:39 +02:00
Louis Gombert 0df693e204 Remove extra header define checks (#27851) 2026-02-25 22:46:40 -06:00
dependabot[bot] b6c8e68eda Bump step-security/harden-runner from 2.14.2 to 2.15.0
Bumps [step-security/harden-runner](https://github.com/step-security/harden-runner) from 2.14.2 to 2.15.0.
- [Release notes](https://github.com/step-security/harden-runner/releases)
- [Commits](https://github.com/step-security/harden-runner/compare/5ef0c079ce82195b2a36a210272d6b661572d83e...a90bcbc6539c36a85cdfeb73f7e2f433735f215b)

---
updated-dependencies:
- dependency-name: step-security/harden-runner
  dependency-version: 2.15.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-02-25 22:43:52 -06:00
sliptonic a17bb6bf10 Merge pull request #27013 from tarman3/CmdMoveMill
CAM: Path.Geom.CmdMoveMill
2026-02-25 18:31:26 -06:00
Kacper Donat e62d68a49e Gui: Improve visuals of checked toolbar buttons 2026-02-25 21:05:05 +01:00
Kacper Donat 1a8840bff9 Part: Make 3D View properly checkable
This commit fixes the 3D View button in "Location" sections in Part GUI
to stay pressed when it is active.
2026-02-25 21:05:05 +01:00
tarman3 4a773d2f6a CAM: Refactor CmdMoveMill 2026-02-25 20:49:22 +02:00
tarman3 9972df7c1d CAM: Path.Geom.pointsCoincide - allow list and tuple 2026-02-25 20:40:19 +02:00
tarman3 97cf569756 CAM: PathScripts/PathUtils.py - Get CmdMove from Geom 2026-02-25 20:38:49 +02:00
tarman3 6620e149a5 CAM: Path.Geom.CmdMoveMill 2026-02-25 20:38:41 +02:00
sliptonic f2063c055f Cam constants (#27861)
* CAM: Create a more accessible CONSTANTS file

* Changes to make the tests less noisy

* Update src/Mod/CAM/CONSTANTS.py

Co-authored-by: tarman3 <joice501790018@tutamail.com>

* missing cmake change

* maintainer feedback

---------

Co-authored-by: tarman3 <joice501790018@tutamail.com>
2026-02-25 19:11:33 +01:00
Chris Hennes ad50c6eb64 Merge pull request #27428 from kadet1090/add-style-parameter-tuples
Gui: Add Tuple type to StyleParameters
2026-02-25 08:28:50 -06:00
tarman3 657a34b48a CAM: Drillable - allowPartial for faces 2026-02-25 08:07:07 +02:00
Dorian Gaensslen d5397516b5 move thread milling out of experimental too 2026-02-24 21:38:31 +01:00
Dorian Gaensslen 4895bea741 Forum Thread 49591, move from Experimental to standard 2026-02-24 21:11:44 +01:00
tarman3 9abcdad176 CAM: Drillable - Auto-select faces with number edges more than 3 2026-02-24 21:22:04 +02:00
tarman3 e643328599 CAM: Drillable - Optimizations for Auto-select 2026-02-24 21:20:54 +02:00
marioalexis 9c9bf18478 Fem: Set pipeline time info for new CalculiX 2026-02-24 16:15:57 -03:00
marioalexis c1ca8a79c9 Fem: Add method to set pipeline time info data 2026-02-24 16:00:51 -03:00
theo-vt 34ae16cd01 Sketcher: fix evaluation of driven diameter constraint 2026-02-24 19:54:53 +01:00
Ladislav Michl 6d9201c828 PD: Avoid QString to std::string back and forth conversion
Fixes Qt5 build.
2026-02-24 11:30:24 -06:00
sliptonic ab2f655245 Merge pull request #26131 from tarman3/axismap
CAM: Axismap Dressup - Invert rotary axis
2026-02-24 09:34:17 -06:00
Roy-043 650b15dd76 Draft: fix anno style assignment regression
Fixes #27822.

Break statement had wrong indentation.
2026-02-24 13:03:25 +01:00
Syres916 ab5ef99344 [MeshPart] Fix string encoding document, object and subobject names 2026-02-24 00:28:35 -06:00
tarman3 0a4f6ec7c4 CAM: Drillable - Remove raisedFeature() 2026-02-24 06:20:11 +02:00
tarman3 2e7261eec3 CAM: Drillable - Fix linter errors 2026-02-24 06:20:11 +02:00
ᴩʜᴏɴᴇᴅʀᴏɪᴅ e89d849bb7 [ Sketcher ]: Fix Windows Include (#27829) 2026-02-23 21:35:35 -06:00
PaddleStroke 3c860396d8 TechDraw: Annotation tool rework (#24624) 2026-02-24 00:59:15 +00:00
Parag Debnath acb14726b6 Part: add missing tooltips to Location task panel (fixes #27736) 2026-02-23 21:41:16 +01:00
Louis Gombert 0b44a3f6c8 Sketcher: Optimize eliminateNonZerosOverPivotInUpperTriangularMatrix for sparse matrices
Matrix processing function eliminateNonZerosOverPivotInUpperTriangularMatrix tried to eliminate ALL non zero values in the upper triangle, even values under a small epsilon. This makes the routine take much more time than it should be. Not considering small values significantly speeds it up, ultimately increasing sketch constraint solving performance.
2026-02-23 18:30:54 +01:00
tarman3 26a1e452c0 CAM: Profile - Fix 2 equal length edges 2026-02-23 11:30:01 -06:00
PaddleStroke 4deb889057 Assembly: Fix mirrored links not working. (#26090) 2026-02-23 11:29:27 -06:00
xtemp09 59370eeb23 [GUI] Prevent double click event on visibility icon (#26043) 2026-02-23 11:26:15 -06:00
theo-vt 92894ea3a8 Sketcher: Evaluate driven constraints rather than solving them (#26632) 2026-02-23 11:14:22 -06:00
Loke Strøm f153960396 Measurement: Added disc/circular faces measurements radius, diameter and area. (#27415)
* Added disc measurements radius, diameter and area.

* [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>
2026-02-23 18:04:01 +01:00
Paul Ebbers e591fe0901 GUI: Add wrap-around to search in parameters (#24772) 2026-02-23 11:02:55 -06:00
sliptonic 88e7c60414 Merge pull request #27788 from petterreinholdtsen/cam-fanuc-fix-drilling
CAM: Adjusted fanuc post processor to always use required drill parameters.
2026-02-23 10:54:41 -06:00
Yash Suthar 1c0ac9a269 Measure: fix measurements are saved if exit tool by opening a sketch
Signed-off-by: Yash Suthar <yashsuthar983@gmail.com>
2026-02-23 10:47:21 -06:00
PaddleStroke 194ec0820c PartDesign: UpToFace to plane in LCS (#27637)
* PartDesign: UpToFace to plane in LCS

* Update TaskSketchBasedParameters.cpp
2026-02-23 10:46:05 -06:00
tarman3 ab1b3246d4 CAM: AxisMap Dressup - Add 'Invert' to Task panel 2026-02-23 18:42:48 +02:00
tarman3 27b74f3ba3 CAM: AxisMap Dressup - Deflection 2026-02-23 18:42:47 +02:00
tarman3 1396309093 CAM: AxisMap Dressup - Invert axis 2026-02-23 18:42:42 +02:00
Kacper Donat cd19a3cee5 Merge pull request #27127 from alfrix/fix_tapered
PD: hole fix tapered threads not cutting properly
2026-02-23 17:42:24 +01:00
Benjamin Nauck 7923614124 Merge pull request #27367 from 3x380V/app
App: Random fixes 3
2026-02-23 14:09:23 +01:00
captain0xff f238a5f4e5 CAM: fix the transform tool 2026-02-23 11:07:37 +01:00
wmayer 26c2d7a77c App: Fix linter warnings 2026-02-23 10:12:38 +01:00
wmayer 05ef4153f5 App: Add overloaded method Application::closeDocument 2026-02-23 10:12:38 +01:00
wmayer 7a392c4d99 App: Add overloaded method Document::removeObject 2026-02-23 10:12:38 +01:00
wmayer 0eb01c636c App: Fix PropertyFileIncluded::SaveDocFile
Before trying to access the filename check whether it isn't set.
In this case print a warning and return.
2026-02-23 10:12:38 +01:00
wmayer af5c40d8e8 App: Fix some linter warnings 2026-02-23 10:12:38 +01:00
wmayer e4b6e5ab43 App: Add convenience methods to DocumentT and DocumentObjectT 2026-02-23 10:12:38 +01:00
wmayer 322da60cb2 Fix macro Q_DISABLE_COPY_MOVE 2026-02-23 10:12:38 +01:00
Furgo 99d142af38 BIM: rename obsolete Mesh property to HiRes (#27783)
* BIM: rename obsolete Mesh property to HiRes

* BIM: remove unused createMeshView function

* BIM: remove all remaining references of Mesh
2026-02-23 08:09:40 +01:00
freecad-gh-actions-translation-bot 23df715e24 Update translations from Crowdin 2026-02-22 22:04:19 -06:00
marioalexis 159059fc7d Fem: Fix import vtk Python module 2026-02-22 21:51:32 -06:00
marioalexis d4c28786df Fem: Add displace mesh option to CalculiX 2026-02-22 16:29:45 -06:00
ᴩʜᴏɴᴇᴅʀᴏɪᴅ ca9e1ecdf3 All: Header Guards ➞ Pragma Once (#27154) 2026-02-22 16:28:20 -06:00
Max Wilfinger 3a241c5515 Merge pull request #27775 from marioalexis84/fem-elmer_text_output
Fem: Load Elmer text output
2026-02-22 21:30:32 +01:00
tarman3 144f1843fa CAM: Axismap Dressup - Refactoring 2026-02-22 21:36:06 +02:00
tarman3 92a23ca21b CAM: Axismap Dressup - Remove _linear2angular() 2026-02-22 21:36:06 +02:00
tarman3 a57ea57dba CAM: AxisMap Dressup - Remove _stripArcs() 2026-02-22 21:36:06 +02:00
tarman3 0fce2611ad CAM: Base Task Panel - Fix Apply after adding geometry 2026-02-22 16:38:20 +02:00
Morten Vajhøj cc626f88b1 Measurement: Moved buttons to top (#27774)
* Moved button position

* Remove command

Remove setting button position in TaskMeasure constructor.
2026-02-22 12:01:16 +01:00
Petter Reinholdtsen 954a1239f3 Adjusted fanuc post processor to always use required drill parameters.
At least for G73, the Z, Q and R parameters seem to be required.
Assuming drill related parameters are required for all drill
operations to err on the safe side.

Fixes #27413
2026-02-22 09:56:33 +01:00
marioalexis 1e51d10de8 Fem: Enable keep results on rerun option for new CalculiX 2026-02-21 18:40:13 -03:00
marioalexis e116b5ae34 Fem: Load Elmer solver text output 2026-02-21 18:40:06 -03:00
Max Wilfinger 7001255e90 Merge pull request #27749 from marioalexis84/fem-elmer_examples_run
Fem: Run Elmer examples - fixes #27547
2026-02-21 22:04:22 +01:00
Furgo b36991b239 BIM: initial implementation of Sliding Door preset (#27375)
* BIM: initial implementation of sliding door preset

* BIM: fix sliding door context menus

* BIM: limit travel distance

* BIM: increase preset indexes for icons

* BIM: update edit task panel to adapt to sliding doors

* BIM: make rotation/translation data exclusive or

* BIM: remove code duplication for Sliding and -Sliding doors

* BIM: refine travel distance clamping to expose handle

* BIM: make sliding direction independent of geometry direction

* BIM: remove non-visible 2D symbol for now

* BIM: make door leaf wire comment more precise

* BIM: use local coordinates when calculating the start/end points for the sliding track
2026-02-21 19:10:46 +00:00
Max Wilfinger d3496b0458 Merge pull request #27616 from WandererFan/nearestFractionFillTemplateFields
TechDraw: Fix fillTemplateFields returns unusual fractional scale
2026-02-21 16:01:46 +01:00
Max Wilfinger 23f046075a Merge pull request #27577 from pieterhijma/fix-fem-analysis-toggle 2026-02-21 13:54:04 +01:00
Chris Hennes 359e1033ec Addon Manager: Update to 2026-02-19 2026-02-21 13:49:47 +01:00
tarman3 c9518817c6 CAM: Path.Op.Area - Offer side 2026-02-21 08:45:24 +02:00
dependabot[bot] 2fda119f74 Bump korthout/backport-action from 3.4.1 to 4.1.0
Bumps [korthout/backport-action](https://github.com/korthout/backport-action) from 3.4.1 to 4.1.0.
- [Release notes](https://github.com/korthout/backport-action/releases)
- [Commits](https://github.com/korthout/backport-action/compare/d07416681cab29bf2661702f925f020aaa962997...01619ebc9a6e3f6820274221b9956b3e7365000a)

---
updated-dependencies:
- dependency-name: korthout/backport-action
  dependency-version: 4.1.0
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-02-20 20:20:14 -06:00
chris jones @ipatch 1d6b2a4cca core: git: alphabetize entries in .gitignore and add entry for .clangd 2026-02-21 01:05:06 +01:00
Billy Huddleston 69b1b19024 CAM: Refactor shape type handling for aliases and subtypes
This PR intruduces a way to dynamicly alias toolbits and adds subtype
for toolbits. Prior to this change, aliases were hardcoded in multiple
locations, making it difficult to maintain and extend. Now, aliases
and the newly subtypes are defined in a single JSON file, which is
loaded at runtime. This allows for easier management and addition of new
aliases or subtypes without modifying the codebase.

Updated the shape system to use a dict format for aliases and subtypes,
improved label formatting, and fixed normalization logic for toolbit
types. Enhanced dropdown display and editor logic to properly handle
subtypes and aliases, including special cases for consecutive capitals.

Users can add shape_aliases.json to the toolbit Shape dirctory allowing
theme to add/remove entries.  Adding a "!" in front of a alias or a
subtime removes it from the list.

This PR also introduces the ability for  the user to choose tools from
a libary or all tools when adding tools via the Job panel.

src/Mod/CAM/Path/Tool/docobject/ui/docobject.py:
- Added keep_case and preserve_consecutive_caps options to
_get_label_text for improved label formatting

src/Mod/CAM/Path/Tool/shape/__init__.py:
- Refactored alias/subtype loading to support new dict format
- Applied aliases and subtypes to shape classes

src/Mod/CAM/Path/Tool/shape/models/base.py:
- Added subtypes attribute to ToolBitShape
- Updated class lookup to support subtypes

src/Mod/CAM/Path/Tool/toolbit/models/base.py:
- Improved normalization logic for aliases and subtypes in
ToolBit.from_dict

src/Mod/CAM/Path/Tool/toolbit/ui/editor.py:
- Updated editor logic to use subtypes and aliases for dropdowns
- Improved read-only and editable state handling

src/Mod/CAM/Path/Tool/toolbit/ui/typefilter.py:
- Used _get_label_text for dropdown filter display with improved
formatting

src/Mod/CAM/Tools/Shape/shape_aliases.json:
- Converted to new dict format with separate aliases and subtypes
2026-02-20 18:48:46 -05:00
sliptonic e3857b11a1 Merge pull request #26818 from tarman3/engrave_fix_taskpanel
CAM: Engrave - Fix regression in Task panel after #22304
2026-02-20 12:02:57 -06:00
sliptonic 6a4b6af094 Merge pull request #27389 from tarman3/path_length
CAM: Fix calculation arc move length
2026-02-20 12:00:47 -06:00
sliptonic 088b384216 Merge pull request #27704 from tarman3/leadinout_g00
CAM: LeadInOut - Replace G00 and G01 by G0 and G1
2026-02-20 11:57:10 -06:00
sliptonic 3f83c820d5 Merge pull request #24958 from tarman3/startPoint
CAM: Profile - Start point in the middle of longthest edge
2026-02-20 11:05:53 -06:00
marioalexis 49652e3c60 Fem: Update and clean up examples and test 2026-02-20 13:01:07 -03:00
marioalexis f8e5a92b98 Fem: Add base class for solver and mesher tools 2026-02-20 10:43:49 -03:00
marioalexis 6f8e9f1a9e Fem: Add Tool property to solvers and meshers 2026-02-20 10:43:49 -03:00
chris jones @ipatch b026958f80 part: fixes #27592 add tooltips for part primitives 2026-02-20 10:14:16 +01:00
marcuspollio d90b6ebd0d Gui: Add line selection to TextEditor 2026-02-19 22:24:40 -06:00
dependabot[bot] 0327534ffe Bump actions/upload-artifact from 5.0.0 to 6.0.0
Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 5.0.0 to 6.0.0.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](https://github.com/actions/upload-artifact/compare/v5...v6)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-version: 6.0.0
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-02-19 16:20:29 -06:00
dependabot[bot] b4e690d9cb Bump actions/download-artifact from 6.0.0 to 7.0.0
Bumps [actions/download-artifact](https://github.com/actions/download-artifact) from 6.0.0 to 7.0.0.
- [Release notes](https://github.com/actions/download-artifact/releases)
- [Commits](https://github.com/actions/download-artifact/compare/018cc2cf5baa6db3ef3c5f8a56943fffe632ef53...37930b1c2abaa49bbe596cd826c3c89aef350131)

---
updated-dependencies:
- dependency-name: actions/download-artifact
  dependency-version: 7.0.0
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-02-19 16:20:17 -06:00
wandererfan ba24ab8a49 [TD]fix unhelpful warning message 2026-02-19 15:30:48 -05:00
wandererfan b0e11e286b [TD]use thin line for smooth edges 2026-02-19 15:30:48 -05:00
Pieter Hijma 94c722d285 Fem: Improve visibility toggling Result and Solver 2026-02-19 16:28:00 +01:00
Roy-043 ddb54cce65 BIM: workaround for WP switch crash (issue #26539) (#27373) 2026-02-19 09:26:35 -06:00
Pieter Hijma 0339458869 Core: Disable toggling visibility text document 2026-02-19 16:22:55 +01:00
Furgo 85e0038515 BIM: Set default value of 'MoveWithHost' property to True (#27685) 2026-02-19 14:39:44 +01:00
Yash Suthar f67088a970 Measure: Fix crash while dragging label of unsaved measurment
Signed-off-by: Yash Suthar <yashsuthar983@gmail.com>
2026-02-19 07:36:43 +01:00
Nathan Schulte 99016e37ed Gui: Add startup log when missing SVG support (#27694) 2026-02-18 18:00:14 -06:00
PaddleStroke be6af47f29 Sketcher: Offset: add checkbox tooltips (#26114) 2026-02-18 21:02:54 +00:00
tarman3 c29868cd48 CAM: LeadInOut - Replace G00(1,2,3) by G0(1,2,3) 2026-02-18 20:43:44 +02:00
dependabot[bot] 45f65f643d Bump actions/stale from 10.1.0 to 10.2.0
Bumps [actions/stale](https://github.com/actions/stale) from 10.1.0 to 10.2.0.
- [Release notes](https://github.com/actions/stale/releases)
- [Changelog](https://github.com/actions/stale/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/stale/compare/5f858e3efba33a5ca4407a664cc011ad407f2008...b5d41d4e1d5dceea10e7104786b73624c18a190f)

---
updated-dependencies:
- dependency-name: actions/stale
  dependency-version: 10.2.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-02-18 13:41:16 +01:00
paul aa4a71b55b [ArchWall] Fix Regression: sortSketchWidth only in addon (#27676)
* [ArchWall] Fix Regression: sortSketchWidth only in addon

Regression was introduced when get_width() method uses ArchSketchObject.sortSketchWidth() function in below lines.

https://github.com/FreeCAD/FreeCAD/blob/468269b9a6ea58cd8b0f9d8579b711c530db83b2/src/Mod/BIM/ArchWall.py#L1668-L1673
        if not lwidths:
            if obj.OverrideWidth:
                if obj.Base and obj.Base.isDerivedFrom("Sketcher::SketchObject"):
                    lwidths = ArchSketchObject.sortSketchWidth(
                        obj.Base, obj.OverrideWidth, obj.ArchSketchEdges
                    )

ArchSketchObject.sortSketchWidth() function is not in the FC core ArchSketchObject.py module and this results in error.  This function would only exist when the external add-on is present and loaded.

Previously, a try/exception test was used; now hasattr() is used in this fix to test the presence of the required function before it is used.

* [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>
2026-02-18 11:49:33 +01:00
Yash Suthar 2d3b0a2ded Measure: ix angle measurement for face and edge selection
Signed-off-by: Yash Suthar <yashsuthar983@gmail.com>
2026-02-18 09:21:17 +01:00
Louis Gombert 3bad5dabde Add missing NOLINTEND clang-tidy comment 2026-02-17 15:26:14 -06:00
PaddleStroke bd07c8a214 Sketcher: OVP Fix tab not working when mouse move (#27638)
* Sketcher: OVP Fix tab not working when mouse move

* [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>
2026-02-17 22:02:36 +01:00
Benjamin Nauck 99f4776fda Merge pull request #27381 from furgo16/bim-window-task-panel
BIM: add window options task box
2026-02-17 18:52:33 +01:00
Furgo c788a88d6a BIM: simplify value assignment for quantity spinboxes
Co-authored-by: Roy-043 <70520633+Roy-043@users.noreply.github.com>
2026-02-17 17:19:55 +01:00
Furgo 6f0b1fca3d BIM: use the correct widget for percentages 2026-02-17 17:19:55 +01:00
Furgo 9fad0ed223 BIM: add window options task box 2026-02-17 17:19:55 +01:00
dependabot[bot] fca58d99ed Bump actions/cache from 4.3.0 to 5.0.3
Bumps [actions/cache](https://github.com/actions/cache) from 4.3.0 to 5.0.3.
- [Release notes](https://github.com/actions/cache/releases)
- [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md)
- [Commits](https://github.com/actions/cache/compare/0057852bfaa89a56745cba8c7296529d2fc39830...cdf6c1fa76f9f475f3d7449005a359c84ca0f306)

---
updated-dependencies:
- dependency-name: actions/cache
  dependency-version: 5.0.3
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-02-17 09:08:42 -06:00
bdieterm 468269b9a6 TemplatePyMod: fix DocumentObject for newer FreeCAD versions (#27662)
* TemplatePyMod: fix DocumentObject for newer FreeCAD versions

original bug report:
https://forum.freecad.org/viewtopic.php?p=873546

* TemplatePyMod: fix FeaturePython example for newer FreeCAD versions
2026-02-17 10:07:58 +01:00
Louis Gombert 289411f51c Move costly boost includes out of core headers
Use pimpl or move definitions to .cpp files in order to avoid including huge Boost headers in core FreeCAD headers. Due to boost inclusions in a few core headers, boost graph utilities, multi index and predicates headers were included in in a large portion of translation units, without them being actually required. This helps reduce build time of the project.
2026-02-16 21:58:36 -06:00
Chris Hennes f83aaf0e59 Merge pull request #25538 from marioalexis84/fem-clean_dlg_settings
Fem: Remove unnecessary code
2026-02-16 11:14:31 -06:00
xtemp09 f1d79d9ab4 [GUI] Make precision of QuantitySpinBox accessible from Python 2026-02-16 11:13:52 -06:00
marbocub bc3c0dc19a Sketcher: Add symmetric constraint option (an element + a symmetry line) (#25525) 2026-02-16 11:05:56 -06:00
Steven James 8567dce28a FeaturePython objects include the Python class's __repr__ it their __repr__ (#24462) 2026-02-16 10:57:14 -06:00
Chris Hennes 72a024aaeb Merge pull request #27587 from WandererFan/BrokenViewRemoveFCBRepAlgoAPI_Cut2
TechDraw: FCBRepAlgoAPI_Cut returns null shape for BrokenView break
2026-02-16 10:51:06 -06:00
xtemp09 e0cd49e670 [Spreadsheet] Syncronize scrollbars in ZoomableView
Closes #27165.
2026-02-16 10:38:56 -06:00
Chris 17d5bca2ec part: fixes #27365 mirror place copy at correct location (#27370) 2026-02-16 10:32:08 -06:00
WandererFan 82ba9ec9d8 fix spelling mistake
Co-authored-by: Chris Hennes <chennes@pioneerlibrarysystem.org>
2026-02-16 09:24:47 -05:00
Furgo d05db60465 BIM: prevent child objects from moving during Arch Wall debasing (#27290)
* BIM: regression test for child object stability during wall debasing

Introduces test_debase_wall_stationary_children to verify that objects
attached to a wall (via Additions or Hosts) retain their global position
when the wall's base is removed and its placement is recalculated.

* BIM: Fix wall debasing to maintain stationary child element positions

Corrects the placement propagation that occurred when Arch.debaseWall()
recalculated the Wall's Placement, causing connected children (Windows,
Additions) to shift their global coordinates.

The fix pins children by capturing their current global placements before
the wall's placement is updated, and immediately restoring those placements
after the wall's transformation is complete.

Fixes: https://github.com/FreeCAD/FreeCAD/issues/27267

* Avoid confusing comment about wall placement in TestArchWall.py

---------

Co-authored-by: Roy-043 <70520633+Roy-043@users.noreply.github.com>
2026-02-16 14:14:34 +00:00
PaddleStroke bb5afb911a Sketcher: Fix loss of expression on trim (#27505) 2026-02-15 20:41:13 -06:00
freecad-gh-actions-translation-bot ec9ead0db9 Update translations from Crowdin 2026-02-15 19:41:17 -06:00
PaddleStroke 94a4017432 Assembly: Bom: fix non-grouping regression 2026-02-15 19:03:06 -06:00
Louis Gombert 5f89fd4e98 Replace deprecated QImage::mirrored by QImage::flipped
QImage::mirrored was deprecated and will be deleted by Qt6.13
2026-02-15 18:59:37 -06:00
Grzegorz Kwacz 7b4770c3f2 Remove Navigation from context menu 2026-02-15 18:57:54 -06:00
Chris Hennes f991407900 PD: Return inversion status by reference (#27435)
* PD: Return inversion status by reference

* Update FeatureExtrude.cpp

Co-authored-by: PaddleStroke <pierrelouis.boyer@gmail.com>

---------

Co-authored-by: PaddleStroke <pierrelouis.boyer@gmail.com>
2026-02-16 01:01:37 +01:00
PaddleStroke 47855a018b Assembly: Fix nested assembly stuck isolate bug 2026-02-15 17:50:13 -06:00
wandererfan f60f3d7cc5 [TD]use nearestFraction to get scale 2026-02-15 18:33:09 -05:00
wandererfan bef9d03312 [TD]expose nearestFraction to python 2026-02-15 18:32:06 -05:00
Roy-043 37600b85a0 Draft: fix ghost preview of Arch_SectionPlane and Draft_WorkingPlaneProxy (#27605) 2026-02-15 17:06:44 -06:00
bdieterm ce38741a52 Core: improve Python docstring for Document.addObject 2026-02-15 17:04:19 -06:00
Roy-043 62700a5f12 TemplatePyMod: fix regression due to locked=True mod
Fix regression caused by:
https://github.com/FreeCAD/FreeCAD/commit/a7331cbb43876b14e5e84d1fde1b673e8c381bb7
2026-02-15 12:48:53 -06:00
Furgo 562cac277c BIM: fix coordinate normalization and area calculation for generic ArchComponents (#27322)
* BIM: extend ArchComponent test suite

Adds several unit tests to TestArchComponent.py to validate the
coordinate system logic and CSG behavior of generic Arch Components.

Included tests cover:
- Double-transformation/displacement bugs when using moved base objects.
- Correct alignment of CSG additions/subtractions in world space.
- Consistency of Vertical and Horizontal area calculations for
  rotated components.
- Automatic geometry spreading (arraying) via the Axis property.
- Cleanup behavior ensuring the shape is cleared when the Base
  link is removed.

* BIM: fix double displacement bug and area calculation in ArchComponent

Rewrites ArchComponent.Component.execute to resolve placement
conflicts between the Document Object and its internal TopoShape.

Changes:
- Reset base_shape.Placement to Identity immediately after copying
  from the source. This strips inherited placements from the Base
  object, ensuring the geometry is local before processing.
- Pass the object's placement to processSubShapes. This allows
  additions and subtractions to be correctly localized to the
  component's local origin.
- Replaces direct Shape assignment with self.applyShape(). This fixes
  area calculations by ensuring the AreaCalculator receives the
  correct placement context, and enables automatic geometry
  spreading via the Axis property.

Fixes: https://github.com/FreeCAD/FreeCAD/issues/24580

* BIM: Refine base validation in ArchComponent to prevent stale shapes

Updates the validation logic in ArchComponent.execute() to correctly
handle the removal of a base object.

Changes:
- The check on self.ensureBase(obj) now explicitly looks for
  False. Because ensureBase returns None when no base is present,
  the previous logic would return early and leave the old shape
  behind.
- This change allows the method to fall through to the shape-clearing
  logic, ensuring that unlinking a base object correctly removes its
  geometry from the 3D view.
- Added a TODO note to ensureBase() regarding its undocumented
  triple-state return (True, False, None) for future cleanup.
2026-02-15 17:35:26 +01:00
Kacper Donat fae6cda1d7 Merge pull request #26938 from chennes/macroPathToDefault
Gui: Don't record macro path if default
2026-02-14 20:24:31 +01:00
Chris Hennes 45598fa319 Merge pull request #27552 from hyarion/fix-schema-issues
Base: Fix schema issues
2026-02-14 12:17:51 -06:00
Loke Strøm cbdb615141 Measurement: Fix: Implicit C-string to QString conversions causing build failure (#27580)
* Measurement: Fix: missing tr() wrapping causing build failure

* Swapped tr() with QLatin1String()

* [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>
2026-02-14 09:49:34 +01:00
Chris Hennes 3fecf957cb Points: Switch to modern libE57 types 2026-02-13 23:33:24 +01:00
Chris Hennes 0cacc9bd34 Merge pull request #27363 from 3x380V/import
Import fixes
2026-02-13 15:43:45 -06:00
theo-vt 9cbef0c5ce Sketcher.scale: scale constraint with the right index (#27188) 2026-02-13 15:34:46 -06:00
chris jones @ipatch 4938a6f75b material: fixes #25817 prevent unecessary save over dialogue 2026-02-13 15:32:46 -06:00
PaddleStroke 885b8cf1de Sketcher : SketchObject::getHigherElements fix (#27560) 2026-02-13 15:32:26 -06:00
Pieter Hijma 1bfaa81d77 FEM: Reenable toggling visibility
This reenables visibility toggling for Analysis and Solver objects.
2026-02-13 22:16:03 +01:00
Pieter Hijma 7586620d41 Revert [Core] Remove various DisplayModes from FEM
This reverts commit 5915575f19.
2026-02-13 21:54:02 +01:00
Loke Strøm 5d81f8ac16 Sketcher: Fix: Arc of ellipse when first and second X coordinates are the same (#27327) 2026-02-13 11:57:27 -06:00
Syres916 ba030237b7 [Gui] Ensure Read Only Booleans in PropertyEditor are shown using Disabled Text Color (#27429)
* Ensure read only Booleans are shown using Disabled Text color
* Make the disabled text color a more significant contrast to enabled
* Ensure correct contrasting color for Axis letters versus background color for both Light and Dark themes
2026-02-13 11:56:20 -06:00
Frank David Martínez M f1366e8a75 Base: Remove assertion on isForceXML() (#27491)
This fixes a difference between Main code and LS3 Code ported during TNP big merge. The Issue generates a crash if FreeCAD is compiled in Debug Mode: #27489.
2026-02-13 11:51:52 -06:00
Chris e595cc49f2 FEM: Update netgenplugin src files to fix builds with netgen >= 6.2.2601 (#27508) 2026-02-13 11:50:04 -06:00
chris jones @ipatch 9289e27230 gui: preferences fixes #27379 2026-02-13 11:48:48 -06:00
Roy-043 a8757f7947 Draft: fix depency of patharray normal on view direction
Change normal calculation to use get_shape_normal
2026-02-13 11:47:44 -06:00
Chris Hennes 9e042ff480 PD: Improve error handling for RevolMethod::ToFirst 2026-02-13 17:48:13 +01:00
wandererfan 6d73f9173c [TD]use BRepAlgoAPI_Cut instead of FCBRepAlgoAPI_Cut 2026-02-13 10:29:46 -05:00
wandererfan 36ddfdc7b9 [TD]fix crash on failed cut
- wrong result and warning on first time through.  Fixes itself after
  next execute().
- https://github.com/FreeCAD/FreeCAD/issues/27414
2026-02-13 10:29:46 -05:00
Paweł Biegun 1752fd59f9 Measurement: Add on the fly measurement unit change (#27462)
Enables the user to change the unit of the measurement temporarily to convert to a different unit. This is useful when the user sometimes needs to get a dimension of the model in a different unit than the one it was designed in.
2026-02-12 14:35:54 +00:00
Benjamin Nauck d94269f85f Base: Add sweep round-trip tests for all unit schemas
Sweep tests parse a string and translate it back, verifying identical
output. Values cover every threshold band at 10x increments plus a
scientific-notation value in each default band. Tests all 10 schemas.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-12 14:26:46 +01:00
Benjamin Nauck bb977afe55 Base: Fix floating point issue in schema threshold comparison
When a parsed value lands exactly at a threshold boundary (e.g. "1 S/m"
= 1e-9 at threshold 1e-9), floating point rounding could cause the
wrong unit to be selected. Shrink thresholds by a relative epsilon so
boundary values fall through to the next (more natural) unit.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-12 14:26:45 +01:00
Benjamin Nauck 3f17f2f01f Base: Fix schema translation data
Corrects 12 bugs across Internal and MKS schemas where factors were
wrong, units were assigned to the wrong threshold positions, or
thresholds didn't align with natural unit boundaries.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-12 14:26:45 +01:00
Roy-043 7912f84136 BIM+Draft: fix Placement task panel issue for Arch_SectionPlane and Draft_WorkingPlaneProxy (#27101)
* BIM+Draft: fix Placement Task Panel issue for Arch_SectionPlane and Draft_WorkingPlaneProxy

* BIM+Draft: fix Placement Task Panel issue for Arch_SectionPlane and Draft_WorkingPlaneProxy
2026-02-12 12:39:46 +00:00
Roy-043 db5fff6ccc BIM: fix BuildingPart issues with Arch_Reference 2026-02-12 11:35:55 +00:00
PaddleStroke 6abb2b447f Assembly: Isolate grounded objects on selection (#24952)
* Assembly: Isolate grounded objects on selection

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

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

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

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

* Update ViewProviderAssembly.cpp

* Update ViewProviderAssembly.cpp

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Chris Hennes <chennes@pioneerlibrarysystem.org>
2026-02-12 09:43:46 +01:00
marioalexis ba174bdad5 Fem: Remove unnecessary code from Z88 preference page 2026-02-12 09:38:33 +01:00
marioalexis ea27d96374 Fem: Remove unnecessary code from import/export INP preference page 2026-02-12 09:38:33 +01:00
marioalexis 1fcbe6095c Fem: Remove unnecessary code from CalculiX preference page 2026-02-12 09:38:33 +01:00
JIJINBEI 379179ce2b README: Update compiling section to recommend pixi (#27501) 2026-02-11 21:36:18 +00:00
Chris Hennes 076c5916b5 Sketcher: Remove unneeded parameters from seekConstraintPosition 2026-02-11 19:49:31 +01:00
Yash Suthar 3d14203fa4 Draft: fix Draft_Label MaxChars property (#27478)
* Draft: fix Draft_Label MaxChars property

Signed-off-by: Yash Suthar <yashsuthar983@gmail.com>

* Minor tweak: moved/replaced call to self.onChanged

---------

Signed-off-by: Yash Suthar <yashsuthar983@gmail.com>
Co-authored-by: Roy-043 <70520633+Roy-043@users.noreply.github.com>
2026-02-11 17:58:42 +00:00
Chris Hennes ec18d4e250 Tests/Sketcher: Eliminate unused variables 2026-02-11 17:03:18 +01:00
wmayer be3acac53a Import: Fix import/export of STEP file
For the import/export use the transparency value of the material property.
Since v1.0 the alpha channel of the diffuse color is used for this but
when changing the transparency in the user interface this alpha channel
won't be adjusted and thus leads to unexpected results.

This fixes issue 18569
2026-02-10 11:03:27 +01:00
wmayer 1412cad2ec Import: Use ImportGui module for IGES import & export
Fixes issue 10701
2026-02-10 11:03:27 +01:00
Kacper Donat 1cc53d911a Gui: Add element-wise tuple arithmetic to StyleParameters
Add arithmetic operators (+, -, *, /, unary -) to Value, enabling
element-wise operations on tuples and scalar broadcast with numerics.
Tuple addition/subtraction uses union semantics: named elements match
by name, unnamed elements match positionally, and unmatched elements
pass through. BinaryOp and UnaryOp now delegate to these Value operators.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-09 00:33:00 +01:00
Kacper Donat 7bf2050865 Gui: Add dot syntax for tuple member access in StyleParameters
Add MemberAccess AST node and postfix `.member` parsing to support
extracting individual elements from tuple-valued parameters, e.g.
`@ButtonBorderThickness.left` or `@Grays.0`.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-09 00:33:00 +01:00
Kacper Donat b7b3187e1d Gui: Split Value types out of ParameterManager into Value.h/.cpp
Move Numeric, Tuple, Value, valueTypeName, ArgumentParser, and ParamDef
into their own Value.h/.cpp files. ParameterManager.h now includes
Value.h and keeps only parameter sources and the manager itself.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-09 00:33:00 +01:00
Kacper Donat 9e0538abc8 Gui: Add ArgumentParser for named/positional function arguments
Adds ArgumentParser class that resolves mixed positional and named
arguments against a declared function signature (Python-style).
Includes Tuple::get<T>(name) for type-checked access with
user-friendly error messages. Refactors lighten/darken/blend to use it.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-09 00:33:00 +01:00
Kacper Donat a64a43b9ca Gui: Refactor function arguments to use TupleLiteral
Replace the separate argument parsing in parseFunctionCall() with a
call to parseTuple(), unifying the two comma-separated-expression
parsing paths. FunctionCall now stores a TupleLiteral instead of
a vector of expressions, and evaluates it into a Tuple value that
functions access via at()/find().

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-09 00:33:00 +01:00
Kacper Donat 7c813a6f5a Gui: Add tests for StyleParameters tuple support
Test cases cover unnamed, named, and mixed tuples, single named
elements, nested tuples, expressions and mixed types in elements,
toString roundtrip, Value::holds/get accessors, Tuple::at/find/size,
error handling, and backward compatibility of grouped expressions.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-09 00:33:00 +01:00
Kacper Donat 884baf2cb8 Gui: Add tuple parsing to StyleParameters parser
Add TupleLiteral AST node and parser support for tuple syntax using
parentheses with comma-separated elements: (val1, val2) for unnamed
tuples, (name: val1, val2) for named elements.

Disambiguation with grouped expressions in parseFactor():
- `(identifier:` lookahead → tuple
- expression followed by `,` → tuple
- expression followed by `)` → grouped expression (backward compatible)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-09 00:33:00 +01:00
Kacper Donat 0f4ad868f7 Gui: Add Tuple type to StyleParameters
Add a tuple value type to the StyleParameters system, allowing related
values to be grouped into a single parameter with optional named fields.

Tuple is stored inline in the Value variant. The circular dependency
(Value contains Tuple, Tuple elements contain Value) is broken by
storing element values as shared_ptr<const Value> inside Tuple::Element.

Generic holds<T>() and get<T>() template methods are added to Value
for uniform type-checked access to all variant alternatives.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-09 00:29:03 +01:00
Chris Hennes 5b27deb4f0 Gui: Migrate old macro dir if needed 2026-02-07 20:36:43 -06:00
Chris Hennes f008c80030 Gui: Don't record macro path if default 2026-02-07 20:35:32 -06:00
timpieces adf15a401d ExpressionParser: Add more tests for expression parsing (#27098)
- I'm not familiar with absolutely all usages of expressions - this is
  intended more as a starting point to make it easy to add more
- The test captures *current* behaviour, please don't assume that
  everything it tests is *correct* behaviour
2026-02-07 11:23:13 +08:00
timpieces 1de8cd5e36 ExpressionParser: Make cosmetic test changes before adding more tests (#27098)
Fix some weird quirks before adding new tests:
- The whole file has clang format off, this feels unnecessary, localize
  it to where it's important
- Put the code inside a nested test namespace within the production
  namespace, this is generally good practice rather than putting it in
  the global namespace, and it means we don't have to explicitly namespace
  methods that are directly under test
- Rename variables to camelCase, which afaict is closer to 'normal' in
  freecad cpp
- Remove the usage of arrays. Maintaining manual array sizes is
  annoying. Just use initializer lists here as they are all constants.
- I have *not* renamed the snake_case methods, as I feel that it
  destroys too much of the git history for too little benefit
2026-02-07 11:23:13 +08:00
timpieces daceb8afe4 ExpressionParser: Return unique_ptr from simplified (#27098)
- Removes many/most of the copy().release() from the last commit
- Still some .release() in the simplify functions now
- It doesn't work to rename simplify and turn it into a protected
  method, because it's called recursively within the tree
2026-02-07 11:23:13 +08:00
timpieces 8dad760db4 ExpressionParser: Return unique_ptr from copy (#27098)
- We need copy().release() on many of these calls because nodes in the
  tree call 'copy' explicitly. It's not really different to the code
  that's there now, but it's not pretty either. Some of these will go
  away in the upcoming commit
2026-02-07 11:23:13 +08:00
timpieces 1455321ace ExpressionParser: Return unique_ptr from eval (#27098)
- Most of the usages of 'release' are temporary here, but a few will
  likely need to stay. In these cases, the existing behaviour is
  retained. To fix all usages, smart pointers would need to be used all
  throughout the tree
- The freecad_cast looks awkward now. I haven't added a new version that
  works with smart pointers because it's not clear what the right
  ownership semantics would be. Make the caller be explicit for now.
2026-02-07 11:23:13 +08:00
timpieces 47d02c0618 ExpressionParser: Return unique_ptr from parse (#27098)
- Start at ScanResult, as starting higher makes it easy to have memory
  issues.
- There are multiple memory leaks (at least in tests, but possibly in
  production code too) from using raw pointers in the public interface
  here. Fix these before adding more tests.
- Starts at ScanResult
- The bison changes were applied manually, as I don't think that it's
  pixified and running my local version showed many changes.
- I've chosen not to pimplify Expression, but only because it would be
  such a significant change for not so much value.
2026-02-07 11:23:09 +08:00
tarman3 53bb61da00 CAM: Fix calculation arc move time 2026-02-06 22:25:39 +02:00
tarman3 dd3c12758f CAM: Fix calculation arc move length 2026-02-06 21:46:57 +02:00
Pieter Hijma 6d3f786b38 Doc: Improve layout doxygen output 2026-02-03 21:07:13 +01:00
Pieter Hijma 1eb6968265 Doc: Comment out doxygen javascript
This commit comments out javascript for doxygen that does not work
anymore or is unneeded in newer versions.  The code is left in for later
attempts to revitalize this functionality, most notable the search
function.
2026-02-03 21:07:13 +01:00
David Kaufman 388c66b41e move max-arc-radius test from AlmostALine to CheckForArc 2026-02-02 10:46:00 -05:00
Alfredo Monclus 928e5e0fbb PD: preview substractive feature check for removed volume 2026-01-28 11:03:30 -03:00
Alfredo Monclus 603fc4b341 PD: hole speficify the tolerance in the boolean op
this fixes issues in which the helix is the only thing being cut and the revolve is ignored
2026-01-28 11:03:30 -03:00
Alfredo Monclus 70b9305f2e PD: hole use a compound instead of a fuse for threads 2026-01-28 11:03:30 -03:00
David Kaufman 8e04386c67 use CArea::get_accuracy instead of Point::arc_tolerance 2026-01-26 16:27:19 -05:00
David Kaufman cdce2f0ffd [CAM] separate tolerance variable used for arc fitting from tolerance used for section height offsets 2026-01-26 10:35:23 -05:00
tarman3 6a66c233f1 CAM: Profile - Start point in the middle of edges 2026-01-24 00:38:52 +02:00
Dimitris75 1800ef0f10 CAM Waterline OCL Adaptive
Add - Optimize Linear Paths
Remove - Unecessary BoundBox selection
2026-01-20 04:35:32 +02:00
tarman3 bc81a16eb4 CAM: Engrave - Fix regression in Task panel after #22304 2026-01-10 10:04:39 +02:00
tarman3 22f40741ee CAM: LeadInOut - ArcZ following profile 2026-01-06 14:59:25 +02:00
3347 changed files with 340267 additions and 120429 deletions
+2 -2
View File
@@ -58,7 +58,7 @@ jobs:
logdir: /tmp/log/
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
uses: step-security/harden-runner@fa2e9d605c4eeb9fcad4c99c224cee0c6c7f3594 # v2.16.0
with:
egress-policy: audit
@@ -108,7 +108,7 @@ jobs:
done
- name: Upload logs
if: always()
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
with:
name: ${{ github.job }}-Logs
path: |
@@ -68,6 +68,12 @@ runs:
testCommand: ${{ inputs.builddir }}/tests/Gui_tests_run --gtest_output=json:${{ inputs.reportdir }}gui_gtest_results.json
testLogFile: ${{ inputs.reportdir }}gui_gtest_test_log.txt
testName: Gui
- name: C++ Qt tests
id: qttests
uses: ./.github/workflows/actions/runCPPTests/runQtTests
with:
builddir: ${{ inputs.builddir }}
testLogFile: ${{ inputs.reportdir }}qt_ctest_log.txt
- name: C++ Material tests
id: material
uses: ./.github/workflows/actions/runCPPTests/runSingleTest
@@ -0,0 +1,55 @@
# SPDX-License-Identifier: LGPL-2.1-or-later
# SPDX-FileNotice: Part of the FreeCAD project.
name: runQtTests
description: "Run all QtTest-based C++ tests (those labelled 'Qt' in CTest), generate log and report"
inputs:
builddir:
description: "Build directory containing CTestTestfile.cmake"
required: true
testLogFile:
description: "Path for the command-line output of the tests"
required: true
outputs:
reportText:
description: "Report text"
value: ${{ steps.report.outputs.reportText }}
runs:
using: "composite"
steps:
- name: Run Qt tests via CTest
shell: bash -l {0}
env:
BUILD_DIR: ${{ inputs.builddir }}
TEST_LOG_FILE: ${{ inputs.testLogFile }}
run: |
set -o pipefail
ctest --test-dir "$BUILD_DIR" -L Qt --output-on-failure | tee -a "$TEST_LOG_FILE"
- name: Parse test results
if: always()
id: report
shell: bash -l {0}
env:
TEST_LOG_FILE: ${{ inputs.testLogFile }}
run: |
result=$(grep -E "(Test #|tests passed|tests failed|Total Test time)" "$TEST_LOG_FILE" || true)
if grep -qE "[1-9][0-9]* tests failed" "$TEST_LOG_FILE"
then
reportText="<details><summary>:fire: QtTest C++ tests failed</summary>\n"
else
reportText="<details><summary>:heavy_check_mark: QtTest C++ tests succeeded</summary>\n"
fi
reportText+="\n"
reportText+="Results\n"
reportText+="\n"
reportText+='```\n'
reportText+="$result\n"
reportText+='```\n'
reportText+="</details>\n"
reportText+="\n"
echo "reportText<<EOD" >> $GITHUB_OUTPUT
echo -e "$reportText" >> $GITHUB_OUTPUT
echo "EOD" >> $GITHUB_OUTPUT
echo -e "$reportText"
@@ -0,0 +1,62 @@
# SPDX-License-Identifier: LGPL-2.1-or-later
# SPDX-FileNotice: Part of the FreeCAD project.
name: runSingleQtTest
description: "Run a single QtTest-based C++ test executable, generate log and report"
inputs:
testCommand:
description: "Test executable path"
required: true
testLogFile:
description: "Path for the command-line output of the tests"
required: true
testName:
description: "A descriptive name for the test suite"
required: true
outputs:
reportText:
description: "Report text"
value: ${{ steps.report.outputs.reportText }}
runs:
using: "composite"
steps:
- name: Run QtTest tests
shell: bash -l {0}
env:
QT_QPA_PLATFORM: offscreen
TEST_COMMAND: ${{ inputs.testCommand }}
TEST_LOG_FILE: ${{ inputs.testLogFile }}
run: |
set -o pipefail
$TEST_COMMAND | tee -a "$TEST_LOG_FILE"
- name: Parse test results
if: always()
id: report
shell: bash -l {0}
env:
TEST_LOG_FILE: ${{ inputs.testLogFile }}
TEST_NAME: ${{ inputs.testName }}
run: |
# This bonkers sed regex is to try to find the start and end of the QtTest output block, which is not really
# designed to be machine-readable. Why did they have to choose asterisks?!?!
result=$(sed -n '/^\*\*\*\*\*\*\*\*\* Start/,/^\*\*\*\*\*\*\*\*\* Finished/p' "$TEST_LOG_FILE" || true)
if grep -qE "^FAIL!" "$TEST_LOG_FILE"
then
reportText="<details><summary>:fire: QtTest C++ test suite '${TEST_NAME}' failed</summary>\n"
else
reportText="<details><summary>:heavy_check_mark: QtTest C++ test suite '${TEST_NAME}' succeeded</summary>\n"
fi
reportText+="\n"
reportText+="Results\n"
reportText+="\n"
reportText+='```\n'
reportText+="$result\n"
reportText+='```\n'
reportText+="</details>\n"
reportText+="\n"
echo "reportText<<EOD" >> $GITHUB_OUTPUT
echo -e "$reportText" >> $GITHUB_OUTPUT
echo "EOD" >> $GITHUB_OUTPUT
echo -e "$reportText"
@@ -21,13 +21,13 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
uses: step-security/harden-runner@fa2e9d605c4eeb9fcad4c99c224cee0c6c7f3594 # v2.16.0
with:
egress-policy: audit
- name: '🧹 Tag & close stale unconfirmed bugs'
id: stale_issues
uses: actions/stale@5f858e3efba33a5ca4407a664cc011ad407f2008 # v10.1.0
uses: actions/stale@b5d41d4e1d5dceea10e7104786b73624c18a190f # v10.2.0
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
days-before-issue-stale: 90
@@ -53,7 +53,7 @@ jobs:
- name: '🧹 Close stale requested feedback issues'
id: awaiting_issues
uses: actions/stale@5f858e3efba33a5ca4407a664cc011ad407f2008 # v10.1.0
uses: actions/stale@b5d41d4e1d5dceea10e7104786b73624c18a190f # v10.2.0
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
days-before-issue-stale: 20
@@ -80,7 +80,7 @@ jobs:
- name: '🧹 Tag & close inactive issues'
id: inactive_issues
uses: actions/stale@5f858e3efba33a5ca4407a664cc011ad407f2008 # v10.1.0
uses: actions/stale@b5d41d4e1d5dceea10e7104786b73624c18a190f # v10.2.0
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
days-before-issue-stale: 190
@@ -110,7 +110,7 @@ jobs:
- name: '🧹 Tag & close inactive PRs'
id: inactive_pr
uses: actions/stale@5f858e3efba33a5ca4407a664cc011ad407f2008 # v10.1.0
uses: actions/stale@b5d41d4e1d5dceea10e7104786b73624c18a190f # v10.2.0
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
days-before-issue-stale: -1
+1 -1
View File
@@ -33,7 +33,7 @@ jobs:
token: ${{ secrets.GH_TOKEN_FOR_CI_RUNNERS }}
- name: Create backport pull requests
uses: korthout/backport-action@d07416681cab29bf2661702f925f020aaa962997 # v3.4.1
uses: korthout/backport-action@01619ebc9a6e3f6820274221b9956b3e7365000a # v4.1.0
with:
# Inputs documented here: https://github.com/korthout/backport-action?tab=readme-ov-file#inputs
github_token: ${{ secrets.GH_TOKEN_FOR_CI_RUNNERS }}
+79 -15
View File
@@ -10,6 +10,10 @@ permissions:
contents: write
actions: write
concurrency:
group: build-release-${{ github.event_name }}
cancel-in-progress: true
jobs:
upload_src:
runs-on: ubuntu-latest
@@ -17,11 +21,11 @@ jobs:
build_tag: ${{ steps.get_tag.outputs.build_tag }}
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
uses: step-security/harden-runner@fa2e9d605c4eeb9fcad4c99c224cee0c6c7f3594 # v2.16.0
with:
egress-policy: audit
- name: Checkout Source
- name: Checkout source
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
ref: ${{ github.sha }}
@@ -29,7 +33,7 @@ jobs:
fetch-tags: true
submodules: 'recursive'
- name: get tag and create release if weekly
- name: Get tag and create release if weekly
id: get_tag
shell: bash -l {0}
env:
@@ -39,14 +43,17 @@ jobs:
export BUILD_TAG="${{ github.event.release.tag_name }}"
else
export BUILD_TAG=weekly-$(date "+%Y.%m.%d")
gh release create ${BUILD_TAG} --title "Development Build ${BUILD_TAG}" -F .github/workflows/weekly-build-notes.md --prerelease || true
gh release create ${BUILD_TAG} --title "Development Build ${BUILD_TAG}" \
-F .github/workflows/weekly-build-notes.md \
--prerelease || \
gh release view ${BUILD_TAG} > /dev/null # fail if it doesn't exist
fi
echo "BUILD_TAG=${BUILD_TAG}" >> "$GITHUB_ENV"
echo "build_tag=${BUILD_TAG}" >> "$GITHUB_OUTPUT"
- name: Trigger notes updater workflow (only for weekly)
if: startsWith(steps.get_tag.outputs.build_tag, 'weekly-')
uses: actions/github-script@v7
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
env:
WEEKLY_TAG: ${{ steps.get_tag.outputs.build_tag }}
with:
@@ -105,7 +112,7 @@ jobs:
environment: weekly-build
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
uses: step-security/harden-runner@fa2e9d605c4eeb9fcad4c99c224cee0c6c7f3594 # v2.16.0
with:
egress-policy: audit
@@ -118,7 +125,7 @@ jobs:
remove-android: 'true' # (frees ~9 GB)
remove-cached-tools: 'true' # (frees ~8.3 GB)
- name: Set Platform Environment Variables
- name: Set platform environment variables
shell: bash -l {0}
env:
OPERATING_SYSTEM: ${{ runner.os }}
@@ -128,7 +135,7 @@ jobs:
echo 'RATTLER_CACHE_DIR=D:\rattler' >> "$GITHUB_ENV"
fi
- name: Checkout Source
- name: Checkout source
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
ref: ${{ github.sha }}
@@ -142,7 +149,7 @@ jobs:
cache: false
- name: Install the Apple certificate and provisioning profile
id: get_cert
id: macos_get_cert
if: runner.os == 'macOS'
env:
APP_SPECIFIC_PASSWORD: ${{ secrets.APP_SPECIFIC_PASSWORD }}
@@ -150,7 +157,6 @@ jobs:
BUILD_CERTIFICATE_BASE64: ${{ secrets.BUILD_CERTIFICATE_BASE64 }}
BUILD_PROVISION_PROFILE_BASE64: ${{ secrets.BUILD_PROVISION_PROFILE_BASE64 }}
DEVELOPER_TEAM_ID: ${{ secrets.DEVELOPER_TEAM_ID }}
KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }}
P12_PASSWORD: ${{ secrets.P12_PASSWORD }}
run: |
if [ -z "$BUILD_CERTIFICATE_BASE64" ]; then
@@ -186,23 +192,81 @@ jobs:
xcrun notarytool store-credentials "FreeCAD" --keychain "$KEYCHAIN_PATH" --apple-id "${APPLE_ID}" --password "${APP_SPECIFIC_PASSWORD}" --team-id "${DEVELOPER_TEAM_ID}"
- name: Build and Release Packages
- name: Setup .NET 10 SDK
if: runner.os == 'Windows'
uses: actions/setup-dotnet@baa11fbfe1d6520db94683bd5c7a3818018e4309 # v5.1.0
with:
dotnet-version: '10.0.103'
- name: Install sign tool
if: runner.os == 'Windows'
run: |
# NOTE: The sign tool is ONLY available as a prerelease package, they never issue real releases.
dotnet tool install --global --prerelease sign
echo "$env:USERPROFILE\.dotnet\tools" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
dotnet --info
sign --version
- name: Build packages
shell: bash
env:
GH_TOKEN: ${{ github.token }}
SIGNING_KEY_ID: ${{ secrets.SIGNING_KEY_ID }}
SIGN_RELEASE: ${{ steps.get_cert.outputs.has_cert }}
TARGET_PLATFORM: ${{ matrix.target }}
MAKE_INSTALLER: "true"
UPLOAD_RELEASE: "true"
BUILD_TAG: ${{ needs.upload_src.outputs.build_tag }}
run: |
set -euo pipefail
if [[ "${{ runner.os }}" == "macOS" ]]; then
export MACOS_DEPLOYMENT_TARGET="${{ matrix.deploy_target }}"
fi
python3 package/scripts/write_version_info.py ../freecad_version.txt
cd package/rattler-build
pixi install
- name: Azure login for Windows build code signing
id: azure_login
if: runner.os == 'Windows'
continue-on-error: true
uses: azure/login@a457da9ea143d694b1b9c7c869ebb04ebe844ef5 # v2.3.0
with:
creds: '{"clientId":"${{ secrets.AZURE_CLIENT_ID }}","clientSecret":"${{ secrets.AZURE_CLIENT_SECRET }}","subscriptionId":"${{ secrets.AZURE_SUBSCRIPTION_ID }}","tenantId":"${{ secrets.AZURE_TENANT_ID }}"}'
- name: Release packages with optional code-signing on Windows and macOS
shell: bash
env:
GH_TOKEN: ${{ github.token }}
TARGET_PLATFORM: ${{ matrix.target }}
MAKE_INSTALLER: "true"
UPLOAD_RELEASE: "true"
BUILD_TAG: ${{ needs.upload_src.outputs.build_tag }}
run: |
set -euo pipefail
export MACOS_SIGN_RELEASE=0
export WINDOWS_SIGN_RELEASE=0
case "${RUNNER_OS}" in
Windows)
export WINDOWS_SIGN_RELEASE="${{ steps.azure_login.outcome }}"
export WINDOWS_AZURE_ENDPOINT="${{ vars.AZURE_TRUSTED_SIGNING_ENDPOINT }}"
export WINDOWS_AZURE_CERTIFICATE_PROFILE="${{ vars.AZURE_TRUSTED_SIGNING_CERTIFICATE_PROFILE }}"
export WINDOWS_AZURE_SIGNING_ACCOUNT="${{ vars.AZURE_TRUSTED_SIGNING_ACCOUNT }}"
# For good measure, normalize the azure_login result to 1 or 0
if [[ "${WINDOWS_SIGN_RELEASE:-}" == "success" ]]; then
export WINDOWS_SIGN_RELEASE=1
else
export WINDOWS_SIGN_RELEASE=0
fi
;;
macOS)
export MACOS_SIGN_RELEASE="${{ steps.macos_get_cert.outputs.has_cert }}"
export MACOS_SIGNING_KEY_ID="${{ secrets.SIGNING_KEY_ID }}"
export MACOS_DEPLOYMENT_TARGET="${{ matrix.deploy_target }}"
;;
esac
cd package/rattler-build
pixi run -e package create_bundle
## Needed if running on a self-hosted runner:
+1 -1
View File
@@ -64,7 +64,7 @@ jobs:
# your codebase is analyzed, see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/codeql-code-scanning-for-compiled-languages
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
uses: step-security/harden-runner@fa2e9d605c4eeb9fcad4c99c224cee0c6c7f3594 # v2.16.0
with:
egress-policy: audit
+2 -2
View File
@@ -68,7 +68,7 @@ jobs:
# your codebase is analyzed, see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/codeql-code-scanning-for-compiled-languages
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
uses: step-security/harden-runner@fa2e9d605c4eeb9fcad4c99c224cee0c6c7f3594 # v2.16.0
with:
egress-policy: audit
@@ -156,7 +156,7 @@ jobs:
sarif_file: sarif-results/cpp.sarif
- name: Upload loc as a Build Artifact
uses: actions/upload-artifact@v5
uses: actions/upload-artifact@v7.0.0
with:
name: sarif-results
path: sarif-results
+2 -2
View File
@@ -17,11 +17,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
uses: step-security/harden-runner@fa2e9d605c4eeb9fcad4c99c224cee0c6c7f3594 # v2.16.0
with:
egress-policy: audit
- name: 'Checkout Repository'
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: 'Dependency Review'
uses: actions/dependency-review-action@3c4e3dcb1aa7874d2c16be7d79418e9b7efd6261 # v4
uses: actions/dependency-review-action@05fe4576374b728f0c523d6a13d64c25081e0803 # v4
+2 -2
View File
@@ -17,7 +17,7 @@ jobs:
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
uses: step-security/harden-runner@fa2e9d605c4eeb9fcad4c99c224cee0c6c7f3594 # v2.16.0
with:
egress-policy: audit
@@ -35,7 +35,7 @@ jobs:
echo "last_month=$first_day..$last_day" >> "$GITHUB_ENV"
- name: Run issue-metrics tool
uses: github/issue-metrics@67526e7bd8100b870f10b1c120780a8375777b43 # v3.25.5
uses: github/issue-metrics@6a35322ff89cee3e1a594d282c27eb34bffa9174 # v4.1.1
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SEARCH_QUERY: 'repo:FreeCAD/FreeCAD is:issue created:${{ env.last_month }}'
+1 -1
View File
@@ -21,7 +21,7 @@ jobs:
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
uses: step-security/harden-runner@fa2e9d605c4eeb9fcad4c99c224cee0c6c7f3594 # v2.16.0
with:
egress-policy: audit
+2 -2
View File
@@ -36,7 +36,7 @@ jobs:
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
uses: step-security/harden-runner@fa2e9d605c4eeb9fcad4c99c224cee0c6c7f3594 # v2.16.0
with:
egress-policy: audit
@@ -68,7 +68,7 @@ jobs:
# Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF
# format to the repository Actions tab.
- name: "Upload artifact"
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
with:
name: SARIF file
path: results.sarif
+5 -5
View File
@@ -75,7 +75,7 @@ jobs:
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
uses: step-security/harden-runner@fa2e9d605c4eeb9fcad4c99c224cee0c6c7f3594 # v2.16.0
with:
egress-policy: audit
@@ -124,7 +124,7 @@ jobs:
- name: Restore Compiler Cache
id: cache-restore
if: always()
uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
uses: actions/cache/restore@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3
with:
path: ${{ env.CCACHE_DIR }}
key: FC-${{ env.cacheKey }}-${{ github.ref }}-${{ github.run_id }}
@@ -209,14 +209,14 @@ jobs:
- name: Save Compiler Cache
id: cache-save
if: always()
uses: actions/cache/save@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
uses: actions/cache/save@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3
with:
path: ${{ env.CCACHE_DIR }}
key: FC-${{ env.cacheKey }}-${{ github.ref }}-${{ github.run_id }}
- name: Upload logs
if: always()
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
with:
name: ${{ inputs.artifactBasename }}-${{ matrix.os }}-Logs
path: |
@@ -225,7 +225,7 @@ jobs:
- name: Upload report
if: always()
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
with:
name: ${{ env.reportfilename }}
path: |
+5 -5
View File
@@ -77,7 +77,7 @@ jobs:
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
uses: step-security/harden-runner@fa2e9d605c4eeb9fcad4c99c224cee0c6c7f3594 # v2.16.0
with:
egress-policy: audit
@@ -116,7 +116,7 @@ jobs:
- name: Restore Compiler Cache
id: cache-restore
if: always()
uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
uses: actions/cache/restore@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3
with:
path: ${{ env.CCACHE_DIR }}
key: FC-${{ steps.genCacheKey.outputs.cacheKey }}-${{ github.ref }}-${{ github.run_id }}
@@ -216,14 +216,14 @@ jobs:
- name: Save Compiler Cache
id: cache-save
if: always()
uses: actions/cache/save@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
uses: actions/cache/save@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3
with:
path: ${{ env.CCACHE_DIR }}
key: FC-${{ steps.genCacheKey.outputs.cacheKey }}-${{ github.ref }}-${{ github.run_id }}
- name: Upload logs
if: always()
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
with:
name: ${{ inputs.artifactBasename }}-Logs
path: |
@@ -232,7 +232,7 @@ jobs:
- name: Upload report
if: always()
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
with:
name: ${{ env.reportfilename }}
path: |
+4 -4
View File
@@ -78,7 +78,7 @@ jobs:
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
uses: step-security/harden-runner@fa2e9d605c4eeb9fcad4c99c224cee0c6c7f3594 # v2.16.0
with:
egress-policy: audit
@@ -111,7 +111,7 @@ jobs:
- name: Restore compiler cache
id: cache-restore
if: always()
uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
uses: actions/cache/restore@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3
with:
path: ${{ env.CCACHE_DIR }}
key: FC-${{ env.cacheKey }}-${{ github.ref }}-${{ github.run_id }}
@@ -169,14 +169,14 @@ jobs:
- name: Save Compiler Cache
id: cache-save
if: always()
uses: actions/cache/save@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
uses: actions/cache/save@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3
with:
path: ${{ env.CCACHE_DIR }}
key: FC-${{ env.cacheKey }}-${{ github.ref }}-${{ github.run_id }}
- name: Upload logs
if: always()
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
with:
name: ${{ inputs.artifactBasename }}-Logs
path: |
+3 -3
View File
@@ -198,7 +198,7 @@ jobs:
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
uses: step-security/harden-runner@fa2e9d605c4eeb9fcad4c99c224cee0c6c7f3594 # v2.16.0
with:
egress-policy: audit
@@ -355,7 +355,7 @@ jobs:
- name: Upload logs and fixes
if: always()
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
with:
name: ${{ inputs.artifactBasename }}-Logs
path: |
@@ -364,7 +364,7 @@ jobs:
- name: Upload report
if: always()
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
with:
name: ${{ env.reportfilename }}
path: |
+3 -3
View File
@@ -81,7 +81,7 @@ jobs:
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
uses: step-security/harden-runner@fa2e9d605c4eeb9fcad4c99c224cee0c6c7f3594 # v2.16.0
with:
egress-policy: audit
@@ -180,14 +180,14 @@ jobs:
echo "" >> $GITHUB_OUTPUT
- name: Upload logs
if: always()
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
with:
name: ${{ inputs.artifactBasename }}-Logs
path: |
${{ env.logdir }}
- name: Upload report
if: always()
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
with:
name: ${{ env.reportfilename }}
path: |
+3 -3
View File
@@ -54,7 +54,7 @@ jobs:
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
uses: step-security/harden-runner@fa2e9d605c4eeb9fcad4c99c224cee0c6c7f3594 # v2.16.0
with:
egress-policy: audit
@@ -62,7 +62,7 @@ jobs:
run: |
mkdir -p ${{ env.artifactsDownloadDir }}
- name: Download artifacts
uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 # v6.0.0
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
path: ${{ env.artifactsDownloadDir }}
- name: Save input data to file
@@ -119,7 +119,7 @@ jobs:
cat report.md >> $GITHUB_STEP_SUMMARY
- name: Delete used artifacts
continue-on-error: true
uses: geekyeggo/delete-artifact@f275313e70c08f6120db482d7a6b98377786765b # v5.1.0
uses: geekyeggo/delete-artifact@176a747ab7e287e3ff4787bf8a148716375ca118 # v6.0.0
with:
name: |
${{ env.usedArtifacts }}
+1 -1
View File
@@ -22,7 +22,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Inject compare link into weekly release notes
uses: actions/github-script@v7
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
env:
# Pass manual inputs via env for convenience
CURRENT_TAG: ${{ github.event.inputs.current_tag }}
+29 -28
View File
@@ -1,59 +1,60 @@
# file types to ignore
.*
!/.packit.yaml
!*.gitattributes
!*.gitignore
!/.clang-format
!/.clang-tidy
!/.git-blame-ignore-revs
!/.gitattributes
!/.github/
!/.gitignore
!/.gitmodules
!/.packit.yaml
!/.pre-commit-config.yaml
!/.pylintrc
!/.github/
!/contrib/.vscode/
!*.gitattributes
!*.gitignore
*.clangd
*.DS_Store
*.pyc
*.obj
*.lib
*.pch
*.vcproj
*.kdev4
*.exp
*.dep
*.exp
*.kdev4
*.lib
*.manifest
*.o
*.obj
*.orig
*.output
*.pch
*.pyc
*.vcproj
# Ignore .db files created by Qt Designer when editing .ui files
*.db
qrc_*.cpp
BuildLog.htm
cmake_install.cmake
*~
CMakeFiles/
*qrc.depends
ui_*.h
moc_*.cpp
Makefile
*~
BuildLog.htm
CMakeCache.txt
CMakeFiles/
CMakeLists.txt.user
Makefile
cmake_install.cmake
config.h
install_manifest.txt
/bin/
moc_*.cpp
qrc_*.cpp
ui_*.h
/.vscode/
/ALL_BUILD.dir/
/doc/
/lib/
/Mod/
/ZERO_CHECK.dir/
/build/
/bin/
/build-*/
/build/
/cmake-build*/
/src/Tools/offlinedoc/localwiki/
/src/Tools/offlinedoc/*.txt
/conda/environment.yml
/.vscode/
/doc/
/lib/
/src/Tools/offlinedoc/*.txt
/src/Tools/offlinedoc/localwiki/
OpenSCAD_rc.py
tags
/CMakeUserPresets.json
@@ -63,10 +64,10 @@ compile_commands.json
*.sublime-workspace
# crowdin file
files_to_translate.txt
src/Tools/freecad.zip
tsupdate_stderr.log
tsupdate_stdout.log
files_to_translate.txt
# pixi environments
.pixi
*.egg-info
.pixi
+3 -1
View File
@@ -62,7 +62,9 @@ The FreeCAD Contribution Process is expressed here with the following specific g
1. the PR description MUST contain proper attribution as the first line, for example: "This is work of XYZ cherry-picked from <link>";
2. all commits MUST have proper authorship, i.e. be authored by the original author and committed by the author of the PR;
3. if changes to cherry-picked commits are necessary they SHOULD be done as follow-up commits. If it is not possible to do so, then the modified commits MUST contain a `Co-Authored-By` trailer in their commit message.
14. A “Valid PR” is one which satisfies the above requirements.
14. Contributions must meet existing quality standards. Raw AI output is not accepted under any circumstances. AI may be used only as an assistive tool; in all cases, the resulting content must be reviewed, validated, and justifiable by the contributor. The contributor should be able to explain design and code decisions, answer reviewers questions, and ensure that AI use does not waste reviewers time during review. That being said, the use of AI is not recommended under any circumstances or in any manner.
15. The contributor provides reasonable assurance that the contribution does not infringe third-party copyrights or license terms.
16. A “Valid PR” is one which satisfies the above requirements.
## 6. Process
+2 -8
View File
@@ -56,14 +56,8 @@ Other options are described on the [wiki Download page](https://wiki.freecad.org
Compiling
---------
FreeCAD requires several dependencies to correctly compile for development and
production builds. The following pages contain updated build instructions for
their respective platforms:
- [Linux](https://wiki.freecad.org/Compile_on_Linux)
- [Windows](https://wiki.freecad.org/Compile_on_Windows)
- [macOS](https://wiki.freecad.org/Compile_on_MacOS)
- [MinGW](https://wiki.freecad.org/Compile_on_MinGW)
See the [Developers Handbook Getting Started](https://freecad.github.io/DevelopersHandbook/gettingstarted/)
for build instructions.
Reporting Issues
+41 -9
View File
@@ -1,7 +1,11 @@
# The Qt for Python project officially recommends using pip to install PySide, so we expect to find PySide in the
# site-packages directory. The library will be called "PySide6.abi3.*", and there will be an "include" directory inside
# the site-packages/PySide6. Over time some distros may provide custom versions, so we also support using a more normal
# cMake find_package() call
# The Qt for Python project officially recommends using pip to install PySide,
# so we expect to find PySide in the site-packages directory.
# The library will be called "PySide6.abi3.*", and there will
# be an "include" directory inside the site-packages/PySide6.
# Over time some distros may provide custom versions, so we also support
# using a more normal cMake find_package() call
include(FindPackageHandleStandardArgs)
find_package(PySide6 CONFIG QUIET)
@@ -9,12 +13,40 @@ if(NOT PySide6_FOUND)
find_pip_package(PySide6)
endif()
if(NOT PySide6_INCLUDE_DIRS AND TARGET PySide6::pyside6)
get_property(PySide6_INCLUDE_DIRS TARGET PySide6::pyside6 PROPERTY INTERFACE_INCLUDE_DIRECTORIES)
endif()
if(PySide6_FOUND)
# verify PySide6 version matches Qt6 version (major.minor)
if(PySide6_VERSION AND Qt6_VERSION)
string(REGEX MATCH "^([0-9]+)\\.([0-9]+)" _qt6_major_minor "${Qt6_VERSION}")
string(REGEX MATCH "^([0-9]+)\\.([0-9]+)" _pyside6_major_minor "${PySide6_VERSION}")
# Also provide the old-style variables so we don't have to update everything yet
if (PySide6_FOUND)
message(STATUS "Qt version: ${Qt6_VERSION}")
message(STATUS "PySide version: ${PySide6_VERSION}")
if(NOT _qt6_major_minor STREQUAL _pyside6_major_minor)
message(FATAL_ERROR
" --------------------------------------------------------
Qt/PySide version mismatch!
cmake found Qt: ${Qt6_VERSION}
cmake found PySide: ${PySide6_VERSION}
major.minor versions of Qt and PySide must match to avoid errors.
Ensure CMAKE_PREFIX_PATH points to matching Qt and PySide6 installations.
--------------------------------------------------------"
)
endif()
message(STATUS "PySide/Qt version check passed (${_pyside6_major_minor})")
endif()
if(NOT PySide6_INCLUDE_DIRS AND TARGET PySide6::pyside6)
get_property(PySide6_INCLUDE_DIRS TARGET PySide6::pyside6 PROPERTY INTERFACE_INCLUDE_DIRECTORIES)
endif()
find_package_handle_standard_args(PySide6
REQUIRED_VARS PySide6_INCLUDE_DIRS
VERSION_VAR PySide6_VERSION
)
# Also provide the old-style variables so we don't have to update everything yet
set(PYSIDE_INCLUDE_DIR ${PySide6_INCLUDE_DIRS})
set(PYSIDE_LIBRARY ${PySide6_LIBRARIES})
set(PYSIDE_FOUND TRUE)
+6 -6
View File
@@ -3,11 +3,11 @@
# PYSIDE_RCC_EXECUTABLE - Location of PYSIDE6RCC executable
# PYSIDE_TOOLS_FOUND - PYSIDE6 utilities found.
if (TARGET Qt6::uic)
if(TARGET Qt6::uic)
get_target_property(PYSIDE6_UIC_EXECUTABLE Qt6::uic LOCATION)
set(UICOPTIONS "--generator=python")
endif()
if (TARGET Qt6::rcc)
if(TARGET Qt6::rcc)
get_target_property(PYSIDE6_RCC_EXECUTABLE Qt6::rcc LOCATION)
set(RCCOPTIONS "--generator=python" "--compress-algo=zlib" "--compress=1")
endif()
@@ -18,15 +18,15 @@ set(PySideTools_VERSION 6)
if(PYSIDE_RCC_EXECUTABLE AND PYSIDE_UIC_EXECUTABLE)
set(PYSIDE_TOOLS_FOUND TRUE)
if (NOT PYSIDE6Tools_FIND_QUIETLY)
if(NOT PYSIDE6Tools_FIND_QUIETLY)
message(STATUS "Found PYSIDE6 tools: ${PYSIDE_UIC_EXECUTABLE}, ${PYSIDE_RCC_EXECUTABLE}")
endif ()
endif()
else()
if(PYSIDE6Tools_FIND_REQUIRED)
message(FATAL_ERROR "PYSIDE6 tools could not be found, but are required.")
else()
if (NOT PYSIDE6Tools_FIND_QUIETLY)
if(NOT PYSIDE6Tools_FIND_QUIETLY)
message(STATUS "PYSIDE6 tools: not found.")
endif ()
endif()
endif()
endif()
+2 -2
View File
@@ -10,14 +10,14 @@ if(NOT Shiboken6_FOUND)
endif()
if(NOT Shiboken6_INCLUDE_DIR)
find_pip_package(Shiboken6)
if (Shiboken6_FOUND)
if(Shiboken6_FOUND)
set(SHIBOKEN_LIBRARY ${Shiboken6_LIBRARIES})
set(SHIBOKEN_MAJOR_VERSION 6)
set(SHIBOKEN_FOUND ON)
endif()
# The include directory we actually want is part of shiboken6-generator
find_pip_package(shiboken6_generator)
if (shiboken6_generator_FOUND)
if(shiboken6_generator_FOUND)
set(SHIBOKEN_INCLUDE_DIR ${shiboken6_generator_INCLUDE_DIRS})
endif()
endif()
+16
View File
@@ -7,6 +7,22 @@ macro(SetupFreetype)
message("===============================================================\n"
"FreeType2 not found. Part module will lack of makeWireString().\n"
"===============================================================\n")
else()
# find_package(harfbuzz CONFIG) fails on windows
# lets do it the complicated way instead.
find_path(HARFBUZZ_INCLUDE_DIR hb.h PATH_SUFFIXES harfbuzz)
find_library(HARFBUZZ_LIBRARY NAMES harfbuzz)
if(HARFBUZZ_INCLUDE_DIR AND HARFBUZZ_LIBRARY)
if(NOT TARGET harfbuzz::harfbuzz)
add_library(harfbuzz::harfbuzz UNKNOWN IMPORTED)
set_target_properties(harfbuzz::harfbuzz PROPERTIES
IMPORTED_LOCATION "${HARFBUZZ_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${HARFBUZZ_INCLUDE_DIR}"
)
endif()
else()
message(FATAL_ERROR "HarfBuzz not found")
endif()
endif(NOT FREETYPE_FOUND)
endif(FREECAD_USE_FREETYPE)
@@ -7,7 +7,7 @@ macro(SetupShibokenAndPyside)
if(DEFINED MACPORTS_PREFIX)
find_package(Shiboken REQUIRED HINTS "${PYTHON_LIBRARY_DIR}/cmake")
find_package(PySide REQUIRED HINTS "${PYTHON_LIBRARY_DIR}/cmake")
endif(DEFINED MACPORTS_PREFIX)
endif()
if(FREECAD_QT_MAJOR_VERSION EQUAL 5)
set(SHIBOKEN_MAJOR_VERSION 2)
@@ -21,16 +21,16 @@ macro(SetupShibokenAndPyside)
# Shiboken2Config.cmake may explicitly set CMAKE_BUILD_TYPE to Release which causes
# CMake to fail to create Makefiles for a debug build.
# So as a workaround we save and restore the value after checking for Shiboken2.
set (SAVE_BUILD_TYPE ${CMAKE_BUILD_TYPE})
set(SAVE_BUILD_TYPE ${CMAKE_BUILD_TYPE})
find_package(Shiboken${SHIBOKEN_MAJOR_VERSION} QUIET)
set (CMAKE_BUILD_TYPE ${SAVE_BUILD_TYPE})
if (Shiboken${SHIBOKEN_MAJOR_VERSION}_FOUND)
set(CMAKE_BUILD_TYPE ${SAVE_BUILD_TYPE})
if(Shiboken${SHIBOKEN_MAJOR_VERSION}_FOUND)
# Shiboken config file was found but it may use the wrong Python version
# Try to get the matching config suffix and repeat finding the package
set(SHIBOKEN_PATTERN .cpython-${Python3_VERSION_MAJOR}${Python3_VERSION_MINOR})
file(GLOB SHIBOKEN_CONFIG "${Shiboken${SHIBOKEN_MAJOR_VERSION}_DIR}/Shiboken${SHIBOKEN_MAJOR_VERSION}Config${SHIBOKEN_PATTERN}*.cmake")
if (SHIBOKEN_CONFIG)
if(SHIBOKEN_CONFIG)
get_filename_component(SHIBOKEN_CONFIG_SUFFIX ${SHIBOKEN_CONFIG} NAME)
string(SUBSTRING ${SHIBOKEN_CONFIG_SUFFIX} 15 -1 SHIBOKEN_CONFIG_SUFFIX)
string(REPLACE ".cmake" "" PYTHON_CONFIG_SUFFIX ${SHIBOKEN_CONFIG_SUFFIX})
@@ -47,11 +47,11 @@ macro(SetupShibokenAndPyside)
# to dance to be compatible with the old (<5.12) and the new versions (>=5.12)
if(NOT SHIBOKEN_INCLUDE_DIR AND TARGET Shiboken${SHIBOKEN_MAJOR_VERSION}::libshiboken)
get_property(SHIBOKEN_INCLUDE_DIR TARGET Shiboken${SHIBOKEN_MAJOR_VERSION}::libshiboken PROPERTY INTERFACE_INCLUDE_DIRECTORIES)
endif(NOT SHIBOKEN_INCLUDE_DIR AND TARGET Shiboken${SHIBOKEN_MAJOR_VERSION}::libshiboken)
endif()
if(NOT SHIBOKEN_INCLUDE_DIR)
find_pip_package(Shiboken${SHIBOKEN_MAJOR_VERSION})
if (Shiboken${SHIBOKEN_MAJOR_VERSION}_FOUND)
if(Shiboken${SHIBOKEN_MAJOR_VERSION}_FOUND)
set(SHIBOKEN_INCLUDE_DIR ${Shiboken${SHIBOKEN_MAJOR_VERSION}_INCLUDE_DIRS})
set(SHIBOKEN_LIBRARY ${Shiboken${SHIBOKEN_MAJOR_VERSION}_LIBRARIES})
endif()
@@ -63,11 +63,11 @@ macro(SetupShibokenAndPyside)
# Our internal FindPySide6.cmake file already provides these for PySide6
if(NOT PYSIDE_INCLUDE_DIR AND TARGET PySide${PYSIDE_MAJOR_VERSION}::pyside${PYSIDE_MAJOR_VERSION})
get_property(PYSIDE_INCLUDE_DIR TARGET PySide${PYSIDE_MAJOR_VERSION}::pyside${PYSIDE_MAJOR_VERSION} PROPERTY INTERFACE_INCLUDE_DIRECTORIES)
endif(NOT PYSIDE_INCLUDE_DIR AND TARGET PySide${PYSIDE_MAJOR_VERSION}::pyside${PYSIDE_MAJOR_VERSION})
endif()
if(NOT PYSIDE_INCLUDE_DIR)
find_pip_package(PySide${PYSIDE_MAJOR_VERSION})
if (PySide${PYSIDE_MAJOR_VERSION}_FOUND)
if(PySide${PYSIDE_MAJOR_VERSION}_FOUND)
set(PYSIDE_INCLUDE_DIR ${PySide${PYSIDE_MAJOR_VERSION}_INCLUDE_DIRS})
set(PYSIDE_LIBRARY ${PySide${PYSIDE_MAJOR_VERSION}_LIBRARIES})
endif()
@@ -175,22 +175,22 @@ macro(SetupShibokenAndPyside)
message(STATUS "PySide ${PySide_VERSION} Python module found at ${PRINT_OUTPUT}.\n")
endif()
endmacro(SetupShibokenAndPyside)
endmacro()
MACRO(PYSIDE_WRAP_RC outfiles)
if (NOT PYSIDE_RCC_EXECUTABLE)
macro(PYSIDE_WRAP_RC outfiles)
if(NOT PYSIDE_RCC_EXECUTABLE)
message(FATAL_ERROR "Qt rcc is required for generating ${ARGN}")
endif()
FOREACH(it ${ARGN})
GET_FILENAME_COMPONENT(outfile ${it} NAME_WE)
GET_FILENAME_COMPONENT(infile ${it} ABSOLUTE)
SET(outfile "${CMAKE_CURRENT_BINARY_DIR}/${outfile}_rc.py")
foreach(it ${ARGN})
get_filename_component(outfile ${it} NAME_WE)
get_filename_component(infile ${it} ABSOLUTE)
set(outfile "${CMAKE_CURRENT_BINARY_DIR}/${outfile}_rc.py")
#ADD_CUSTOM_TARGET(${it} ALL
# DEPENDS ${outfile}
#)
if(WIN32 OR APPLE)
ADD_CUSTOM_COMMAND(OUTPUT ${outfile}
add_custom_command(OUTPUT ${outfile}
COMMAND ${PYSIDE_RCC_EXECUTABLE} ${RCCOPTIONS} ${infile} -o ${outfile}
MAIN_DEPENDENCY ${infile}
)
@@ -198,7 +198,7 @@ MACRO(PYSIDE_WRAP_RC outfiles)
# Especially on Open Build Service we don't want changing date like
# pyside-rcc generates in comments at beginning, which is why
# we follow the tool command with in-place sed.
ADD_CUSTOM_COMMAND(OUTPUT "${outfile}"
add_custom_command(OUTPUT "${outfile}"
COMMAND "${PYSIDE_RCC_EXECUTABLE}" ${RCCOPTIONS} "${infile}" ${PY_ATTRIBUTE} -o "${outfile}"
# The line below sometimes catches unwanted lines too - but there is no date in the file
# anymore with Qt5 RCC, so commenting it out for now...
@@ -207,5 +207,5 @@ MACRO(PYSIDE_WRAP_RC outfiles)
)
endif()
list(APPEND ${outfiles} ${outfile})
ENDFOREACH(it)
ENDMACRO (PYSIDE_WRAP_RC)
endforeach()
endmacro()
Binary file not shown.
-2
View File
@@ -57,8 +57,6 @@
test: xvfb-run /usr/bin/FreeCAD -t TestPartGui
/TestPartDesignGui :
test: xvfb-run /usr/bin/FreeCAD -t TestPartDesignGui
/TestSketcherGui :
test: xvfb-run /usr/bin/FreeCAD -t TestSketcherGui
/TestTechDrawGui :
test: xvfb-run /usr/bin/FreeCAD -t TestTechDrawGui
/Workbench :
+1 -1
View File
@@ -31,4 +31,4 @@ else
MAIN="$HERE/usr/bin/freecad"
fi
"${MAIN}" "$@"
exec "${MAIN}" "$@"
+2 -2
View File
@@ -76,9 +76,9 @@ if [ -d "${conda_env}/PlugIns" ]; then
mv ${conda_env}/PlugIns ${conda_env}/..
fi
if [[ "${SIGN_RELEASE}" == "true" ]]; then
if [[ "${MACOS_SIGN_RELEASE}" == "true" ]]; then
# create the signed dmg
../../scripts/macos_sign_and_notarize.zsh -p "FreeCAD" -k ${SIGNING_KEY_ID} -o "${version_name}.dmg"
../../scripts/macos_sign_and_notarize.zsh -p "FreeCAD" -k ${MACOS_SIGNING_KEY_ID} -o "${version_name}.dmg"
else
# Ad-hoc sign for local builds (required for QuickLook extensions to register)
if [ -d "FreeCAD.app/Contents/PlugIns" ]; then
+1 -1
View File
@@ -100,7 +100,7 @@ requirements:
host:
- coin3d
- eigen
- eigen >=3.3,<5
- fmt
- freetype
- hdf5
@@ -44,6 +44,9 @@ find ${copy_dir} -name \*arm\*.exe -delete # arm binaries that fail to extract u
mv ${copy_dir}/bin/Lib/ssl.py .ssl-orig.py
cp ssl-patch.py ${copy_dir}/bin/Lib/ssl.py
# Turn off the echo before we start actually calling "echo"
set +x
echo '[Paths]' >> ${copy_dir}/bin/qt6.conf
echo 'Prefix = ../lib/qt6' >> ${copy_dir}/bin/qt6.conf
@@ -67,6 +70,64 @@ sed -i '1s/.*/\nLIST OF PACKAGES:/' ${copy_dir}/packages.txt
mv ${copy_dir} ${version_name}
# Sign the EXE, DLL, and PYD files (if we can access the Azure account for signing):
set -euo pipefail
SIGN_DIR="${version_name}"
if [[ "${WINDOWS_SIGN_RELEASE:-0}" == "1" ]]; then
TENANT="$(az account show --query tenantId -o tsv)"
export AZURE_IDENTITY_DISABLE_WORKLOAD_IDENTITY=true
export AZURE_IDENTITY_DISABLE_MANAGED_IDENTITY=true
unset AZURE_IDENTITY_LOGGING_ENABLED
if az account get-access-token \
--tenant "$TENANT" \
--scope "https://codesigning.azure.net/.default" \
>/dev/null 2>&1;
then
echo "Azure Artifact Signing access confirmed. Beginning signing process..."
shopt -s nullglob
FILES=(
"$SIGN_DIR"/*.exe
"$SIGN_DIR"/bin/*.exe
"$SIGN_DIR"/bin/*.dll
"$SIGN_DIR"/bin/*.pyd
)
count=0
total=${#FILES[@]}
echo "Signing $total files"
for f in "${FILES[@]}"; do
((count+=1))
echo "Signing [$count/$total]: $f"
sign code artifact-signing \
--artifact-signing-endpoint "${WINDOWS_AZURE_ENDPOINT}" \
--artifact-signing-certificate-profile "${WINDOWS_AZURE_CERTIFICATE_PROFILE}" \
--artifact-signing-account "${WINDOWS_AZURE_SIGNING_ACCOUNT}" \
--timestamp-url https://timestamp.acs.microsoft.com \
--timestamp-digest sha256 \
"$f" >/dev/null 2>&1
# Output was redirected to /dev/null because Azure authentication is absurdly noisy, with constant misleading
# "failure" messages about Managed Identity authentication failing. We don't use, or want to use, that
# authentication, and the fact that it fails is not a problem as long as the real authentication succeeds.
done
# Manually check the important one!
signtool verify -pa "$SIGN_DIR/bin/FreeCAD.exe"
echo "Signing completed."
else
echo "Signing requested, but no Azure Artifact Signing available -- skipping signing."
fi
else
echo "Not logged into Azure -- skipping signing."
fi
7z a -t7z -mx9 -mmt=${NUMBER_OF_PROCESSORS} ${version_name}.7z ${version_name} -bb
# create hash
sha256sum ${version_name}.7z > ${version_name}.7z-SHA256.txt
@@ -88,6 +149,28 @@ if [ "${MAKE_INSTALLER}" == "true" ]; then
-X'SetCompressor /FINAL lzma' \
../../WindowsInstaller/FreeCAD-installer.nsi
mv ../../WindowsInstaller/${version_name}-installer.exe .
echo "Created installer ${version_name}-installer.exe"
# See if we can sign the installer exe as well:
if [[ "${WINDOWS_SIGN_RELEASE:-0}" == "1" ]] && \
az account get-access-token \
--tenant "$TENANT" \
--scope "https://codesigning.azure.net/.default" \
>/dev/null 2>&1;
then
echo "Signing the installer..."
sign code artifact-signing \
--artifact-signing-endpoint "${WINDOWS_AZURE_ENDPOINT}" \
--artifact-signing-certificate-profile "${WINDOWS_AZURE_CERTIFICATE_PROFILE}" \
--artifact-signing-account "${WINDOWS_AZURE_SIGNING_ACCOUNT}" \
--timestamp-url https://timestamp.acs.microsoft.com \
--timestamp-digest sha256 \
${version_name}-installer.exe >/dev/null 2>&1 \
|| { echo "Signing the installer failed!"; exit 1; }
else
echo "No code signing available, leaving the installer unsigned"
fi
sha256sum ${version_name}-installer.exe > ${version_name}-installer.exe-SHA256.txt
else
echo "Error: Failed to get NsProcess plugin. Aborting installer creation..."
@@ -96,8 +179,10 @@ if [ "${MAKE_INSTALLER}" == "true" ]; then
fi
if [ "${UPLOAD_RELEASE}" == "true" ]; then
echo "Uploading the release..."
gh release upload --clobber ${BUILD_TAG} "${version_name}.7z" "${version_name}.7z-SHA256.txt"
if [ "${MAKE_INSTALLER}" == "true" ]; then
gh release upload --clobber ${BUILD_TAG} "${version_name}-installer.exe" "${version_name}-installer.exe-SHA256.txt"
fi
echo "Done uploading"
fi
+2 -1
View File
@@ -19,11 +19,12 @@ debugpy = "*"
defusedxml = "*"
docutils = "*"
doxygen = "*"
eigen = "*"
eigen = ">=3.3,<5"
fmt = "*"
freetype = "*"
git = "*"
graphviz = "*"
harfbuzz = "*"
hdf5 = "*"
ifcopenshell = "*"
lark = "*"
@@ -126,7 +126,11 @@ namespace netgen {
#endif
//extern void OCCSetLocalMeshSize(OCCGeometry & geom, Mesh & mesh);
DLL_HEADER extern MeshingParameters mparam;
DLL_HEADER extern volatile multithreadt multithread;
#if NETGEN_VERSION >= NETGEN_VERSION_STRING(6,2,2601)
using ngcore::multithread;
#else
DLL_HEADER extern volatile multithreadt multithread;
#endif
DLL_HEADER extern bool merge_solids;
}
@@ -112,7 +112,11 @@ namespace netgen {
DLL_HEADER extern int OCCGenerateMesh (OCCGeometry&, Mesh*&, int, int, char*);
#endif
DLL_HEADER extern MeshingParameters mparam;
DLL_HEADER extern volatile multithreadt multithread;
#if NETGEN_VERSION >= NETGEN_VERSION_STRING(6,2,2601)
using ngcore::multithread;
#else
DLL_HEADER extern volatile multithreadt multithread;
#endif
}
using namespace nglib;
using namespace std;
+1 -5
View File
@@ -23,8 +23,7 @@
***************************************************************************/
#ifndef APP_ANNOTATION_H
#define APP_ANNOTATION_H
#pragma once
#include "DocumentObject.h"
#include "PropertyGeo.h"
@@ -74,6 +73,3 @@ public:
};
} // namespace App
#endif // APP_ANNOTATION_H
+188 -175
View File
@@ -34,15 +34,18 @@
# define WINVER 0x502 // needed for SetDllDirectory
# include <Windows.h>
# endif
# include <boost/algorithm/string.hpp>
# include <boost/program_options.hpp>
# include <boost/date_time/posix_time/posix_time.hpp>
# include <boost/scope_exit.hpp>
# include <chrono>
# include <optional>
# include <random>
# include <memory>
# include <utility>
# include <set>
# include <string>
# include <list>
# include <algorithm>
# include <iostream>
@@ -93,6 +96,7 @@
#include <Base/ProgressIndicatorPy.h>
#include <Base/RotationPy.h>
#include <Base/UniqueNameManager.h>
#include <Base/SystemHandler.h>
#include <Base/Tools.h>
#include <Base/Translate.h>
#include <Base/Type.h>
@@ -161,18 +165,38 @@
#include "SafeMode.h"
#ifdef _MSC_VER // New handler for Microsoft Visual C++ compiler
# pragma warning( disable : 4535 )
# if !defined(_DEBUG) && defined(HAVE_SEH)
# define FC_SE_TRANSLATOR
# endif
# include <new.h>
# include <eh.h> // VC exception handling
#else // Ansi C/C++ new handler
# include <new>
#ifdef FC_OS_WIN32
#include <windows.h>
#endif
std::optional<std::string> getenvUTF8(const char* name) {
#ifdef FC_OS_WIN32
int wideLength = MultiByteToWideChar(CP_UTF8, 0, name, -1, nullptr, 0);
std::wstring wideName(wideLength ? wideLength - 1 : 0, L'\0');
if (wideLength) {
MultiByteToWideChar(CP_UTF8, 0, name, -1, wideName.data(), wideLength);
}
DWORD needed = GetEnvironmentVariableW(wideName.c_str(), nullptr, 0);
if (needed == 0) {
return std::nullopt;
}
std::wstring wideValue(needed, L'\0');
DWORD written = GetEnvironmentVariableW(wideName.c_str(), wideValue.data(), needed);
if (written == 0) {
return std::nullopt;
}
wideValue.resize(written);
return Base::Tools::wstringToString(wideValue);
#else
if (const char* v = std::getenv(name)) {
return std::string(v);
}
return std::nullopt;
#endif
}
FC_LOG_LEVEL_INIT("App", true, true)
using namespace App;
@@ -512,6 +536,11 @@ Document* Application::newDocument(const char * proposedName, const char * propo
return doc;
}
bool Application::closeDocument(const Document* doc)
{
return closeDocument(doc->getName());
}
bool Application::closeDocument(const char* name)
{
const auto pos = DocMap.find( name );
@@ -558,6 +587,15 @@ Document* Application::getDocument(const char *Name) const
return pos->second;
}
Document* Application::getDocumentOrActive(const char *Name) const
{
if (!Base::Tools::isNullOrEmpty(Name)) {
return getDocument(Name);
}
else {
return getActiveDocument();
}
}
const char * Application::getDocumentName(const Document* doc) const
{
@@ -957,7 +995,7 @@ Document* Application::openDocumentPrivate(const char * FileName,
// add it to _pendingDocsReopen to delay reloading.
for(auto obj2 : doc->getObjects())
objNames.emplace_back(obj2->getNameInDocument());
_pendingDocMap[doc->FileName.getValue()] = std::move(objNames);
_pendingDocMap[doc->FileName.getValue()] = objNames;
break;
}
}
@@ -1447,6 +1485,93 @@ void Application::addExportType(const char* filter, const char* moduleName)
}
}
namespace {
// To enable changing languages while the program is running, cache the translatable export type
// entries so that their addition can be "replayed" when the language changes (after removing
// the originals).
struct TranslatableTypeCacheEntry {
std::string description;
const std::vector<std::string> extensions;
std::string moduleName;
};
class TranslatableTypeCache {
public:
TranslatableTypeCache() = default;
void addCacheEntry(TranslatableTypeCacheEntry entry) {
_cache.push_back(std::move(entry));
}
std::vector<TranslatableTypeCacheEntry> getCache() const {
return _cache;
}
void clear()
{
_cache.clear();
}
private:
std::vector<TranslatableTypeCacheEntry> _cache;
};
TranslatableTypeCache translatableExportTypeCache;
// Given a description string and a list of extensions, construct a type string that Qt's file
// dialogs will recognize
void appendTypeString(std::string &description, const std::vector<std::string> &extensions) {
description = fmt::format("{} (*.{})", description, fmt::join(extensions, " *."));
}
}
void Application::addTranslatableExportType(const std::string &description,
const std::vector<std::string> &extensions,
const std::string &moduleName)
{
assert(!extensions.empty()); // Programming error, there must be extensions
// Branding: replace "FreeCAD" in a file type description with the branded application name
auto replaceFreeCAD =
[](std::string& s)
{
constexpr std::string_view freecad = "FreeCAD";
if (auto pos = s.find(freecad); pos != std::string::npos) {
s.replace(pos, freecad.size(), getExecutableName());
return true; // Contained the app name
}
return false; // Did NOT contain the app name
};
translatableExportTypeCache.addCacheEntry({description, extensions, moduleName});
auto translatedDescription = QCoreApplication::translate("FileFormat", description.c_str()).toStdString();
bool containsAppName = replaceFreeCAD(translatedDescription); // Run *AFTER* translation
appendTypeString(translatedDescription, extensions);
FileTypeItem item;
item.filter = translatedDescription;
item.module = moduleName;
item.types = extensions;
item.translatable = true;
if (containsAppName) {
// put to the front of the array
_mExportTypes.insert(_mExportTypes.begin(),std::move(item));
}
else {
_mExportTypes.push_back(std::move(item));
}
}
void Application::retranslateExportTypes()
{
auto cache = translatableExportTypeCache.getCache();
translatableExportTypeCache.clear();
std::erase_if(_mExportTypes, [](const FileTypeItem& item) {
return item.translatable;
});
for (const auto &cacheEntry : translatableExportTypeCache.getCache()) {
addTranslatableExportType(cacheEntry.description, cacheEntry.extensions, cacheEntry.moduleName);
}
}
void Application::changeExportModule(const char* filter, const char* oldModuleName, const char* newModuleName)
{
for (auto& it : _mExportTypes) {
@@ -1734,175 +1859,59 @@ void Application::destructObserver()
}
}
/** freecadNewHandler()
* prints an error message and throws an exception
*/
#ifdef _MSC_VER // New handler for Microsoft Visual C++ compiler
int __cdecl freecadNewHandler(size_t size )
namespace
{
// throw an exception
throw Base::MemoryException();
return 0;
}
#else // Ansi C/C++ new handler
static void freecadNewHandler ()
void initExceptions()
{
// throw an exception
throw Base::MemoryException();
// register exception producer types
// NOLINTBEGIN
new Base::ExceptionProducer<Base::AbortException>;
new Base::ExceptionProducer<Base::XMLBaseException>;
new Base::ExceptionProducer<Base::XMLParseException>;
new Base::ExceptionProducer<Base::XMLAttributeError>;
new Base::ExceptionProducer<Base::FileException>;
new Base::ExceptionProducer<Base::FileSystemError>;
new Base::ExceptionProducer<Base::BadFormatError>;
new Base::ExceptionProducer<Base::MemoryException>;
new Base::ExceptionProducer<Base::AccessViolation>;
new Base::ExceptionProducer<Base::AbnormalProgramTermination>;
new Base::ExceptionProducer<Base::UnknownProgramOption>;
new Base::ExceptionProducer<Base::ProgramInformation>;
new Base::ExceptionProducer<Base::TypeError>;
new Base::ExceptionProducer<Base::ValueError>;
new Base::ExceptionProducer<Base::IndexError>;
new Base::ExceptionProducer<Base::NameError>;
new Base::ExceptionProducer<Base::ImportError>;
new Base::ExceptionProducer<Base::AttributeError>;
new Base::ExceptionProducer<Base::RuntimeError>;
new Base::ExceptionProducer<Base::BadGraphError>;
new Base::ExceptionProducer<Base::NotImplementedError>;
new Base::ExceptionProducer<Base::ZeroDivisionError>;
new Base::ExceptionProducer<Base::ReferenceError>;
new Base::ExceptionProducer<Base::ExpressionError>;
new Base::ExceptionProducer<Base::ParserError>;
new Base::ExceptionProducer<Base::UnicodeError>;
new Base::ExceptionProducer<Base::OverflowError>;
new Base::ExceptionProducer<Base::UnderflowError>;
new Base::ExceptionProducer<Base::UnitsMismatchError>;
new Base::ExceptionProducer<Base::CADKernelError>;
new Base::ExceptionProducer<Base::RestoreError>;
new Base::ExceptionProducer<Base::PropertyError>;
// NOLINTEND
}
#endif
#if defined(FC_OS_LINUX)
#include <execinfo.h>
#include <dlfcn.h>
#include <cxxabi.h>
#include <cstdio>
#include <cstdlib>
#include <string>
#include <sstream>
#if HAVE_CONFIG_H
#include <config.h>
#endif // HAVE_CONFIG_H
// This function produces a stack backtrace with demangled function & method names.
void printBacktrace(size_t skip=0)
{
#if defined HAVE_BACKTRACE_SYMBOLS
void *callstack[128];
size_t nMaxFrames = sizeof(callstack) / sizeof(callstack[0]);
size_t nFrames = backtrace(callstack, nMaxFrames);
char **symbols = backtrace_symbols(callstack, nFrames);
for (size_t i = skip; i < nFrames; i++) {
char *demangled = nullptr;
int status = -1;
Dl_info info;
if (dladdr(callstack[i], &info) && info.dli_sname && info.dli_fname) {
if (info.dli_sname[0] == '_') {
demangled = abi::__cxa_demangle(info.dli_sname, nullptr, nullptr, &status);
}
}
std::stringstream str;
if (status == 0) {
void* offset = (void*)((char*)callstack[i] - (char*)info.dli_saddr);
str << "#" << (i-skip) << " " << callstack[i] << " in " << demangled << " from " << info.dli_fname << "+" << offset << '\n';
free(demangled);
}
else {
str << "#" << (i-skip) << " " << symbols[i] << '\n';
}
// cannot directly print to cerr when using --write-log
std::cerr << str.str();
}
free(symbols);
#else //HAVE_BACKTRACE_SYMBOLS
(void)skip;
std::cerr << "Cannot print the stacktrace because the C runtime library doesn't provide backtrace or backtrace_symbols\n";
#endif
}
#endif
void segmentation_fault_handler(int sig)
{
#if defined(FC_OS_LINUX)
(void)sig;
std::cerr << "Program received signal SIGSEGV, Segmentation fault.\n";
printBacktrace(2);
#if defined(FC_DEBUG)
abort();
#else
_exit(1);
#endif
#else
switch (sig) {
case SIGSEGV:
std::cerr << "Illegal storage access..." << '\n';
#if !defined(_DEBUG)
throw Base::AccessViolation("Illegal storage access! Please save your work under a new file name and restart the application!");
#endif
break;
case SIGABRT:
std::cerr << "Abnormal program termination..." << '\n';
#if !defined(_DEBUG)
throw Base::AbnormalProgramTermination("Break signal occurred");
#endif
break;
default:
std::cerr << "Unknown error occurred..." << '\n';
break;
}
#endif // FC_OS_LINUX
}
void unhandled_exception_handler()
{
std::cerr << "Terminating..." << '\n';
}
void unexpection_error_handler()
{
std::cerr << "Unexpected error occurred..." << '\n';
// try to throw an exception and give the user chance to save their work
#if !defined(_DEBUG)
throw Base::AbnormalProgramTermination("Unexpected error occurred! Please save your work under a new file name and restart the application!");
#else
terminate();
#endif
}
#if defined(FC_SE_TRANSLATOR) // Microsoft compiler
void my_se_translator_filter(unsigned int code, EXCEPTION_POINTERS* pExp)
{
Q_UNUSED(pExp)
switch (code)
{
case EXCEPTION_ACCESS_VIOLATION:
throw Base::AccessViolation();
case EXCEPTION_FLT_DIVIDE_BY_ZERO:
case EXCEPTION_INT_DIVIDE_BY_ZERO:
Base::Console().error("SEH exception (%u): Division by zero\n", code);
return;
}
std::stringstream str;
str << "SEH exception of type: " << code;
// general C++ SEH exception for things we don't need to handle separately....
throw Base::RuntimeError(str.str());
}
#endif
void Application::init(int argc, char ** argv)
{
try {
// install our own new handler
#ifdef _MSC_VER // Microsoft compiler
_set_new_handler ( freecadNewHandler ); // Setup new handler
_set_new_mode( 1 ); // Re-route malloc failures to new handler !
#else // Ansi compiler
std::set_new_handler (freecadNewHandler); // ANSI new handler
#endif
// if an unexpected crash occurs we can install a handler function to
// write some additional information
#if defined (_MSC_VER) // Microsoft compiler
std::signal(SIGSEGV,segmentation_fault_handler);
std::signal(SIGABRT,segmentation_fault_handler);
std::set_terminate(unhandled_exception_handler);
::set_unexpected(unexpection_error_handler);
#elif defined(FC_OS_LINUX)
std::signal(SIGSEGV,segmentation_fault_handler);
#endif
#if defined(FC_SE_TRANSLATOR)
_set_se_translator(my_se_translator_filter);
#endif
Base::SystemHandler::installNewHandler();
Base::SystemHandler::installSegfaultHandler();
initTypes();
initConfig(argc,argv);
initApplication();
initExceptions();
}
catch (...) {
// force the log to flush
@@ -2142,6 +2151,7 @@ void Application::initTypes()
(DocumentObject::getClassTypeId());
// register exception producer types
// NOLINTBEGIN
new Base::ExceptionProducer<Base::AbortException>;
new Base::ExceptionProducer<Base::XMLBaseException>;
new Base::ExceptionProducer<Base::XMLParseException>;
@@ -2174,6 +2184,7 @@ void Application::initTypes()
new Base::ExceptionProducer<Base::CADKernelError>;
new Base::ExceptionProducer<Base::RestoreError>;
new Base::ExceptionProducer<Base::PropertyError>;
// NOLINTEND
Base::registerServiceImplementation<CenterOfMassProvider>(new NullCenterOfMass);
}
@@ -2490,7 +2501,9 @@ void processProgramOptions(const boost::program_options::variables_map& vm, std:
void Application::initConfig(int argc, char ** argv)
{
// find the home path....
mConfig["AppHomePath"] = ApplicationDirectories::findHomePath(argv[0]).string();
mConfig["AppHomePath"] = Base::FileInfo::pathToString(
ApplicationDirectories::findHomePath(argv[0])
);
// Version of the application extracted from SubWCRef into src/Build/Version.h
// We only set these keys if not yet defined. Therefore it suffices to search
@@ -2737,9 +2750,9 @@ void Application::initConfig(int argc, char ** argv)
void Application::SaveEnv(const char* s)
{
const char *c = getenv(s);
if (c)
mConfig[s] = c;
if (auto c = getenvUTF8(s)) {
mConfig[s] = c.value();
}
}
void Application::initApplication()
@@ -3416,9 +3429,9 @@ std::string Application::FindHomePath(const char* sCall)
}
// should be an absolute path now
std::string::size_type pos = absPath.find_last_of("/");
std::string::size_type pos = absPath.find_last_of('/');
homePath.assign(absPath,0,pos);
pos = homePath.find_last_of("/");
pos = homePath.find_last_of('/');
homePath.assign(homePath,0,pos+1);
return homePath;
@@ -3611,7 +3624,7 @@ void Application::getVerboseCommonInfo(QTextStream& str, const std::map<std::str
const QString deskSess =
QProcessEnvironment::systemEnvironment().value(QStringLiteral("DESKTOP_SESSION"),
QString());
const QString major = getValueOrEmpty(mConfig, "BuildVersionMajor");
const QString minor = getValueOrEmpty(mConfig, "BuildVersionMinor");
const QString point = getValueOrEmpty(mConfig, "BuildVersionPoint");
+79 -32
View File
@@ -23,8 +23,7 @@
* *
***************************************************************************/
#ifndef SRC_APP_APPLICATION_H_
#define SRC_APP_APPLICATION_H_
#pragma once
#include <fastsignals/signal.h>
#include <QtCore/qtextstream.h>
@@ -36,10 +35,12 @@
#include <set>
#include <map>
#include <string>
#include <optional>
#include <Base/Observer.h>
#include <Base/Parameter.h>
#include <Base/ProgressIndicator.h>
#include "TransactionDefs.h"
// forward declarations
using PyObject = struct _object;
@@ -129,6 +130,15 @@ public:
App::Document* newDocument(const char* proposedName = nullptr,
const char* proposedLabel = nullptr,
DocumentInitFlags CreateFlags = DocumentInitFlags());
/**
* @brief Closes the document and removes it from the application.
*
* @param[in] doc The document to close.
* @return Returns true if the document was found and closed, false otherwise.
*/
bool closeDocument(const Document* doc);
/**
* @brief Closes the document and removes it from the application.
*
@@ -195,6 +205,8 @@ public:
*/
App::Document* getDocument(const char *Name) const;
App::Document* getDocumentOrActive(const char *Name) const;
/// %Path matching modes for getDocumentByPath()
enum class PathMatchMode
{
@@ -281,9 +293,11 @@ public:
/**
* @brief Setup a pending application-wide active transaction.
*
* Call this function to setup an application-wide transaction. All current
* pending transactions of opening documents will be committed first.
* However, no new transaction is created by this call. Any subsequent
* Call this function to setup a transaction in the currently active document
* if no document is active, a global transaction is created. If the current
* active document already has a transaction setup it will either commit the
* current transaction or rename it, depending on the tmpName flag of the
* currently setup transaction. No new transaction is created by this call. Any subsequent
* changes in any current opening document will auto create a transaction
* with the given name and ID. If more than one document is changed, the
* transactions will share the same ID, and will be undo/redo together.
@@ -295,32 +309,45 @@ public:
*
* @return The new transaction ID.
*/
int setActiveTransaction(const char* name, bool persist = false);
/**
* @brief Get the current active transaction name and ID.
int setActiveTransaction(TransactionName name);
/// Return the current global transaction name and ID if such a global transaction is
/// setup (uncommon)
std::string getActiveTransaction(int *tid=nullptr) const;
int openGlobalTransaction(TransactionName name);
int getGlobalTransaction() const;
bool transactionIsActive(int tid) const;
std::string getTransactionName(int tid) const;
bool transactionTmpName(int tid) const;
Document* transactionInitiator(int tid) const;
std::optional<TransactionDescription> transactionDescription(int tid) const;
void setTransactionDescription(int tid, const TransactionDescription& desc);
void setTransactionName(int tid, const TransactionName& name);
/** Commit/abort current active transactions
*
* If there is no active transaction, an empty string is returned.
*
* @param[out] tid If not `nullptr`, the current active transaction ID is
* returned through this pointer.
* @return The current active transaction name.
*/
const char* getActiveTransaction(int* tid = nullptr) const;
/**
* @brief Commit/abort current active transactions.
*
* @param[in] abort: whether to abort or commit the transactions
* @param[in] id: by default 0 meaning that the current active transaction ID is used.
*
* Besides calling this function directly, it will be called by
* automatically if 1) any new transaction is created with a different ID,
* or 2) any transaction with the current active transaction ID is either
* committed or aborted.
* @param[in] id: by default 0 meaning that the current global transaction ID is used.
*
* Bsides calling this function directly, it will be called by automatically
* if 1) any new transaction is created with a different ID, or 2) any
* transaction with the current active transaction ID is either committed or
* aborted
* returns true if it succeeded in closing the transaction
*/
void closeActiveTransaction(bool abort=false, int id=0);
/// @}
bool closeActiveTransaction(TransactionCloseMode mode = TransactionCloseMode::Commit, int id=0);
/// Internally call closeActiveTransaction(), but it makes the call site clearer
bool commitTransaction(int tid);
bool abortTransaction(int tid);
//@}
// NOLINTBEGIN
// clang-format off
@@ -595,6 +622,22 @@ public:
*/
void addExportType(const char* filter, const char* moduleName);
/**
* @brief Register an export filetype with a translatable description
*
* @param[in] description A translatable string describing the file type. Must not contain the
* list of extensions.
* @param[in] extensions A list of supported extensions. Do not include the "*.", only the
* extension itself. For example, "txt", not "*.txt".
* @param[in] moduleName The name of the module handling the export.
*/
void addTranslatableExportType(const std::string &description,
const std::vector<std::string> &extensions,
const std::string &moduleName);
/// Intended to be called when the language is changed, this retranslates the export type.
void retranslateExportTypes();
/**
* @copydoc changeImportModule
*/
@@ -987,6 +1030,7 @@ private:
std::string filter;
std::string module;
std::vector<std::string> types;
bool translatable = false;
};
// open ending information
@@ -1015,10 +1059,16 @@ private:
friend class AutoTransaction;
std::string _activeTransactionName;
int _activeTransactionID{0};
int _activeTransactionGuard{0};
bool _activeTransactionTmpName{false};
std::map<int, TransactionDescription> _activeTransactionDescriptions; // Maps transaction ID to transaction name
int currentlyClosingID {0};
// This is the transaction ID for a global transaction
// Documents will take this ID if it is non-zero
// and generate their own otherwise
int _globalTransactionID { 0 };
bool _globalTransactionTmpName {false};
std::string _globalTransactionName;
Base::ProgressIndicator _progressIndicator;
@@ -1035,6 +1085,3 @@ inline App::Application &GetApplication(){
}
} // namespace App
#endif // SRC_APP_APPLICATION_H_
+13 -6
View File
@@ -80,12 +80,16 @@ const fs::path& ApplicationDirectories::getTempPath() const {
return this->_temp;
}
fs::path ApplicationDirectories::getTempFileName(const std::string & filename) const {
fs::path ApplicationDirectories::getTempFileName(const std::string & filename) const
{
auto tempPath = Base::FileInfo::pathToString(getTempPath());
if (filename.empty()) {
return Base::FileInfo::getTempFileName(nullptr, tempPath.c_str());
return Base::FileInfo::stringToPath(Base::FileInfo::getTempFileName(nullptr, tempPath.c_str())
);
}
return Base::FileInfo::getTempFileName(filename.c_str(), tempPath.c_str());
return Base::FileInfo::stringToPath(
Base::FileInfo::getTempFileName(filename.c_str(), tempPath.c_str())
);
}
const fs::path& ApplicationDirectories::getUserCachePath() const
@@ -138,7 +142,10 @@ fs::path ApplicationDirectories::findPath(const fs::path& stdHome, const fs::pat
// If a custom user home path is given, then don't modify it
if (customHome.empty()) {
for (const auto& it : subdirs) {
appData = appData / it;
if (!it.empty()) {
// Refuse to add an empty directory path component
appData = appData / it;
}
}
}
@@ -179,7 +186,7 @@ void ApplicationDirectories::configurePaths(std::map<std::string,std::string>& m
bool keepDeprecatedPaths = mConfig.contains("KeepDeprecatedPaths");
// std paths
_home = fs::path(mConfig.at("AppHomePath"));
_home = Base::FileInfo::stringToPath(mConfig.at("AppHomePath"));
mConfig["BinPath"] = mConfig.at("AppHomePath") + "bin" + PATHSEP;
mConfig["DocPath"] = mConfig.at("AppHomePath") + "doc" + PATHSEP;
@@ -295,7 +302,7 @@ void ApplicationDirectories::configureResourceDirectory(const std::map<std::stri
_resource = Base::FileInfo::stringToPath(mConfig.at("AppHomePath")) / path;
}
#else
_resource = fs::path(mConfig.at("AppHomePath"));
_resource = Base::FileInfo::stringToPath(mConfig.at("AppHomePath"));
#endif
}
+1 -4
View File
@@ -20,8 +20,7 @@
* *
**************************************************************************************************/
#ifndef SRC_APP_APPLICATIONDIRECTORIES_H_
#define SRC_APP_APPLICATIONDIRECTORIES_H_
#pragma once
#include "FCConfig.h"
#include "FCGlobal.h"
@@ -257,5 +256,3 @@ namespace App {
};
} // App
#endif //SRC_APP_APPLICATIONDIRECTORIES_H_
+185 -111
View File
@@ -48,6 +48,7 @@ using namespace App;
//**************************************************************************
// Python stuff
// NOLINTBEGIN
// Application methods structure
PyMethodDef ApplicationPy::Methods[] = {
{"ParamGet", (PyCFunction)ApplicationPy::sGetParam, METH_VARARGS, "Get parameters by path"},
@@ -88,6 +89,12 @@ PyMethodDef ApplicationPy::Methods[] = {
(PyCFunction)ApplicationPy::sAddExportType,
METH_VARARGS,
"Register filetype for export"},
{"addTranslatableExportType",
(PyCFunction)ApplicationPy::sAddTranslatableExportType,
METH_VARARGS,
"addTranslatableExportType(description:str, extensions:list[str], module_name:str)\n\n"
"Register filetype with translatable description for export. Description should be a\n"
"string registered with the translation system using the 'FileFormat' context."},
{"changeExportModule",
(PyCFunction)ApplicationPy::sChangeExportModule,
METH_VARARGS,
@@ -158,9 +165,6 @@ PyMethodDef ApplicationPy::Methods[] = {
" In this case the document is kept alive.\n"
"hidden: whether to hide document 3D view.\n"
"temporary: whether to hide document in the tree view."},
// {"saveDocument", (PyCFunction) ApplicationPy::sSaveDocument, METH_VARARGS,
// "saveDocument(string) -- Save the document to a file."},
// {"saveDocumentAs", (PyCFunction) ApplicationPy::sSaveDocumentAs, METH_VARARGS},
{"newDocument",
reinterpret_cast<PyCFunction>(reinterpret_cast<void (*)()>(ApplicationPy::sNewDocument)),
METH_VARARGS | METH_KEYWORDS,
@@ -238,9 +242,7 @@ PyMethodDef ApplicationPy::Methods[] = {
METH_VARARGS,
"setActiveTransaction(name, persist=False) -- setup active transaction with the given name\n\n"
"name: the transaction name\n"
"persist(False): by default, if the calling code is inside any invocation of a command, it\n"
" will be auto closed once all commands within the current stack exists. To\n"
" disable auto closing, set persist=True\n"
"persist(False): This parameter has no effect and is kept for compatibility reasonss"
"Returns the transaction ID for the active transaction. An application-wide\n"
"active transaction causes any document changes to open a transaction with\n"
"the given name and ID."},
@@ -268,11 +270,12 @@ PyMethodDef ApplicationPy::Methods[] = {
"trigger a Base.FreeCADAbort exception."},
{nullptr, nullptr, 0, nullptr} /* Sentinel */
};
// NOLINTEND
// NOLINTBEGIN(cppcoreguidelines-pro-type-*)
PyObject* ApplicationPy::sLoadFile(PyObject* /*self*/, PyObject* args)
{
const char* path;
const char* path = "";
const char* doc = "";
const char* mod = "";
if (!PyArg_ParseTuple(args, "s|ss", &path, &doc, &mod)) {
@@ -293,9 +296,8 @@ PyObject* ApplicationPy::sLoadFile(PyObject* /*self*/, PyObject* args)
PyErr_Format(PyExc_IOError, "Filetype %s is not supported.", ext.c_str());
return nullptr;
}
else {
module = modules.front();
}
module = modules.front();
}
// path could contain characters that need escaping, such as quote signs
@@ -340,7 +342,7 @@ PyObject* ApplicationPy::sIsRestoring(PyObject* /*self*/, PyObject* args)
PyObject* ApplicationPy::sOpenDocument(PyObject* /*self*/, PyObject* args, PyObject* kwd)
{
char* Name;
char* Name {};
PyObject* hidden = Py_False;
PyObject* temporary = Py_False;
static const std::array<const char*, 4> kwlist {"name", "hidden", "temporary", nullptr};
@@ -439,31 +441,54 @@ PyObject* ApplicationPy::sSetActiveDocument(PyObject* /*self*/, PyObject* args)
PyObject* ApplicationPy::sCloseDocument(PyObject* /*self*/, PyObject* args)
{
char* pstr = nullptr;
if (!PyArg_ParseTuple(args, "s", &pstr)) {
return nullptr;
if (PyArg_ParseTuple(args, "s", &pstr)) {
Document* doc = GetApplication().getDocument(pstr);
if (!doc) {
PyErr_Format(PyExc_NameError, "Unknown document '%s'", pstr);
return nullptr;
}
if (!doc->isClosable()) {
PyErr_Format(PyExc_RuntimeError, "The document '%s' is not closable for the moment", pstr);
return nullptr;
}
if (!GetApplication().closeDocument(pstr)) {
PyErr_Format(PyExc_RuntimeError, "Closing the document '%s' failed", pstr);
return nullptr;
}
Py_Return;
}
Document* doc = GetApplication().getDocument(pstr);
if (!doc) {
PyErr_Format(PyExc_NameError, "Unknown document '%s'", pstr);
return nullptr;
}
if (!doc->isClosable()) {
PyErr_Format(PyExc_RuntimeError, "The document '%s' is not closable for the moment", pstr);
return nullptr;
PyErr_Clear();
PyObject* docpy {};
if (PyArg_ParseTuple(args, "O!", &App::DocumentPy::Type, &docpy)) {
Document* doc = static_cast<App::DocumentPy*>(docpy)->getDocumentPtr();
if (!doc) {
PyErr_Format(PyExc_RuntimeError, "Invalid document");
return nullptr;
}
if (!doc->isClosable()) {
PyErr_Format(PyExc_RuntimeError, "The document '%s' is not closable for the moment", doc->getName());
return nullptr;
}
if (!GetApplication().closeDocument(doc)) {
PyErr_Format(PyExc_RuntimeError, "Closing the document '%s' failed", doc->getName());
return nullptr;
}
Py_Return;
}
if (!GetApplication().closeDocument(pstr)) {
PyErr_Format(PyExc_RuntimeError, "Closing the document '%s' failed", pstr);
return nullptr;
}
Py_Return;
PyErr_SetString(PyExc_TypeError, "Expect str or Document");
return nullptr;
}
PyObject* ApplicationPy::sSaveDocument(PyObject* /*self*/, PyObject* args)
{
char* pDoc;
char* pDoc {};
if (!PyArg_ParseTuple(args, "s", &pDoc)) {
return nullptr;
}
@@ -493,10 +518,9 @@ PyObject* ApplicationPy::sActiveDocument(PyObject* /*self*/, PyObject* args)
if (doc) {
return doc->getPyObject();
}
else {
Py_INCREF(Py_None);
return Py_None;
}
Py_INCREF(Py_None);
return Py_None;
}
PyObject* ApplicationPy::sGetDocument(PyObject* /*self*/, PyObject* args)
@@ -545,7 +569,7 @@ PyObject* ApplicationPy::sSaveParameter(PyObject* /*self*/, PyObject* args)
PyErr_SetString(PyExc_ValueError, str.str().c_str());
return nullptr;
}
else if (!param->HasSerializer()) {
if (!param->HasSerializer()) {
std::stringstream str;
str << "Parameter set cannot be serialized: " << pstr;
PyErr_SetString(PyExc_RuntimeError, str.str().c_str());
@@ -562,21 +586,21 @@ PyObject* ApplicationPy::sSaveParameter(PyObject* /*self*/, PyObject* args)
PyObject* ApplicationPy::sGetConfig(PyObject* /*self*/, PyObject* args)
{
char* pstr;
char* pstr {};
if (!PyArg_ParseTuple(args, "s", &pstr)) {
return nullptr;
}
const std::map<std::string, std::string>& Map = GetApplication().Config();
std::map<std::string, std::string>::const_iterator it = Map.find(pstr);
const std::map<std::string, std::string>& Map = Application::Config();
auto it = Map.find(pstr);
if (it != Map.end()) {
return Py_BuildValue("s", it->second.c_str());
}
else {
// do not set an error because this may break existing python code
return PyUnicode_FromString("");
}
// do not set an error because this may break existing python code
return PyUnicode_FromString("");
}
PyObject* ApplicationPy::sDumpConfig(PyObject* /*self*/, PyObject* args)
@@ -586,7 +610,7 @@ PyObject* ApplicationPy::sDumpConfig(PyObject* /*self*/, PyObject* args)
}
PyObject* dict = PyDict_New();
for (const auto& It : GetApplication().Config()) {
for (const auto& It : Application::Config()) {
PyDict_SetItemString(dict, It.first.c_str(), PyUnicode_FromString(It.second.c_str()));
}
return dict;
@@ -594,13 +618,14 @@ PyObject* ApplicationPy::sDumpConfig(PyObject* /*self*/, PyObject* args)
PyObject* ApplicationPy::sSetConfig(PyObject* /*self*/, PyObject* args)
{
char *pstr, *pstr2;
char *pstr {};
char *pstr2 {};
if (!PyArg_ParseTuple(args, "ss", &pstr, &pstr2)) {
return nullptr;
}
GetApplication().Config()[pstr] = pstr2;
Application::Config()[pstr] = pstr2;
Py_INCREF(Py_None);
return Py_None;
@@ -649,7 +674,8 @@ PyObject* ApplicationPy::sGetVersion(PyObject* /*self*/, PyObject* args)
PyObject* ApplicationPy::sAddImportType(PyObject* /*self*/, PyObject* args)
{
char *psKey, *psMod;
char *psKey {};
char *psMod {};
if (!PyArg_ParseTuple(args, "ss", &psKey, &psMod)) {
return nullptr;
@@ -662,7 +688,9 @@ PyObject* ApplicationPy::sAddImportType(PyObject* /*self*/, PyObject* args)
PyObject* ApplicationPy::sChangeImportModule(PyObject* /*self*/, PyObject* args)
{
char *key, *oldMod, *newMod;
char *key {};
char *oldMod {};
char *newMod {};
if (!PyArg_ParseTuple(args, "sss", &key, &oldMod, &newMod)) {
return nullptr;
@@ -690,33 +718,33 @@ PyObject* ApplicationPy::sGetImportType(PyObject* /*self*/, PyObject* args)
return Py::new_reference_to(list);
}
else {
Py::Dict dict;
std::vector<std::string> types = GetApplication().getImportTypes();
for (const auto& it : types) {
std::vector<std::string> modules = GetApplication().getImportModules(it.c_str());
if (modules.empty()) {
dict.setItem(it.c_str(), Py::None());
}
else if (modules.size() == 1) {
dict.setItem(it.c_str(), Py::String(modules.front()));
}
else {
Py::List list;
for (const auto& jt : modules) {
list.append(Py::String(jt));
}
dict.setItem(it.c_str(), list);
}
}
return Py::new_reference_to(dict);
Py::Dict dict;
std::vector<std::string> types = GetApplication().getImportTypes();
for (const auto& it : types) {
std::vector<std::string> modules = GetApplication().getImportModules(it.c_str());
if (modules.empty()) {
dict.setItem(it.c_str(), Py::None());
}
else if (modules.size() == 1) {
dict.setItem(it.c_str(), Py::String(modules.front()));
}
else {
Py::List list;
for (const auto& jt : modules) {
list.append(Py::String(jt));
}
dict.setItem(it.c_str(), list);
}
}
return Py::new_reference_to(dict);
}
PyObject* ApplicationPy::sAddExportType(PyObject* /*self*/, PyObject* args)
{
char *psKey, *psMod;
char *psKey {};
char *psMod {};
if (!PyArg_ParseTuple(args, "ss", &psKey, &psMod)) {
return nullptr;
@@ -727,9 +755,52 @@ PyObject* ApplicationPy::sAddExportType(PyObject* /*self*/, PyObject* args)
Py_Return;
}
PyObject* ApplicationPy::sAddTranslatableExportType(PyObject* /*self*/, PyObject* args)
{
char *description {};
PyObject *pyExtensions {};
char *moduleName {};
if (!PyArg_ParseTuple(args, "sOs", &description, &pyExtensions, &moduleName)) {
return nullptr;
}
if (!PyList_Check(pyExtensions)) {
PyErr_SetString(PyExc_TypeError,
"Expected a list of strings as second argument");
return nullptr;
}
Py_ssize_t n = PyList_Size(pyExtensions);
std::vector<std::string> extensions;
for (Py_ssize_t i = 0; i < n; ++i) {
PyObject *item = PyList_GetItem(pyExtensions, i);
if (!PyUnicode_Check(item)) {
PyErr_SetString(PyExc_TypeError,
"Extensions list elements must be strings");
return nullptr;
}
const char *value = PyUnicode_AsUTF8(item);
if (!value) {
return nullptr;
}
extensions.emplace_back(value);
}
GetApplication().addTranslatableExportType(description, extensions, moduleName);
Py_Return;
}
PyObject* ApplicationPy::sChangeExportModule(PyObject* /*self*/, PyObject* args)
{
char *key, *oldMod, *newMod;
char *key {};
char *oldMod {};
char *newMod {};
if (!PyArg_ParseTuple(args, "sss", &key, &oldMod, &newMod)) {
return nullptr;
@@ -757,28 +828,27 @@ PyObject* ApplicationPy::sGetExportType(PyObject* /*self*/, PyObject* args)
return Py::new_reference_to(list);
}
else {
Py::Dict dict;
std::vector<std::string> types = GetApplication().getExportTypes();
for (const auto& it : types) {
std::vector<std::string> modules = GetApplication().getExportModules(it);
if (modules.empty()) {
dict.setItem(it.c_str(), Py::None());
}
else if (modules.size() == 1) {
dict.setItem(it.c_str(), Py::String(modules.front()));
}
else {
Py::List list;
for (const auto& jt : modules) {
list.append(Py::String(jt));
}
dict.setItem(it.c_str(), list);
}
}
return Py::new_reference_to(dict);
Py::Dict dict;
std::vector<std::string> types = GetApplication().getExportTypes();
for (const auto& it : types) {
std::vector<std::string> modules = GetApplication().getExportModules(it.c_str());
if (modules.empty()) {
dict.setItem(it.c_str(), Py::None());
}
else if (modules.size() == 1) {
dict.setItem(it.c_str(), Py::String(modules.front()));
}
else {
Py::List list;
for (const auto& jt : modules) {
list.append(Py::String(jt));
}
dict.setItem(it.c_str(), list);
}
}
return Py::new_reference_to(dict);
}
PyObject* ApplicationPy::sGetResourcePath(PyObject* /*self*/, PyObject* args)
@@ -889,8 +959,8 @@ PyObject* ApplicationPy::sListDocuments(PyObject* /*self*/, PyObject* args)
PY_TRY
{
PyObject* pDict = PyDict_New();
PyObject* pKey;
Base::PyObjectBase* pValue;
PyObject* pKey {};
Base::PyObjectBase* pValue {};
std::vector<Document*> docs = GetApplication().getDocuments();
;
@@ -914,7 +984,7 @@ PyObject* ApplicationPy::sListDocuments(PyObject* /*self*/, PyObject* args)
PyObject* ApplicationPy::sAddDocObserver(PyObject* /*self*/, PyObject* args)
{
PyObject* o;
PyObject* o {};
if (!PyArg_ParseTuple(args, "O", &o)) {
return nullptr;
}
@@ -928,7 +998,7 @@ PyObject* ApplicationPy::sAddDocObserver(PyObject* /*self*/, PyObject* args)
PyObject* ApplicationPy::sRemoveDocObserver(PyObject* /*self*/, PyObject* args)
{
PyObject* o;
PyObject* o {};
if (!PyArg_ParseTuple(args, "O", &o)) {
return nullptr;
}
@@ -942,14 +1012,14 @@ PyObject* ApplicationPy::sRemoveDocObserver(PyObject* /*self*/, PyObject* args)
PyObject* ApplicationPy::sSetLogLevel(PyObject* /*self*/, PyObject* args)
{
char* tag;
PyObject* pcObj;
char* tag {};
PyObject* pcObj {};
if (!PyArg_ParseTuple(args, "sO", &tag, &pcObj)) {
return nullptr;
}
PY_TRY
{
int l;
int l {};
if (PyUnicode_Check(pcObj)) {
const char* pstr = PyUnicode_AsUTF8(pcObj);
if (strcmp(pstr, "Log") == 0) {
@@ -978,7 +1048,7 @@ PyObject* ApplicationPy::sSetLogLevel(PyObject* /*self*/, PyObject* args)
}
}
else {
l = PyLong_AsLong(pcObj);
l = static_cast<int>(PyLong_AsLong(pcObj));
}
GetApplication()
.GetParameterGroupByPath("User parameter:BaseApp/LogLevels")
@@ -1008,7 +1078,7 @@ PyObject* ApplicationPy::sSetLogLevel(PyObject* /*self*/, PyObject* args)
PyObject* ApplicationPy::sGetLogLevel(PyObject* /*self*/, PyObject* args)
{
char* tag;
char* tag {};
if (!PyArg_ParseTuple(args, "s", &tag)) {
return nullptr;
}
@@ -1018,7 +1088,7 @@ PyObject* ApplicationPy::sGetLogLevel(PyObject* /*self*/, PyObject* args)
int l = -1;
if (strcmp(tag, "Default") == 0) {
#ifdef FC_DEBUG
l = GetApplication().GetUserParameter().GetGroup("BaseApp/LogLevels")->GetInt(tag, -1);
l = static_cast<int>(GetApplication().GetUserParameter().GetGroup("BaseApp/LogLevels")->GetInt(tag, -1));
#endif
}
else if (strcmp(tag, "DebugDefault") == 0) {
@@ -1071,7 +1141,7 @@ PyObject* ApplicationPy::sGetLinksTo(PyObject* /*self*/, PyObject* args)
}
auto links = GetApplication().getLinksTo(obj, options, count);
Py::Tuple ret(links.size());
Py::Tuple ret(static_cast<int>(links.size()));
int i = 0;
for (auto o : links) {
ret.setItem(i++, Py::Object(o->getPyObject(), true));
@@ -1084,7 +1154,7 @@ PyObject* ApplicationPy::sGetLinksTo(PyObject* /*self*/, PyObject* args)
PyObject* ApplicationPy::sGetDependentObjects(PyObject* /*self*/, PyObject* args)
{
PyObject* obj;
PyObject* obj {};
int options = 0;
if (!PyArg_ParseTuple(args, "O|i", &obj, &options)) {
return nullptr;
@@ -1093,13 +1163,13 @@ PyObject* ApplicationPy::sGetDependentObjects(PyObject* /*self*/, PyObject* args
std::vector<App::DocumentObject*> objs;
if (PySequence_Check(obj)) {
Py::Sequence seq(obj);
for (Py_ssize_t i = 0; i < seq.size(); ++i) {
if (!PyObject_TypeCheck(seq[i].ptr(), &DocumentObjectPy::Type)) {
for (const auto& py : seq) {
if (!PyObject_TypeCheck(py.ptr(), &DocumentObjectPy::Type)) {
PyErr_SetString(PyExc_TypeError,
"Expect element in sequence to be of type document object");
return nullptr;
}
objs.push_back(static_cast<DocumentObjectPy*>(seq[i].ptr())->getDocumentObjectPtr());
objs.push_back(static_cast<DocumentObjectPy*>(py.ptr())->getDocumentObjectPtr());
}
}
else if (!PyObject_TypeCheck(obj, &DocumentObjectPy::Type)) {
@@ -1116,9 +1186,9 @@ PyObject* ApplicationPy::sGetDependentObjects(PyObject* /*self*/, PyObject* args
{
auto ret = App::Document::getDependencyList(objs, options);
Py::Tuple tuple(ret.size());
Py::Tuple tuple(static_cast<int>(ret.size()));
for (size_t i = 0; i < ret.size(); ++i) {
tuple.setItem(i, Py::Object(ret[i]->getPyObject(), true));
tuple.setItem(static_cast<int>(i), Py::Object(ret[i]->getPyObject(), true));
}
return Py::new_reference_to(tuple);
}
@@ -1128,15 +1198,15 @@ PyObject* ApplicationPy::sGetDependentObjects(PyObject* /*self*/, PyObject* args
PyObject* ApplicationPy::sSetActiveTransaction(PyObject* /*self*/, PyObject* args)
{
char* name;
PyObject* persist = Py_False;
char* name {};
PyObject* persist = Py_False; // Not used
if (!PyArg_ParseTuple(args, "s|O!", &name, &PyBool_Type, &persist)) {
return nullptr;
}
PY_TRY
{
Py::Long ret(GetApplication().setActiveTransaction(name, Base::asBoolean(persist)));
Py::Long ret(GetApplication().setActiveTransaction(TransactionName {.name=name, .temporary=false}));
return Py::new_reference_to(ret);
}
PY_CATCH;
@@ -1151,8 +1221,8 @@ PyObject* ApplicationPy::sGetActiveTransaction(PyObject* /*self*/, PyObject* arg
PY_TRY
{
int id = 0;
const char* name = GetApplication().getActiveTransaction(&id);
if (!name || id <= 0) {
std::string name = GetApplication().getActiveTransaction(&id);
if (name.empty() || id <= 0) {
Py_Return;
}
Py::Tuple ret(2);
@@ -1173,7 +1243,10 @@ PyObject* ApplicationPy::sCloseActiveTransaction(PyObject* /*self*/, PyObject* a
PY_TRY
{
GetApplication().closeActiveTransaction(Base::asBoolean(abort), id);
TransactionCloseMode mode = Base::asBoolean(abort)
? TransactionCloseMode::Abort
: TransactionCloseMode::Commit;
GetApplication().closeActiveTransaction(mode, id);
Py_Return;
}
PY_CATCH;
@@ -1192,3 +1265,4 @@ PyObject* ApplicationPy::sCheckAbort(PyObject* /*self*/, PyObject* args)
}
PY_CATCH
}
// NOLINTEND(cppcoreguidelines-pro-type-*)
+2 -5
View File
@@ -21,8 +21,7 @@
* *
**************************************************************************/
#ifndef APP_APPLICATIONPY_H
#define APP_APPLICATIONPY_H
#pragma once
#include <Base/PyObjectBase.h>
@@ -48,6 +47,7 @@ public:
static PyObject* sChangeImportModule (PyObject *self, PyObject *args);
static PyObject* sGetImportType (PyObject *self, PyObject *args);
static PyObject* sAddExportType (PyObject *self, PyObject *args);
static PyObject* sAddTranslatableExportType (PyObject *self, PyObject *args);
static PyObject* sChangeExportModule (PyObject *self, PyObject *args);
static PyObject* sGetExportType (PyObject *self, PyObject *args);
static PyObject* sGetResourcePath (PyObject *self, PyObject *args);
@@ -63,7 +63,6 @@ public:
static PyObject* sLoadFile (PyObject *self,PyObject *args);
static PyObject* sOpenDocument (PyObject *self,PyObject *args, PyObject *kwd);
static PyObject* sSaveDocument (PyObject *self,PyObject *args);
static PyObject* sSaveDocumentAs (PyObject *self,PyObject *args);
static PyObject* sNewDocument (PyObject *self,PyObject *args, PyObject *kwd);
static PyObject* sCloseDocument (PyObject *self,PyObject *args);
static PyObject* sActiveDocument (PyObject *self,PyObject *args);
@@ -91,5 +90,3 @@ public:
};
}
#endif // APP_APPLICATIONPY_H
+167 -167
View File
@@ -35,204 +35,217 @@ FC_LOG_LEVEL_INIT("App", true, true)
using namespace App;
static int _TransactionLock;
static int _TransactionClosed;
AutoTransaction::AutoTransaction(const char* name, bool tmpName)
AutoTransaction::AutoTransaction(int tid)
: tid(tid)
{
auto& app = GetApplication();
if (name && app._activeTransactionGuard >= 0) {
if (!app.getActiveTransaction() || (!tmpName && app._activeTransactionTmpName)) {
FC_LOG("auto transaction '" << name << "', " << tmpName);
tid = app.setActiveTransaction(name);
app._activeTransactionTmpName = tmpName;
}
}
// We use negative transaction guard to disable auto transaction from here
// and any stack below. This is to support user setting active transaction
// before having any existing AutoTransaction on stack, or 'persist'
// transaction that can out live AutoTransaction.
if (app._activeTransactionGuard < 0) {
--app._activeTransactionGuard;
}
else if (tid || app._activeTransactionGuard > 0) {
++app._activeTransactionGuard;
}
else if (app.getActiveTransaction()) {
FC_LOG("auto transaction disabled because of '" << app._activeTransactionName << "'");
--app._activeTransactionGuard;
}
else {
++app._activeTransactionGuard;
}
FC_TRACE("construct auto Transaction " << app._activeTransactionGuard);
}
AutoTransaction::AutoTransaction(Document* doc, const std::string& name)
: AutoTransaction(doc->openTransaction(name))
{
}
AutoTransaction::~AutoTransaction()
{
auto& app = GetApplication();
FC_TRACE("before destruct auto Transaction " << app._activeTransactionGuard);
if (app._activeTransactionGuard < 0) {
++app._activeTransactionGuard;
}
else if (!app._activeTransactionGuard) {
#ifdef FC_DEBUG
FC_ERR("Transaction guard error");
#endif
}
else if (--app._activeTransactionGuard == 0) {
try {
// We don't call close() here, because close() only closes
// transaction that we opened during construction time. However,
// when _activeTransactionGuard reaches zero here, we are supposed
// to close any transaction opened.
app.closeActiveTransaction();
}
catch (Base::Exception& e) {
e.reportException();
}
catch (...) {
}
}
FC_TRACE("destruct auto Transaction " << app._activeTransactionGuard);
close(TransactionCloseMode::Commit);
}
void AutoTransaction::close(bool abort)
void AutoTransaction::close(TransactionCloseMode mode)
{
if (tid || abort) {
GetApplication().closeActiveTransaction(abort, abort ? 0 : tid);
if (tid != NullTransaction) {
GetApplication().closeActiveTransaction(mode, tid);
tid = 0;
}
}
void AutoTransaction::setEnable(bool enable)
int Application::setActiveTransaction(TransactionName name)
{
auto& app = GetApplication();
if (!app._activeTransactionGuard) {
return;
if (name.name.empty()) {
name.name = "Command";
}
if ((enable && app._activeTransactionGuard > 0)
|| (!enable && app._activeTransactionGuard < 0)) {
return;
}
app._activeTransactionGuard = -app._activeTransactionGuard;
FC_TRACE("toggle auto Transaction " << app._activeTransactionGuard);
if (!enable && app._activeTransactionTmpName) {
bool close = true;
for (auto& v : app.DocMap) {
if (v.second->hasPendingTransaction()) {
close = false;
break;
}
}
if (close) {
app.closeActiveTransaction();
}
if (_pActiveDoc != nullptr) {
return _pActiveDoc->setActiveTransaction(name);
}
return openGlobalTransaction(name);
}
int Application::setActiveTransaction(const char* name, bool persist)
std::string Application::getActiveTransaction(int* id) const
{
if (id != nullptr) {
*id = _globalTransactionID;
}
return _globalTransactionID != 0 ? getTransactionName(_globalTransactionID) : "";
}
int Application::openGlobalTransaction(TransactionName name)
{
if (name.name.empty()) {
name.name = "Command";
}
if (!name || !name[0]) {
name = "Command";
}
this->signalBeforeOpenTransaction(name);
if (_activeTransactionGuard > 0 && getActiveTransaction()) {
if (_activeTransactionTmpName) {
FC_LOG("transaction rename to '" << name << "'");
for (auto& v : DocMap) {
v.second->renameTransaction(name, _activeTransactionID);
FC_WARN("Setting a global transaction with name='" << name.name);
if (_globalTransactionID != 0 && transactionTmpName(_globalTransactionID)) {
setTransactionName(_globalTransactionID, name);
} else {
FC_LOG("set global transaction '" << name.name << "'");
if (_globalTransactionID != 0 && !commitTransaction(_globalTransactionID)) {
FC_WARN("could not close current global transaction");
return _globalTransactionID;
}
_globalTransactionID = Transaction::getNewID();
setTransactionDescription(
_globalTransactionID,
TransactionDescription {
.initiator = nullptr,
.name = name
}
}
else {
if (persist) {
AutoTransaction::setEnable(false);
}
return 0;
}
);
}
else if (_TransactionLock) {
if (FC_LOG_INSTANCE.isEnabled(FC_LOGLEVEL_LOG)) {
FC_WARN("Transaction locked, ignore new transaction '" << name << "'");
}
return 0;
return _globalTransactionID;
}
int Application::getGlobalTransaction() const
{
return _globalTransactionID;
}
bool Application::transactionIsActive(int tid) const
{
return transactionDescription(tid) != std::nullopt;
}
std::string Application::getTransactionName(int tid) const
{
auto desc = transactionDescription(tid);
return desc ? desc->name.name : "";
}
bool Application::transactionTmpName(int tid) const
{
auto desc = transactionDescription(tid);
return desc ? desc->name.temporary : false;
}
Document* Application::transactionInitiator(int tid) const
{
auto desc = transactionDescription(tid);
return desc ? desc->initiator : nullptr;
}
std::optional<TransactionDescription> Application::transactionDescription(int tid) const
{
if (tid == NullTransaction) {
return std::nullopt;
}
else {
FC_LOG("set active transaction '" << name << "'");
_activeTransactionID = 0;
auto found = _activeTransactionDescriptions.find(tid);
if (found != _activeTransactionDescriptions.end()) {
return std::optional<TransactionDescription>(found->second);
}
return std::nullopt;
}
void Application::setTransactionDescription(int tid, const TransactionDescription& desc)
{
if (tid == NullTransaction) {
return;
}
auto found = _activeTransactionDescriptions.find(tid);
bool wasPresent = (found != _activeTransactionDescriptions.end());
if (wasPresent && found->second.name.temporary) {
for (auto& v : DocMap) {
v.second->_commitTransaction();
v.second->renameTransaction(desc.name.name, tid);
}
_activeTransactionID = Transaction::getNewID();
}
_activeTransactionTmpName = false;
_activeTransactionName = name;
if (persist) {
AutoTransaction::setEnable(false);
if (!wasPresent || found->second.name.temporary) {
_activeTransactionDescriptions[tid] = desc;
FC_LOG("transaction rename to '" << desc.name.name << "'");
}
return _activeTransactionID;
}
void Application::setTransactionName(int tid, const TransactionName& name)
{
if (tid == NullTransaction || !transactionIsActive(tid)) {
return;
}
auto found = _activeTransactionDescriptions.find(tid);
if (found == _activeTransactionDescriptions.end() || found->second.name.temporary) {
_activeTransactionDescriptions[tid].name = name;
FC_LOG("transaction rename to '" << name.name << "'");
for (auto& v : DocMap) {
v.second->renameTransaction(name.name, tid);
}
}
}
const char* Application::getActiveTransaction(int* id) const
bool Application::closeActiveTransaction(TransactionCloseMode mode, int id)
{
int tid = 0;
if (Transaction::getLastID() == _activeTransactionID) {
tid = _activeTransactionID;
}
if (id) {
*id = tid;
}
return tid ? _activeTransactionName.c_str() : nullptr;
}
void Application::closeActiveTransaction(bool abort, int id)
{
if (!id) {
id = _activeTransactionID;
}
if (!id) {
return;
}
if (_activeTransactionGuard > 0 && !abort) {
FC_LOG("ignore close transaction");
return;
}
if (_TransactionLock) {
if (_TransactionClosed >= 0) {
_TransactionLock = abort ? -1 : 1;
bool abort = (mode == TransactionCloseMode::Abort);
if (id == NullTransaction) {
if (_pActiveDoc != nullptr && _pActiveDoc->getBookedTransactionID() != NullTransaction) {
id = _pActiveDoc->getBookedTransactionID();
} else {
id = _globalTransactionID;
}
FC_LOG("pending " << (abort ? "abort" : "close") << " transaction");
return;
}
if (id == NullTransaction || id == currentlyClosingID) {
return false;
}
currentlyClosingID = id;
FC_LOG("close transaction '" << _activeTransactionName << "' " << abort);
_activeTransactionID = 0;
TransactionSignaller signaller(abort, false);
for (auto& v : DocMap) {
if (v.second->getTransactionID(true) != id) {
std::vector<Document*> docsToPoke;
for (auto& docNameAndDoc : DocMap) {
if (docNameAndDoc.second->getBookedTransactionID() != id) {
continue;
}
if(docNameAndDoc.second->isTransactionLocked() || docNameAndDoc.second->transacting()) {
FC_LOG("pending " << (abort ? "abort" : "close") << " transaction");
currentlyClosingID = 0;
return false;
}
if(docNameAndDoc.second->transacting()) {
FC_LOG("pending " << (abort ? "abort" : "close") << " transaction");
currentlyClosingID = 0;
return false;
}
docsToPoke.push_back(docNameAndDoc.second);
}
FC_LOG("close transaction '" << _activeTransactionDescriptions[id].name.name << "' " << abort);
_activeTransactionDescriptions.erase(id);
if (id == _globalTransactionID) {
_globalTransactionID = 0;
}
TransactionSignaller signaller(abort, false);
for (auto& doc : docsToPoke) {
if (abort) {
v.second->_abortTransaction();
doc->_abortTransaction();
}
else {
v.second->_commitTransaction();
doc->_commitTransaction();
}
}
currentlyClosingID = 0;
return true;
}
bool Application::commitTransaction(int tid)
{
return closeActiveTransaction(TransactionCloseMode::Commit, tid);
}
bool Application::abortTransaction(int tid)
{
return closeActiveTransaction(TransactionCloseMode::Abort, tid);
}
////////////////////////////////////////////////////////////////////////
TransactionLocker::TransactionLocker(bool lock)
TransactionLocker::TransactionLocker(Document* doc, bool lock)
: active(lock)
, doc(doc)
{
if (lock) {
++_TransactionLock;
doc->lockTransaction();
}
}
@@ -267,22 +280,9 @@ void TransactionLocker::activate(bool enable)
active = enable;
if (active) {
++_TransactionLock;
doc->lockTransaction();
return;
}
if (--_TransactionLock != 0) {
return;
}
if (_TransactionClosed) {
bool abort = (_TransactionClosed < 0);
_TransactionClosed = 0;
GetApplication().closeActiveTransaction(abort);
}
}
bool TransactionLocker::isLocked()
{
return _TransactionLock > 0;
doc->unlockTransaction();
}
+24 -53
View File
@@ -22,16 +22,19 @@
* *
****************************************************************************/
#ifndef APP_AUTOTRANSACTION_H
#define APP_AUTOTRANSACTION_H
#pragma once
#include <cstddef>
#include <FCGlobal.h>
#include <string>
#include "TransactionDefs.h"
namespace App
{
class Application;
class Document;
/**
* @brief A helper class to manage transactions (i.e. undo/redo).
@@ -46,59 +49,31 @@ public:
void* operator new(std::size_t) = delete;
public:
/**
* @brief Construct an auto transaction.
*
* @param[in] name: optional new transaction name on construction
* @param[in] tmpName: if true and a new transaction is setup, the name given is
* considered as temporary, and subsequent construction of this class (or
* calling Application::setActiveTransaction()) can override the transaction
* name.
*
* The constructor increments an internal counter
* (Application::_activeTransactionGuard). The counter prevents any new
* active transactions being setup. It also prevents to close
* (i.e. commits) the current active transaction until it reaches zero. It
* does not have any effect on aborting transactions though.
/** Constructor
*
* @param tid the ID of the transaction to manage
*
* No action is done in the constructor
*/
AutoTransaction(const char* name = nullptr, bool tmpName = false);
/**
* @brief Destruct an auto transaction.
*
* This destructor decrease an internal counter
* (Application::_activeTransactionGuard), and will commit any current
* active transaction when the counter reaches zero.
explicit AutoTransaction(int tid);
AutoTransaction(Document* doc, const std::string& name);
/** Destructor
*
* This destructor attempts to commit the transaction it manages
*/
~AutoTransaction();
/**
* @brief Close or abort the transaction.
*
* This function can be used to explicitly close (i.e. commit) the
* transaction, if the current transaction ID matches the one created inside
* the constructor. For aborting, it will abort any current transaction.
*
* @param[in] abort: if true, abort the transaction; otherwise, commit it.
* This function can be used to explicitly close (i.e. commit / abort) the
* transaction,
*/
void close(bool abort = false);
/**
* @brief Enable/Disable any AutoTransaction instance on the current stack.
*
* Once disabled, any empty temporary named transaction is closed. If there
* are non-empty or non-temporary named active transaction, it will not be
* auto closed.
*
* This function may be used in, for example, Gui::Document::setEdit() to
* allow a transaction live past any command scope.
*
* @param[in] enable: if true, enable the AutoTransaction; otherwise, disable it.
*/
static void setEnable(bool enable);
void close(TransactionCloseMode mode = TransactionCloseMode::Commit);
private:
int tid = 0;
int tid { 0 };
};
@@ -117,7 +92,7 @@ public:
*
* @param[in] lock: whether to activate the lock
*/
TransactionLocker(bool lock = true);
TransactionLocker(Document* doc, bool lock = true);
/**
* @brief Destruct a transaction locker.
@@ -143,10 +118,7 @@ public:
{
return active;
}
/// Check if transaction is being locked.
static bool isLocked();
friend class Application;
public:
@@ -155,8 +127,7 @@ public:
private:
bool active;
Document* doc;
};
} // namespace App
#endif // APP_AUTOTRANSACTION_H
} // namespace App
+1 -4
View File
@@ -23,8 +23,7 @@
***************************************************************************/
#ifndef APP_BRANDING_H
#define APP_BRANDING_H
#pragma once
#include <string>
#include <QDomDocument>
@@ -54,5 +53,3 @@ private:
};
} // namespace App
#endif // APP_BRANDING_H
+2 -5
View File
@@ -21,8 +21,7 @@
* *
**************************************************************************/
#ifndef APP_CLEANUPPROCESS_H
#define APP_CLEANUPPROCESS_H
#pragma once
#include <functional>
#include <FCGlobal.h>
@@ -52,6 +51,4 @@ public:
static void callCleanup();
};
} // namespace App
#endif // APP_CLEANUPPROCESS_H
} // namespace App
+2 -5
View File
@@ -23,8 +23,7 @@
***************************************************************************/
#ifndef APP_COLORMODEL_H
#define APP_COLORMODEL_H
#pragma once
#include "Material.h"
#include <Base/Bitmask.h>
@@ -702,6 +701,4 @@ inline const ColorModel& ColorGradient::getColorModel() const
return currentModelPack.totalModel;
}
} // namespace App
#endif // APP_COLORMODEL_H
} // namespace App
+1
View File
@@ -41,6 +41,7 @@
#include <boost/iostreams/device/array.hpp>
#include <boost/iostreams/stream.hpp>
#include <boost/algorithm/string/predicate.hpp>
using namespace Data;
+1 -3
View File
@@ -25,8 +25,7 @@
***************************************************************************/
#ifndef APP_COMPLEX_GEO_DATA_H
#define APP_COMPLEX_GEO_DATA_H
#pragma once
#include <algorithm>
#include <optional>
@@ -749,4 +748,3 @@ protected:
} // namespace Data
ENABLE_BITMASK_OPERATORS(Data::SearchOption)
#endif
+1 -4
View File
@@ -23,8 +23,7 @@
* *
***************************************************************************/
#ifndef DATUMS_H
#define DATUMS_H
#pragma once
#include "GeoFeature.h"
#include "GeoFeatureGroupExtension.h"
@@ -254,5 +253,3 @@ private:
};
} // namespace App
#endif /* end of include guard: DATUMS_H */
+229 -115
View File
@@ -35,10 +35,12 @@
#include <list>
#include <algorithm>
#include <filesystem>
#include <format>
#include <boost/algorithm/string.hpp>
#include <boost/bimap.hpp>
#include <boost/graph/strong_components.hpp>
#include <boost/graph/topological_sort.hpp>
#include <boost/regex.hpp>
#include <random>
@@ -189,6 +191,7 @@ bool Document::undo(const int id)
mRedoMap[d->activeUndoTransaction->getID()] = d->activeUndoTransaction;
mRedoTransactions.push_back(d->activeUndoTransaction);
d->activeUndoTransaction = nullptr;
d->bookedTransaction = 0;
mUndoMap.erase(mUndoTransactions.back()->getID());
delete mUndoTransactions.back();
@@ -241,6 +244,7 @@ bool Document::redo(const int id)
mUndoMap[d->activeUndoTransaction->getID()] = d->activeUndoTransaction;
mUndoTransactions.push_back(d->activeUndoTransaction);
d->activeUndoTransaction = nullptr;
d->bookedTransaction = 0;
mRedoMap.erase(mRedoTransactions.back()->getID());
delete mRedoTransactions.back();
@@ -270,10 +274,10 @@ void Document::changePropertyOfObject(TransactionalObject* obj,
}
if ((d->iUndoMode != 0) && !isPerformingTransaction() && !d->activeUndoTransaction) {
if (!testStatus(Restoring) || testStatus(Importing)) {
int tid = 0;
const char* name = GetApplication().getActiveTransaction(&tid);
if (name && tid > 0) {
_openTransaction(name, tid);
if (d->bookedTransaction == NullTransaction) {
d->bookedTransaction = GetApplication().getGlobalTransaction();
} else {
_openTransaction(GetApplication().getTransactionName(d->bookedTransaction), d->bookedTransaction);
}
}
}
@@ -328,71 +332,92 @@ std::vector<std::string> Document::getAvailableRedoNames() const
return vList;
}
void Document::openTransaction(const char* name) // NOLINT
int Document::openTransaction(TransactionName name, int tid) // NOLINT
{
if (isPerformingTransaction() || d->committing) {
if (FC_LOG_INSTANCE.isEnabled(FC_LOGLEVEL_LOG)) {
FC_WARN("Cannot open transaction while transacting");
}
return;
if (tid != NullTransaction && tid == d->bookedTransaction) {
return tid; // Early exit without warning
}
if (isTransactionLocked()) {
if (FC_LOG_INSTANCE.isEnabled(FC_LOGLEVEL_LOG)) {
FC_WARN("Transaction locked, ignore new transaction '" << name.name << "'");
}
return 0;
}
GetApplication().setActiveTransaction(name ? name : "<empty>");
}
int Document::_openTransaction(const char* name, int id)
{
if (isPerformingTransaction() || d->committing) {
if (FC_LOG_INSTANCE.isEnabled(FC_LOGLEVEL_LOG)) {
FC_WARN("Cannot open transaction while transacting");
}
return 0;
}
if (d->iUndoMode != 0) {
// Avoid recursive calls that is possible while
// clearing the redo transactions and will cause
// a double deletion of some transaction and thus
// a segmentation fault
if (d->opentransaction) {
return 0;
}
Base::FlagToggler<> flag(d->opentransaction);
if ((id != 0) && mUndoMap.find(id) != mUndoMap.end()) {
throw Base::RuntimeError("invalid transaction id");
}
if (d->activeUndoTransaction) {
_commitTransaction(true);
}
_clearRedos();
d->activeUndoTransaction = new Transaction(id);
if (!name) {
name = "<empty>";
}
d->activeUndoTransaction->Name = name;
mUndoMap[d->activeUndoTransaction->getID()] = d->activeUndoTransaction;
id = d->activeUndoTransaction->getID();
signalOpenTransaction(*this, name);
auto& app = GetApplication();
auto activeDoc = app.getActiveDocument();
if (activeDoc && activeDoc != this && !activeDoc->hasPendingTransaction()) {
std::string aname("-> ");
aname += d->activeUndoTransaction->Name;
FC_LOG("auto transaction " << getName() << " -> " << activeDoc->getName());
activeDoc->_openTransaction(aname.c_str(), id);
}
return id;
if (name.name.empty()) {
name.name = "<empty>";
}
return 0;
return setActiveTransaction(name, tid);
}
int Document::openTransaction(std::string name, int tid)
{
return openTransaction(TransactionName {.name = name, .temporary = false}, tid);
}
void Document::renameTransaction(const char* name, const int id) const
int Document::_openTransaction(std::string name, int id)
{
if (name && d->activeUndoTransaction && d->activeUndoTransaction->getID() == id) {
if (isTransactionLocked() && id != d->bookedTransaction) {
if (FC_LOG_INSTANCE.isEnabled(FC_LOGLEVEL_LOG)) {
FC_WARN("Transaction locked, ignore new transaction '" << name << "'");
}
}
if (isPerformingTransaction() || d->committing) {
if (FC_LOG_INSTANCE.isEnabled(FC_LOGLEVEL_LOG)) {
FC_WARN("Cannot open transaction while transacting");
}
return 0;
}
if (d->iUndoMode == 0) {
return 0;
}
// Avoid recursive calls that is possible while
// clearing the redo transactions and will cause
// a double deletion of some transaction and thus
// a segmentation fault
if (d->opentransaction) {
return 0;
}
Base::FlagToggler<> flag(d->opentransaction);
if ((id != 0) && mUndoMap.find(id) != mUndoMap.end()) {
throw Base::RuntimeError("invalid transaction id");
}
if (d->activeUndoTransaction) {
_commitTransaction(true);
}
_clearRedos();
// When id == 0, this creates a new id
// for instance, when there is no global transaction
// from the application to stick to
d->activeUndoTransaction = new Transaction(id);
if (name.empty()) {
name = "<empty>";
}
d->activeUndoTransaction->Name = name;
mUndoMap[d->activeUndoTransaction->getID()] = d->activeUndoTransaction;
id = d->activeUndoTransaction->getID();
signalOpenTransaction(*this, name);
Document* transactionInitiator = GetApplication().transactionInitiator(id);
if (transactionInitiator && transactionInitiator != this && !transactionInitiator->hasPendingTransaction()) {
std::string aname = std::format("-> {}", d->activeUndoTransaction->Name);
FC_LOG("auto transaction " << getName() << " -> " << transactionInitiator->getName());
transactionInitiator->_openTransaction(aname, id);
}
return id;
}
void Document::renameTransaction(const std::string& name, const int id) const
{
if (!name.empty() && d->activeUndoTransaction && d->activeUndoTransaction->getID() == id) {
if (boost::starts_with(d->activeUndoTransaction->Name, "-> ")) {
d->activeUndoTransaction->Name.resize(3);
}
@@ -402,48 +427,108 @@ void Document::renameTransaction(const char* name, const int id) const
d->activeUndoTransaction->Name += name;
}
}
int Document::setActiveTransaction(TransactionName name, int tid)
{
// Probably a group transaction situation
if (tid != NullTransaction) {
if (!GetApplication().transactionIsActive(tid)) {
FC_LOG("Could not set active transaction to inactive ID");
return NullTransaction;
}
if (d->bookedTransaction != NullTransaction && d->bookedTransaction != tid && !_commitTransaction(true)) {
FC_LOG("Could not book transaction for document");
return NullTransaction;
}
d->bookedTransaction = tid;
if (GetApplication().transactionTmpName(d->bookedTransaction)) {
GetApplication().setTransactionName(d->bookedTransaction, name);
}
return d->bookedTransaction;
}
// Rename the transaction if it had a tmp name
if (d->bookedTransaction != NullTransaction && GetApplication().transactionTmpName(d->bookedTransaction)) {
GetApplication().setTransactionName(d->bookedTransaction, name);
return d->bookedTransaction;
}
if (d->bookedTransaction != NullTransaction && !_commitTransaction(true)) {
FC_LOG("Could not book transaction for document");
return NullTransaction;
}
d->bookedTransaction = Transaction::getNewID();
GetApplication().setTransactionDescription(d->bookedTransaction, TransactionDescription {.initiator = this, .name = name});
return d->bookedTransaction;
}
void Document::lockTransaction()
{
d->TransactionLock++;
}
void Document::unlockTransaction()
{
if (d->TransactionLock > 0) {
d->TransactionLock--;
}
}
bool Document::isTransactionLocked() const
{
return d->TransactionLock > 0;
}
bool Document::transacting() const
{
return isPerformingTransaction() || d->committing;
}
void Document::_checkTransaction(DocumentObject* pcDelObj, const Property* What, int line)
{
// if the undo is active but no transaction open, open one!
if ((d->iUndoMode != 0) && !isPerformingTransaction()) {
if (!d->activeUndoTransaction) {
if (!testStatus(Restoring) || testStatus(Importing)) {
int tid = 0;
const char* name = GetApplication().getActiveTransaction(&tid);
if (name && tid > 0) {
bool ignore = false;
if (What && What->testStatus(Property::NoModify)) {
ignore = true;
}
if (FC_LOG_INSTANCE.isEnabled(FC_LOGLEVEL_LOG)) {
if (What) {
FC_LOG((ignore ? "ignore" : "auto")
<< " transaction (" << line << ") '" << What->getFullName());
}
else {
FC_LOG((ignore ? "ignore" : "auto") << " transaction (" << line << ") '"
<< name << "' in " << getName());
}
}
if (!ignore) {
_openTransaction(name, tid);
}
return;
if (d->iUndoMode == 0 || isPerformingTransaction() || d->activeUndoTransaction) {
return;
}
if (!testStatus(Restoring) || testStatus(Importing)) {
// Priority to a transaction that has been booked
// explicitly for this document, it there are none
// get a sticky transaction from application
if (!d->bookedTransaction) {
d->bookedTransaction = GetApplication().getGlobalTransaction();
}
if (d->bookedTransaction != NullTransaction) {
std::string name = GetApplication().getTransactionName(d->bookedTransaction);
bool ignore = false;
if (What && What->testStatus(Property::NoModify)) {
ignore = true;
}
if (FC_LOG_INSTANCE.isEnabled(FC_LOGLEVEL_LOG)) {
if (What) {
FC_LOG((ignore ? "ignore" : "auto")
<< " transaction (" << line << ") '" << What->getFullName());
}
else {
FC_LOG((ignore ? "ignore" : "auto") << " transaction (" << line << ") '"
<< name << "' in " << getName());
}
}
if (!pcDelObj) {
return;
}
// When the object is going to be deleted we have to check if it has already been added
// to the undo transactions
std::list<Transaction*>::iterator it;
for (it = mUndoTransactions.begin(); it != mUndoTransactions.end(); ++it) {
if ((*it)->hasObject(pcDelObj)) {
_openTransaction("Delete");
break;
}
if (!ignore) {
_openTransaction(name, d->bookedTransaction);
}
return;
}
}
if (!pcDelObj) {
return;
}
// When the object is going to be deleted we have to check if it has already been added
// to the undo transactions
std::list<Transaction*>::iterator it;
for (it = mUndoTransactions.begin(); it != mUndoTransactions.end(); ++it) {
if ((*it)->hasObject(pcDelObj)) {
_openTransaction("Delete");
break;
}
}
}
@@ -472,29 +557,36 @@ void Document::commitTransaction() // NOLINT
}
if (d->activeUndoTransaction) {
GetApplication().closeActiveTransaction(false, d->activeUndoTransaction->getID());
// This will iterate over all documents and ask them to
// commit their transaction if their ID matches
GetApplication().commitTransaction(d->activeUndoTransaction->getID());
} else {
d->bookedTransaction = 0; // Reset booked transaction even if it was not used
}
}
void Document::_commitTransaction(const bool notify)
bool Document::_commitTransaction(const bool notify)
{
if (isPerformingTransaction()) {
if (FC_LOG_INSTANCE.isEnabled(FC_LOGLEVEL_LOG)) {
FC_WARN("Cannot commit transaction while transacting");
}
return;
return false;
}
if (d->committing) {
// for a recursive call return without printing a warning
return;
return false;
}
d->bookedTransaction = 0;
if (d->activeUndoTransaction) {
Base::FlagToggler<> flag(d->committing);
Application::TransactionSignaller signaller(false, true);
const int id = d->activeUndoTransaction->getID();
mUndoTransactions.push_back(d->activeUndoTransaction);
d->activeUndoTransaction = nullptr;
// check the stack for the limits
if (mUndoTransactions.size() > d->UndoMaxStackSize) {
mUndoMap.erase(mUndoTransactions.front()->getID());
@@ -503,11 +595,12 @@ void Document::_commitTransaction(const bool notify)
}
signalCommitTransaction(*this);
// closeActiveTransaction() may call again _commitTransaction()
// commitTransaction() may call again _commitTransaction()
if (notify) {
GetApplication().closeActiveTransaction(false, id);
GetApplication().commitTransaction(id);
}
}
return true;
}
void Document::abortTransaction() const
@@ -519,7 +612,9 @@ void Document::abortTransaction() const
return;
}
if (d->activeUndoTransaction) {
GetApplication().closeActiveTransaction(true, d->activeUndoTransaction->getID());
GetApplication().abortTransaction(d->activeUndoTransaction->getID());
} else {
d->bookedTransaction = 0; // Reset booked transaction even if it was not used
}
}
@@ -531,6 +626,7 @@ void Document::_abortTransaction()
}
}
d->bookedTransaction = 0;
if (d->activeUndoTransaction) {
Base::FlagToggler<bool> flag(d->rollback);
Application::TransactionSignaller signaller(true, true);
@@ -574,7 +670,10 @@ int Document::getTransactionID(const bool undo, unsigned pos) const
for (; pos != 0U; ++rit, --pos) {}
return (*rit)->getID();
}
int Document::getBookedTransactionID() const
{
return d->bookedTransaction;
}
bool Document::isTransactionEmpty() const
{
return !d->activeUndoTransaction;
@@ -995,7 +1094,14 @@ void Document::Save(Base::Writer& writer) const
writer.incInd();
// NOTE: This differs from LS3 Code. Persisting this table
// forces the assertion in Writer.addFile(...): assert(!isForceXML()); to be removed
// see: https://github.com/FreeCAD/FreeCAD/issues/27489
//
// Original code in LS3:
// d->Hasher->setPersistenceFileName(0);
d->Hasher->setPersistenceFileName("StringHasher.Table");
for (const auto o : d->objectArray) {
o->beforeSave();
}
@@ -3134,7 +3240,7 @@ DocumentObject* Document::addObject(const char* sType,
AddObjectOption::SetNewStatus
| (isPartial ? AddObjectOption::SetPartialStatus : AddObjectOption::UnsetPartialStatus)
| (isNew ? AddObjectOption::DoSetup : AddObjectOption::None)
| AddObjectOption::ActivateObject,
| AddObjectOption::ActivateObject,
viewType);
// return the Object
@@ -3201,7 +3307,7 @@ void Document::_addObject(DocumentObject* pcObject, const char* pObjectName, Add
else {
ObjectName = getUniqueObjectName(pcObject->getTypeId().getName());
}
// insert in the name map
d->objectMap[ObjectName] = pcObject;
d->objectNameManager.addExactName(ObjectName);
@@ -3217,7 +3323,7 @@ void Document::_addObject(DocumentObject* pcObject, const char* pObjectName, Add
}
d->objectIdMap[pcObject->_Id] = pcObject;
d->objectArray.push_back(pcObject);
// do no transactions if we do a rollback!
if (!d->rollback) {
// Undo stuff
@@ -3236,9 +3342,9 @@ void Document::_addObject(DocumentObject* pcObject, const char* pObjectName, Add
if (!isPerformingTransaction() && options.testFlag(AddObjectOption::DoSetup)) {
pcObject->setupObject();
}
if (options.testFlag(AddObjectOption::SetNewStatus)) {
pcObject->setStatus(ObjectStatus::New, true);
pcObject->setStatus(ObjectStatus::New, true);
}
if (options.testFlag(AddObjectOption::SetPartialStatus) || options.testFlag(AddObjectOption::UnsetPartialStatus)) {
pcObject->setStatus(ObjectStatus::PartialObject, options.testFlag(AddObjectOption::SetPartialStatus));
@@ -3250,15 +3356,15 @@ void Document::_addObject(DocumentObject* pcObject, const char* pObjectName, Add
pcObject->_pcViewProviderName = viewType ? viewType : "";
signalNewObject(*pcObject);
// do no transactions if we do a rollback!
if (!d->rollback && d->activeUndoTransaction) {
signalTransactionAppend(*pcObject, d->activeUndoTransaction);
}
if (options.testFlag(AddObjectOption::ActivateObject)) {
d->activeObject = pcObject;
signalActivatedObject(*pcObject);
signalActivatedObject(*pcObject);
}
}
@@ -3271,6 +3377,14 @@ bool Document::containsObject(const DocumentObject* pcObject) const
return found != d->objectIdMap.end() && found->second == pcObject;
}
/// Remove an object out of the document
void Document::removeObject(const DocumentObject* object)
{
if (object->getDocument() == this) {
removeObject(object->getNameInDocument());
}
}
/// Remove an object out of the document
void Document::removeObject(const char* sName)
{
@@ -3295,8 +3409,8 @@ void Document::_removeObject(DocumentObject* pcObject, RemoveObjectOptions optio
FC_ERR("Cannot delete " << pcObject->getFullName() << " while recomputing");
return;
}
TransactionLocker tlock;
TransactionLocker tlock(this);
_checkTransaction(pcObject, nullptr, __LINE__);
@@ -3305,7 +3419,7 @@ void Document::_removeObject(DocumentObject* pcObject, RemoveObjectOptions optio
FC_ERR("Internal error, could not find " << pcObject->getFullName() << " to remove");
}
if (options.testFlag(RemoveObjectOption::PreserveChildrenVisibility)
if (options.testFlag(RemoveObjectOption::PreserveChildrenVisibility)
&& !d->rollback && d->activeUndoTransaction && pcObject->hasChildElement()) {
// Preserve link group sub object global visibilities. Normally those
// claimed object should be hidden in global coordinate space. However,
@@ -3313,7 +3427,7 @@ void Document::_removeObject(DocumentObject* pcObject, RemoveObjectOptions optio
// children, which may now in the global space. When the parent is
// undeleted, having its children shown in both the local and global
// coordinate space is very confusing. Hence, we preserve the visibility
// here
// here
for (auto& sub : pcObject->getSubObjects()) {
if (sub.empty()) {
continue;
@@ -3360,7 +3474,7 @@ void Document::_removeObject(DocumentObject* pcObject, RemoveObjectOptions optio
}
std::unique_ptr<DocumentObject> tobedestroyed;
if ((options.testFlag(RemoveObjectOption::MayDestroyOutOfTransaction) && !d->rollback && !d->activeUndoTransaction)
if ((options.testFlag(RemoveObjectOption::MayDestroyOutOfTransaction) && !d->rollback && !d->activeUndoTransaction)
|| (options.testFlag(RemoveObjectOption::DestroyOnRollback) && d->rollback)) {
// if not saved in undo -> delete object later
std::unique_ptr<DocumentObject> delobj(pos->second);
@@ -3376,13 +3490,13 @@ void Document::_removeObject(DocumentObject* pcObject, RemoveObjectOptions optio
break;
}
}
// In case the object gets deleted the pointer must be nullified
if (tobedestroyed) {
tobedestroyed->pcNameInDocument = nullptr;
}
// Erase last to avoid invalidating pcObject->pcNameInDocument
// Erase last to avoid invalidating pcObject->pcNameInDocument
// when it is still needed in Transaction::addObjectNew
d->objectMap.erase(pos);
}
+26 -11
View File
@@ -22,8 +22,7 @@
* *
***************************************************************************/
#ifndef SRC_APP_DOCUMENT_H_
#define SRC_APP_DOCUMENT_H_
#pragma once
#include <CXX/Objects.hxx>
#include <Base/Observer.h>
@@ -36,6 +35,7 @@
#include "PropertyLinks.h"
#include "PropertyStandard.h"
#include "ExportInfo.h"
#include "TransactionDefs.h"
#include <map>
#include <vector>
@@ -500,6 +500,13 @@ public:
std::vector<DocumentObject*>
addObjects(const char* sType, const std::vector<std::string>& objectNames, bool isNew = true);
/**
* @brief Remove an object from the document.
*
* @param[in] object The object to remove.
*/
void removeObject(const DocumentObject* object);
/**
* @brief Remove an object from the document.
*
@@ -859,7 +866,19 @@ public:
* setup a potential transaction that will only be created if there are
* actual changes.
*/
void openTransaction(const char* name = nullptr);
int openTransaction(TransactionName name, int tid = 0);
int openTransaction(std::string name, int tid = 0);
// If the tid != 0, it will take the transaction id if it exists
int setActiveTransaction(TransactionName name, int tid = 0);
void lockTransaction();
void unlockTransaction();
bool isTransactionLocked() const;
bool transacting() const;
int getBookedTransactionID() const;
/**
* @brief Rename the current transaction.
@@ -869,7 +888,7 @@ public:
* @param[in] name The new name of the transaction.
* @param[in] id The transaction ID to match.
*/
void renameTransaction(const char* name, int id) const;
void renameTransaction(const std::string& name, int id) const;
/**
* @brief Commit the Command transaction.
@@ -1238,7 +1257,7 @@ public:
/// Check if there is any document restoring/importing.
static bool isAnyRestoring();
/// Register a new label.
void registerLabel(const std ::string& newLabel);
/// Unregister a label.
@@ -1403,8 +1422,7 @@ protected:
* This function creates an actual transaction regardless of Application
* AutoTransaction setting.
*/
int _openTransaction(const char* name = nullptr, int id = 0);
int _openTransaction(std::string name = "", int id = 0);
/**
* @brief Commit the Command transaction.
*
@@ -1413,8 +1431,7 @@ protected:
*
* @param notify If true, notify the application to close the transaction.
*/
void _commitTransaction(bool notify = false);
bool _commitTransaction(bool notify = false);
/**
* @brief Abort the running transaction.
*
@@ -1470,5 +1487,3 @@ T* Document::addObject(const char* pObjectName, bool isNew, const char* viewType
}
} // namespace App
#endif // SRC_APP_DOCUMENT_H_
+10
View File
@@ -198,6 +198,7 @@ class Document(PropertyContainer):
Args:
type: the type of the document object to create.
Call method supportedTypes() to get a list of possible values.
name: the optional name of the new object.
objProxy: the Python binding object to attach to the new document object.
viewProxy: the Python binding object to attach the view provider of this object.
@@ -446,3 +447,12 @@ class Document(PropertyContainer):
sort: whether to topologically sort the return list
"""
...
def getBookedTransactionID(self) -> int:
"""
getBookedTransactionID() -> int
Returns the currently booked transaction id, which is the id of the current transaction OR the id
the next transaction will stick to if no change has occured yet
"""
...
+2 -4
View File
@@ -140,12 +140,10 @@ void DocumentObject::printInvalidLinks() const
scopenames.pop_back();
}
Base::Console().warning("%s: Link(s) to object(s) '%s' go out of the allowed scope '%s'. "
"Instead, the linked object(s) reside within '%s'.\n",
Base::Console().warning("%s: %s links are out of scope. Out of scope links to: %s\n",
getTypeId().getName(),
objnames.c_str(),
getNameInDocument(),
scopenames.c_str());
objnames.c_str());
}
catch (const Base::Exception& e) {
e.reportException();
+1 -4
View File
@@ -24,8 +24,7 @@
***************************************************************************/
#ifndef SRC_APP_DOCUMENTOBJECT_H_
#define SRC_APP_DOCUMENTOBJECT_H_
#pragma once
#include <App/TransactionalObject.h>
#include <App/PropertyExpressionEngine.h>
@@ -1365,5 +1364,3 @@ private:
};
} // namespace App
#endif // SRC_APP_DOCUMENTOBJECT_H_
+1 -4
View File
@@ -23,8 +23,7 @@
***************************************************************************/
#ifndef APP_DOCUMENTOBJECTEXTENSION_H
#define APP_DOCUMENTOBJECTEXTENSION_H
#pragma once
#include "Extension.h"
@@ -144,5 +143,3 @@ public:
};
} // namespace App
#endif // APP_DOCUMENTOBJECTEXTENSION_H
+1 -5
View File
@@ -23,8 +23,7 @@
***************************************************************************/
#ifndef APP_DOCUMENTOBJECTFILEINCLUDED_H
#define APP_DOCUMENTOBJECTFILEINCLUDED_H
#pragma once
#include "DocumentObject.h"
#include "PropertyFile.h"
@@ -54,6 +53,3 @@ public:
};
} // namespace App
#endif // APP_DOCUMENTOBJECTFILEINCLUDED_H
+1 -5
View File
@@ -23,8 +23,7 @@
***************************************************************************/
#ifndef APP_DOCUMENTOBJECTGROUP_H
#define APP_DOCUMENTOBJECTGROUP_H
#pragma once
#include "DocumentObject.h"
#include "FeaturePython.h"
@@ -57,6 +56,3 @@ using DocumentObjectGroupPython = App::FeaturePythonT<DocumentObjectGroup>;
} // namespace App
#endif // APP_DOCUMENTOBJECTGROUP_H
+104 -54
View File
@@ -38,38 +38,49 @@ namespace sp = std::placeholders;
DocumentT::DocumentT() = default;
DocumentT::DocumentT(Document* doc)
{
document = doc->getName();
}
: document {doc->getName()}
{}
DocumentT::DocumentT(const std::string& name)
{
document = name;
}
DocumentT::DocumentT(std::string name)
: document {std::move(name)}
{}
DocumentT::DocumentT(const DocumentT& doc)
{
document = doc.document;
}
: document {doc.document}
{}
DocumentT::DocumentT(DocumentT&& doc) noexcept
: document {std::move(doc.document)}
{}
DocumentT::~DocumentT() = default;
void DocumentT::operator=(const DocumentT& doc)
DocumentT& DocumentT::operator=(const DocumentT& doc)
{
if (this == &doc) {
return;
if (this != &doc) {
document = doc.document;
}
document = doc.document;
return *this;
}
void DocumentT::operator=(const Document* doc)
DocumentT& DocumentT::operator=(DocumentT&& doc) noexcept
{
if (this != &doc) {
document = std::move(doc.document);
}
return *this;
}
DocumentT& DocumentT::operator=(const Document* doc)
{
document = doc->getName();
return *this;
}
void DocumentT::operator=(const std::string& name)
DocumentT& DocumentT::operator=(const std::string& name)
{
document = name;
return *this;
}
Document* DocumentT::getDocument() const
@@ -98,7 +109,7 @@ DocumentObjectT::DocumentObjectT(const DocumentObjectT& other)
*this = other;
}
DocumentObjectT::DocumentObjectT(DocumentObjectT&& other)
DocumentObjectT::DocumentObjectT(DocumentObjectT&& other) noexcept
{
*this = std::move(other);
}
@@ -145,7 +156,7 @@ DocumentObjectT& DocumentObjectT::operator=(const DocumentObjectT& obj)
return *this;
}
DocumentObjectT& DocumentObjectT::operator=(DocumentObjectT&& obj)
DocumentObjectT& DocumentObjectT::operator=(DocumentObjectT&& obj) noexcept
{
if (this == &obj) {
return *this;
@@ -157,7 +168,7 @@ DocumentObjectT& DocumentObjectT::operator=(DocumentObjectT&& obj)
return *this;
}
void DocumentObjectT::operator=(const DocumentObject* obj)
DocumentObjectT& DocumentObjectT::operator=(const DocumentObject* obj)
{
if (!obj || !obj->isAttachedToDocument()) {
object.clear();
@@ -171,9 +182,11 @@ void DocumentObjectT::operator=(const DocumentObject* obj)
document = obj->getDocument()->getName();
property.clear();
}
return *this;
}
void DocumentObjectT::operator=(const Property* prop)
DocumentObjectT& DocumentObjectT::operator=(const Property* prop)
{
if (!prop || !prop->hasName() || !prop->getContainer()
|| !prop->getContainer()->isDerivedFrom<App::DocumentObject>()) {
@@ -182,13 +195,14 @@ void DocumentObjectT::operator=(const Property* prop)
document.clear();
property.clear();
}
else {
auto obj = static_cast<App::DocumentObject*>(prop->getContainer());
else if (auto obj = freecad_cast<App::DocumentObject*>(prop->getContainer())) {
object = obj->getNameInDocument();
label = obj->Label.getValue();
document = obj->getDocument()->getName();
property = prop->getName();
}
return *this;
}
bool DocumentObjectT::operator==(const DocumentObjectT& other) const
@@ -217,8 +231,7 @@ std::string DocumentObjectT::getDocumentPython() const
DocumentObject* DocumentObjectT::getObject() const
{
DocumentObject* obj = nullptr;
Document* doc = getDocument();
if (doc) {
if (auto doc = getDocument()) {
obj = doc->getObject(object.c_str());
}
return obj;
@@ -229,6 +242,20 @@ const std::string& DocumentObjectT::getObjectName() const
return object;
}
const char* DocumentObjectT::getNameInDocument() const
{
return object.c_str();
}
bool DocumentObjectT::isAttachedToDocument() const
{
if (auto obj = getObject()) {
return obj->isAttachedToDocument();
}
return false;
}
const std::string& DocumentObjectT::getObjectLabel() const
{
return label;
@@ -258,9 +285,13 @@ std::string DocumentObjectT::getPropertyPython() const
Property* DocumentObjectT::getProperty() const
{
auto obj = getObject();
if (obj) {
return obj->getPropertyByName(property.c_str());
return getPropertyByName(property.c_str());
}
Property* DocumentObjectT::getPropertyByName(const char* name) const
{
if (auto obj = getObject()) {
return obj->getPropertyByName(name);
}
return nullptr;
}
@@ -271,7 +302,7 @@ SubObjectT::SubObjectT() = default;
SubObjectT::SubObjectT(const SubObjectT&) = default;
SubObjectT::SubObjectT(SubObjectT&& other)
SubObjectT::SubObjectT(SubObjectT&& other) noexcept
: DocumentObjectT(std::move(other))
, subname(std::move(other.subname))
{}
@@ -295,6 +326,8 @@ SubObjectT::SubObjectT(const char* docName, const char* objName, const char* s)
, subname(s ? s : "")
{}
SubObjectT::~SubObjectT() = default;
bool SubObjectT::operator<(const SubObjectT& other) const
{
if (getDocumentName() < other.getDocumentName()) {
@@ -323,18 +356,18 @@ SubObjectT& SubObjectT::operator=(const SubObjectT& other)
if (this == &other) {
return *this;
}
static_cast<DocumentObjectT&>(*this) = other;
static_cast<DocumentObjectT&>(*this) = other; // NOLINT
subname = other.subname;
return *this;
}
SubObjectT& SubObjectT::operator=(SubObjectT&& other)
SubObjectT& SubObjectT::operator=(SubObjectT&& other) noexcept
{
if (this == &other) {
return *this;
}
static_cast<DocumentObjectT&>(*this) = std::move(other);
subname = std::move(other.subname);
static_cast<DocumentObjectT&>(*this) = std::move(other);
return *this;
}
@@ -639,11 +672,14 @@ PropertyLinkT::PropertyLinkT(const std::vector<DocumentObject*>& objs)
}
str << "]";
toPython = str.str();
}
}
PropertyLinkT::PropertyLinkT(const std::vector<DocumentObject*>& objs,
const std::vector<std::string>& subNames)
PropertyLinkT::PropertyLinkT(
const std::vector<DocumentObject*>& objs,
const std::vector<std::string>& subNames
)
: PropertyLinkT()
{
if (!objs.empty() && objs.size() == subNames.size()) {
@@ -672,6 +708,7 @@ PropertyLinkT::PropertyLinkT(const std::vector<DocumentObject*>& objs,
}
str << "]";
toPython = str.str();
}
}
@@ -691,7 +728,8 @@ public:
if (doc) {
// NOLINTBEGIN
connectApplicationDeletedDocument = App::GetApplication().signalDeleteDocument.connect(
std::bind(&Private::deletedDocument, this, sp::_1));
std::bind(&Private::deletedDocument, this, sp::_1)
);
// NOLINTEND
}
}
@@ -784,12 +822,15 @@ public:
// NOLINTBEGIN
indocument = true;
connectApplicationDeletedDocument = App::GetApplication().signalDeleteDocument.connect(
std::bind(&Private::deletedDocument, this, sp::_1));
std::bind(&Private::deletedDocument, this, sp::_1)
);
App::Document* doc = obj->getDocument();
connectDocumentCreatedObject =
doc->signalNewObject.connect(std::bind(&Private::createdObject, this, sp::_1));
connectDocumentDeletedObject =
doc->signalDeletedObject.connect(std::bind(&Private::deletedObject, this, sp::_1));
connectDocumentCreatedObject = doc->signalNewObject.connect(
std::bind(&Private::createdObject, this, sp::_1)
);
connectDocumentDeletedObject = doc->signalDeletedObject.connect(
std::bind(&Private::deletedObject, this, sp::_1)
);
// NOLINTEND
}
}
@@ -864,11 +905,14 @@ DocumentObserver::DocumentObserver()
{
// NOLINTBEGIN
this->connectApplicationCreatedDocument = App::GetApplication().signalNewDocument.connect(
std::bind(&DocumentObserver::slotCreatedDocument, this, sp::_1));
std::bind(&DocumentObserver::slotCreatedDocument, this, sp::_1)
);
this->connectApplicationDeletedDocument = App::GetApplication().signalDeleteDocument.connect(
std::bind(&DocumentObserver::slotDeletedDocument, this, sp::_1));
std::bind(&DocumentObserver::slotDeletedDocument, this, sp::_1)
);
this->connectApplicationActivateDocument = App::GetApplication().signalActiveDocument.connect(
std::bind(&DocumentObserver::slotActivateDocument, this, sp::_1));
std::bind(&DocumentObserver::slotActivateDocument, this, sp::_1)
);
// NOLINTEND
}
@@ -901,15 +945,20 @@ void DocumentObserver::attachDocument(Document* doc)
// NOLINTBEGIN
this->connectDocumentCreatedObject = _document->signalNewObject.connect(
std::bind(&DocumentObserver::slotCreatedObject, this, sp::_1));
std::bind(&DocumentObserver::slotCreatedObject, this, sp::_1)
);
this->connectDocumentDeletedObject = _document->signalDeletedObject.connect(
std::bind(&DocumentObserver::slotDeletedObject, this, sp::_1));
std::bind(&DocumentObserver::slotDeletedObject, this, sp::_1)
);
this->connectDocumentChangedObject = _document->signalChangedObject.connect(
std::bind(&DocumentObserver::slotChangedObject, this, sp::_1, sp::_2));
std::bind(&DocumentObserver::slotChangedObject, this, sp::_1, sp::_2)
);
this->connectDocumentRecomputedObject = _document->signalRecomputedObject.connect(
std::bind(&DocumentObserver::slotRecomputedObject, this, sp::_1));
std::bind(&DocumentObserver::slotRecomputedObject, this, sp::_1)
);
this->connectDocumentRecomputed = _document->signalRecomputed.connect(
std::bind(&DocumentObserver::slotRecomputedDocument, this, sp::_1));
std::bind(&DocumentObserver::slotRecomputedDocument, this, sp::_1)
);
// NOLINTEND
}
}
@@ -941,8 +990,7 @@ void DocumentObserver::slotCreatedObject(const App::DocumentObject& /*Obj*/)
void DocumentObserver::slotDeletedObject(const App::DocumentObject& /*Obj*/)
{}
void DocumentObserver::slotChangedObject(const App::DocumentObject& /*Obj*/,
const App::Property& /*Prop*/)
void DocumentObserver::slotChangedObject(const App::DocumentObject& /*Obj*/, const App::Property& /*Prop*/)
{}
void DocumentObserver::slotRecomputedObject(const DocumentObject& /*Obj*/)
@@ -978,7 +1026,7 @@ void DocumentObjectObserver::removeFromObservation(App::DocumentObject* obj)
_objects.erase(obj);
}
void DocumentObjectObserver::slotCreatedDocument(const App::Document&)
void DocumentObjectObserver::slotCreatedDocument([[maybe_unused]] const App::Document& doc)
{}
void DocumentObjectObserver::slotDeletedDocument(const App::Document& Doc)
@@ -990,13 +1038,12 @@ void DocumentObjectObserver::slotDeletedDocument(const App::Document& Doc)
}
}
void DocumentObjectObserver::slotCreatedObject(const App::DocumentObject&)
void DocumentObjectObserver::slotCreatedObject([[maybe_unused]] const App::DocumentObject& obj)
{}
void DocumentObjectObserver::slotDeletedObject(const App::DocumentObject& Obj)
{
std::set<App::DocumentObject*>::iterator it =
_objects.find(const_cast<App::DocumentObject*>(&Obj));
auto it = _objects.find(const_cast<App::DocumentObject*>(&Obj));
if (it != _objects.end()) {
_objects.erase(it);
}
@@ -1005,7 +1052,10 @@ void DocumentObjectObserver::slotDeletedObject(const App::DocumentObject& Obj)
}
}
void DocumentObjectObserver::slotChangedObject(const App::DocumentObject&, const App::Property&)
void DocumentObjectObserver::slotChangedObject(
[[maybe_unused]] const App::DocumentObject& obj,
[[maybe_unused]] const App::Property& prop
)
{}
void DocumentObjectObserver::cancelObservation()
+42 -16
View File
@@ -23,8 +23,7 @@
***************************************************************************/
#ifndef APP_DOCUMENTOBSERVER_H
#define APP_DOCUMENTOBSERVER_H
#pragma once
#include <Base/BaseClass.h>
#include <Base/Bitmask.h>
@@ -56,17 +55,21 @@ public:
/*! Constructor */
DocumentT(Document*); // explicit bombs
/*! Constructor */
explicit DocumentT(const std::string&);
explicit DocumentT(std::string);
/*! Constructor */
DocumentT(const DocumentT&);
/*! Move constructor */
DocumentT(DocumentT&&) noexcept;
/*! Destructor */
~DocumentT();
/*! Assignment operator */
void operator=(const DocumentT&);
DocumentT& operator=(const DocumentT&);
/*! Move assignment operator */
DocumentT& operator=(DocumentT&&) noexcept;
/*! Assignment operator */
void operator=(const Document*);
DocumentT& operator=(const Document*);
/*! Assignment operator */
void operator=(const std::string&);
DocumentT& operator=(const std::string&);
bool operator==(const DocumentT& other) const
{
@@ -78,6 +81,11 @@ public:
return document < other.document;
}
explicit operator bool() const
{
return getDocument() != nullptr;
}
/*! Get a pointer to the document or 0 if it doesn't exist any more. */
Document* getDocument() const;
/*! Get the name of the document. */
@@ -104,7 +112,7 @@ public:
/*! Constructor */
DocumentObjectT(const DocumentObjectT&);
/*! Constructor */
DocumentObjectT(DocumentObjectT&&);
DocumentObjectT(DocumentObjectT&&) noexcept;
/*! Constructor */
explicit DocumentObjectT(const DocumentObject*);
/*! Constructor */
@@ -118,14 +126,24 @@ public:
/*! Assignment operator */
DocumentObjectT& operator=(const DocumentObjectT&);
/*! Assignment operator */
DocumentObjectT& operator=(DocumentObjectT&&);
DocumentObjectT& operator=(DocumentObjectT&&) noexcept;
/*! Assignment operator */
void operator=(const DocumentObject*);
DocumentObjectT& operator=(const DocumentObject*);
/*! Assignment operator */
void operator=(const Property*);
DocumentObjectT& operator=(const Property*);
/*! Equality operator */
bool operator==(const DocumentObjectT&) const;
bool operator<(const DocumentObjectT& other) const
{
return object < other.object;
}
explicit operator bool() const
{
return getObject() != nullptr;
}
/*! Get a pointer to the document or 0 if it doesn't exist any more. */
Document* getDocument() const;
/*! Get the name of the document. */
@@ -136,8 +154,13 @@ public:
DocumentObject* getObject() const;
/*! Get a pointer to the property or 0 if it doesn't exist any more. */
Property* getProperty() const;
/*! Get a pointer to the property by name or 0 if it doesn't exist any more. */
Property* getPropertyByName(const char* name) const;
/*! Get the name of the document object. */
const std::string& getObjectName() const;
/*! Get the name of the document object. */
const char* getNameInDocument() const;
bool isAttachedToDocument() const;
/*! Get the label of the document object. */
const std::string& getObjectLabel() const;
/*! Get the name of the property. */
@@ -172,11 +195,14 @@ public:
/*! Constructor */
SubObjectT();
/*! Destructor */
~SubObjectT();
/*! Constructor */
SubObjectT(const SubObjectT&);
/*! Constructor */
SubObjectT(SubObjectT&&);
SubObjectT(SubObjectT&&) noexcept;
/*! Constructor */
SubObjectT(const DocumentObjectT& obj, const char* subname);
@@ -194,7 +220,7 @@ public:
SubObjectT& operator=(const SubObjectT&);
/*! Assignment operator */
SubObjectT& operator=(SubObjectT&&);
SubObjectT& operator=(SubObjectT&&) noexcept;
/*! Assignment operator */
SubObjectT& operator=(const DocumentObjectT&);
@@ -357,7 +383,9 @@ public:
// disable
DocumentWeakPtrT(const DocumentWeakPtrT&) = delete;
DocumentWeakPtrT(DocumentWeakPtrT&&) = delete;
DocumentWeakPtrT& operator=(const DocumentWeakPtrT&) = delete;
DocumentWeakPtrT& operator=(DocumentWeakPtrT&&) = delete;
private:
class Private;
@@ -425,8 +453,6 @@ public:
private:
App::DocumentObject* _get() const noexcept;
private:
class Private;
std::unique_ptr<Private> d;
};
@@ -508,7 +534,9 @@ public:
// disable
WeakPtrT(const WeakPtrT&) = delete;
WeakPtrT(WeakPtrT&&) = delete;
WeakPtrT& operator=(const WeakPtrT&) = delete;
WeakPtrT& operator=(WeakPtrT&&) = delete;
private:
DocumentObjectWeakPtrT ptr;
@@ -628,5 +656,3 @@ struct std::hash<App::DocumentObjectWeakPtrT>
};
ENABLE_BITMASK_OPERATORS(App::SubObjectT::NormalizeOption)
#endif // APP_DOCUMENTOBSERVER_H
+1 -4
View File
@@ -23,8 +23,7 @@
***************************************************************************/
#ifndef APP_DOCUMENTOBSERVERPYTHON_H
#define APP_DOCUMENTOBSERVERPYTHON_H
#pragma once
#include <FCGlobal.h>
#include <fastsignals/signal.h>
@@ -165,5 +164,3 @@ private:
};
} // namespace App
#endif // APP_DOCUMENTOBSERVERPYTHON_H
+38 -11
View File
@@ -411,22 +411,40 @@ PyObject* DocumentPy::addObject(PyObject* args, PyObject* kwd)
PyObject* DocumentPy::removeObject(PyObject* args)
{
char* sName;
if (!PyArg_ParseTuple(args, "s", &sName)) {
return nullptr;
}
char* sName {};
if (PyArg_ParseTuple(args, "s", &sName)) {
DocumentObject* object = getDocumentPtr()->getObject(sName);
if (object) {
getDocumentPtr()->removeObject(sName);
Py_Return;
}
DocumentObject* pcFtr = getDocumentPtr()->getObject(sName);
if (pcFtr) {
getDocumentPtr()->removeObject(sName);
Py_Return;
}
else {
std::stringstream str;
str << "No document object found with name '" << sName << "'" << std::ends;
throw Py::ValueError(str.str());
}
PyErr_Clear();
PyObject* objpy {};
if (PyArg_ParseTuple(args, "O!", &App::DocumentObjectPy::Type, &objpy)) {
DocumentObject* object = static_cast<App::DocumentObjectPy*>(objpy)->getDocumentObjectPtr();
if (!object) {
PyErr_Format(PyExc_RuntimeError, "Invalid document object");
return nullptr;
}
if (object->getDocument() == getDocumentPtr()) {
getDocumentPtr()->removeObject(object);
Py_Return;
}
std::stringstream str;
str << "Document object is not part of this document";
throw Py::ValueError(str.str());
}
PyErr_SetString(PyExc_TypeError, "Expect str or DocumentObject");
return nullptr;
}
PyObject* DocumentPy::copyObject(PyObject* args, PyObject* kwd)
@@ -1157,6 +1175,15 @@ PyObject* DocumentPy::getDependentDocuments(PyObject* args)
}
PY_CATCH;
}
PyObject* DocumentPy::getBookedTransactionID(PyObject* args)
{
if (!PyArg_ParseTuple(args, "")) {
return nullptr;
}
int tid = getDocumentPtr()->getBookedTransactionID();
return Py::new_reference_to(Py::Long(tid));
}
Py::Boolean DocumentPy::getRestoring() const
{
+65 -23
View File
@@ -26,6 +26,12 @@
#include <vector>
#include <string>
#include <boost/multi_index_container.hpp>
#include <boost/multi_index/hashed_index.hpp>
#include <boost/multi_index/sequenced_index.hpp>
#include <boost/multi_index/member.hpp>
#include <boost/multi_index/mem_fun.hpp>
#include <Base/Reader.h>
#include <Base/Tools.h>
#include <Base/UniqueNameManager.h>
@@ -42,8 +48,38 @@ FC_LOG_LEVEL_INIT("Property", true, true)
using namespace App;
std::size_t CStringHasher::operator()(const char* s) const {
if (!s) {
return 0;
}
return boost::hash_range(s, s + std::strlen(s));
}
DynamicProperty::DynamicProperty() = default;
bool CStringHasher::operator()(const char* a, const char* b) const {
if (!a) {
return !b;
}
if (!b) {
return false;
}
return std::strcmp(a, b) == 0;
}
namespace bmi = boost::multi_index;
struct DynamicProperty::Impl {
bmi::multi_index_container<
PropData,
bmi::indexed_by<
bmi::hashed_unique<bmi::const_mem_fun<PropData, const char*, &PropData::getName>,
CStringHasher,
CStringHasher>,
bmi::hashed_unique<bmi::member<PropData, Property*, &PropData::property>>>>
props;
};
DynamicProperty::DynamicProperty(): impl(std::make_unique<Impl>()) {};
DynamicProperty::~DynamicProperty()
{
@@ -52,7 +88,7 @@ DynamicProperty::~DynamicProperty()
void DynamicProperty::clear()
{
auto& index = props.get<0>();
auto& index = impl->props.get<0>();
for (auto& v : index) {
delete v.property;
}
@@ -61,7 +97,7 @@ void DynamicProperty::clear()
void DynamicProperty::getPropertyList(std::vector<Property*>& List) const
{
for (auto& v : props.get<0>()) {
for (auto& v : impl->props.get<0>()) {
List.push_back(v.property);
}
}
@@ -69,27 +105,27 @@ void DynamicProperty::getPropertyList(std::vector<Property*>& List) const
void DynamicProperty::getPropertyNamedList(
std::vector<std::pair<const char*, Property*>>& List) const
{
for (auto& v : props.get<0>()) {
for (auto& v : impl->props.get<0>()) {
List.emplace_back(v.getName(), v.property);
}
}
void DynamicProperty::visitProperties(const std::function<void(Property*)>& visitor) const {
for (auto& v : props.get<0>()) {
for (auto& v : impl->props.get<0>()) {
visitor(v.property);
}
}
void DynamicProperty::getPropertyMap(std::map<std::string,Property*>& Map) const
{
for (auto& v : props.get<0>()) {
for (auto& v : impl->props.get<0>()) {
Map[v.name] = v.property;
}
}
Property* DynamicProperty::getDynamicPropertyByName(const char* name) const
{
auto& index = props.get<0>();
auto& index = impl->props.get<0>();
auto it = index.find(name);
if (it != index.end()) {
return it->property;
@@ -100,7 +136,7 @@ Property* DynamicProperty::getDynamicPropertyByName(const char* name) const
std::vector<std::string> DynamicProperty::getDynamicPropertyNames() const
{
std::vector<std::string> names;
auto& index = props.get<0>();
auto& index = impl->props.get<0>();
names.reserve(index.size());
for (auto& v : index) {
names.push_back(v.name);
@@ -115,7 +151,7 @@ short DynamicProperty::getPropertyType(const Property* prop) const
short DynamicProperty::getPropertyType(const char* name) const
{
auto& index = props.get<0>();
auto& index = impl->props.get<0>();
auto it = index.find(name);
if (it != index.end()) {
short attr = it->attr;
@@ -132,7 +168,7 @@ short DynamicProperty::getPropertyType(const char* name) const
const char* DynamicProperty::getPropertyGroup(const Property* prop) const
{
auto& index = props.get<1>();
auto& index = impl->props.get<1>();
auto it = index.find(const_cast<Property*>(prop));
if (it != index.end()) {
return it->group.c_str();
@@ -142,7 +178,7 @@ const char* DynamicProperty::getPropertyGroup(const Property* prop) const
const char* DynamicProperty::getPropertyGroup(const char* name) const
{
auto& index = props.get<0>();
auto& index = impl->props.get<0>();
auto it = index.find(name);
if (it != index.end()) {
return it->group.c_str();
@@ -152,7 +188,7 @@ const char* DynamicProperty::getPropertyGroup(const char* name) const
const char* DynamicProperty::getPropertyDocumentation(const Property* prop) const
{
auto& index = props.get<1>();
auto& index = impl->props.get<1>();
auto it = index.find(const_cast<Property*>(prop));
if (it != index.end()) {
return it->doc.c_str();
@@ -160,9 +196,15 @@ const char* DynamicProperty::getPropertyDocumentation(const Property* prop) cons
return nullptr;
}
size_t DynamicProperty::size() const
{
return impl->props.size();
}
const char* DynamicProperty::getPropertyDocumentation(const char* name) const
{
auto& index = props.get<0>();
auto& index = impl->props.get<0>();
auto it = index.find(name);
if (it != index.end()) {
return it->doc.c_str();
@@ -228,7 +270,7 @@ Property* DynamicProperty::addDynamicProperty(PropertyContainer& pc,
Property* pcProperty = static_cast<Property*>(propInstance);
auto res = props.get<0>().emplace(pcProperty, name, nullptr, group, doc, attr, ro, hidden);
auto res = impl->props.get<0>().emplace(pcProperty, name, nullptr, group, doc, attr, ro, hidden);
pcProperty->setContainer(&pc);
pcProperty->myName = res.first->name.c_str();
@@ -253,7 +295,7 @@ bool DynamicProperty::addProperty(Property* prop)
if (!prop || !prop->hasName()) {
return false;
}
auto& index = props.get<0>();
auto& index = impl->props.get<0>();
#if BOOST_VERSION < 107500
if (index.count(prop->getName())) {
return false;
@@ -276,7 +318,7 @@ bool DynamicProperty::addProperty(Property* prop)
bool DynamicProperty::removeProperty(const Property* prop)
{
auto& index = props.get<1>();
auto& index = impl->props.get<1>();
auto it = index.find(const_cast<Property*>(prop));
if (it != index.end()) {
index.erase(it);
@@ -287,7 +329,7 @@ bool DynamicProperty::removeProperty(const Property* prop)
bool DynamicProperty::removeDynamicProperty(const char* name)
{
auto& index = props.get<0>();
auto& index = impl->props.get<0>();
auto it = index.find(name);
if (it != index.end()) {
if (it->property->testStatus(Property::LockDynamic)) {
@@ -333,7 +375,7 @@ std::string DynamicProperty::getUniquePropertyName(const PropertyContainer& pc,
void DynamicProperty::save(const Property* prop, Base::Writer& writer) const
{
auto& index = props.get<1>();
auto& index = impl->props.get<1>();
auto it = index.find(const_cast<Property*>(prop));
if (it != index.end()) {
auto& data = *it;
@@ -385,7 +427,7 @@ Property* DynamicProperty::restore(PropertyContainer& pc,
DynamicProperty::PropData DynamicProperty::getDynamicPropertyData(const Property* prop) const
{
auto& index = props.get<1>();
auto& index = impl->props.get<1>();
auto it = index.find(const_cast<Property*>(prop));
if (it != index.end()) {
return *it;
@@ -397,7 +439,7 @@ bool DynamicProperty::changeDynamicProperty(const Property* prop,
const char* group,
const char* doc)
{
auto& index = props.get<1>();
auto& index = impl->props.get<1>();
auto it = index.find(const_cast<Property*>(prop));
if (it == index.end()) {
return false;
@@ -414,7 +456,7 @@ bool DynamicProperty::changeDynamicProperty(const Property* prop,
bool DynamicProperty::renameDynamicProperty(Property* prop,
const char* newName)
{
auto& propIndex = props.get<1>();
auto& propIndex = impl->props.get<1>();
auto propIt = propIndex.find(prop);
if (propIt == propIndex.end()) {
return false;
@@ -436,7 +478,7 @@ bool DynamicProperty::renameDynamicProperty(Property* prop,
}
std::string oldName{data.getName()};
auto& nameIndex = props.get<0>();
auto& nameIndex = impl->props.get<0>();
auto nameIt = nameIndex.find(data.getName());
if (nameIt == nameIndex.end()) {
// This should never happen
@@ -458,7 +500,7 @@ bool DynamicProperty::renameDynamicProperty(Property* prop,
const char* DynamicProperty::getPropertyName(const Property* prop) const
{
auto& index = props.get<1>();
auto& index = impl->props.get<1>();
auto it = index.find(const_cast<Property*>(prop));
if (it != index.end()) {
return it->getName();
+10 -42
View File
@@ -23,19 +23,15 @@
***************************************************************************/
#ifndef SRC_APP_DYNAMICPROPERTY_H_
#define SRC_APP_DYNAMICPROPERTY_H_
#pragma once
#include <map>
#include <string>
#include <vector>
#include <utility>
#include <memory>
#include <functional>
#include <boost/multi_index_container.hpp>
#include <boost/multi_index/hashed_index.hpp>
#include <boost/multi_index/sequenced_index.hpp>
#include <boost/multi_index/member.hpp>
#include <boost/multi_index/mem_fun.hpp>
#include <FCGlobal.h>
@@ -51,27 +47,10 @@ namespace App
class Property;
class PropertyContainer;
namespace bmi = boost::multi_index;
struct CStringHasher
struct AppExport CStringHasher
{
inline std::size_t operator()(const char* s) const
{
if (!s) {
return 0;
}
return boost::hash_range(s, s + std::strlen(s));
}
inline bool operator()(const char* a, const char* b) const
{
if (!a) {
return !b;
}
if (!b) {
return false;
}
return std::strcmp(a, b) == 0;
}
std::size_t operator()(const char* s) const;
bool operator()(const char* a, const char* b) const;
};
/** This class implements an interface to add properties at run-time to an object
@@ -161,10 +140,7 @@ public:
void clear();
/// Get property count
size_t size() const
{
return props.size();
}
size_t size() const;
void save(const Property* prop, Base::Writer& writer) const;
@@ -218,16 +194,8 @@ private:
std::string getUniquePropertyName(const PropertyContainer& pc, const char* Name) const;
private:
bmi::multi_index_container<
PropData,
bmi::indexed_by<
bmi::hashed_unique<bmi::const_mem_fun<PropData, const char*, &PropData::getName>,
CStringHasher,
CStringHasher>,
bmi::hashed_unique<bmi::member<PropData, Property*, &PropData::property>>>>
props;
struct Impl;
std::unique_ptr<Impl> impl;
};
} // namespace App
#endif // SRC_APP_DYNAMICPROPERTY_H_
} // namespace App
+1
View File
@@ -14,6 +14,7 @@
#include "DocumentObject.h"
#include <boost/algorithm/string/classification.hpp>
#include <boost/algorithm/string/predicate.hpp>
#include <boost/algorithm/string/split.hpp>
#include <boost/io/ios_state.hpp>
+1 -4
View File
@@ -23,8 +23,7 @@
* *
***************************************************************************/
#ifndef DATA_ELEMENTMAP_H
#define DATA_ELEMENTMAP_H
#pragma once
#include "FCGlobal.h"
@@ -423,5 +422,3 @@ public:
} // namespace Data
#endif // DATA_ELEMENTMAP_H
+18
View File
@@ -1,6 +1,7 @@
// SPDX-License-Identifier: LGPL-2.1-or-later
#include "ElementNamingUtils.h"
#include <charconv>
#include <boost/algorithm/string/predicate.hpp>
@@ -123,3 +124,20 @@ const std::string Data::indexSuffix(int index, const char* label)
name += std::to_string(index);
return name;
}
int Data::indexOfElement(std::string_view s, std::string_view prefix)
{
int idx = 0;
if (prefix.empty()) {
return idx;
}
if (s.starts_with(prefix)) {
auto num = s.substr(prefix.size());
auto [ptr, ec] = std::from_chars(num.data(), num.data() + num.size(), idx);
if (ec != std::errc{} || ptr != num.data() + num.size()) {
return 0;
}
}
return idx;
}
+5 -4
View File
@@ -1,9 +1,9 @@
// SPDX-License-Identifier: LGPL-2.1-or-later
#ifndef ELEMENT_NAMING_UTILS_H
#define ELEMENT_NAMING_UTILS_H
#pragma once
#include <string>
#include <string_view>
#include <utility>
#include "FCGlobal.h"
@@ -120,7 +120,8 @@ AppExport const char *hasMappedElementName(const char *subname);
AppExport const std::string indexSuffix(int index, const char *label=ELEMENT_MAP_INDEX);
/// Given a string and a prefix, return the integer index that follows that prefix, or 0 if not found
AppExport int indexOfElement(std::string_view s, std::string_view prefix);
} // namespace Data
// clang-format on
#endif // ELEMENT_NAMING_UTILS_H
+1 -4
View File
@@ -23,8 +23,7 @@
***************************************************************************/
#ifndef BASE_ENUMERATION_H
#define BASE_ENUMERATION_H
#pragma once
#include <memory>
#include <string>
@@ -194,5 +193,3 @@ private:
friend class PropertyEnumeration;
}; // class Enumeration
} // namespace App
#endif // #ifndef BASE_ENUMERATION_H
+1 -4
View File
@@ -1,7 +1,6 @@
// SPDX-License-Identifier: LGPL-2.1-or-later
#ifndef SRC_APP_EXPORTINFO_H_
#define SRC_APP_EXPORTINFO_H_
#pragma once
#include "DocumentObject.h"
@@ -23,5 +22,3 @@ struct ExportInfo {
};
}
#endif
+96 -81
View File
@@ -636,25 +636,31 @@ bool isAnyEqual(const App::any &v1, const App::any &v2) {
return !!res;
}
Expression* expressionFromPy(const DocumentObject *owner, const Py::Object &value) {
ExpressionPtr expressionFromPy(const DocumentObject* owner, const Py::Object& value)
{
if (value.isNone())
return new PyObjectExpression(owner);
return std::make_unique<PyObjectExpression>(owner);
if(value.isString()) {
return new StringExpression(owner,value.as_string());
return std::make_unique<StringExpression>(owner, value.as_string());
} else if (PyObject_TypeCheck(value.ptr(),&QuantityPy::Type)) {
return new NumberExpression(owner,
*static_cast<QuantityPy*>(value.ptr())->getQuantityPtr());
return std::make_unique<NumberExpression>(
owner,
*static_cast<QuantityPy*>(value.ptr())->getQuantityPtr()
);
} else if (value.isBoolean()) {
if(value.isTrue())
return new ConstantExpression(owner,"True",Quantity(1.0));
else
return new ConstantExpression(owner,"False",Quantity(0.0));
if (value.isTrue()) {
return std::make_unique<ConstantExpression>(owner, "True", Quantity(1.0));
}
else {
return std::make_unique<ConstantExpression>(owner, "False", Quantity(0.0));
}
} else {
Quantity q;
if(pyToQuantity(q,value))
return new NumberExpression(owner,q);
if (pyToQuantity(q, value)) {
return std::make_unique<NumberExpression>(owner, q);
}
}
return new PyObjectExpression(owner,value.ptr());
return std::make_unique<PyObjectExpression>(owner, value.ptr());
}
} // namespace App
@@ -686,12 +692,7 @@ Expression::Component::Component(const Component &other)
,e3(other.e3?other.e3->copy():nullptr)
{}
Expression::Component::~Component()
{
delete e1;
delete e2;
delete e3;
}
Expression::Component::~Component() = default;
Expression::Component* Expression::Component::copy() const {
return new Component(*this);
@@ -881,7 +882,7 @@ int Expression::priority() const {
return 20;
}
Expression * Expression::parse(const DocumentObject *owner, const std::string &buffer)
ExpressionPtr Expression::parse(const DocumentObject* owner, const std::string& buffer)
{
return ExpressionParser::parse(owner, buffer.c_str());
}
@@ -1024,7 +1025,7 @@ ExpressionPtr Expression::importSubNames(const std::map<std::string,std::string>
ImportSubNamesExpressionVisitor v(subNameMap);
auto res = copy();
res->visit(v);
return ExpressionPtr(res);
return res;
}
class UpdateLabelExpressionVisitor : public ExpressionVisitor {
@@ -1056,7 +1057,7 @@ ExpressionPtr Expression::updateLabelReference(
UpdateLabelExpressionVisitor v(obj,ref,newLabel);
auto expr = copy();
expr->visit(v);
return ExpressionPtr(expr);
return expr;
}
}
return {};
@@ -1101,7 +1102,7 @@ ExpressionPtr Expression::replaceObject(const DocumentObject *parent,
auto expr = copy();
v.collect = false;
expr->visit(v);
return ExpressionPtr(expr);
return expr;
}
App::any Expression::getValueAsAny() const {
@@ -1135,9 +1136,10 @@ void Expression::visit(ExpressionVisitor &v) {
v.visit(*this);
}
Expression* Expression::eval() const {
ExpressionPtr Expression::eval() const
{
Base::PyGILStateLocker lock;
return expressionFromPy(owner,getPyValue());
return expressionFromPy(owner, getPyValue());
}
bool Expression::isSame(const Expression &other, bool checkComment) const {
@@ -1175,8 +1177,9 @@ void Expression::toString(std::ostream &ss, bool persistent, bool checkPriority,
c->toString(ss,persistent);
}
Expression* Expression::copy() const {
auto expr = _copy();
ExpressionPtr Expression::copy() const
{
auto expr = std::unique_ptr<Expression>(_copy());
copy_vector(expr->components,components);
expr->comment = comment;
return expr;
@@ -1223,9 +1226,9 @@ void UnitExpression::setUnit(const Quantity &_quantity)
}
}
Expression *UnitExpression::simplify() const
ExpressionPtr UnitExpression::simplify() const
{
return new NumberExpression(owner, quantity);
return std::make_unique<NumberExpression>(owner, quantity);
}
void UnitExpression::_toString(std::ostream &ss, bool,int) const
@@ -1255,7 +1258,7 @@ NumberExpression::NumberExpression(const DocumentObject *_owner, const Quantity
{
}
Expression *NumberExpression::simplify() const
ExpressionPtr NumberExpression::simplify() const
{
return copy();
}
@@ -1436,19 +1439,17 @@ Py::Object OperatorExpression::_getPyValue() const {
return calc(this,op,left,right,false);
}
Expression *OperatorExpression::simplify() const
ExpressionPtr OperatorExpression::simplify() const
{
Expression * v1 = left->simplify();
Expression * v2 = right->simplify();
ExpressionPtr v1 = left->simplify();
ExpressionPtr v2 = right->simplify();
// Both arguments reduced to numerics? Then evaluate and return answer
if (freecad_cast<NumberExpression*>(v1) && freecad_cast<NumberExpression*>(v2)) {
delete v1;
delete v2;
if (freecad_cast<NumberExpression*>(v1.get()) && freecad_cast<NumberExpression*>(v2.get())) {
return eval();
}
else
return new OperatorExpression(owner, v1, op, v2);
return std::make_unique<OperatorExpression>(owner, v1.release(), op, v2.release());
}
void OperatorExpression::_toString(std::ostream &s, bool persistent,int) const
@@ -1554,7 +1555,7 @@ void OperatorExpression::_toString(std::ostream &s, bool persistent,int) const
Expression *OperatorExpression::_copy() const
{
return new OperatorExpression(owner, left->copy(), op, right->copy());
return new OperatorExpression(owner, left->copy().release(), op, right->copy().release());
}
int OperatorExpression::priority() const
@@ -2584,18 +2585,19 @@ Py::Object FunctionExpression::_getPyValue() const {
return evaluate(this,f,args);
}
Expression *FunctionExpression::simplify() const
ExpressionPtr FunctionExpression::simplify() const
{
size_t numerics = 0;
std::vector<Expression*> simplifiedArgs;
// Try to simplify each argument to function
for (auto it : args) {
Expression * v = it->simplify();
ExpressionPtr v = it->simplify();
if (freecad_cast<NumberExpression*>(v))
if (freecad_cast<NumberExpression*>(v.get())) {
++numerics;
simplifiedArgs.push_back(v);
}
simplifiedArgs.push_back(v.release());
}
if (numerics == args.size()) {
@@ -2608,8 +2610,12 @@ Expression *FunctionExpression::simplify() const
return eval();
}
else
return new FunctionExpression(owner, f, std::string(fname),
std::move(simplifiedArgs));
return std::make_unique<FunctionExpression>(
owner,
f,
std::string(fname),
std::move(simplifiedArgs)
);
}
void FunctionExpression::_toString(std::ostream &ss, bool persistent,int) const
@@ -2768,7 +2774,7 @@ Expression *FunctionExpression::_copy() const
std::vector<Expression*> a;
while (i != args.end()) {
a.push_back((*i)->copy());
a.push_back((*i)->copy().release());
++i;
}
return new FunctionExpression(owner, f, std::string(fname), std::move(a));
@@ -2824,16 +2830,16 @@ void VariableExpression::addComponent(Component *c) {
}
long l1=0,l2=0,l3=1;
if(c->e3) {
auto n3 = freecad_cast<NumberExpression*>(c->e3);
auto n3 = freecad_cast<NumberExpression*>(c->e3.get());
if(!n3 || !essentiallyEqual(n3->getValue(),(double)l3))
break;
}
if(c->e1) {
auto n1 = freecad_cast<NumberExpression*>(c->e1);
auto n1 = freecad_cast<NumberExpression*>(c->e1.get());
if(!n1) {
if(c->e2 || c->e3)
break;
auto s = freecad_cast<StringExpression*>(c->e1);
auto s = freecad_cast<StringExpression*>(c->e1.get());
if(!s)
break;
var << ObjectIdentifier::MapComponent(
@@ -2850,7 +2856,7 @@ void VariableExpression::addComponent(Component *c) {
return;
}
}
auto n2 = freecad_cast<NumberExpression*>(c->e2);
auto n2 = freecad_cast<NumberExpression*>(c->e2.get());
if(n2 && essentiallyInteger(n2->getValue(),l2)) {
var << ObjectIdentifier::RangeComponent(l1,l2,l3);
return;
@@ -2875,7 +2881,7 @@ void VariableExpression::_toString(std::ostream &ss, bool persistent,int) const
ss << var.toString();
}
Expression *VariableExpression::simplify() const
ExpressionPtr VariableExpression::simplify() const
{
return copy();
}
@@ -3080,7 +3086,7 @@ StringExpression::~StringExpression() {
}
}
Expression *StringExpression::simplify() const
ExpressionPtr StringExpression::simplify() const
{
return copy();
}
@@ -3128,18 +3134,26 @@ Py::Object ConditionalExpression::_getPyValue() const {
return falseExpr->getPyValue();
}
Expression *ConditionalExpression::simplify() const
ExpressionPtr ConditionalExpression::simplify() const
{
std::unique_ptr<Expression> e(condition->simplify());
ExpressionPtr e = condition->simplify();
NumberExpression * v = freecad_cast<NumberExpression*>(e.get());
if (!v)
return new ConditionalExpression(owner, condition->simplify(), trueExpr->simplify(), falseExpr->simplify());
if (!v) {
return std::make_unique<ConditionalExpression>(
owner,
condition->simplify().release(),
trueExpr->simplify().release(),
falseExpr->simplify().release()
);
}
else {
if (fabs(v->getValue()) >= Base::Precision::Confusion())
if (fabs(v->getValue()) >= Base::Precision::Confusion()) {
return trueExpr->simplify();
else
}
else {
return falseExpr->simplify();
}
}
}
@@ -3166,7 +3180,12 @@ void ConditionalExpression::_toString(std::ostream &ss, bool persistent,int) con
Expression *ConditionalExpression::_copy() const
{
return new ConditionalExpression(owner, condition->copy(), trueExpr->copy(), falseExpr->copy());
return new ConditionalExpression(
owner,
condition->copy().release(),
trueExpr->copy().release(),
falseExpr->copy().release()
);
}
int ConditionalExpression::priority() const
@@ -3262,7 +3281,7 @@ Expression *RangeExpression::_copy() const
return new RangeExpression(owner, begin, end);
}
Expression *RangeExpression::simplify() const
ExpressionPtr RangeExpression::simplify() const
{
return copy();
}
@@ -3459,7 +3478,7 @@ double num_change(char* yytext,char dez_delim,char grp_delim)
}
/// The resulting expression after a successful parsing.
static Expression* ScanResult = nullptr;
static ExpressionPtr ScanResult = ExpressionPtr {};
/// The DocumentObject that will own the expression.
static const App::DocumentObject* DocumentObject = nullptr;
@@ -3539,7 +3558,7 @@ static void initParser(const App::DocumentObject *owner)
using namespace App::ExpressionParser;
ScanResult = nullptr;
ScanResult.reset();
App::ExpressionParser::DocumentObject = owner;
labels = std::stack<std::string>();
column = 0;
@@ -3659,7 +3678,7 @@ std::vector<std::tuple<int, int, std::string> > tokenize(const std::string &str)
*
*/
Expression * App::ExpressionParser::parse(const App::DocumentObject *owner, const char* buffer)
ExpressionPtr App::ExpressionParser::parse(const App::DocumentObject* owner, const char* buffer)
{
// parse from buffer
ExpressionParser::YY_BUFFER_STATE my_string_buffer = ExpressionParser::ExpressionParser_scan_string (buffer);
@@ -3678,16 +3697,17 @@ Expression * App::ExpressionParser::parse(const App::DocumentObject *owner, cons
throw ParserError(fmt::format("Unknown error in expression '{}'", buffer));
}
if (valueExpression) {
return ScanResult;
}
else {
delete ScanResult;
if (!valueExpression) {
ScanResult.reset();
throw Expression::Exception("Expression can not evaluate to a value.");
}
return std::exchange(ScanResult, nullptr);
}
UnitExpression * ExpressionParser::parseUnit(const App::DocumentObject *owner, const char* buffer)
std::unique_ptr<UnitExpression> ExpressionParser::parseUnit(
const App::DocumentObject* owner,
const char* buffer
)
{
// parse from buffer
ExpressionParser::YY_BUFFER_STATE my_string_buffer = ExpressionParser::ExpressionParser_scan_string (buffer);
@@ -3705,10 +3725,10 @@ UnitExpression * ExpressionParser::parseUnit(const App::DocumentObject *owner, c
throw ParserError("Unknown error in expression");
// Simplify expression
Expression * simplified = ScanResult->simplify();
ExpressionPtr simplified = ScanResult->simplify();
if (!unitExpression) {
OperatorExpression * fraction = freecad_cast<OperatorExpression*>(ScanResult);
auto* fraction = freecad_cast<OperatorExpression*>(ScanResult.get());
if (fraction && fraction->getOperator() == OperatorExpression::DIV) {
NumberExpression * nom = freecad_cast<NumberExpression*>(fraction->getLeft());
@@ -3719,21 +3739,16 @@ UnitExpression * ExpressionParser::parseUnit(const App::DocumentObject *owner, c
unitExpression = true;
}
}
delete ScanResult;
ScanResult.reset();
if (unitExpression) {
NumberExpression * num = freecad_cast<NumberExpression*>(simplified);
if (num) {
simplified = new UnitExpression(num->getOwner(), num->getQuantity());
delete num;
}
return freecad_cast<UnitExpression*>(simplified);
}
else {
delete simplified;
if (!unitExpression) {
throw Expression::Exception("Expression is not a unit.");
}
if (auto num = freecad_cast<NumberExpression*>(simplified.get()); num) {
return std::make_unique<UnitExpression>(num->getOwner(), num->getQuantity());
}
return std::unique_ptr<UnitExpression>(freecad_cast<UnitExpression*>(simplified.release()));
}
namespace {
+6 -9
View File
@@ -22,8 +22,7 @@
* *
***************************************************************************/
#ifndef EXPRESSION_H
#define EXPRESSION_H
#pragma once
#include <deque>
#include <set>
@@ -332,7 +331,7 @@ public:
*
* @return The evaluated expression.
*/
Expression* eval() const;
ExpressionPtr eval() const;
/**
* @brief Convert the expression to a string.
@@ -363,10 +362,10 @@ public:
*
* @return The parsed expression.
*/
static Expression* parse(const App::DocumentObject * owner, const std::string& buffer);
static ExpressionPtr parse(const App::DocumentObject* owner, const std::string& buffer);
/// Copy an expression.
Expression * copy() const;
ExpressionPtr copy() const;
/**
* @brief Get the operator priority.
@@ -487,7 +486,7 @@ public:
*
* @return The simplified expression.
*/
virtual Expression * simplify() const = 0;
virtual ExpressionPtr simplify() const = 0;
/// Visit the expression with a visitor.
void visit(ExpressionVisitor & v);
@@ -580,6 +579,4 @@ public:
// clang-format on
};
}
#endif // EXPRESSION_H
}
+9
View File
@@ -211,6 +211,9 @@ EXPO [eE][-+]?[0-9]+
"h" COUNTCHARS; yylval.quantity.scaler = Quantity::Hour; yylval.quantity.unitStr = yytext; return UNIT; // hour
"A" COUNTCHARS; yylval.quantity.scaler = Quantity::Ampere; yylval.quantity.unitStr = yytext; return UNIT; // Ampere (internal standard electric current)
"nA" COUNTCHARS; yylval.quantity.scaler = Quantity::NanoAmpere; yylval.quantity.unitStr = yytext; return UNIT; // nano Ampere
"uA" COUNTCHARS; yylval.quantity.scaler = Quantity::MicroAmpere; yylval.quantity.unitStr = yytext; return UNIT; // micro Ampere
"\xC2\xB5""A" COUNTCHARS; yylval.quantity.scaler = Quantity::MicroAmpere; yylval.quantity.unitStr = yytext; return UNIT; // micro Ampere
"mA" COUNTCHARS; yylval.quantity.scaler = Quantity::MilliAmpere; yylval.quantity.unitStr = yytext; return UNIT; // milli Ampere
"kA" COUNTCHARS; yylval.quantity.scaler = Quantity::KiloAmpere; yylval.quantity.unitStr = yytext; return UNIT; // kilo Ampere
"MA" COUNTCHARS; yylval.quantity.scaler = Quantity::MegaAmpere; yylval.quantity.unitStr = yytext; return UNIT; // mega Ampere
@@ -221,6 +224,9 @@ EXPO [eE][-+]?[0-9]+
"uK" COUNTCHARS; yylval.quantity.scaler = Quantity::MicroKelvin; yylval.quantity.unitStr = yytext; return UNIT; // micro Kelvin
"mol" COUNTCHARS; yylval.quantity.scaler = Quantity::Mole; yylval.quantity.unitStr = yytext; return UNIT; // Mole (internal standard amount of substance)
"nmol" COUNTCHARS; yylval.quantity.scaler = Quantity::NanoMole; yylval.quantity.unitStr = yytext; return UNIT; // nano Mole
"\xC2\xB5mol" COUNTCHARS; yylval.quantity.scaler = Quantity::MicroMole; yylval.quantity.unitStr = yytext; return UNIT; // micro Mole
"umol" COUNTCHARS; yylval.quantity.scaler = Quantity::MicroMole; yylval.quantity.unitStr = yytext; return UNIT; // micro Mole
"mmol" COUNTCHARS; yylval.quantity.scaler = Quantity::MilliMole; yylval.quantity.unitStr = yytext; return UNIT; // milli Mole
"cd" COUNTCHARS; yylval.quantity.scaler = Quantity::Candela; yylval.quantity.unitStr = yytext; return UNIT; // Candela (internal standard luminous intensity)
@@ -269,6 +275,9 @@ EXPO [eE][-+]?[0-9]+
"Mpsi" COUNTCHARS; yylval.quantity.scaler = Quantity::MPSI; yylval.quantity.unitStr = yytext; return UNIT; // 1000 ksi
"W" COUNTCHARS; yylval.quantity.scaler = Quantity::Watt; yylval.quantity.unitStr = yytext; return UNIT; // Watt (kg*m^2/s^3)
"nW" COUNTCHARS; yylval.quantity.scaler = Quantity::NanoWatt; yylval.quantity.unitStr = yytext; return UNIT; // nano Watt
"uW" COUNTCHARS; yylval.quantity.scaler = Quantity::MicroWatt; yylval.quantity.unitStr = yytext; return UNIT; // micro Watt
"\xC2\xB5W" COUNTCHARS; yylval.quantity.scaler = Quantity::MicroWatt; yylval.quantity.unitStr = yytext; return UNIT; // micro Watt
"mW" COUNTCHARS; yylval.quantity.scaler = Quantity::MilliWatt; yylval.quantity.unitStr = yytext; return UNIT; // milli Watt
"kW" COUNTCHARS; yylval.quantity.scaler = Quantity::KiloWatt; yylval.quantity.unitStr = yytext; return UNIT; // kilo Watt
"VA" COUNTCHARS; yylval.quantity.scaler = Quantity::VoltAmpere; yylval.quantity.unitStr = yytext; return UNIT; // VoltAmpere (kg*m^2/s^3)
+6215 -6349
View File
File diff suppressed because it is too large Load Diff
+10 -178
View File
@@ -70,7 +70,6 @@
/* First part of user prologue. */
#line 26 "Expression.y"
#define YYSTYPE App::ExpressionParser::semantic_type
@@ -79,7 +78,6 @@ std::stack<FunctionExpression::Function> functions; /**< Function
#define yyparse ExpressionParser_yyparse
#define yyerror ExpressionParser_yyerror
#line 80 "Expression.tab.c"
# ifndef YY_CAST
# ifdef __cplusplus
@@ -555,14 +553,14 @@ static const yytype_int8 yytranslate[] =
/* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
static const yytype_uint8 yyrline[] =
{
0, 81, 81, 82, 85, 86, 89, 90, 91, 92,
93, 94, 95, 96, 97, 98, 99, 100, 101, 102,
103, 104, 105, 106, 107, 108, 109, 110, 111, 114,
115, 116, 117, 119, 120, 121, 122, 123, 124, 127,
131, 132, 134, 135, 136, 137, 138, 139, 140, 143,
144, 148, 149, 153, 154, 158, 163, 168, 174, 181,
188, 195, 199, 200, 201, 202, 203, 204, 205, 206,
210, 211, 212, 216, 217, 221, 222
0, 83, 83, 84, 87, 88, 91, 92, 93, 94,
95, 96, 97, 98, 99, 100, 101, 102, 103, 104,
105, 106, 107, 108, 109, 110, 111, 112, 113, 116,
117, 118, 119, 121, 122, 123, 124, 125, 126, 129,
133, 134, 136, 137, 138, 139, 140, 141, 142, 145,
146, 150, 151, 155, 156, 160, 165, 170, 176, 183,
190, 197, 201, 202, 203, 204, 205, 206, 207, 208,
212, 213, 214, 218, 219, 223, 224
};
#endif
@@ -1007,45 +1005,31 @@ yydestruct (const char *yymsg,
switch (yykind)
{
case YYSYMBOL_exp: /* exp */
#line 73 "Expression.y"
{ delete ((*yyvaluep).expr); }
#line 1010 "Expression.tab.c"
break;
case YYSYMBOL_num: /* num */
#line 73 "Expression.y"
{ delete ((*yyvaluep).expr); }
#line 1016 "Expression.tab.c"
break;
case YYSYMBOL_args: /* args */
#line 75 "Expression.y"
{ std::vector<Expression*>::const_iterator i = ((*yyvaluep).arguments).begin(); while (i != ((*yyvaluep).arguments).end()) { delete *i; ++i; } }
#line 1022 "Expression.tab.c"
break;
case YYSYMBOL_range: /* range */
#line 73 "Expression.y"
{ delete ((*yyvaluep).expr); }
#line 1028 "Expression.tab.c"
break;
case YYSYMBOL_unit_exp: /* unit_exp */
#line 73 "Expression.y"
{ delete ((*yyvaluep).expr); }
#line 1034 "Expression.tab.c"
break;
case YYSYMBOL_indexer: /* indexer */
#line 74 "Expression.y"
{ delete ((*yyvaluep).component); }
#line 1040 "Expression.tab.c"
break;
case YYSYMBOL_indexable: /* indexable */
#line 73 "Expression.y"
{ delete ((*yyvaluep).expr); }
#line 1046 "Expression.tab.c"
break;
default:
@@ -1313,356 +1297,243 @@ yyreduce:
switch (yyn)
{
case 2: /* input: exp */
#line 81 "Expression.y"
{ ScanResult = (yyvsp[0].expr); valueExpression = true; }
#line 1316 "Expression.tab.c"
{ ScanResult = std::unique_ptr<Expression>((yyvsp[0].expr)); valueExpression = true; }
break;
case 3: /* input: unit_exp */
#line 82 "Expression.y"
{ ScanResult = (yyvsp[0].expr); unitExpression = true; }
#line 1322 "Expression.tab.c"
{ ScanResult = std::unique_ptr<Expression>((yyvsp[0].expr)); unitExpression = true; }
break;
case 4: /* unit_num: num unit_exp */
#line 85 "Expression.y"
{ (yyval.expr) = new OperatorExpression(DocumentObject, (yyvsp[-1].expr), OperatorExpression::UNIT, (yyvsp[0].expr)); }
#line 1328 "Expression.tab.c"
break;
case 5: /* unit_num: num us_building_unit num us_building_unit */
#line 86 "Expression.y"
{ (yyval.expr) = new OperatorExpression(DocumentObject, new OperatorExpression(DocumentObject, (yyvsp[-3].expr), OperatorExpression::UNIT, (yyvsp[-2].expr)), OperatorExpression::ADD, new OperatorExpression(DocumentObject, (yyvsp[-1].expr), OperatorExpression::UNIT, (yyvsp[0].expr)));}
#line 1334 "Expression.tab.c"
break;
case 6: /* exp: num */
#line 89 "Expression.y"
{ (yyval.expr) = (yyvsp[0].expr); }
#line 1340 "Expression.tab.c"
break;
case 7: /* exp: unit_num */
#line 90 "Expression.y"
{ (yyval.expr) = (yyvsp[0].expr); }
#line 1346 "Expression.tab.c"
break;
case 8: /* exp: STRING */
#line 91 "Expression.y"
{ (yyval.expr) = new StringExpression(DocumentObject, (yyvsp[0].string)); }
#line 1352 "Expression.tab.c"
break;
case 9: /* exp: identifier */
#line 92 "Expression.y"
{ (yyval.expr) = new VariableExpression(DocumentObject, (yyvsp[0].path)); }
#line 1358 "Expression.tab.c"
break;
case 10: /* exp: MINUSSIGN exp */
#line 93 "Expression.y"
{ (yyval.expr) = new OperatorExpression(DocumentObject, (yyvsp[0].expr), OperatorExpression::NEG, new NumberExpression(DocumentObject, Quantity(-1))); }
#line 1364 "Expression.tab.c"
break;
case 11: /* exp: '+' exp */
#line 94 "Expression.y"
{ (yyval.expr) = new OperatorExpression(DocumentObject, (yyvsp[0].expr), OperatorExpression::POS, new NumberExpression(DocumentObject, Quantity(1))); }
#line 1370 "Expression.tab.c"
break;
case 12: /* exp: exp '+' exp */
#line 95 "Expression.y"
{ (yyval.expr) = new OperatorExpression(DocumentObject, (yyvsp[-2].expr), OperatorExpression::ADD, (yyvsp[0].expr)); }
#line 1376 "Expression.tab.c"
break;
case 13: /* exp: exp MINUSSIGN exp */
#line 96 "Expression.y"
{ (yyval.expr) = new OperatorExpression(DocumentObject, (yyvsp[-2].expr), OperatorExpression::SUB, (yyvsp[0].expr)); }
#line 1382 "Expression.tab.c"
break;
case 14: /* exp: exp '*' exp */
#line 97 "Expression.y"
{ (yyval.expr) = new OperatorExpression(DocumentObject, (yyvsp[-2].expr), OperatorExpression::MUL, (yyvsp[0].expr)); }
#line 1388 "Expression.tab.c"
break;
case 15: /* exp: exp '/' exp */
#line 98 "Expression.y"
{ (yyval.expr) = new OperatorExpression(DocumentObject, (yyvsp[-2].expr), OperatorExpression::DIV, (yyvsp[0].expr)); }
#line 1394 "Expression.tab.c"
break;
case 16: /* exp: exp '%' exp */
#line 99 "Expression.y"
{ (yyval.expr) = new OperatorExpression(DocumentObject, (yyvsp[-2].expr), OperatorExpression::MOD, (yyvsp[0].expr)); }
#line 1400 "Expression.tab.c"
break;
case 17: /* exp: exp '/' unit_exp */
#line 100 "Expression.y"
{ (yyval.expr) = new OperatorExpression(DocumentObject, (yyvsp[-2].expr), OperatorExpression::DIV, (yyvsp[0].expr)); }
#line 1406 "Expression.tab.c"
break;
case 18: /* exp: exp '^' exp */
#line 101 "Expression.y"
{ (yyval.expr) = new OperatorExpression(DocumentObject, (yyvsp[-2].expr), OperatorExpression::POW, (yyvsp[0].expr)); }
#line 1412 "Expression.tab.c"
break;
case 19: /* exp: exp EQ exp */
#line 102 "Expression.y"
{ (yyval.expr) = new OperatorExpression(DocumentObject, (yyvsp[-2].expr), OperatorExpression::EQ, (yyvsp[0].expr)); }
#line 1418 "Expression.tab.c"
break;
case 20: /* exp: exp NEQ exp */
#line 103 "Expression.y"
{ (yyval.expr) = new OperatorExpression(DocumentObject, (yyvsp[-2].expr), OperatorExpression::NEQ, (yyvsp[0].expr)); }
#line 1424 "Expression.tab.c"
break;
case 21: /* exp: exp LT exp */
#line 104 "Expression.y"
{ (yyval.expr) = new OperatorExpression(DocumentObject, (yyvsp[-2].expr), OperatorExpression::LT, (yyvsp[0].expr)); }
#line 1430 "Expression.tab.c"
break;
case 22: /* exp: exp GT exp */
#line 105 "Expression.y"
{ (yyval.expr) = new OperatorExpression(DocumentObject, (yyvsp[-2].expr), OperatorExpression::GT, (yyvsp[0].expr)); }
#line 1436 "Expression.tab.c"
break;
case 23: /* exp: exp GTE exp */
#line 106 "Expression.y"
{ (yyval.expr) = new OperatorExpression(DocumentObject, (yyvsp[-2].expr), OperatorExpression::GTE, (yyvsp[0].expr)); }
#line 1442 "Expression.tab.c"
break;
case 24: /* exp: exp LTE exp */
#line 107 "Expression.y"
{ (yyval.expr) = new OperatorExpression(DocumentObject, (yyvsp[-2].expr), OperatorExpression::LTE, (yyvsp[0].expr)); }
#line 1448 "Expression.tab.c"
break;
case 25: /* exp: indexable */
#line 108 "Expression.y"
{ (yyval.expr) = (yyvsp[0].expr); }
#line 1454 "Expression.tab.c"
break;
case 26: /* exp: FUNC args ')' */
#line 109 "Expression.y"
{ (yyval.expr) = new FunctionExpression(DocumentObject, (yyvsp[-2].func).first, std::move((yyvsp[-2].func).second), (yyvsp[-1].arguments));}
#line 1460 "Expression.tab.c"
break;
case 27: /* exp: exp '?' exp ':' exp */
#line 110 "Expression.y"
{ (yyval.expr) = new ConditionalExpression(DocumentObject, (yyvsp[-4].expr), (yyvsp[-2].expr), (yyvsp[0].expr)); }
#line 1466 "Expression.tab.c"
break;
case 28: /* exp: '(' exp ')' */
#line 111 "Expression.y"
{ (yyval.expr) = (yyvsp[-1].expr); }
#line 1472 "Expression.tab.c"
break;
case 29: /* num: ONE */
#line 114 "Expression.y"
{ (yyval.expr) = new NumberExpression(DocumentObject, Quantity((yyvsp[0].fvalue))); }
#line 1478 "Expression.tab.c"
break;
case 30: /* num: NUM */
#line 115 "Expression.y"
{ (yyval.expr) = new NumberExpression(DocumentObject, Quantity((yyvsp[0].fvalue))); }
#line 1484 "Expression.tab.c"
break;
case 31: /* num: INTEGER */
#line 116 "Expression.y"
{ (yyval.expr) = new NumberExpression(DocumentObject, Quantity((double)(yyvsp[0].ivalue))); }
#line 1490 "Expression.tab.c"
break;
case 32: /* num: CONSTANT */
#line 117 "Expression.y"
{ (yyval.expr) = new ConstantExpression(DocumentObject, (yyvsp[0].constant).name, Quantity((yyvsp[0].constant).fvalue)); }
#line 1496 "Expression.tab.c"
break;
case 33: /* args: exp */
#line 119 "Expression.y"
{ (yyval.arguments).push_back((yyvsp[0].expr)); }
#line 1502 "Expression.tab.c"
break;
case 34: /* args: range */
#line 120 "Expression.y"
{ (yyval.arguments).push_back((yyvsp[0].expr)); }
#line 1508 "Expression.tab.c"
break;
case 35: /* args: args ',' exp */
#line 121 "Expression.y"
{ (yyvsp[-2].arguments).push_back((yyvsp[0].expr)); (yyval.arguments) = (yyvsp[-2].arguments); }
#line 1514 "Expression.tab.c"
break;
case 36: /* args: args ';' exp */
#line 122 "Expression.y"
{ (yyvsp[-2].arguments).push_back((yyvsp[0].expr)); (yyval.arguments) = (yyvsp[-2].arguments); }
#line 1520 "Expression.tab.c"
break;
case 37: /* args: args ',' range */
#line 123 "Expression.y"
{ (yyvsp[-2].arguments).push_back((yyvsp[0].expr)); (yyval.arguments) = (yyvsp[-2].arguments); }
#line 1526 "Expression.tab.c"
break;
case 38: /* args: args ';' range */
#line 124 "Expression.y"
{ (yyvsp[-2].arguments).push_back((yyvsp[0].expr)); (yyval.arguments) = (yyvsp[-2].arguments); }
#line 1532 "Expression.tab.c"
break;
case 39: /* range: id_or_cell ':' id_or_cell */
#line 127 "Expression.y"
{ (yyval.expr) = new RangeExpression(DocumentObject, (yyvsp[-2].string), (yyvsp[0].string)); }
#line 1538 "Expression.tab.c"
break;
case 40: /* us_building_unit: USUNIT */
#line 131 "Expression.y"
{ (yyval.expr) = new UnitExpression(DocumentObject, (yyvsp[0].quantity).scaler, (yyvsp[0].quantity).unitStr ); }
#line 1544 "Expression.tab.c"
break;
case 41: /* other_unit: UNIT */
#line 132 "Expression.y"
{ (yyval.expr) = new UnitExpression(DocumentObject, (yyvsp[0].quantity).scaler, (yyvsp[0].quantity).unitStr ); }
#line 1550 "Expression.tab.c"
break;
case 42: /* unit_exp: other_unit */
#line 134 "Expression.y"
{ (yyval.expr) = (yyvsp[0].expr); }
#line 1556 "Expression.tab.c"
break;
case 43: /* unit_exp: us_building_unit */
#line 135 "Expression.y"
{ (yyval.expr) = (yyvsp[0].expr); }
#line 1562 "Expression.tab.c"
break;
case 44: /* unit_exp: unit_exp '/' unit_exp */
#line 136 "Expression.y"
{ (yyval.expr) = new OperatorExpression(DocumentObject, (yyvsp[-2].expr), OperatorExpression::DIV, (yyvsp[0].expr)); }
#line 1568 "Expression.tab.c"
break;
case 45: /* unit_exp: unit_exp '*' unit_exp */
#line 137 "Expression.y"
{ (yyval.expr) = new OperatorExpression(DocumentObject, (yyvsp[-2].expr), OperatorExpression::MUL, (yyvsp[0].expr)); }
#line 1574 "Expression.tab.c"
break;
case 46: /* unit_exp: unit_exp '^' integer */
#line 138 "Expression.y"
{ (yyval.expr) = new OperatorExpression(DocumentObject, (yyvsp[-2].expr), OperatorExpression::POW, new NumberExpression(DocumentObject, Quantity((double)(yyvsp[0].ivalue)))); }
#line 1580 "Expression.tab.c"
break;
case 47: /* unit_exp: unit_exp '^' MINUSSIGN integer */
#line 139 "Expression.y"
{ (yyval.expr) = new OperatorExpression(DocumentObject, (yyvsp[-3].expr), OperatorExpression::POW, new OperatorExpression(DocumentObject, new NumberExpression(DocumentObject, Quantity((double)(yyvsp[0].ivalue))), OperatorExpression::NEG, new NumberExpression(DocumentObject, Quantity(-1)))); }
#line 1586 "Expression.tab.c"
break;
case 48: /* unit_exp: '(' unit_exp ')' */
#line 140 "Expression.y"
{ (yyval.expr) = (yyvsp[-1].expr); }
#line 1592 "Expression.tab.c"
break;
case 49: /* integer: INTEGER */
#line 143 "Expression.y"
{ (yyval.ivalue) = (yyvsp[0].ivalue); }
#line 1598 "Expression.tab.c"
break;
case 50: /* integer: ONE */
#line 144 "Expression.y"
{ (yyval.ivalue) = (yyvsp[0].fvalue); }
#line 1604 "Expression.tab.c"
break;
case 51: /* id_or_cell: IDENTIFIER */
#line 148 "Expression.y"
{ (yyval.string) = std::move((yyvsp[0].string)); }
#line 1610 "Expression.tab.c"
break;
case 52: /* id_or_cell: CELLADDRESS */
#line 149 "Expression.y"
{ (yyval.string) = std::move((yyvsp[0].string)); }
#line 1616 "Expression.tab.c"
break;
case 53: /* identifier: id_or_cell */
#line 153 "Expression.y"
{ (yyval.path) = ObjectIdentifier(DocumentObject); (yyval.path) << ObjectIdentifier::SimpleComponent((yyvsp[0].string)); }
#line 1622 "Expression.tab.c"
break;
case 54: /* identifier: iden */
#line 154 "Expression.y"
{ (yyval.path) = std::move((yyvsp[0].path)); }
#line 1628 "Expression.tab.c"
break;
case 55: /* iden: '.' STRING '.' id_or_cell */
#line 158 "Expression.y"
{ /* Path to property of a sub-object of the current object*/
(yyval.path) = ObjectIdentifier(DocumentObject,true);
(yyval.path).setDocumentObjectName(DocumentObject,false,ObjectIdentifier::String(std::move((yyvsp[-2].string)),true),true);
(yyval.path).addComponent(ObjectIdentifier::SimpleComponent((yyvsp[0].string)));
}
#line 1638 "Expression.tab.c"
break;
case 56: /* iden: '.' id_or_cell */
#line 163 "Expression.y"
{ /* Path to property of the current document object */
(yyval.path) = ObjectIdentifier(DocumentObject,true);
(yyval.path).setDocumentObjectName(DocumentObject);
(yyval.path).addComponent(ObjectIdentifier::SimpleComponent((yyvsp[0].string)));
}
#line 1648 "Expression.tab.c"
break;
case 57: /* iden: object '.' STRING '.' id_or_cell */
#line 168 "Expression.y"
{ /* Path to property of a sub-object */
(yyval.path) = ObjectIdentifier(DocumentObject);
(yyval.path).setDocumentObjectName(std::move((yyvsp[-4].string_or_identifier)), true, ObjectIdentifier::String(std::move((yyvsp[-2].string)),true),true);
(yyval.path).addComponent(ObjectIdentifier::SimpleComponent((yyvsp[0].string)));
(yyval.path).resolveAmbiguity();
}
#line 1659 "Expression.tab.c"
break;
case 58: /* iden: object '.' id_or_cell */
#line 174 "Expression.y"
{ /* Path to property of a given document object */
(yyval.path) = ObjectIdentifier(DocumentObject);
(yyvsp[-2].string_or_identifier).checkImport(DocumentObject);
@@ -1670,11 +1541,9 @@ yyreduce:
(yyval.path).addComponent(ObjectIdentifier::SimpleComponent((yyvsp[0].string)));
(yyval.path).resolveAmbiguity();
}
#line 1671 "Expression.tab.c"
break;
case 59: /* iden: document '#' object '.' id_or_cell */
#line 181 "Expression.y"
{ /* Path to property from an external document, within a named document object */
(yyval.path) = ObjectIdentifier(DocumentObject);
(yyval.path).setDocumentName(std::move((yyvsp[-4].string_or_identifier)), true);
@@ -1682,118 +1551,82 @@ yyreduce:
(yyval.path).addComponent(ObjectIdentifier::SimpleComponent((yyvsp[0].string)));
(yyval.path).resolveAmbiguity();
}
#line 1683 "Expression.tab.c"
break;
case 60: /* iden: document '#' object '.' STRING '.' id_or_cell */
#line 189 "Expression.y"
{ (yyval.path) = ObjectIdentifier(DocumentObject);
(yyval.path).setDocumentName(std::move((yyvsp[-6].string_or_identifier)), true);
(yyval.path).setDocumentObjectName(std::move((yyvsp[-4].string_or_identifier)), true, ObjectIdentifier::String(std::move((yyvsp[-2].string)),true));
(yyval.path).addComponent(ObjectIdentifier::SimpleComponent((yyvsp[0].string)));
(yyval.path).resolveAmbiguity();
}
#line 1694 "Expression.tab.c"
break;
case 61: /* iden: iden '.' IDENTIFIER */
#line 195 "Expression.y"
{ (yyval.path)= std::move((yyvsp[-2].path)); (yyval.path).addComponent(ObjectIdentifier::SimpleComponent((yyvsp[0].string))); }
#line 1700 "Expression.tab.c"
break;
case 62: /* indexer: '[' exp ']' */
#line 199 "Expression.y"
{ (yyval.component) = Expression::createComponent((yyvsp[-1].expr)); }
#line 1706 "Expression.tab.c"
break;
case 63: /* indexer: '[' exp ':' ']' */
#line 200 "Expression.y"
{ (yyval.component) = Expression::createComponent((yyvsp[-2].expr),0,0,true); }
#line 1712 "Expression.tab.c"
break;
case 64: /* indexer: '[' ':' exp ']' */
#line 201 "Expression.y"
{ (yyval.component) = Expression::createComponent(0,(yyvsp[-1].expr)); }
#line 1718 "Expression.tab.c"
break;
case 65: /* indexer: '[' ':' ':' exp ']' */
#line 202 "Expression.y"
{ (yyval.component) = Expression::createComponent(0,0,(yyvsp[-1].expr)); }
#line 1724 "Expression.tab.c"
break;
case 66: /* indexer: '[' exp ':' exp ']' */
#line 203 "Expression.y"
{ (yyval.component) = Expression::createComponent((yyvsp[-3].expr),(yyvsp[-1].expr));}
#line 1730 "Expression.tab.c"
break;
case 67: /* indexer: '[' exp ':' ':' exp ']' */
#line 204 "Expression.y"
{ (yyval.component) = Expression::createComponent((yyvsp[-4].expr),0,(yyvsp[-1].expr)); }
#line 1736 "Expression.tab.c"
break;
case 68: /* indexer: '[' ':' exp ':' exp ']' */
#line 205 "Expression.y"
{ (yyval.component) = Expression::createComponent(0,(yyvsp[-3].expr),(yyvsp[-1].expr)); }
#line 1742 "Expression.tab.c"
break;
case 69: /* indexer: '[' exp ':' exp ':' exp ']' */
#line 206 "Expression.y"
{ (yyval.component) = Expression::createComponent((yyvsp[-5].expr),(yyvsp[-3].expr),(yyvsp[-1].expr));}
#line 1748 "Expression.tab.c"
break;
case 70: /* indexable: identifier indexer */
#line 210 "Expression.y"
{ (yyval.expr) = new VariableExpression(DocumentObject,(yyvsp[-1].path)); (yyval.expr)->addComponent((yyvsp[0].component)); }
#line 1754 "Expression.tab.c"
break;
case 71: /* indexable: indexable indexer */
#line 211 "Expression.y"
{ (yyvsp[-1].expr)->addComponent(std::move((yyvsp[0].component))); (yyval.expr) = (yyvsp[-1].expr); }
#line 1760 "Expression.tab.c"
break;
case 72: /* indexable: indexable '.' IDENTIFIER */
#line 212 "Expression.y"
{ (yyvsp[-2].expr)->addComponent(Expression::createComponent((yyvsp[0].string))); (yyval.expr) = (yyvsp[-2].expr); }
#line 1766 "Expression.tab.c"
break;
case 73: /* document: STRING */
#line 216 "Expression.y"
{ (yyval.string_or_identifier) = ObjectIdentifier::String(std::move((yyvsp[0].string)), true); }
#line 1772 "Expression.tab.c"
break;
case 74: /* document: IDENTIFIER */
#line 217 "Expression.y"
{ (yyval.string_or_identifier) = ObjectIdentifier::String(std::move((yyvsp[0].string)), false, true);}
#line 1778 "Expression.tab.c"
break;
case 75: /* object: STRING */
#line 221 "Expression.y"
{ (yyval.string_or_identifier) = ObjectIdentifier::String(std::move((yyvsp[0].string)), true); }
#line 1784 "Expression.tab.c"
break;
case 76: /* object: id_or_cell */
#line 222 "Expression.y"
{ (yyval.string_or_identifier) = ObjectIdentifier::String(std::move((yyvsp[0].string)), false);}
#line 1790 "Expression.tab.c"
break;
#line 1794 "Expression.tab.c"
default: break;
}
@@ -1986,5 +1819,4 @@ yyreturnlab:
return yyresult;
}
#line 225 "Expression.y"
+1
View File
@@ -1,5 +1,6 @@
// SPDX-License-Identifier: LGPL-2.1-or-later
// clang-format off
/* A Bison parser, made by GNU Bison 3.8.2. */
/* Bison interface for Yacc-like parsers in C
+2 -2
View File
@@ -80,8 +80,8 @@ std::stack<FunctionExpression::Function> functions; /**< Function
%%
input: exp { ScanResult = $1; valueExpression = true; }
| unit_exp { ScanResult = $1; unitExpression = true; }
input: exp { ScanResult = std::unique_ptr<Expression>($1); valueExpression = true; }
| unit_exp { ScanResult = std::unique_ptr<Expression>($1); unitExpression = true; }
;
unit_num: num unit_exp %prec NUM_AND_UNIT { $$ = new OperatorExpression(DocumentObject, $1, OperatorExpression::UNIT, $2); }
+16 -19
View File
@@ -24,8 +24,7 @@
****************************************************************************/
#ifndef EXPRESSION_PARSER_H
#define EXPRESSION_PARSER_H
#pragma once
#include "Expression.h"
#include <Base/Matrix.h>
@@ -48,9 +47,9 @@ namespace App
struct AppExport Expression::Component
{
ObjectIdentifier::Component comp;
Expression* e1;
Expression* e2;
Expression* e3;
ExpressionPtr e1;
ExpressionPtr e2;
ExpressionPtr e3;
explicit Component(const std::string& n);
Component(Expression* e1, Expression* e2, Expression* e3, bool isRange = false);
@@ -88,7 +87,7 @@ public:
~UnitExpression() override;
Expression* simplify() const override;
ExpressionPtr simplify() const override;
void setUnit(const Base::Quantity& _quantity);
@@ -144,7 +143,7 @@ public:
explicit NumberExpression(const App::DocumentObject* _owner = nullptr,
const Base::Quantity& quantity = Base::Quantity());
Expression* simplify() const override;
ExpressionPtr simplify() const override;
/**
* @brief Negate the stored value.
@@ -221,7 +220,7 @@ public:
bool isTouched() const override;
Expression* simplify() const override;
ExpressionPtr simplify() const override;
int priority() const override;
@@ -274,7 +273,7 @@ public:
bool isTouched() const override;
Expression* simplify() const override;
ExpressionPtr simplify() const override;
int priority() const override;
@@ -403,7 +402,7 @@ public:
bool isTouched() const override;
Expression* simplify() const override;
ExpressionPtr simplify() const override;
static Py::Object
evaluate(const Expression* owner, int type, const std::vector<Expression*>& args);
@@ -465,7 +464,7 @@ public:
bool isTouched() const override;
Expression* simplify() const override;
ExpressionPtr simplify() const override;
std::string name() const
{
@@ -540,7 +539,7 @@ public:
void setPyValue(Py::Object pyobj);
void setPyValue(PyObject* pyobj, bool owned = false);
Expression* simplify() const override
ExpressionPtr simplify() const override
{
return copy();
}
@@ -568,7 +567,7 @@ public:
const std::string& _text = std::string());
~StringExpression() override;
Expression* simplify() const override;
ExpressionPtr simplify() const override;
virtual std::string getText() const
{
@@ -602,7 +601,7 @@ public:
bool isTouched() const override;
App::Expression* simplify() const override;
ExpressionPtr simplify() const override;
Range getRange() const;
@@ -630,8 +629,8 @@ protected:
*/
namespace ExpressionParser
{
AppExport Expression* parse(const App::DocumentObject* owner, const char* buffer);
AppExport UnitExpression* parseUnit(const App::DocumentObject* owner, const char* buffer);
AppExport ExpressionPtr parse(const App::DocumentObject* owner, const char* buffer);
AppExport std::unique_ptr<UnitExpression> parseUnit(const App::DocumentObject* owner, const char* buffer);
AppExport ObjectIdentifier parsePath(const App::DocumentObject* owner, const char* buffer);
AppExport bool isTokenAnIndentifier(const std::string& str);
AppExport bool isTokenAConstant(const std::string& str);
@@ -689,6 +688,4 @@ public:
#undef YYSTYPE_ISDECLARED
} // namespace ExpressionParser
} // namespace App
#endif // EXPRESSION_PARSER_H
} // namespace App
+1 -4
View File
@@ -22,8 +22,7 @@
* *
***************************************************************************/
#ifndef EXPRESSIONTOKENIZER_H
#define EXPRESSIONTOKENIZER_H
#pragma once
#include <QString>
#include <FCGlobal.h>
@@ -53,5 +52,3 @@ private:
};
} // namespace App
#endif // EXPRESSIONTOKENIZER_H
+1 -4
View File
@@ -22,8 +22,7 @@
* *
***************************************************************************/
#ifndef RENAMEOBJECTIDENTIFIEREXPRESSIONVISITOR_H
#define RENAMEOBJECTIDENTIFIEREXPRESSIONVISITOR_H
#pragma once
#include "Expression.h"
@@ -146,5 +145,3 @@ private:
};
} // namespace App
#endif // RENAMEOBJECTIDENTIFIEREXPRESSIONVISITOR_H
+1 -4
View File
@@ -23,8 +23,7 @@
***************************************************************************/
#ifndef SRC_APP_EXTENSION_H_
#define SRC_APP_EXTENSION_H_
#pragma once
#include <map>
#include <string>
@@ -367,5 +366,3 @@ private:
} // namespace App
#endif // SRC_APP_EXTENSION_H_
+1 -4
View File
@@ -23,8 +23,7 @@
***************************************************************************/
#ifndef SRC_APP_EXTENSIONCONTAINER_H_
#define SRC_APP_EXTENSIONCONTAINER_H_
#pragma once
#include <vector>
#include <string>
@@ -352,5 +351,3 @@ private:
PROPERTY_SOURCE_ABSTRACT(_class_, _parentclass_)
} // namespace App
#endif // SRC_APP_EXTENSIONCONTAINER_H_
+1 -4
View File
@@ -23,8 +23,7 @@
***************************************************************************/
#ifndef APP_EXTENSIONPYTHON_H
#define APP_EXTENSIONPYTHON_H
#pragma once
#include <Base/Interpreter.h>
#include "Extension.h"
@@ -121,5 +120,3 @@ using ExtensionPython = ExtensionPythonT<App::Extension>;
};
} // namespace App
#endif // APP_EXTENSIONPYTHON_H
+1 -4
View File
@@ -23,8 +23,7 @@
***************************************************************************/
#ifndef APP_FEATURECUSTOM_H
#define APP_FEATURECUSTOM_H
#pragma once
#include <App/PropertyContainer.h>
@@ -104,5 +103,3 @@ public:
};
} // namespace App
#endif // APP_FEATURECUSTOM_H
+1 -4
View File
@@ -23,8 +23,7 @@
***************************************************************************/
#ifndef APP_FEATUREPYTHON_H
#define APP_FEATUREPYTHON_H
#pragma once
#include <App/GeoFeature.h>
#include <App/PropertyPythonObject.h>
@@ -460,5 +459,3 @@ using FeaturePython = FeaturePythonT<DocumentObject>;
using GeometryPython = FeaturePythonT<GeoFeature>;
} // namespace App
#endif // APP_FEATUREPYTHON_H
+1 -3
View File
@@ -23,8 +23,7 @@
***************************************************************************/
// clang-format off
#ifndef APP_FEATUREPYTHONPYIMP_H
#define APP_FEATUREPYTHONPYIMP_H
#pragma once
#include <Base/BaseClass.h>
#include <Base/Interpreter.h>
@@ -118,5 +117,4 @@ private:
# pragma GCC diagnostic pop
#endif
#endif // APP_FEATUREPYTHONPYIMP_H
// clang-format on
+1 -4
View File
@@ -23,8 +23,7 @@
***************************************************************************/
#ifndef APP_FEATURETEST_H
#define APP_FEATURETEST_H
#pragma once
#include "DocumentObject.h"
#include "PropertyGeo.h"
@@ -222,5 +221,3 @@ public:
} // namespace App
#endif // APP_FEATURETEST_H
+7 -1
View File
@@ -456,6 +456,8 @@ App.Units.Minute = App.Units.Quantity('min')
App.Units.Hour = App.Units.Quantity('h')
App.Units.Ampere = App.Units.Quantity('A')
App.Units.NanoAmpere = App.Units.Quantity('nA')
App.Units.MicroAmpere = App.Units.Quantity('uA')
App.Units.MilliAmpere = App.Units.Quantity('mA')
App.Units.KiloAmpere = App.Units.Quantity('kA')
App.Units.MegaAmpere = App.Units.Quantity('MA')
@@ -464,8 +466,10 @@ App.Units.Kelvin = App.Units.Quantity('K')
App.Units.MilliKelvin = App.Units.Quantity('mK')
App.Units.MicroKelvin = App.Units.Quantity('uK')
App.Units.MilliMole = App.Units.Quantity('mmol')
App.Units.Mole = App.Units.Quantity('mol')
App.Units.NanoMole = App.Units.Quantity('nmol')
App.Units.MicroMole = App.Units.Quantity('umol')
App.Units.MilliMole = App.Units.Quantity('mmol')
App.Units.Candela = App.Units.Quantity('cd')
@@ -511,6 +515,8 @@ App.Units.KSI = App.Units.Quantity('ksi')
App.Units.MPSI = App.Units.Quantity('Mpsi')
App.Units.Watt = App.Units.Quantity('W')
App.Units.NanoWatt = App.Units.Quantity('nW')
App.Units.MicroWatt = App.Units.Quantity('uW')
App.Units.MilliWatt = App.Units.Quantity('mW')
App.Units.KiloWatt = App.Units.Quantity('kW')
App.Units.VoltAmpere = App.Units.Quantity('VA')
+2 -1
View File
@@ -328,7 +328,7 @@ Base::Placement GeoFeature::getGlobalPlacement(App::DocumentObject* targetObj,
Base::Placement GeoFeature::getGlobalPlacement(App::DocumentObject* targetObj,
App::PropertyXLinkSub* prop)
{
if (!targetObj || !prop) {
if (!prop) {
return Base::Placement();
}
@@ -357,3 +357,4 @@ Base::Placement GeoFeature::getGlobalPlacement(const DocumentObject* obj)
return placementProperty->getValue();
}
+1 -5
View File
@@ -23,8 +23,7 @@
***************************************************************************/
#ifndef APP_GEOFEATURE_H
#define APP_GEOFEATURE_H
#pragma once
#include "DocumentObject.h"
#include "PropertyGeo.h"
@@ -216,6 +215,3 @@ protected:
};
} // namespace App
#endif // APP_GEOFEATURE_H
+1 -5
View File
@@ -24,8 +24,7 @@
***************************************************************************/
#ifndef APP_GeoFeatureGroup_H
#define APP_GeoFeatureGroup_H
#pragma once
#include <unordered_set>
#include "DocumentObject.h"
@@ -159,6 +158,3 @@ using GeoFeatureGroupExtensionPython =
} // namespace App
#endif // APP_GeoFeatureGroup_H
+1 -5
View File
@@ -23,8 +23,7 @@
***************************************************************************/
#ifndef APP_GROUPEXTENSION_H
#define APP_GROUPEXTENSION_H
#pragma once
#include <App/DocumentObject.h>
#include <App/DocumentObjectExtension.h>
@@ -195,6 +194,3 @@ public:
using GroupExtensionPython = ExtensionPythonT<GroupExtensionPythonT<GroupExtension>>;
} // namespace App
#endif // APP_GROUPEXTENSION_H
+1 -5
View File
@@ -22,8 +22,7 @@
* *
***************************************************************************/
#ifndef App_ImagePlane_H
#define App_ImagePlane_H
#pragma once
#include <App/GeoFeature.h>
#include <App/PropertyFile.h>
@@ -61,6 +60,3 @@ public:
};
} // namespace Image
#endif // App_ImagePlane_H
+1 -4
View File
@@ -22,8 +22,7 @@
* *
***************************************************************************/
#ifndef APP_INDEXEDNAME_H
#define APP_INDEXEDNAME_H
#pragma once
#include <cassert>
#include <cstring>
@@ -467,5 +466,3 @@ struct ByteArrayHasher
};
} // namespace Data
#endif // APP_INDEXEDNAME_H
+1 -5
View File
@@ -23,8 +23,7 @@
***************************************************************************/
#ifndef APP_INVENTOROBJECT_H
#define APP_INVENTOROBJECT_H
#pragma once
#include "GeoFeature.h"
#include "PropertyStandard.h"
@@ -59,6 +58,3 @@ public:
};
} // namespace App
#endif // APP_INVENTOROBJECT_H
+1 -4
View File
@@ -22,8 +22,7 @@
* *
***************************************************************************/
#ifndef APP_LICENSE_H
#define APP_LICENSE_H
#pragma once
#include <array>
#include <cstring>
@@ -80,5 +79,3 @@ int constexpr findLicense(const char* identifier)
return -1;
}
} // namespace App
#endif // APP_LICENSE_H
+4 -4
View File
@@ -22,8 +22,10 @@
* *
****************************************************************************/
#ifndef APP_LINK_H
#define APP_LINK_H
#pragma once
#include <boost/preprocessor/seq/for_each.hpp>
#include <boost/algorithm/string/predicate.hpp>
#include <unordered_set>
#include <Base/Parameter.h>
@@ -1211,5 +1213,3 @@ public:
#if defined(__clang__)
#pragma clang diagnostic pop
#endif
#endif // APP_LINK_H
+1 -5
View File
@@ -20,8 +20,7 @@
* *
**************************************************************************************************/
#ifndef APP_MAPPED_ELEMENT_H
#define APP_MAPPED_ELEMENT_H
#pragma once
#include "IndexedName.h"
#include "MappedName.h"
@@ -149,6 +148,3 @@ struct AppExport ElementNameComparator
};
} // namespace Data
#endif // APP_MAPPED_ELEMENT_H

Some files were not shown because too many files have changed in this diff Show More