Compare commits

...

223 Commits

Author SHA1 Message Date
Adrian Insaurralde Avalos de230cfaa7 fix broken copr config in fedora-daily action 2025-11-25 21:30:17 -03:00
Chris Hennes 1f582e2504 Merge pull request #25655 from mnesarco/fix-pylint-py-version
Build: Update pylint minimum python version to 3.10
2025-11-25 10:48:23 -06:00
Frank Martinez 863d77562d Build: Remove deprecated pylint option 2025-11-25 10:41:29 -05:00
sliptonic 85ef37d606 Merge pull request #25638 from LarryWoestman/linuxcnc_preamble
CAM:  fix for linuxcnc ignoring --preamble argument, with test
2025-11-25 09:03:09 -06:00
dependabot[bot] 50f68f3bc9 Bump github/issue-metrics from 3.25.2 to 3.25.3
Bumps [github/issue-metrics](https://github.com/github/issue-metrics) from 3.25.2 to 3.25.3.
- [Release notes](https://github.com/github/issue-metrics/releases)
- [Commits](https://github.com/github/issue-metrics/compare/637a24e71b78bc10881e61972b19ea9ff736e14a...78b1d469a1b1c94945b15bd71dedcb1928667f49)

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

Signed-off-by: dependabot[bot] <support@github.com>
2025-11-25 15:06:09 +01:00
tetektoza b27c9640c8 Gui: Support searching for tooltips, comboboxes and groups in Prefs
As the title says. This patch adds support for finding tooltip text,
also extends widget types to QSpinBoxes/QDoubleSpinBoxes and also adds
support for finding combobox items from QComboBox dropdown. Also adds
support for QGroupBox titles.
2025-11-25 13:49:17 +01:00
Frank Martinez 2ef70f6094 Build: Update pylint minimum python version to 3.10 2025-11-25 07:34:03 -05:00
Louis Gombert 0fca304912 CMake: fix parsing error in Sandbox/Gui
Introduced by commit 755229d
2025-11-25 05:53:44 -06:00
Max Wilfinger 972ade948c Gui: Add command to create an AnnotationLabel (#23673)
* Gui: Add command to create an AnnotationLabel

* Update src/Gui/CommandStd.cpp

Co-authored-by: Kacper Donat <kadet1090@gmail.com>

* Update src/Gui/CommandStd.cpp

Co-authored-by: Florian Foinant-Willig <FlachyJoe@users.noreply.github.com>

---------

Co-authored-by: Kacper Donat <kadet1090@gmail.com>
Co-authored-by: Florian Foinant-Willig <FlachyJoe@users.noreply.github.com>
2025-11-25 11:47:05 +01:00
Max Wilfinger e70c516774 Gui: Add icon to Clarify Selection tool (#24844) 2025-11-25 11:35:28 +01:00
PaddleStroke 59f672eb94 Assembly: Bom: replace QtWidget by QtGui for Qt6 2025-11-24 21:18:16 -06:00
pre-commit-ci[bot] 6da7cb2f9f [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2025-11-24 23:12:28 +00:00
Lawrence Woestman f349336fc8 CAM: fix for linuxcnc ignoring --preamble argument, with test 2025-11-24 14:40:16 -08:00
FEA-eng d2f082c7bc FEM: add new cyclic symm centrif example 2025-11-24 22:55:38 +01:00
Billy Huddleston 9cab1f8f52 CAM: Make CAM tests and serialization robust to locale-dependent decimal separators
Updated CAM unit tests and LinuxCNC serializer to handle decimal separators consistently, ensuring tests pass regardless of system locale. Assertions now compare FreeCAD.Units.Quantity objects directly or normalize decimal separators in strings. LinuxCNC serializer output is forced to use periods for decimals.

src/Mod/CAM/CAMTests/TestPathToolBitListWidget.py:
- Normalize decimal separators in tool description assertions for locale robustness.

src/Mod/CAM/CAMTests/TestPathToolBitPropertyEditorWidget.py:
- Use FreeCAD.Units.Quantity for direct quantity comparisons in property editor tests.

src/Mod/CAM/CAMTests/TestPathToolBitSerializer.py:
- Compare deserialized and serialized quantities using FreeCAD.Units.Quantity for consistency.

src/Mod/CAM/CAMTests/TestPathToolShapeClasses.py:
- Compare parameter values and units directly instead of relying on string formatting.

src/Mod/CAM/Path/Tool/library/serializers/linuxcnc.py:
- Force period as decimal separator in LinuxCNC serializer output to avoid locale issues.
2025-11-24 18:53:32 +01:00
Chris Hennes e937063e41 Merge pull request #25555 from furgo16/assembly-exploded-points-equal-fix
Assembly: exploded points equal fix
2025-11-24 11:52:51 -06:00
PaddleStroke 8b1dce3437 Assembly: Joint task: Fix sel gate not being cleared if doc closed 2025-11-24 18:28:46 +01:00
Chris Hennes 56884b4c41 Merge pull request #25548 from Rexbas/fix-gesture-contextmenu-segfault
Gui: Fix Gesture style context menu segfault
2025-11-24 11:13:14 -06:00
PaddleStroke 629eff4a26 Assembly: Joint task: fix spinbox not being populated 2025-11-24 11:11:15 -06:00
Chris Hennes 54ba0a8a29 CI: Update GitHub Actions for Crowdin translation sync
Ensure the clone is also using the freecad-gh-actions-translation-bot account so that if it force-pushes to an existing PR, the CI will run.
2025-11-24 17:10:19 +00:00
Chris Hennes 4536a54f8f Gui: Switch to defusedxml for document recovery 2025-11-24 17:07:39 +00:00
Ajinkya Dahale bb0cd704fb Merge pull request #25536 from AjinkyaDahale/patch-8
Sketcher: Only draw finite conics
2025-11-24 11:03:08 -06:00
paul bcc30869b7 [ArchWall] Fix Bug: Center-Align with Centered Multi-Material (#25572)
* [ArchWall] Fix Bug: Center-Align with Centered Multi-Material

Fix #25485

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

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

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2025-11-24 18:01:38 +01:00
Chris Hennes 6b59672689 Merge pull request #25507 from adrianinsaval/ci-release
CI: improve release workflow
2025-11-24 10:59:58 -06:00
Chris Hennes 9e35172bea Measure: Translate measurement types 2025-11-24 16:51:35 +00:00
Kacper Donat 88543612e4 PartDesign: Use true tool positions for boolean preview
This fixes positioning of some previews for booleans that were misplaced
after #24750 was merged. It restores previous code that was correct for
most cases. The reason for some previews being misaligned is described
in the #25578 - the preview actually shows how the result should be but
due to some shortcuts taken in code the result is incorrect.
2025-11-24 10:48:32 -06:00
Chris Hennes 8acccf3194 Merge pull request #25526 from Syres916/Fix_Two_StyleSheet_Issues
[Gui] increase contrast of menu separators and down arrows in comboboxes
2025-11-24 10:48:12 -06:00
PaddleStroke 74aafcee75 Sketcher: External Face: decide between defining and construction (#25390) 2025-11-24 10:47:12 -06:00
Chris Hennes febcff1777 Merge pull request #25530 from ipatch/ipatch.tshoot.24962-preserve-body-name-in-part
core: preserve body name in step file when exporting part that contains body with feature, fixes #24962
2025-11-24 10:43:00 -06:00
chris 0fc96a1a6f part design: reimp feature to move datum objects using modal / dialogue box from right click menu in model tab 2025-11-24 10:39:13 -06:00
Max Wilfinger 53042a5c38 GitHub: Update issue template 2025-11-24 10:37:02 -06:00
marioalexis 2457715d84 Fem: Improve VTK import/export preference page 2025-11-24 16:34:48 +00:00
pre-commit-ci[bot] ada21269aa [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2025-11-24 16:34:48 +00:00
Chris Hennes 128dec534a FEM: Add missing translation in InOutVTK 2025-11-24 16:34:48 +00:00
marioalexis 7d218b3f9b Fem: Improve Gmsh preference page implementation 2025-11-24 16:33:39 +00:00
Chris Hennes 16eb18abb2 FEM: Translate log verbosity settings 2025-11-24 16:33:39 +00:00
Kacper Donat 3e356491e2 Attacher: Reduce unnecessary rotation around normal for midpoint 2025-11-24 10:33:02 -06:00
PaddleStroke e38154474a Sketcher: Prevent bad coincidences (#25304) 2025-11-24 10:32:22 -06:00
Furgo 2763bb962f Assembly: Prevent zero-length line creation in ExplodedView
Safeguards the generation of explosion trail lines to avoid creating
invalid geometry.

Previously, if a part displacement was zero (or effectively zero),
`Part.LineSegment` would attempt to create a line with identical start
and end points, causing OpenCascade to throw a `Part.OCCError`. This
resulted in failures during document restoration and recomputes.

This commit introduces a `_createSafeLine` helper method that checks the
distance against a `1e-7` (near-zero) tolerance before attempting to
generate the shape.
2025-11-24 17:26:46 +01:00
Furgo b571889ab5 App: Handle uncleared Python exceptions during object restoration
When a Python-based object throws an exception during the restoration
process (e.g. inside `onDocumentRestored`), the error is caught by a
generic `catch(...)` block in `Document::afterRestore`.

Previously, this block swallowed the C++ exception wrapper but failed to
clear the underlying Python error state. Leaving the interpreter in this
"dirty" state caused a segmentation fault or `SystemError` later in the
loading process when C++ attempted to interact with the Python API
(specifically in `App::Application::setActiveDocument`).

This commit adds a check for `PyErr_Occurred()` inside the catch block.
If an error is detected, the traceback is printed to the console for
debugging, and `PyErr_Clear()` is called to reset the interpreter state,
allowing the application to continue loading the document without
crashing.
2025-11-24 17:26:46 +01:00
pjcreath efb10e1b28 Sketcher: prevent undo/redo crash when selected geometry goes away.
Fixes #25497
2025-11-24 08:56:48 -06:00
pjcreath 16aff10544 Sketcher: prevent crash on undo/redo while dragging.
Fixes #25500
2025-11-24 08:54:50 -06:00
xtemp09 eb0c980c1d [GUI] Handle ampersand in windowTitle 2025-11-24 08:18:28 -06:00
Chris Hennes 93eb02b09f Merge pull request #25604 from FreeCAD/dependabot/github_actions/peter-evans/create-pull-request-7.0.9
Bump peter-evans/create-pull-request from 7.0.8 to 7.0.9
2025-11-24 08:10:45 -06:00
dependabot[bot] 890ce2bb29 Bump peter-evans/create-pull-request from 7.0.8 to 7.0.9
Bumps [peter-evans/create-pull-request](https://github.com/peter-evans/create-pull-request) from 7.0.8 to 7.0.9.
- [Release notes](https://github.com/peter-evans/create-pull-request/releases)
- [Commits](https://github.com/peter-evans/create-pull-request/compare/271a8d0340265f705b14b6d32b9829c1cb33d45e...84ae59a2cdc2258d6fa0732dd66352dddae2a412)

---
updated-dependencies:
- dependency-name: peter-evans/create-pull-request
  dependency-version: 7.0.9
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-11-24 11:59:57 +00:00
Chris Hennes 748fe5121e Merge pull request #25479 from Syres916/Fix_DlgPropertyLink_Utf8_DocumentName
[Gui] Fix string encoding for document, object and subobject names in PropertyLink, SelectionSearch, PD Sketch Based Tasks, Part Primitives and Document handling.
2025-11-23 23:32:20 -06:00
PaddleStroke 1d30d079b0 Sketcher: Rotate: Fix line length ignored (#25434) 2025-11-23 22:40:04 -06:00
Roy-043 98240a6de5 Draft: fix number_length for imperial dimensions (#25369)
* The number_length function did not take imperial dimensions into account. For `9" + 7/8"` it would return 1.
* In ArchRoof reference number_length function from DraftGui.py to avoid duplicate code.
2025-11-23 22:30:09 -06:00
FEA-eng 44bf1c35d6 FEM: Add Thick Pipe Internal Pressure 2D example (#25191)
Co-authored-by: Kacper Donat <kadet1090@gmail.com>
2025-11-23 22:22:27 -06:00
PaddleStroke 40e4eb8770 Assembly: BOM: fix subassembly 2025-11-23 22:20:11 -06:00
Chris 72d021108f Sketcher: allow grid snapping while hovering mouse over axis (#25226) 2025-11-23 21:50:35 -06:00
pre-commit-ci[bot] 59715114f5 [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2025-11-23 23:52:14 +00:00
chris e226e9b06e core: fix various issues exporting step files, ie. #25540 #24962 #25567 2025-11-23 17:50:04 -06:00
chris d806b4e5f3 sketcher: fix issue #13852 resolve issue with state not updating constraint text 2025-11-23 23:28:51 +01:00
chris 9c48c9a3e3 export: step file preserve last feature when exporting step file, fix issue #25567 2025-11-23 15:26:57 -06:00
chris 246218b28b core: preserve body name in step file when exporting part that contains body with feature, fixes #24962 2025-11-23 15:26:31 -06:00
sliptonic ebbddc97e2 Merge pull request #25570 from Connor9220/FixChipLoad
CAM: Ensure Chipload is restored and displayed with user-preferred units
2025-11-23 12:42:24 -06:00
sliptonic 42e6af4237 Merge pull request #25106 from davidgilkaufman/tool_migrations_custom_dir
[CAM] Offer automatic migration of tools in (old) custom working directory to the new tool system
2025-11-23 12:28:17 -06:00
sliptonic 971fd31068 Merge pull request #22738 from tarman3/bsplinesurface
CAM: Pocket BSplineSurface
2025-11-23 11:49:52 -06:00
sliptonic e9c3b13c04 Merge pull request #25372 from tarman3/engrave_fix22380
CAM: Engrave - Fix #22380 - duplicates
2025-11-23 11:41:03 -06:00
Billy Huddleston 4432575243 CAM: Ensure Chipload is restored and displayed with user-preferred units
Fixes an issue where Chipload and similar mixin-defined properties were added to
the schema but not reliably restored, because parameter restoration did not always
apply them to the toolbit object. This change ensures Chipload is restored from saved
data and displayed using the user's preferred unit schema, even when no document
is open. This update also ensures the toolbit editor respects the user’s unit schema
preference during editing, even outside an open document.

src/Mod/CAM/Path/Tool/toolbit/models/base.py:
- Restore Chipload (and other parameters) to toolbit.obj if the property exists.

src/Mod/CAM/Path/Tool/toolbit/ui/editor.py:
- Set units schema to user preference when opening the toolbit editor, so Chipload and other values display correctly.
2025-11-23 11:45:47 -05:00
Adrian Insaurralde Avalos 46f3cf2f19 CI: improve release workflow
adapt weekly build workflow to do normal releases too, rename accordingly
skip macos singning setup if certificate not available (useful to run on forks)
add missing dmgbuild dependency for badge icons on macos
build windows installer in workflow, add needed dependencies to pixi.toml
reorganize packaging scripts that can be useful outside rattler-build too
do some cleanup
add .gitignore to rattler-build
Properly configure appimage updating depending on release type and upload zsync file
2025-11-23 10:54:51 -03:00
Bas Ruigrok 6e5a318ceb Gui: Simplify QObject::connect in openPopupMenu
Co-authored-by: xtemp09 <9303235+xtemp09@users.noreply.github.com>
2025-11-23 14:30:51 +01:00
Andrew Burks bad2989b7b #25474 Added read-only warnings when saving documents (#25532)
* #25474 Added read-only warnings when saving documents

Block saving a file and notify user if windows is unable to save to the file for any reason, or the read-only attribute is checked. Also check std::filesystem::perms for write permission and other checks in FileInfo::isWritable(), although it doesn't seem to matter on windows.

Co-authored-by: Chris Hennes <chennes@pioneerlibrarysystem.org>
2025-11-23 05:09:32 +00:00
Adrián Insaurralde Avalos d466ba037b WindowsInstaller: multiple improvements and fixes
move windowsinstaller to /package
update artwork
adapt to conda builds
make msvc redist directory optional
automate version information definition
use relative directories for file locations definitions
improve/update readme
partially update Delete.bat for qt6 libpack
add .gitignore
update signing.bat and add hashing command

WindowsInstaller: use --safe-mode in freecadcmd commands [skip ci]

WindowsInstaller: make windows 8 the minimum version [skip ci]

WindowsInstaller: allow configuring some values via command line

windows installer update for qt6 build
2025-11-22 23:46:11 -03:00
Bas Ruigrok dec0ea238a Gui: Fix Gesture style context menu segfault 2025-11-22 15:39:32 +01:00
Adrian Insaurralde Avalos 3ab8dbe194 pixi: enable building reverse engineering 2025-11-21 16:35:53 -06:00
Syres916 fc6a39658a [Gui] Reduce separator from 2px to 1px 2025-11-21 19:10:20 +00:00
Syres916 cda9a107aa [Gui] increase contrast of menu separators and down arrows in comboboxes 2025-11-21 17:07:03 +00:00
Roy-043 63c9b176e2 BIM: fix handling of BIM_Sketch view properties (#25339)
* BIM: fix handling of BIM_Sketch view properties

The handling of the sketch view properties was not correct:
* AutoColor was not set to `False`.
* PointSize was missing.
* PointColor was not set to the DefaultShapeVertexColor preference.
* Grid values were never applied. Sketches do not have a GridSnap property and gridSize is not the correct Draft preference.
* Sketch grid snap is a global setting that affects all sketches, the code should not change that setting IMO.

* Remove trailing white space
2025-11-21 10:12:33 +00:00
Logstor e802aa1821 Removed sys in 'from os import sys, path' 2025-11-20 20:13:16 -06:00
Adrian Insaurralde Avalos a847a794c4 CI: specify environment for fedora-daily workflow
otherwise it doesn't have access to the secrets it needs
2025-11-20 23:03:30 -03:00
Jacob Oursland f48db1f855 Enable Reverse Engineering WB.
The Reverse Engineering WB was temporarily disabled as it didn't support Qt6.As it now supports Qt6,
it is time to re-enable the WB.
2025-11-20 17:39:49 -06:00
Chris Hennes a0419f3874 CI: Remove labels from Crowdin update workflow
Adding labels requires admin privileges, which we don't want this account to have.
2025-11-21 00:20:07 +01:00
Syres916 a10fbf2e8c [Gui] Fix string coding on selection changed 2025-11-20 21:37:05 +00:00
Syres916 76071ffbeb [Part] Fix string encoding for document name and object name 2025-11-20 20:04:48 +00:00
Syres916 83c01fae68 [Gui] Fix string encoding for document name 2025-11-20 20:02:21 +00:00
pre-commit-ci[bot] 6d8c5bd2f9 [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2025-11-20 19:55:20 +00:00
Syres916 eb08fe2a78 [Gui] Fix string encoding for preselect, select and deselect 2025-11-20 19:52:12 +00:00
pre-commit-ci[bot] 23df7e4cad [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2025-11-20 19:22:23 +00:00
Syres916 d19ab48231 [Gui] Fix string encoding for document, object and subojects 2025-11-20 19:19:45 +00:00
pre-commit-ci[bot] 78bb40c419 [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2025-11-20 19:04:34 +00:00
Syres916 1e30362dd4 [PartDesign] Fix string encoding for document name and face reference 2025-11-20 19:02:25 +00:00
Syres916 61db439744 [Gui] Fix string encoding for document name 2025-11-20 18:37:50 +00:00
pre-commit-ci[bot] 4c8d140373 [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2025-11-20 16:31:00 +00:00
Syres916 fcd487e0ad [Gui] Fix string encoding document name and object name 2025-11-20 16:28:04 +00:00
Syres916 093a070439 [Gui] Fix incorrect document name when updating PropertyLink 2025-11-19 23:43:52 +00:00
Chris Hennes deab0abf8e Gui: Translate 'Don't show me again' 2025-11-20 00:28:17 +01:00
PaddleStroke 2266a42009 Assembly: Make the 'ground first part' dialog closable 2025-11-20 00:27:06 +01:00
Kacper Donat 8995f43a15 Gui: Fix stylesheet loading order
For some platforms due to event loop and timer triggering being not
deterministic stylesheets could be loaded before style parameters were
fully loaded. This caused warnings about style parameters to appear
potentially confusing users.

This commit changes the stylesheet loading to happen much earlier in the
process so the stylesheet is applied before theme preselection has
chance to happen.
2025-11-19 13:00:14 -06:00
Kacper Donat d1a8f99509 Gui: Save defaults layout after first launch 2025-11-19 10:27:20 -06:00
PaddleStroke 1cf6f5f3a6 Assembly: Fix joint on Body-LCS not working 2025-11-19 12:23:59 +01:00
PaddleStroke be7d41dea7 Assembly/TechDraw: Fix exploded view views (#25426) 2025-11-18 15:54:51 -06:00
PaddleStroke 2a8d648ad3 Assembly: Fix crash on moving unconnected parts 2025-11-18 13:06:33 -06:00
Chris Hennes b2a1e2a6e1 Gui: Update About banner for 1.2-dev 2025-11-18 19:58:03 +01:00
Chris 3f42824ffa Part: fix splitting of a split that is a container / group (#25293) 2025-11-18 11:48:40 -06:00
Chris Hennes 4fa7dd76f0 Merge pull request #25244 from tetektoza/fix/25232_exp_editor_regressions
Gui: Differentiate completion activation modes in Expression Editor
2025-11-18 10:10:00 -06:00
PaddleStroke 6f90c5ea61 Sketcher: ConstraintList: prevent N transaction on box selection (#25254) 2025-11-18 09:15:03 -06:00
captain0xff 5d387ae014 PartDesign: fix the interactive controls for revolution/groove 2025-11-18 15:39:42 +01:00
Roy-043 45866b5f41 PartDesign: Update TaskFeaturePick.cpp text (Title Case mod) 2025-11-18 15:35:12 +01:00
Furgo 0b0d1ccc12 BIM: Smart removal of wall bases (#24550)
* BIM: Implement smart base removal for Walls

Previously, removing the Base object from an Arch Wall would cause the
wall to reset its position to the document origin and could lead to
unintended geometric changes for complex walls.

This commit introduces a "smart debasing" mechanism integrated into the
Component Task Panel's "Remove" button:

- For walls based on a single straight line, the operation now preserves
  the wall's global position and parametric `Length`, making it an
  independent object.
- For walls with complex bases (multi-segment, curved), a warning dialog
  is now presented to the user, explaining the consequences (shape
  alteration and position reset) before allowing the operation to
  proceed.

This is supported by new API functions `Arch.is_debasable()` and
`Arch.debaseWall()`, which contain the core logic for the feature.

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

* BIM: Move wall debasing logic into ArchWall proxy

The logic for handling the removal of a wall's base object was previously
implemented directly within the generic `ComponentTaskPanel` in
`ArchComponent.py`. This created a tight coupling, forcing the generic
component UI to have specific knowledge about the `ArchWall` type.

This commit refactors the implementation to follow a more object-oriented
and polymorphic design:

1.  A new overridable method, `handleComponentRemoval(subobject)`, has been
    added to the base `ArchComponent` proxy class. Its default implementation
    maintains the standard removal behavior.

2.  The `_Wall` proxy class in `ArchWall.py` now overrides this method. All
    wall-specific debasing logic, including the eligibility check and the
    user-facing warning dialog, now resides entirely within this override.

3.  The `ComponentTaskPanel.removeElement` method has been simplified. It is
    now a generic dispatcher that calls `handleComponentRemoval` on the
    proxy of the object being edited, with no specific knowledge of object types.

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

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

* BIM: Correct user warning

The operation can indeed be undone.

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

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Roy-043 <70520633+Roy-043@users.noreply.github.com>
2025-11-18 13:58:59 +00:00
Chris Hennes 7980d82207 Merge pull request #25044 from WandererFan/CenterMarksNotShown3
TechDraw: Vertex creation, display and selection issues
2025-11-18 05:43:49 -06:00
pre-commit-ci[bot] 151e3a987e chore: Fix formatting for missing file 2025-11-18 03:15:09 -06:00
pre-commit-ci[bot] 0f4be480b1 [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2025-11-18 04:30:12 +00:00
wandererfan 484c89818c [TD]enforce center mark print rule on print preview 2025-11-17 22:28:07 -06:00
wandererfan cf656ba77e [TD]fix center mark preferences not honored 2025-11-17 22:28:07 -06:00
wandererfan 110b4b0d95 [TD]fix lost mouse event in Projection Group 2025-11-17 22:28:07 -06:00
wandererfan 66a2dd984e [TD]fix cosmetic vertex outside frameRect is not selectable
- attempting to select a vertex outside the frameRect/boundingRect
  triggers hoverLeave event which hides the vertex.
2025-11-17 22:28:07 -06:00
wandererfan f6c75c7838 [TD]fix no vertex select in front view of projection group 2025-11-17 22:28:07 -06:00
wandererfan 2161e31328 [TD]fix fail to clear frame on selection change 2025-11-17 22:28:06 -06:00
wandererfan 73e4b296b1 [TD]fix fail to create vertex outside frame 2025-11-17 22:28:06 -06:00
wandererfan f0da095cf8 [TD]fix center marks not shown 2025-11-17 22:28:06 -06:00
wandererfan b918cac67a [TD]fix giant vertex from tracker 2025-11-17 22:28:06 -06:00
wandererfan d2bbd78c67 [TD]clear selection affects vertex display
- clearing the selection here causes the new vertex to not be displayed
2025-11-17 22:28:06 -06:00
wandererfan 4bb8f7e8eb [TD]add getExportingAny() 2025-11-17 22:28:06 -06:00
wandererfan 23290b8050 [TD]add preference methods for center marks 2025-11-17 22:28:06 -06:00
Chris f218c5f25c Import: STEP export preserve body names (#25042) 2025-11-17 22:23:21 -06:00
Chris Hennes 0a73f53990 Gui: Add translation to 'No style sheet' 2025-11-17 23:15:58 +01:00
tarman3 889dc7059c CAM: Pocket BSplineSurface 2025-11-17 19:53:47 +02:00
pre-commit-ci[bot] c1b58d1e91 [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2025-11-17 17:42:43 +00:00
tarman3 5dd3d3d8b1 CAM: Engrave - Fix #22380 - duplicates 2025-11-17 19:40:05 +02:00
sliptonic 8c8b26ee4b Merge pull request #25371 from tarman3/engrave_fix9114
CAM: Engrave - Fix #9114 - Unable to engrave an arc
2025-11-17 11:19:23 -06:00
sliptonic eb4231266e Merge pull request #25376 from chennes/translationStringContext
Gui: Fix context of translation strings
2025-11-17 11:15:57 -06:00
Gaël Écorchard c77e1d840c Remove functions that require Kuka files (#24984) 2025-11-17 11:15:18 -06:00
Billy Huddleston 900d5ae255 CAM: Fix crash when Path panel widgets are deleted
Prevent RuntimeError by safely handling missing or deleted geometry import
widgets in Path operation panels. This ensures the UI update code does not
fail if the underlying C++ objects are destroyed, improving stability when
panels are closed or the UI changes.

src/Mod/CAM/Path/Op/Base.py:
- Wrap geometry import widget access in try/except to avoid crashes
- Add error handling for panel widget deletion scenarios
2025-11-17 11:11:24 -06:00
Chris Hennes e0c5c89bd9 Build: Add network-failure fault tolerance to macOS signing (#25265) 2025-11-17 14:01:54 -03:00
PaddleStroke 551ab85076 Assembly: Sub-assembly: fix support for Part-wb objects (#25279)
* Assembly: Sub-assembly: fix support for Part-wb objects

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

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

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2025-11-17 17:59:40 +01:00
PaddleStroke 10cc4dea16 Assembly: Insert link: Handle partially loaded documents (#25275) 2025-11-17 10:55:48 -06:00
PaddleStroke 33d1d80555 Sketcher: Remove transaction from TaskSketcherConstraints::doSetVisible (#25255)
* Sketcher: Remove transaction from TaskSketcherConstraints::doSetVisible

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

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

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2025-11-17 17:54:55 +01:00
chris 1ec1f1506e sketcher wb: fix issue #25076, resolve grid snapping placement 2025-11-17 10:51:28 -06:00
tarman3 2e3a4d541c CAM: LeadInOut - Fix overtravel 2025-11-17 10:45:08 -06:00
David Carter f4e78e3163 Materials: Assigning material without appearance
Assigning a material without an appearance reset the appearance to the
default appearance.

There were two main problems. One was the comparison function for
App::Material objects. It would return false when the UUID or MatType
values were different although there are many circumstances where this
could be true and the appearance be the same. It also incorrectly
compared the imagePath.

The second problem was the logic for detecting if an object has already
been assigned an appearance by assigning a material or manually setting
the appearance. If assigned a material, the appearance should update but
not if it has been set manually. This logic has been corrected.
2025-11-17 17:43:14 +01:00
Chris Hennes 50392855bf CI: Update macOS Intel target version in workflow
GitHub is deprecating macOS 13 runners -- the only remaining Intel runner is now macOS 15, and it is scheduled for retirement in 2027, at which point we will no longer be able to provide Intel weeklies.
2025-11-17 17:33:25 +01:00
Chris Hennes 4d0c35dd2d Core: Convert transparency to alpha (#24891)
* Core: Convert transparency to alpha

Create new `Base::getVersion()` function for extracting a program
version enumeration given a version string.

Convert transparency to alpha value for old project files.

* Base/App: Address review comments

---------

Co-authored-by: wmayer <wmayer@freecad.org>
2025-11-17 17:15:19 +01:00
David Kaufman 767ee484ba Hopefully placate CodeQL 2025-11-17 09:18:30 -05:00
Connor9220 11eba3f25c Fix carriage returns in the Migrator Dialog Title. (#25379) 2025-11-16 22:48:09 -06:00
Jiří Pinkava 5fc650b2ff Tests: Fix value for Imperial pressure tests
The decimal was (wrongly) cahnged in 5379378626
2025-11-16 22:45:52 -06:00
Chris Hennes 0aec9c3b21 Gui: Fix context of translation strings 2025-11-16 17:12:57 -06:00
Florian Foinant-Willig 526f7f2550 TechDraw: fix "%.0w" format spec (#25367) 2025-11-16 18:51:28 +00:00
tarman3 a514cfdf4b CAM: Engrave - Fix #9114 - Unable to engrave an arc 2025-11-16 20:47:21 +02:00
Aqeel Labash a77f96ea86 Fix wording for On-view-parameters tool tip. (#24773)
* switch wording in tooltip-swap-wording

* switch wording in tooltip for On-View-Paramter
2025-11-15 19:27:03 +01:00
PaddleStroke 5da1e3d899 TaskAttacher: Remove 'reset edit' causing trouble to assembly (#25277) 2025-11-15 10:13:56 -06:00
theo-vt 15d9e14851 Sketcher: Proceed to chamfer/fillet on a vertex if there are more than 2 lines but only two non-construction lines 2025-11-15 10:08:22 -06:00
theo-vt d4bfa82161 Sketcher.planegcs: solve reference constraints with lower priority (#25318) 2025-11-15 09:54:56 -06:00
sliptonic bb172e4a6b CAM: Renaming of postprocessors and cleanup (#24771)
* Post Processor cleanup and rename

remove unused files
Basic implementation of generic post
add blending mode support for linuxcnc
add mocking for postprocessor tests
Add tests for generic post
linuxcnc test only tests linuxcnc specific functionality

minor improvements
add arc splitting to refactored post processors
Refactor smoothie post
move posts to legacy.  Remove 'refactored'
lint cleanup
fixes #19417

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

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

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2025-11-15 09:46:34 -06:00
mosfet80 f8afa5ac72 Update CONTRIBUTORS
Adds my name to the CONTRIBUTORS file
2025-11-15 12:55:49 +01:00
paul 29d2285ed7 [ArchStairs] Fix Landing property disable At-Each-Corner (#25278)
* [ArchStairs] Fix Landing property disable At-Each-Corner

Fix #24384

* Update src/Mod/BIM/ArchStairs.py

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

* Update ArchStairs.py - Typo

---------

Co-authored-by: Roy-043 <70520633+Roy-043@users.noreply.github.com>
2025-11-15 09:17:35 +00:00
tarman3 00a4de14e7 CAM: Slot operation - Tooltip - single slot (#25087)
* CAM: Slot tooltip

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

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

---------

Co-authored-by: sliptonic <shopinthewoods@gmail.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2025-11-14 23:25:14 +00:00
David Kaufman f22d0e2292 migrate silently, no prompts 2025-11-14 14:37:05 -05:00
Roy-043 c422404020 Core: workaround for Building US unit system bug (#25288)
* Core: workaround for Building US unit system bug

Fixes #11345

This workaround should hopefully fix the Building US unit system bug at the level of the InputField code. This is the most feasible solution given that we are currently in the v1.1 feature freeze.

I use the word "hopefully" because I have not compiled and tested the code. But replacing `+` with `--` works in Python examples.

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

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

* Fix typo in comment

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

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

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2025-11-14 12:58:24 -06:00
Pieter Hijma 0083364dbe Doc: Improve the documentation of transactions (#21494) 2025-11-14 12:52:13 -06:00
dependabot[bot] 4fd6dc5120 Bump actions/dependency-review-action from 4.8.0 to 4.8.2
Bumps [actions/dependency-review-action](https://github.com/actions/dependency-review-action) from 4.8.0 to 4.8.2.
- [Release notes](https://github.com/actions/dependency-review-action/releases)
- [Commits](https://github.com/actions/dependency-review-action/compare/56339e523c0409420f6c2c9a2f4292bbb3c07dd3...3c4e3dcb1aa7874d2c16be7d79418e9b7efd6261)

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

Signed-off-by: dependabot[bot] <support@github.com>
2025-11-14 12:48:30 -06:00
dependabot[bot] ccc4e084aa Bump actions/download-artifact from 5.0.0 to 6.0.0
Bumps [actions/download-artifact](https://github.com/actions/download-artifact) from 5.0.0 to 6.0.0.
- [Release notes](https://github.com/actions/download-artifact/releases)
- [Commits](https://github.com/actions/download-artifact/compare/634f93cb2916e3fdff6788551b99b062d0335ce0...018cc2cf5baa6db3ef3c5f8a56943fffe632ef53)

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

Signed-off-by: dependabot[bot] <support@github.com>
2025-11-14 12:48:03 -06:00
sliptonic e212f2a175 Merge pull request #25212 from tarman3/geom_segm
CAM: Path.Geom.cmdsForEdge() - remove useless 'segm'
2025-11-14 12:32:38 -06:00
sliptonic df2774ac72 Merge pull request #24185 from tarman3/loop
CAM: SelectLoop improve
2025-11-14 12:26:11 -06:00
sliptonic 011a6d93bd Merge pull request #25215 from tarman3/geom_clean
CAM: Path.Geom - fix linter errors
2025-11-14 12:25:37 -06:00
sliptonic bd844b8273 Merge pull request #24852 from tarman3/inspect_mhs
CAM: Inspect - decrease default Max Highlighter Size
2025-11-14 12:23:27 -06:00
sliptonic f9c05d18af Merge pull request #25074 from tarman3/slot_face
CAM: Slot - Reject incorrect faces selection
2025-11-14 12:15:53 -06:00
sliptonic 86037a1462 Merge pull request #23285 from davidgilkaufman/feed_rate_percentage
[CAM] Feed rate percentage for ramp and lead in/out moves
2025-11-14 12:07:49 -06:00
sliptonic 2a79543c79 Merge pull request #22598 from emmanuel-ferdman/main
CAM: Fix path dressup array test case
2025-11-14 12:05:57 -06:00
Alfred a283855697 Sketcher: Vertical dimension tooltip fix (#24839)
* Corrected all Veritical Dimension Tooltips

* Fixed error in Sketcher_de

* Fixed rest of translation file errors

* Revert "Fixed rest of translation file errors"

This reverts commit 7f3a50ac4f5de9045236668cc669bd26e1206094.

* Revert "Fixed error in Sketcher_de"

This reverts commit 49d617384e2666a245746e5c599d2962abd678d6.

* Revert "Corrected all Veritical Dimension Tooltips"

This reverts commit 4494b18cdc8d6653b441754cbf8a19d0af6ec46d.

* Corrected Vertical Dimension Tooltip
2025-11-14 17:45:16 +00:00
sliptonic c041671a1b Merge pull request #24044 from davidgilkaufman/adaptive_stepover
[CAM] Improve Adaptive operation to successfully generate for small stepover
2025-11-14 11:43:34 -06:00
sliptonic 4dd03be0dc Merge pull request #24676 from Connor9220/TappingWithAnnotations
CAM: Add rigid tapping support to linuxcnc_post.py via Annotations
2025-11-14 11:39:59 -06:00
sliptonic 587bb9179e Merge pull request #24675 from Connor9220/PathCommandAnnotations
CAM: Path command annotations
2025-11-14 11:39:31 -06:00
sliptonic 4005b78e6d Merge pull request #22764 from tarman3/postprocess
CAM: Post Process only selected Operations
2025-11-14 11:35:27 -06:00
sliptonic 5211400cae Merge pull request #25101 from tarman3/array_dressup_translate
CAM: DressupArray - Fix python import
2025-11-14 10:46:18 -06:00
Roy-043 cc7706ec6f Core: 'Stop macro recording' menu text to Title Case (#24302)
* Core: 'Stop-macro-recording' menu text to Title Case

The modified text appears in the menu during a recording session.

* Rebase
2025-11-14 15:33:12 +01:00
revaarathore11 2903f480ae Fix tooltip text mismatch for 'Dimensions only' in Sketcher Preferences (#24825) 2025-11-14 15:10:03 +01:00
FEA-eng 3aaa225145 Spreadsheet: Update SheetTableView.cpp 2025-11-14 15:03:23 +01:00
Roy-043 dbf1f00c01 GUI: DlgParameterImp.cpp more dialog titles to Title Case (#24258) 2025-11-14 13:07:25 +00:00
Roy-043 84dfab257f GUI: CommandDoc.cpp more dialog titles to Title Case (#24250)
* GUI: CommandDoc.cpp more dialog titles to Title Case

* Rebase
2025-11-14 12:49:01 +00:00
Roy-043 26615ea5d8 GUI: Restore view items and some dialog titles to Title Case (#24222) 2025-11-14 12:31:26 +00:00
Roy-043 4417f501a5 GUI: DrawStyle submenu to Title Case (#24220) 2025-11-14 12:12:41 +00:00
Roy-043 04279e27dd Rebase (#23621) 2025-11-14 11:56:24 +00:00
Furgo 93868d54b7 Define DlgScale task panel's tab order (#25300)
* Define DlgScale task panel's tab order

To improve keyboard navigation.

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

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

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

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2025-11-14 10:18:29 +00:00
Stephan T. Lavavej 9e6509a3a4 Avoid using non-Standard std::locale::empty() for MSVC 2025-11-14 00:22:18 -06:00
Chris Hennes a19db66c8b CI: Add GitHub token for Crowdin sync 2025-11-14 05:08:23 +01:00
tarman3 b0a79a6f2c CAM: DressupArray - Fix python import 2025-11-14 00:11:44 +02:00
tarman3 0dc28c57d7 CAM: Path.Geom - fix linter errors 2025-11-14 00:07:05 +02:00
tarman3 e4ec4cb0df CAM: Path.Geom.cmdsForEdge() - remove useless 'segm' 2025-11-14 00:06:38 +02:00
tarman3 9d25f6f53d CAM: Inspect - decrease default Max Highlighter Size 2025-11-14 00:02:46 +02:00
tarman3 ec5b9a808d CAM: SelectLoop improve 2025-11-13 23:29:17 +02:00
tarman3 092ba973f2 CAM: Post Process only selected Operations 2025-11-13 23:25:53 +02:00
tarman3 c0ebb8e88d CAM: Slot - Reject incorrect faces selection 2025-11-13 23:09:27 +02:00
Chris Hennes cdc798ec12 CI: Update CrowdIn action to use 1.1 release branch 2025-11-13 21:43:30 +01:00
tetektoza ca1528e2a9 Gui: Use UTF-8 string instead of UTF-16 for Reset in Expression Editor
Currently `ExpLineEdit::apply()` passes `QString::constData()` to a
printf-style format string with %s. `QString::constData() returns a
const QChar* (UTF-16, 2 bytes per char), but %s expects a const char*
(UTF-8/ASCII with 1 byte per char).

This results in a string being interpreted as in "Container":
Byte 0: 'C'
Byte 1: 0x00 (high byte of UTF-16 'C', which gets interpreted as null
terminator)

So this patch uses proper conversion to null-terminated C-String before
passing it further.
2025-11-13 21:39:54 +01:00
Rehan Ahmed a704ac301d Fix case inconsistencies (#24812)
* Fix case inconsistency - Input Hints

* Fix case inconsistency - Quick Measure

* Fix case inconsistency - Navigation Indicator

* Fix case inconsistency - BIM Status Widget

* Remove .ts translation file changes

---------

Co-authored-by: Roy-043 <70520633+Roy-043@users.noreply.github.com>
2025-11-13 20:19:19 +00:00
Rahul Paul 888ba973a5 Fix(TechDraw): Capitalize OK button in TemplateFields (#24866) 2025-11-13 20:58:21 +01:00
FEA-eng a18f45914b FEM: Update constraint_tie.py 2025-11-13 20:57:22 +01:00
luzpaz 10709bd467 Fix typos and grammar (#24827)
* Fix typos and grammar
Fixes typos and grammar in several files.

* fix missed typo

* Remove unnecessary line in LeadInOut.py

---------

Co-authored-by: Roy-043 <70520633+Roy-043@users.noreply.github.com>
2025-11-13 19:53:35 +00:00
Chris Hennes e8f826d0ed Build: Bump minor version of main branch from 1.1 to 1.2 (#25274) 2025-11-13 20:35:28 +01:00
ᴩʜᴏɴᴇᴅʀᴏɪᴅ bb37dfda0e [ BIM ]: Refactor - Save Preset Stringify (#25140)
* [ BIM ]: Refactor Save Preset Stringify

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

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

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2025-11-13 19:53:54 +01:00
Furgo 9c22fc55f9 BIM: Update search box text for material search (#24754)
* BIM: Update search box text for material search

* BIM: change Material Manager title to title case

* BIM: change Material Manager search placeholder text to sentence case

* BIM: reword reference to tree to avoid confusion with the Tree View

* BIM: Rename button text for creating Multi-Material for consistency
2025-11-13 19:46:38 +01:00
Ryan K 32840628ae BIM: Update sketch command name to be consistent with other workbenches (#24278)
Co-authored-by: Ryan Kembrey <ryan.kembrey@student.uts>
2025-11-13 19:45:05 +01:00
David Kaufman 4f33d66fb3 re-fix early exit condition for repeat integer points 2025-11-12 21:36:13 +01:00
David Kaufman f4f8bd2c81 fix cam tests
tbh the test seems kind of unstable
2025-11-12 21:36:13 +01:00
David Kaufman 62caf967c7 cleanup 2025-11-12 21:36:13 +01:00
David Kaufman ad1724550e fix adaptive early exit condition for testing repeat integer points 2025-11-12 21:36:10 +01:00
David Kaufman edce05d992 avoid retrying same integer points in optimization routine 2025-11-12 21:36:10 +01:00
David Kaufman 920a2363a7 rename resolution_factor to min_step_clipper 2025-11-12 21:36:08 +01:00
David Kaufman 183e82607a Fix units/extract RESOLUTION_FACTOR from area constants
Most of the code treats RESOLUTION_FACTOR as "number of clipper units in
a single step" -- a linear distance unit. However, there are a few
locations in which it is treated as unitless, multiplied by area
constants. This commit folds the current value of RESOLUTION_FACTOR into
these other contents in preparation for declaring it to have distance
units and increasing its value.
2025-11-12 21:36:05 +01:00
David Kaufman 2f91f74ac9 refinements 2025-11-12 21:36:02 +01:00
David Kaufman 04a9579561 [CAM] WIP fix adaptive stepover bug, many debug statements remain 2025-11-12 21:36:02 +01:00
tetektoza 3f6a0ee78b Gui: Differentiate completion activation modes in Expression Editor
Currently if user tries to press TAB during Expression Editor, it
inserts both the entry and its first subentry. Also, if user browses the
dropdown with arrows keys, it inserts it's values.

Root cause of that is the regression made in latest changes to chaining
completion logic which is triggered for all completion modes including
TAB, which already has its own refresh mechanism. Also,
ExpressionTextEdit connected both activated (Enter/click) and highlight
signals to the same slot, resulting in arrow key navigation inserting
completions.

So, this adds separate slots for ExpressionTextEdit to differentiate
completion modes. And also updates tab handling to pass
ActivationMode::Highlighted to prevent double chaining.
2025-11-12 00:23:04 +01:00
Billy Huddleston bbfd84d7b1 Add rigid tapping support to linuxcnc_post.py and annotate tapping commands in Tapping.py
- Added --rigid-tap argument to linuxcnc_post.py to enable G33.1 rigid tapping cycle output.
- Implemented logic to skip G80, G98, G99 commands with tapping annotation when rigid tapping is enabled.
- Enhanced handling of G84/G74 tapping cycles for rigid tapping, including pitch (K), depth (Z), dwell (G04 P), spindle reversal (M3/M4/M5), and reverse-out moves.
- Updated Tapping.py to annotate G98/G99 and G80 commands with {"operation": "tapping"} for improved post processor handling.
2025-11-10 02:48:27 -05:00
David Kaufman e2b4ea58b8 remove unused import 2025-11-07 14:46:02 -05:00
David Kaufman 7fb93c5a50 retrigger tests 2025-11-06 13:59:04 -05:00
pre-commit-ci[bot] 0976fdb0fa [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2025-11-05 23:03:33 +00:00
David Kaufman e7643dc929 fix codeql warning 2025-11-05 17:47:27 -05:00
David Kaufman 114b679f64 fix lint warnings 2025-11-05 17:47:27 -05:00
David Kaufman 6f62d69b9f fix bugs, clean up 2025-11-05 17:47:26 -05:00
David Kaufman e464cdb73d WIP update tool controller UI 2025-11-05 17:46:03 -05:00
David Kaufman d699d080e0 Fix warning about new Profile properties NumPasses and StepOver being created automatically 2025-11-05 17:46:03 -05:00
David Kaufman d1d6846af0 [CAM] migrate ramp and lead in/out feed rates to the tool controller 2025-11-05 17:46:03 -05:00
David Kaufman f7dc85ef29 update lead in/out to use feed rate from tool controller 2025-11-05 17:46:01 -05:00
David Kaufman 093152b1dc [CAM] separate controls for feed rate percent entrance vs exit 2025-11-05 17:41:32 -05:00
David Kaufman 9c5e8f8340 [CAM] Add feed rate percent to lead in/out dressup 2025-11-05 17:23:03 -05:00
David Kaufman 9ad22dcc0e [CAM] Add feed rate percent to ramp dressup 2025-11-05 17:09:40 -05:00
David Kaufman 21319f95d2 automatically offer migration for tool libraries in custom working dir 2025-11-05 15:18:43 -05:00
David Kaufman bb9ae3540e [CAM] bugfix tools not imported properly during library import 2025-11-05 13:29:54 -05:00
Billy Huddleston bcefebca5f CAM: Simplify annotation handling in GCode and improve annotation parsing
src/Mod/CAM/App/Command.cpp:
- Removed requirement for annotations= prefix; now all text after ; is treated as annotation data.
- Updated Command::toGCode to output annotations as key-value pairs in comments.
- Improved setFromGCode to extract annotations from any comment after ;.
- Enhanced annotation parsing to handle quoted strings and floating-point numbers.
- Simplified XML serialization and restoration logic for annotations.

src/Mod/CAM/App/Path.cpp:
- Added addCommandNoRecalc, allowing bulk loading of commands without repeated recalculation.
- Refactored RestoreDocFile to read GCode files line-by-line, parse each command, and call recalculate() only once after all commands are loaded.
- Added explanatory comment above the old implementation.

src/Mod/CAM/App/Path.h:
- Declared addCommandNoRecalc in the Toolpath class.

src/Mod/CAM/CAMTests/TestPathCommandAnnotations.py:
- Adjusted unit test for scientific notation annotation to check only 6 decimal places.
- Adjusted unit test 10 to properly handle assertions with the toGCode method

src/Mod/CAM/PathSimulator/AppGL/GCodeParser.cpp:
- GCodeParser::ParseLine: Truncate at first semicolon (annotations / comment)
2025-10-15 14:43:40 -04:00
Billy Huddleston a970235484 CAM: Enhance Path.Command annotations with variant type, type-safe API, and robust persistence
- Refactored `Annotations` member to use `std::variant<std::string, double>` for type-safe storage of both string and numeric values.
- Implemented C++ methods:
	- `setAnnotation(key, value)`: overloaded for string and double types.
	- `getAnnotation(key)`: returns annotation value as string.
	- `getAnnotationString(key)`: returns string annotation.
	- `getAnnotationDouble(key, fallback)`: returns numeric annotation.
	- `getAnnotationValue(key)`: returns raw variant value.
	- `hasAnnotation(key)`: checks for annotation existence.
	- `setAnnotations(annotationString)`: parses and stores values as double if possible, otherwise as string.
- Improved XML serialization (`Save`) and deserialization (`Restore`) to persist annotation types and values, including annotation count for robust restoration.
- Updated Python bindings:
	- `Annotations` property now supports mixed-type values (str/float).
	- Values are returned as native Python types.
	- Type errors are raised for invalid assignments.
- Expanded tests in `TestPathCommandAnnotations.py`:
	- Added cases for mixed-type annotations, edge cases, and in-memory persistence using `dumpContent`/`restoreContent`.
	- Verified type preservation and correct restoration.
- Ensured backward compatibility for string-only annotations and improved error handling.

**How to use annotations in Python:**

```import Path

c = Path.Command('G1', {'X': 10.0, 'Y': 20.0, 'F': 1000.0})
c.Annotations = {
	'tool_name': '6mm_endmill',      # string
	'spindle_speed': 12000.0,        # float
	'feed_rate': 1500,               # int (stored as float)
	'operation': 'pocket',           # string
	'depth_of_cut': -2.5,            # negative float
}
print(c.Annotations)  # {'tool_name': '6mm_endmill', 'spindle_speed': 12000.0, ...}
print(type(c.Annotations['spindle_speed']))  # <class 'float'>
print(type(c.Annotations['tool_name']))      # <class 'str'>

xml = c.dumpContent()
c2 = Path.Command()
c2.restoreContent(xml)
print(c2.Annotations)  # Restored with correct types

c.addAnnotations('speed:1000 operation:drill')
print(c.Annotations['speed'])        # 1000.0 (float)
print(c.Annotations['operation'])    # 'drill' (str)
```
2025-10-15 14:26:13 -04:00
Emmanuel Ferdman 1bcf0d4996 Fix path dressup array test case
Signed-off-by: Emmanuel Ferdman <emmanuelferdman@gmail.com>
2025-07-19 13:08:36 -07:00
380 changed files with 13886 additions and 13200 deletions
@@ -0,0 +1,92 @@
name: Report a Problem
description: Have you found something that does not work well, is too hard to do or is missing altogether? Please create a Problem Report.
labels: ["Status: Needs triage","Status: Needs confirmation"]
body:
- type: markdown
attributes:
value: |
Thanks for taking the time to fill out this problem report! Please [search](https://github.com/FreeCAD/FreeCAD/issues) if a similar issue already exists and check out [how to report issues](https://github.com/FreeCAD/FreeCAD?tab=readme-ov-file#reporting-issues). By submitting this issue, you agree to follow our [Code of Conduct](https://github.com/FreeCAD/FreeCAD/blob/main/CODE_OF_CONDUCT.md).
- type: dropdown
id: wb
attributes:
label: Workbench affected?
options:
- Assembly
- BIM
- CAM
- Core (App, Gui,...)
- Draft
- FEM
- Material
- Measurement
- Mesh
- Part
- Part Design
- Sketcher
- Spreadsheet
- TechDraw
- Other (specify in description)
- type: textarea
id: description
attributes:
label: Problem description
description: Describe the problem and how it impacts user experience, workflow, maintainability or performance. You can attach images or log files by clicking this area to highlight it and then dragging files in. To attach a FCStd file, ZIP it first.
placeholder: Describe your problem briefly.
validations:
required: true
- type: textarea
id: steps_to_reproduce
attributes:
label: Steps to reproduce
description: If the problem appears to be a bug with the current functionality, provide a test case or recipe that reliably reproduces the issue. Ideally [record a macro](https://wiki.freecad.org/Std_DlgMacroRecord) and attach it. Please also add an example file as ZIP.
placeholder: |
Drag an example file as ZIP into this textbox to attach it.
Steps to reproduce the behavior:
1. Open my example file
2. Go to '...'
3. Click on '...'
validations:
required: true
- type: textarea
id: expected_behavior
attributes:
label: Expected behavior
description: A clear and concise description of what you expected to happen when following the provided steps above.
placeholder: What is the expected behavior?
validations:
required: true
- type: textarea
id: actual_behavior
attributes:
label: Actual behavior
description: A clear and concise description of what actually happens. If applicable, add screenshots to help explain the problem.
placeholder: What is actually happening? You can add screenshorts or videos by dragging them into this textbox.
validations:
required: true
- type: textarea
id: dev_version
attributes:
label: Development version About Info (in Safe Mode)
description: Download the latest weekly [development release](https://github.com/FreeCAD/FreeCAD/releases) and try reproducing the issue in safe mode (Help → Restart in Safe Mode). Use the [About FreeCAD](https://wiki.freecad.org/About) dialog to copy your full version information and paste it here.
placeholder: |
1. Download the latest weekly development version (link above).
2. Make sure to run in Safe Mode (Help -> Restart in Safe Mode) to exclude interference from 3rd party addons.
3. If the issue is still reproducible, open the About FreeCAD dialog and copy the full version info here.
render: shell
validations:
required: true
- type: textarea
id: good_version
attributes:
label: Last known good version (optional)
description: If this is a regression, paste the [About FreeCAD](https://wiki.freecad.org/About) info from the last known working version.
placeholder: If the problem did not exist in a previous version, paste the About FreeCAD info from that version here.
render: shell
-73
View File
@@ -1,73 +0,0 @@
name: Report a Problem
description: Have you found something that does not work well, is too hard to do or is missing altogether? Please create a Problem Report.
labels: ["Status: Needs triage","Status: Needs confirmation"]
body:
- type: checkboxes
id: existing_issue
attributes:
label: Is there an existing issue for this?
description: Please [search](https://github.com/FreeCAD/FreeCAD/issues) to see if a similar issue already exists for the problem you encountered.
options:
- label: I have searched the existing issues
required: true
- type: textarea
id: description
attributes:
label: Problem description
description: Describe the problem and how it impacts user experience, workflow, maintainability or speed of the code. If the problem appears to be a bug with the current functionality, provide as test case or recipe that reproduces the error. Ideally record a macro and attach it.
placeholder: Description of the problem
validations:
required: true
- type: textarea
id: full_version
attributes:
label: Full version info
description: Please use the About FreeCAD dialog to copy your full version information and paste it here. Try reproducing the issue by restarting FreeCAD in safe mode too.
render: shell
validations:
required: true
- type: dropdown
id: wb
attributes:
label: Subproject(s) affected?
options:
- Addon Manager
- Assembly
- BIM
- CAM
- Core
- Draft
- Expressions
- FEM
- File formats
- Material
- Measurement
- Mesh
- OpenSCAD
- Part
- PartDesign
- Project Tools & Websites
- Sketcher
- Spreadsheet
- TechDraw
- Other (specify in description)
- type: textarea
id: anything_else
attributes:
label: Anything else?
description: |
Links? References? Anything that will give us more context about the issue you are encountering!
If there is a discussion about the problem on the forum, provide link(s) here.
You can upload or copy your macro here to speed up the diagnosis and debugging.
Tip: You can attach images or log files by clicking this area to highlight it and then dragging files in. To attach a FCStd file, ZIP it first (GitHub won't recognize the extension otherwise).
validations:
required: false
- type: checkboxes
id: terms
attributes:
label: Code of Conduct
description: By submitting this issue, you agree to follow our [Code of Conduct](https://github.com/FreeCAD/FreeCAD/blob/main/CODE_OF_CONDUCT.md)
options:
- label: I agree to follow this project's Code of Conduct
required: true
@@ -1,5 +1,7 @@
name: Weekly Build
name: Build Release
on:
release:
types: [created]
schedule:
- cron: "0 0 * * 3"
workflow_dispatch:
@@ -8,10 +10,10 @@ permissions:
contents: write
jobs:
tag_build:
upload_src:
runs-on: ubuntu-latest
outputs:
build_tag: ${{ steps.tag_build.outputs.build_tag }}
build_tag: ${{ steps.get_tag.outputs.build_tag }}
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@95d9a5deda9de15063e7595e9719c11c38c90ae2 # v2.13.2
@@ -21,20 +23,25 @@ jobs:
- name: Checkout Source
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
ref: ${{ github.sha }}
fetch-depth: 2
fetch-tags: true
submodules: 'recursive'
- name: Tag Build
id: tag_build
- name: get tag and create release if weekly
id: get_tag
shell: bash -l {0}
env:
GH_TOKEN: ${{ github.token }}
run: |
export BUILD_TAG=weekly-$(date "+%Y.%m.%d")
if [ "${{ github.event_name }}" = "release" ]; then
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
fi
echo "BUILD_TAG=${BUILD_TAG}" >> "$GITHUB_ENV"
echo "build_tag=${BUILD_TAG}" >> "$GITHUB_OUTPUT"
gh release create ${BUILD_TAG} --title "Development Build ${BUILD_TAG}" -F .github/workflows/weekly-build-notes.md --prerelease || true
- name: Upload Source
id: upload_source
@@ -42,10 +49,10 @@ jobs:
env:
GH_TOKEN: ${{ github.token }}
run: |
python3 package/rattler-build/scripts/make_version_file.py ../freecad_version.txt
python3 package/scripts/write_version_info.py ../freecad_version.txt
git config user.email '41898282+github-actions[bot]@users.noreply.github.com'
git config user.name 'github-actions[bot]'
git apply package/rattler-build/scripts/disable_git_info.patch
git apply package/disable_git_info.patch
git commit -a -m "Disable git info write to Version.h"
git archive HEAD -o freecad_source_${BUILD_TAG}.tar
git submodule foreach --recursive \
@@ -57,13 +64,13 @@ jobs:
gh release upload --clobber ${BUILD_TAG} "freecad_source_${BUILD_TAG}.tar.gz" "freecad_source_${BUILD_TAG}.tar.gz-SHA256.txt"
build:
needs: tag_build
needs: upload_src
strategy:
matrix:
include:
- { target: linux-64, os: ubuntu-22.04 }
- { target: linux-arm64, os: ubuntu-22.04-arm }
- { target: osx-64, os: macos-13 }
- { target: osx-64, os: macos-15-intel }
- { target: osx-arm64, os: macos-latest }
- { target: win-64, os: windows-latest }
fail-fast: false
@@ -88,10 +95,8 @@ jobs:
- name: Set Platform Environment Variables
shell: bash -l {0}
env:
BUILD_TAG: ${{ needs.tag_build.outputs.build_tag }}
OPERATING_SYSTEM: ${{ runner.os }}
run: |
echo "BUILD_TAG=${BUILD_TAG}" >> "$GITHUB_ENV"
if [[ $OPERATING_SYSTEM == 'Windows' ]]; then
echo 'PIXI_CACHE_DIR=D:\rattler' >> "$GITHUB_ENV"
echo 'RATTLER_CACHE_DIR=D:\rattler' >> "$GITHUB_ENV"
@@ -100,6 +105,7 @@ jobs:
- name: Checkout Source
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
ref: ${{ github.sha }}
fetch-depth: 2
fetch-tags: true
submodules: 'recursive'
@@ -110,6 +116,7 @@ jobs:
cache: false
- name: Install the Apple certificate and provisioning profile
id: get_cert
if: runner.os == 'macOS'
env:
APP_SPECIFIC_PASSWORD: ${{ secrets.APP_SPECIFIC_PASSWORD }}
@@ -120,9 +127,15 @@ jobs:
KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }}
P12_PASSWORD: ${{ secrets.P12_PASSWORD }}
run: |
if [ -z "$BUILD_CERTIFICATE_BASE64" ]; then
echo "has_cert=false" >> $GITHUB_OUTPUT
echo "No certificate avalable... skipping" && exit 0
else
echo "has_cert=true" >> $GITHUB_OUTPUT
fi
# create variables
CERTIFICATE_PATH=$RUNNER_TEMP/build_certificate.p12
PP_PATH=$RUNNER_TEMP/FreeCAD_Weekly.provisionprofile
PP_PATH=$RUNNER_TEMP/FreeCAD_bundle.provisionprofile
KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db
export KEYCHAIN_PASSWORD=$(openssl rand -base64 8)
@@ -152,12 +165,13 @@ jobs:
env:
GH_TOKEN: ${{ github.token }}
SIGNING_KEY_ID: ${{ secrets.SIGNING_KEY_ID }}
SIGN_RELEASE: "true"
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: |
python3 package/rattler-build/scripts/make_version_file.py ../freecad_version.txt
git apply package/rattler-build/scripts/disable_git_info.patch
python3 package/scripts/write_version_info.py ../freecad_version.txt
cd package/rattler-build
pixi install
pixi run -e package create_bundle
+1 -1
View File
@@ -24,4 +24,4 @@ jobs:
- name: 'Checkout Repository'
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- name: 'Dependency Review'
uses: actions/dependency-review-action@56339e523c0409420f6c2c9a2f4292bbb3c07dd3 # v4
uses: actions/dependency-review-action@3c4e3dcb1aa7874d2c16be7d79418e9b7efd6261 # v4
+10 -1
View File
@@ -8,7 +8,10 @@ on:
jobs:
trigger-copr-build:
environment: fedora-daily
env:
copr_login: ${{ secrets.COPR_LOGIN }}
copr_username: ${{ secrets.COPR_USERNAME }}
copr_token: ${{ secrets.COPR_TOKEN }}
runs-on: ubuntu-latest
container: quay.io/packit/packit
@@ -16,7 +19,13 @@ jobs:
- name: setup copr token
run: |
mkdir -p ~/.config
echo "$copr_token" > ~/.config/copr
echo \
"[copr-cli]
login = $copr_login
username = $copr_username
token = $copr_token
copr_url = https://copr.fedorainfracloud.org
" > ~/.config/copr
- name: checkout sources
uses: actions/checkout@v4
with:
@@ -13,6 +13,7 @@ jobs:
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8
with:
fetch-depth: 0
token: ${{ secrets.GH_TOKEN_FOR_CROWDIN_SYNC }}
- name: Install Qt ≥ 6.8
uses: jurplel/install-qt-action@d325aaf2a8baeeda41ad0b5d39f84a6af9bcf005
@@ -45,8 +46,8 @@ jobs:
- name: Commit changes
run: |
git config --global user.name "github-actions"
git config --global user.email "github-actions@github.com"
git config --global user.name "freecad-gh-actions-translation-bot"
git config --global user.email "freecad-gh-actions-translation-bot@github.com"
git add src
git commit -m "Update translations from Crowdin" || echo "No changes to commit"
@@ -56,12 +57,12 @@ jobs:
git push origin update-crowdin-translations --force
- name: Create Pull Request
uses: peter-evans/create-pull-request@271a8d0340265f705b14b6d32b9829c1cb33d45e
uses: peter-evans/create-pull-request@84ae59a2cdc2258d6fa0732dd66352dddae2a412
with:
branch: update-crowdin-translations
title: "Update translations from Crowdin"
body: "Automatic Crowdin update."
labels: "translations, automated"
token: ${{ secrets.GH_TOKEN_FOR_CROWDIN_SYNC }}
delete-branch: true
add-paths: |
src
+1 -1
View File
@@ -35,7 +35,7 @@ jobs:
echo "last_month=$first_day..$last_day" >> "$GITHUB_ENV"
- name: Run issue-metrics tool
uses: github/issue-metrics@637a24e71b78bc10881e61972b19ea9ff736e14a # v3.25.2
uses: github/issue-metrics@78b1d469a1b1c94945b15bd71dedcb1928667f49 # v3.25.3
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SEARCH_QUERY: 'repo:FreeCAD/FreeCAD is:issue created:${{ env.last_month }}'
@@ -13,6 +13,7 @@ jobs:
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8
with:
fetch-depth: 0
ref: releases/FreeCAD-1-1
- name: Install Qt ≥ 6.8
uses: jurplel/install-qt-action@d325aaf2a8baeeda41ad0b5d39f84a6af9bcf005
+1 -1
View File
@@ -62,7 +62,7 @@ jobs:
run: |
mkdir -p ${{ env.artifactsDownloadDir }}
- name: Download artifacts
uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0
uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 # v6.0.0
with:
path: ${{ env.artifactsDownloadDir }}
- name: Save input data to file
+1 -1
View File
@@ -3,7 +3,7 @@ files_to_sync:
- .packit.yaml
actions:
post-upstream-clone:
- bash -c 'BUILD_TAG=dev /usr/bin/python3 package/rattler-build/scripts/make_version_file.py freecad_version.txt'
- bash -c '/usr/bin/python3 package/scripts/write_version_info.py freecad_version.txt'
- rm -f freecad-sources.tar.gz
changelog-entry:
- bash -c 'git log --no-merges --pretty="format:- %s (%an)" $(git describe --tags --abbrev=0 )..HEAD -- |sed 's/%/%%/g''
+1 -5
View File
@@ -82,15 +82,11 @@ persistent=yes
# Minimum Python version to use for version dependent checks. Will default to
# the version used to run pylint.
py-version=3.8
py-version=3.10
# Discover python modules and packages in the file system subtree.
recursive=no
# When enabled, pylint would attempt to guess common misconfiguration and emit
# user-friendly hints instead of false-positive error messages.
suggestion-mode=yes
# Allow loading of arbitrary C extensions. Extensions are imported into the
# active Python interpreter and may run arbitrary code.
unsafe-load-any-extension=no
+1 -1
View File
@@ -51,7 +51,7 @@ endif()
project(FreeCAD)
set(PACKAGE_VERSION_MAJOR "1")
set(PACKAGE_VERSION_MINOR "1")
set(PACKAGE_VERSION_MINOR "2")
set(PACKAGE_VERSION_PATCH "0") # number of patch release (e.g. "4" for the 0.18.4 release)
set(PACKAGE_VERSION_SUFFIX "dev") # either "dev" for development snapshot or "" (empty string)
set(PACKAGE_BUILD_VERSION "0") # used when the same FreeCAD version will be re-released (for example using an updated LibPack)
-4
View File
@@ -71,10 +71,6 @@
"type": "BOOL",
"value": "ON"
},
"BUILD_REVERSEENGINEERING": {
"type": "BOOL",
"value": "OFF"
},
"ENABLE_DEVELOPER_TESTS": {
"type": "BOOL",
"value": "ON"
+5
View File
@@ -0,0 +1,5 @@
*.exe
*-SHA256.txt
MSVCRedist
FreeCAD
version.nsh
+47
View File
@@ -0,0 +1,47 @@
del /S *_d.*
del /S *_debug.*
del /S *.pyc
del /S *.pdb
del /S boost*-gd-*.dll
cd bin
del assistant.exe
del Coin4d.dll
del designer.exe
del freetyped.dll
del libcrypto-3d.dll
del libEGLd.dll
del libGLESv2d.dll
del libssl-3d.dll
del linguist.exe
del qdoc.exe
del Qt6Concurrentd.dll
del Qt6Cored.dll
del Qt6DBusd.dll
del Qt6DesignerComponentsd.dll
del Qt6Designerd.dll
del Qt6Guid.dll
del Qt6Helpd.dll
del Qt6LabsAnimationd.dll
del Qt6LabsFolderListModeld.dll
del Qt6LabsPlatformd.dll
del Qt6LabsSettingsd.dll
del Qt6LabsSharedImaged.dll
del Qt6LabsWavefrontMeshd.dll
del Qt6MultimediaWidgetsd.dll
del Qt6Multimediad.dll
del Qt6Networkd.dll
del Qt6OpenGLWidgetsd.dll
del Qt6OpenGLd.dll
del Qt6PrintSupportd.dll
del Qt6SpatialAudiod.dll
del Qt6Sqld.dll
del Qt6SvgWidgetsd.dll
del Qt6Svgd.dll
del Qt6Testd.dll
del Qt6UiToolsd.dll
del Qt6Widgetsd.dll
del Qt6Xmld.dll
del QtWebEngineProcessd.exe
del Quarter1d.dll
del xerces-c_3_2D.dll
del zlibd.dll
@@ -1,7 +1,7 @@
# Creating a Windows installer for FreeCAD
These are instructions for building an NSIS-based installer for FreeCAD. They were designed for FreeCAD 0.21 and later,
and presume that you have cloned a copy of FreeCAD's source code, and therefore have the directory *src/WindowsInstaller*.
and presume that you have cloned a copy of FreeCAD's source code, and therefore have the directory *package/WindowsInstaller*.
## Install NSIS
To set up your system for building an NSIS installer:
@@ -15,16 +15,13 @@ To set up your system for building an NSIS installer:
4. Download and install the nsProcess plugin from https://nsis.sourceforge.io/NsProcess_plugin -- you will need the version that supports Unicode, so make sure to follow the appropriate instructions on their site to install that one (as of this writing it involves manually copying and renaming the plugin DLL file).
## Build the installer
Next, update the installer settings for the current version of FreeCAD. Starting from the *src/WindowsInstaller* folder in the FreeCAD source tree:
1. Set the appropriate version strings for the release you are creating. These are used to construct the filename of the installer, among other things. If you have to upload a new version of the installer for the exact same release of FreeCAD, increment `APP_VERSION BUILD` as needed.
```
!define APP_VERSION_MAJOR 0
!define APP_VERSION_MINOR 21
!define APP_VERSION_REVISION 0
Next, update the installer settings for the current version of FreeCAD. Starting from the *package/WindowsInstaller* folder in the FreeCAD source tree:
1. Set the appropriate version strings for the release you are creating. These are used to construct the filename of the installer, among other things. If you have to upload a new version of the installer for the exact same release of FreeCAD, increment `APP_VERSION BUILD` as needed. The main version numbers are dynamically obtained by calling `freecadcmd.exe`.
```nsis
!define APP_VERSION_EMERGENCY "RC1"
!define APP_VERSION_BUILD 1
```
2. Within the folder *src/WindowsInstaller*, create a new folder called MSVCRedist and copy the following files from your MSVC installation into it:
2. If the installer will be made from a LibPack build create a new folder called MSVCRedist within the folder *package/WindowsInstaller* and copy the following files from your MSVC installation into it:
```
vcruntime140.dll
concrt140.dll
@@ -33,28 +30,38 @@ vcamp140.dll
vccorlib140.dll
vcomp140.dll
```
3. Open the file *Settings.nsh* with a text editor (both jEdit and Visual Studio Code are good editors for NSIS files). Edit the following paths to correspond to your system: `FILES_FREECAD` corresponds to your installation directory (e.g. `CMAKE_INSTALL_PREFIX` if you self-compiled) and `FILES_DEPS` is the folder you created with the MSVC redistributable files in it.
```
!define FILES_FREECAD "C:\FreeCAD\Installer\FreeCAD"
!define FILES_DEPS "C:\FreeCAD\Installer\MSVCRedist"
3. If required open the file *Settings.nsh* with a text editor (both jEdit and Visual Studio Code are good editors for NSIS files). Edit the following paths to correspond to your system: `FILES_FREECAD` corresponds to your installation directory (e.g. `CMAKE_INSTALL_PREFIX` if you self-compiled), `FILES_THUMBS` is the directory where the thumbnailer dll is located and `FILES_DEPS` is the folder you created with the MSVC redistributable files in it. `FILES_DEPS` is not needed if the installer is created from a conda bundle so it is not set by default. These can be set via /D argument for `makensis.exe` or by editing *Settings.nsh*.
```nsis
!ifndef FILES_FREECAD
!define FILES_FREECAD "${__FILEDIR__}\FreeCAD"
!endif
!ifndef FILES_THUMBS
!define FILES_THUMBS "${__FILEDIR__}\thumbnail"
!endif
#!define FILES_DEPS "${__FILEDIR__}\MSVC_Redist"
```
4. Ensure the FreeCAD files are in place. Here you have two options:
* If you are working from an already-compiled version of FreeCAD provided to you by an outside source: in this case, simply ensure that `FILES_FREECAD` is set to the directory containing those files.
* If you compiled FreeCAD on your own as described [here](https://wiki.freecad.org/Compile_on_Windows) (and using the Install option outlined there). Then:
* Open the file *Settings.nsh* as described in step 3. above and set there</br>
`!define FILES_FREECAD` to the folder you specified as `CMAKE_INSTALL_PREFIX`
* Copy into that folder the file *Delete.bat* that is part of the installer
* Copy into the installation folder the file *Delete.bat* that is part of the installer
* open a command line in Windows and change to the folder
* run the comamand</br>
* run the command</br>
`Delete.bat`
* (These steps assure that the installer only contains files users need. Moreover it assures that the
overall files size is below 2 GB and we can use the most compact compression for the installer.)
5. Right-click on the file *FreeCAD-installer.nsi* and choose **Compile NSIS script**
to compile the installer.
to compile the installer. You can also run from command line to specify some settings
```cmd
%your_nsis_path%\makensis.exe /D'FILES_FREECAD="D:\some\path\FreeCAD"' /D'FILES_DEPS="${__FILEDIR__}\MSVC_Redist" /D'ExeFile="my-FreeCAD-installer.exe"' FreeCAD-installer.nsi
```
NOTE: For test builds of the installer you can turn off the compression. This speeds up
NOTE: For test builds of the installer you can turn off compression. This speeds up
the build time for the installer a lot but increases its file size. The compression
is turned off by uncommenting the line</br>
is turned off by commenting the line</br>
`SetCompressor /SOLID lzma`</br>
in the file *Settings.nsh*.
in the file *Settings.nsh* or by defining `FC_TEST_BUILD` in command line
```cmd
%your_nsis_path%\makensis.exe [OPTIONS] /DFC_TEST_BUILD FreeCAD-installer.nsi
```
+62
View File
@@ -0,0 +1,62 @@
/*
Settings for FreeCAD installer
These typically need to be modified for each FreeCAD release
*/
# Make the installer as small as possible
# Using /SOLID is usually better for file size but it can't be used if the original size is
# more than 2GB, if building with /SOLID fails try disabling it
# comment this or use /DFC_TEST_BUILD command line option for testing builds since it will reduce
# the time to create an installer a lot at the cost of a much greater file size.
# So assure it is active for release builds!
!ifndef FC_TEST_BUILD
SetCompressor /SOLID lzma
!endif
#--------------------------------
# File locations
# !!! you may need to adjust them to the folders in your Windows system !!!
# can be specified with /D command line argument to makensis.exe
!ifndef FILES_FREECAD
!define FILES_FREECAD "${__FILEDIR__}\FreeCAD"
!endif
!ifndef FILES_THUMBS
!define FILES_THUMBS "${__FILEDIR__}\thumbnail"
!endif
# msvc redistributables location is required for LibPack builds but not conda
# when using a LibPack build set the redistributables directory location here
# or with /D command line argument to makensis.exe
#!define FILES_DEPS "${__FILEDIR__}\MSVCRedist"
#--------------------------------
# get version info from freecadcmd
!system "${FILES_FREECAD}\bin\freecadcmd.exe --safe-mode -c $\"import datetime; print(f'!define COPYRIGHT_YEAR {datetime.date.today().year}')$\">${__FILEDIR__}\version.nsh" = 0
!system "${FILES_FREECAD}\bin\freecadcmd.exe --safe-mode -c $\"print(f'!define APP_VERSION_MAJOR \$\"{App.Version()[0]}\$\"')$\">>${__FILEDIR__}\version.nsh" = 0
!system "${FILES_FREECAD}\bin\freecadcmd.exe --safe-mode -c $\"print(f'!define APP_VERSION_MINOR \$\"{App.Version()[1]}\$\"')$\">>${__FILEDIR__}\version.nsh" = 0
!system "${FILES_FREECAD}\bin\freecadcmd.exe --safe-mode -c $\"print(f'!define APP_VERSION_PATCH \$\"{App.Version()[2]}\$\"')$\">>${__FILEDIR__}\version.nsh" = 0
!system "${FILES_FREECAD}\bin\freecadcmd.exe --safe-mode -c $\"print(f'!define APP_VERSION_REVISION \$\"{App.Version()[3].split()[0]}\$\"')$\">>${__FILEDIR__}\version.nsh" = 0
!include "${__FILEDIR__}\version.nsh"
!delfile "${__FILEDIR__}\version.nsh"
!define APP_VERSION_EMERGENCY "" # use "1" for an emergency release of FreeCAD otherwise ""
# alternatively you can use APP_VERSION_EMERGENCY for a custom suffix of the version number
!define APP_EMERGENCY_DOT "" # use "." for an emergency release of FreeCAD otherwise ""
!define APP_VERSION_BUILD 1 # Start with 1 for the installer releases of each version
!define APP_VERSION "${APP_VERSION_MAJOR}.${APP_VERSION_MINOR}.${APP_VERSION_PATCH}${APP_EMERGENCY_DOT}${APP_VERSION_EMERGENCY}" # Version to display
#--------------------------------
# Installer file name
# Typical names for the release are "FreeCAD-020-Installer-1.exe" etc.
!ifndef ExeFile
!define ExeFile "${APP_NAME}_${APP_VERSION_MAJOR}.${APP_VERSION_MINOR}.${APP_VERSION_PATCH}${APP_VERSION_EMERGENCY}-Windows-x86_64-installer-${APP_VERSION_BUILD}.exe"
!endif
#--------------------------------
# installer bit type - FreeCAD is only provided as 64bit build
!define MULTIUSER_USE_PROGRAMFILES64
@@ -1 +1,2 @@
signtool.exe sign /f FCweborg.pfx /p FreeCADIsCool /fd sha512 /tr http://timestamp.digicert.com /td sha512 /v %1
certutil -hashfile %1 SHA256 > %1-SHA256.txt
Binary file not shown.

After

Width:  |  Height:  |  Size: 151 KiB

Before

Width:  |  Height:  |  Size: 67 KiB

After

Width:  |  Height:  |  Size: 67 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Before

Width:  |  Height:  |  Size: 116 KiB

After

Width:  |  Height:  |  Size: 116 KiB

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 13 KiB

Before

Width:  |  Height:  |  Size: 64 KiB

After

Width:  |  Height:  |  Size: 64 KiB

Before

Width:  |  Height:  |  Size: 91 KiB

After

Width:  |  Height:  |  Size: 91 KiB

@@ -13,13 +13,13 @@ Configuration and variables of FreeCAD installer
# Names and version
!define APP_NAME "FreeCAD"
!define APP_VERSION_NUMBER "${APP_VERSION_MAJOR}.${APP_VERSION_MINOR}.${APP_VERSION_REVISION}.${APP_VERSION_BUILD}"
!define APP_VERSION_NUMBER "${APP_VERSION_MAJOR}.${APP_VERSION_MINOR}.${APP_VERSION_PATCH}.${APP_VERSION_BUILD}"
# For the proposed install folder we use the scheme "FreeCAD 0.18"
# however for the Registry, we need the scheme "FreeCAD 0.18.x" in order
# to check if it is exactly this version (to support side-by-side installations)
!define APP_SERIES_NAME "${APP_VERSION_MAJOR}.${APP_VERSION_MINOR}"
!define APP_SERIES_KEY "${APP_VERSION_MAJOR}${APP_VERSION_MINOR}${APP_VERSION_REVISION}${APP_VERSION_EMERGENCY}"
!define APP_SERIES_KEY2 "${APP_VERSION_MAJOR}.${APP_VERSION_MINOR}.${APP_VERSION_REVISION}${APP_EMERGENCY_DOT}${APP_VERSION_EMERGENCY}"
!define APP_SERIES_KEY "${APP_VERSION_MAJOR}${APP_VERSION_MINOR}${APP_VERSION_PATCH}${APP_VERSION_EMERGENCY}"
!define APP_SERIES_KEY2 "${APP_VERSION_MAJOR}.${APP_VERSION_MINOR}.${APP_VERSION_PATCH}${APP_EMERGENCY_DOT}${APP_VERSION_EMERGENCY}"
!define APP_DIR_REGKEY "Software\Microsoft\Windows\CurrentVersion\App Paths\${APP_NAME}.exe"
!define APP_DIR "${APP_NAME} ${APP_SERIES_NAME}"
# Fixme: FC should use different preferences folder for every release
@@ -60,7 +60,7 @@ Configuration and variables of FreeCAD installer
!define SETUP_ICON "icons\FreeCAD.ico"
!define SETUP_HEADERIMAGE "graphics\header.bmp"
!define SETUP_WIZARDIMAGE "graphics\orange.bmp"
!define SETUP_WIZARDIMAGE "graphics\banner.bmp"
!define SETUP_UNINSTALLER "Uninstall-${APP_NAME}.exe"
!define SETUP_UNINSTALLER_KEY "${APP_NAME}${APP_SERIES_KEY}"
@@ -92,7 +92,7 @@ BrandingText " "
VIProductVersion "${APP_VERSION_NUMBER}"
VIAddVersionKey /LANG=${LANG_ENGLISH} "ProductName" "${APP_NAME}"
VIAddVersionKey /LANG=${LANG_ENGLISH} "ProductVersion" "${APP_DIR}.${APP_VERSION_REVISION}"
VIAddVersionKey /LANG=${LANG_ENGLISH} "ProductVersion" "${APP_DIR}.${APP_VERSION_PATCH}"
VIAddVersionKey /LANG=${LANG_ENGLISH} "FileDescription" "${APP_INFO}"
VIAddVersionKey /LANG=${LANG_ENGLISH} "FileVersion" "${APP_VERSION}"
VIAddVersionKey /LANG=${LANG_ENGLISH} "LegalCopyright" "${APP_COPYRIGHT}"
@@ -50,7 +50,7 @@ Function PostMultiUserPageInit
# check if there is an existing FreeCAD installation of the same FreeCAD series
# we usually don't release more than 10 versions so with 20 we are safe to check if a newer version is installed
IntOp $4 ${APP_VERSION_REVISION} + 20
IntOp $4 ${APP_VERSION_PATCH} + 20
${for} $5 0 $4
ReadRegStr $0 SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APP_NAME}${APP_VERSION_MAJOR}${APP_VERSION_MINOR}$5" "DisplayVersion"
# also check for an emergency release
@@ -110,7 +110,8 @@ Function .onInit
${orif} $R0 == "5.1" # XP
${orif} $R0 == "5.2" # 2003
${orif} $R0 == "6.0" # Vista
MessageBox MB_OK|MB_ICONSTOP "${APP_NAME} ${APP_VERSION} requires Windows 7 or newer." /SD IDOK
${orif} $R0 == "6.1" # 7
MessageBox MB_OK|MB_ICONSTOP "${APP_NAME} ${APP_VERSION} requires Windows 8 or newer." /SD IDOK
Quit
${endif}
@@ -130,7 +131,7 @@ Function .onInit
# plugin must be unloaded
${nsProcess::Unload}
# initialize the multi-uder installer UI
# initialize the multi-user installer UI
!insertmacro MULTIUSER_INIT
# this can be reset to "true" in section SecDesktop
@@ -18,8 +18,8 @@
# and returns the number of the character in the FindStr where the SearchStr was found (Pointer)
# if nothing was found or the search is impossible the Pointer is set to -1
StrLen $R2 ${SearchStr}
StrLen $R4 ${FindStr}
StrLen $R2 "${SearchStr}"
StrLen $R4 "${FindStr}"
StrCpy $R5 0
${if} $R2 == 0
${orif} $R4 == 0
@@ -27,8 +27,8 @@
${endif}
IntCmp $R4 $R2 loopA NotFound
loopA:
StrCpy $R3 ${FindStr} $R2 $R5
StrCmp $R3 ${SearchStr} Found
StrCpy $R3 "${FindStr}" $R2 $R5
StrCmp $R3 "${SearchStr}" Found
IntOp $R5 $R5 + 1
IntCmp $R4 $R5 loopA NotFound
Goto loopA
@@ -8,14 +8,15 @@ Installation of program files, dictionaries and external components
#--------------------------------
# Program files
!include LogicLib.nsh
Section -ProgramFiles SecProgramFiles
# if the $INSTDIR does not contain "FreeCAD" we must add a subfolder to avoid that FreeCAD will e.g.
# be installed directly to C:\programs - the uninstaller will then delete the whole
# C:\programs directory
StrCpy $String $INSTDIR
StrCpy $Search ${APP_NAME}
StrCpy $String "$INSTDIR"
StrCpy $Search "${APP_NAME}"
Call StrPoint # function from Utils.nsh
${if} $Pointer == "-1"
StrCpy $INSTDIR "$INSTDIR\${APP_DIR}"
@@ -38,8 +39,11 @@ Section -ProgramFiles SecProgramFiles
File /r "${FILES_FREECAD}\bin\*.*"
# MSVC redistributable DLLs
SetOutPath "$INSTDIR\bin"
File "${FILES_DEPS}\*.*"
!ifdef FILES_DEPS
!echo "Including MSVC Redist files from ${FILES_DEPS}"
SetOutPath "$INSTDIR\bin"
File "${FILES_DEPS}\*.*"
!endif
# Others
SetOutPath "$INSTDIR\data"
@@ -52,10 +56,6 @@ Section -ProgramFiles SecProgramFiles
File /r "${FILES_FREECAD}\lib\*.*"
SetOutPath "$INSTDIR\Mod"
File /r "${FILES_FREECAD}\Mod\*.*"
SetOutPath "$INSTDIR\resources"
File /r "${FILES_FREECAD}\resources\*.*"
SetOutPath "$INSTDIR\translations"
File /r "${FILES_FREECAD}\translations\*.*"
SetOutPath "$INSTDIR"
File /r "${FILES_THUMBS}"
+12
View File
@@ -0,0 +1,12 @@
linux/AppDir/usr
linux/AppDir/*.desktop
linux/AppDir/*.svg
linux/AppDir/packages.txt
windows/FreeCAD_*Windows*
osx/FreeCAD.app
**.AppImage
**.AppImage.zsync
**.dmg
**.7z
**.exe
**-SHA256.txt
+26 -7
View File
@@ -1,7 +1,7 @@
#!/bin/bash
set -e
set -x
set -x
conda_env="AppDir/usr"
@@ -9,9 +9,6 @@ mkdir -p ${conda_env}
cp -a ../.pixi/envs/default/* ${conda_env}
export PATH="${PWD}/${conda_env}/bin:${PATH}"
export CONDA_PREFIX="${PWD}/${conda_env}"
echo -e "\nDelete unnecessary stuff"
rm -rf ${conda_env}/include
find ${conda_env} -name \*.a -delete
@@ -49,7 +46,7 @@ rm -rf ${conda_env}/lib/cmake/
find . -name "*.h" -type f -delete
find . -name "*.cmake" -type f -delete
python_version=$(python -c 'import platform; print("py" + platform.python_version_tuple()[0] + platform.python_version_tuple()[1])')
python_version=$(${conda_env}/bin/python -c 'import platform; print("py" + platform.python_version_tuple()[0] + platform.python_version_tuple()[1])')
version_name="FreeCAD_${BUILD_TAG}-Linux-$(uname -m)-${python_version}"
echo -e "\################"
@@ -62,6 +59,20 @@ sed -i "1s/.*/\nLIST OF PACKAGES:/" AppDir/packages.txt
curl -LO https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-$(uname -m).AppImage
chmod a+x appimagetool-$(uname -m).AppImage
if [ "${UPLOAD_RELEASE}" == "true" ]; then
case "${BUILD_TAG}" in
*weekly*)
GH_UPDATE_TAG="weeklies"
;;
*rc*)
GH_UPDATE_TAG="${BUILD_TAG}"
;;
*)
GH_UPDATE_TAG="latest"
;;
esac
fi
echo -e "\nCreate the appimage"
# export GPG_TTY=$(tty)
chmod a+x ./AppDir/AppRun
@@ -69,7 +80,7 @@ chmod a+x ./AppDir/AppRun
--comp zstd \
--mksquashfs-opt -Xcompression-level \
--mksquashfs-opt 22 \
-u "gh-releases-zsync|FreeCAD|FreeCAD|${BUILD_TAG}|FreeCAD*$(uname -m)*.AppImage.zsync" \
-u "gh-releases-zsync|FreeCAD|FreeCAD|${GH_UPDATE_TAG}|FreeCAD*$(uname -m)*.AppImage.zsync" \
AppDir ${version_name}.AppImage
# -s --sign-key ${GPG_KEY_ID} \
@@ -77,5 +88,13 @@ echo -e "\nCreate hash"
sha256sum ${version_name}.AppImage > ${version_name}.AppImage-SHA256.txt
if [ "${UPLOAD_RELEASE}" == "true" ]; then
gh release upload --clobber ${BUILD_TAG} "${version_name}.AppImage" "${version_name}.AppImage-SHA256.txt"
gh release upload --clobber ${BUILD_TAG} "${version_name}.AppImage" "${version_name}.AppImage.zsync" "${version_name}.AppImage-SHA256.txt"
if [ "${GH_UPDATE_TAG}" == "weeklies" ]; then
generic_name="FreeCAD_weekly-Linux-$(uname -m)"
mv "${version_name}.AppImage" "${generic_name}.AppImage"
mv "${version_name}.AppImage.zsync" "${generic_name}.AppImage.zsync"
mv "${version_name}.AppImage-SHA256.txt" "${generic_name}.AppImage-SHA256.txt"
gh release create weeklies --prerelease | true
gh release upload --clobber weeklies "${generic_name}.AppImage" "${generic_name}.AppImage.zsync" "${generic_name}.AppImage-SHA256.txt"
fi
fi
+2 -5
View File
@@ -9,9 +9,6 @@ mkdir -p ${conda_env}
cp -a ../.pixi/envs/default/* ${conda_env}
export PATH="${PWD}/${conda_env}/bin:${PATH}"
export CONDA_PREFIX="${PWD}/${conda_env}"
# delete unnecessary stuff
rm -rf ${conda_env}/include
find ${conda_env} -name \*.a -delete
@@ -50,7 +47,7 @@ cmake --build build
mkdir -p FreeCAD.app/Contents/MacOS
cp build/FreeCAD FreeCAD.app/Contents/MacOS/FreeCAD
python_version=$(python -c 'import platform; print("py" + platform.python_version_tuple()[0] + platform.python_version_tuple()[1])')
python_version=$(${conda_env}/bin/python -c 'import platform; print("py" + platform.python_version_tuple()[0] + platform.python_version_tuple()[1])')
version_name="FreeCAD_${BUILD_TAG}-macOS-$(uname -m)-${python_version}"
application_menu_name="FreeCAD_${BUILD_TAG}"
@@ -71,7 +68,7 @@ rm -rf ${conda_env}/Library
if [[ "${SIGN_RELEASE}" == "true" ]]; then
# create the signed dmg
./macos_sign_and_notarize.zsh -p "FreeCAD" -k ${SIGNING_KEY_ID} -o "${version_name}.dmg"
../../scripts/macos_sign_and_notarize.zsh -p "FreeCAD" -k ${SIGNING_KEY_ID} -o "${version_name}.dmg"
else
# create the dmg
dmgbuild -s dmg_settings.py "FreeCAD" "${version_name}.dmg"
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: LGPL-2.1-or-later
# Ensure default values are set in defines if they are not already provided
defines.setdefault('containing_folder', '.')
defines.setdefault('app_name', 'FreeCAD.app')
File diff suppressed because it is too large Load Diff
+8 -15
View File
@@ -22,44 +22,37 @@ freecad = { path = "." }
[feature.package.dependencies]
python = ">=3.11,<3.12"
[feature.package.tasks]
create_bundle = 'bash -c "cd $(bash scripts/get_os.bash) && bash create_bundle.sh"'
## Linux (x86-64)
[feature.package.target.linux-64.dependencies]
coreutils = "*"
[feature.package.target.linux-64.tasks]
create_bundle = 'bash -c "cd linux && bash create_bundle.sh"'
## Linux (aarch64)
[feature.package.target.linux-aarch64.dependencies]
coreutils = "*"
[feature.package.target.linux-aarch64.tasks]
create_bundle = 'bash -c "cd linux && bash create_bundle.sh"'
## macOS (Intel)
[feature.package.target.osx-64.dependencies]
coreutils = "*"
dmgbuild = "*"
pyobjc-framework-Quartz = "*"
sed = "*"
[feature.package.target.osx-64.tasks]
create_bundle = 'bash -c "cd osx && bash create_bundle.sh"'
## macOS (Apple Silicon)
[feature.package.target.osx-arm64.dependencies]
coreutils = "*"
dmgbuild = "*"
pyobjc-framework-Quartz = "*"
sed = "*"
[feature.package.target.osx-arm64.tasks]
create_bundle = 'bash -c "cd osx && bash create_bundle.sh"'
## Windows dependencies (x86-64)
[feature.package.target.win-64.dependencies]
git = "*"
[feature.package.target.win-64.tasks]
create_bundle = 'bash -c "cd windows && bash create_bundle.sh"'
nsis = { version = "*", build = "*_log*" }
7zip = "*"
vs2022_win-64 = "*"
[environments]
default = ["freecad"]
-1
View File
@@ -145,7 +145,6 @@ requirements:
- gmsh
- graphviz
- ifcopenshell
- jinja2
- lark
- lxml
- matplotlib-base
@@ -1,13 +0,0 @@
diff --git a/src/Tools/SubWCRev.py b/src/Tools/SubWCRev.py
index 1f3f0a436343..c314003736f1 100644
--- a/src/Tools/SubWCRev.py
+++ b/src/Tools/SubWCRev.py
@@ -523,7 +523,7 @@ def main():
inp = open("%s/src/Build/Version.h.in" % (bindir))
lines = inp.readlines()
inp.close()
- lines = i.writeVersion(lines)
+ #lines = i.writeVersion(lines)
out = open("%s/src/Build/Version.h.out" % (bindir), "w")
out.writelines(lines)
out.write("\n")
@@ -1,53 +0,0 @@
import sys
import os
import subprocess
import platform
from datetime import datetime
import freecad
import FreeCAD
package_manager = "conda"
system = platform.platform().split("-")[0]
arch = platform.machine()
# Windows uses a different syntax
if arch == "AMD64":
arch = "x86_64"
if "ARCH" in os.environ:
if os.environ["ARCH"] != "":
arch = os.environ["ARCH"]
python_version = platform.python_version().split(".")
python_version = "py" + python_version[0] + python_version[1]
date = str(datetime.now()).split(" ")[0]
version_info = FreeCAD.Version()
build_version_suffix = FreeCAD.ConfigGet("BuildVersionSuffix")
dev_version = version_info[0] + "." + version_info[1] + "." + version_info[2] + build_version_suffix
revision = version_info[3].split(" ")[0]
if system == "macOS":
import jinja2
print("create plist from template")
osx_directory = os.path.join(os.path.dirname(__file__), "..", "osx")
with open(os.path.join(osx_directory, "Info.plist.template")) as template_file:
template_str = template_file.read()
template = jinja2.Template(template_str)
rendered_str = template.render( FREECAD_VERSION="{}-{}".format(dev_version, revision),
APPLICATION_MENU_NAME="FreeCAD-{}-{}".format(dev_version, revision) )
with open(os.path.join(osx_directory, "FreeCAD.app", "Contents", "Info.plist"), "w") as rendered_file:
rendered_file.write(rendered_str)
if "DEPLOY_RELEASE" in os.environ and os.environ["DEPLOY_RELEASE"] == "weekly-builds":
dev_version = "weekly-builds"
revision_separator = "-"
else:
revision_separator = ""
revision = ""
bundle_name = f"FreeCAD_{dev_version}{revision_separator}{revision}-{package_manager}-{system}-{arch}-{python_version}"
with open("bundle_name.txt", "w") as bundle_name_file:
bundle_name_file.write(bundle_name)
@@ -0,0 +1,8 @@
#!/usr/bin/env bash
if [[ "$OSTYPE" =~ (msys*|cygwin*|mingw*) ]]; then
echo windows
elif [[ "$OSTYPE" == darwin* ]]; then
echo osx
elif [[ "$OSTYPE" == linux* ]]; then
echo linux
fi
@@ -1,56 +0,0 @@
set conda_env="fc_env"
robocopy ..\.pixi\envs\default\* %conda_env% /S /MT:%NUMBER_OF_PROCESSORS% > nul
%conda_env%\python ..\scripts\get_freecad_version.py
set /p freecad_version_name= <bundle_name.txt
echo **********************
echo %freecad_version_name%
echo **********************
REM remove arm binaries that fail to extract unless using latest 7zip
for /r %conda_env% %%i in (*arm*.exe) do (@echo "%%i will be removed" & @del "%%i")
set copy_dir="FreeCAD_Conda_Build"
mkdir %copy_dir%
REM Copy Conda's Python and (U)CRT to FreeCAD/bin
robocopy %conda_env%\DLLs %copy_dir%\bin\DLLs /S /MT:%NUMBER_OF_PROCESSORS% > nul
robocopy %conda_env%\Lib %copy_dir%\bin\Lib /XD __pycache__ /S /MT:%NUMBER_OF_PROCESSORS% > nul
robocopy %conda_env%\Scripts %copy_dir%\bin\Scripts /S /MT:%NUMBER_OF_PROCESSORS% > nul
robocopy %conda_env%\python*.* %copy_dir%\bin\ /XF *.pdb /MT:%NUMBER_OF_PROCESSORS% > nul
robocopy %conda_env%\msvc*.* %copy_dir%\bin\ /XF *.pdb /MT:%NUMBER_OF_PROCESSORS% > nul
robocopy %conda_env%\ucrt*.* %copy_dir%\bin\ /XF *.pdb /MT:%NUMBER_OF_PROCESSORS% > nul
REM Copy meaningful executables
robocopy %conda_env%\Library\bin %copy_dir%\bin\ ccx.exe /MT:%NUMBER_OF_PROCESSORS% > nul
robocopy %conda_env%\Library\bin %copy_dir%\bin\ gmsh.exe /MT:%NUMBER_OF_PROCESSORS% > nul
robocopy %conda_env%\Library\bin %copy_dir%\bin\ dot.exe /MT:%NUMBER_OF_PROCESSORS% > nul
robocopy %conda_env%\Library\bin %copy_dir%\bin\ unflatten.exe /MT:%NUMBER_OF_PROCESSORS% > nul
robocopy %conda_env%\Library\mingw-w64\bin * %copy_dir%\bin\ /MT:%NUMBER_OF_PROCESSORS% > nul
REM Copy Conda's QT5/plugins to FreeCAD/bin
robocopy %conda_env%\Library\plugins %copy_dir%\bin\ /S /MT:%NUMBER_OF_PROCESSORS% > nul
robocopy %conda_env%\Library\resources %copy_dir%\resources /MT:%NUMBER_OF_PROCESSORS% > nul
robocopy %conda_env%\Library\translations %copy_dir%\translations /MT:%NUMBER_OF_PROCESSORS% > nul
REM get all the dependency .dlls
robocopy %conda_env%\Library\bin *.dll %copy_dir%\bin /XF *.pdb /XF api*.* /MT:%NUMBER_OF_PROCESSORS% > nul
REM Copy FreeCAD build
robocopy %conda_env%\Library\bin FreeCAD* %copy_dir%\bin /XF *.pdb /MT:%NUMBER_OF_PROCESSORS% > nul
robocopy %conda_env%\Library\data %copy_dir%\data /XF *.txt /S /MT:%NUMBER_OF_PROCESSORS% > nul
robocopy %conda_env%\Library\Ext %copy_dir%\Ext /S /XD __pycache__ /MT:%NUMBER_OF_PROCESSORS% > nul
robocopy %conda_env%\Library\lib %copy_dir%\lib /XF *.lib /XF *.prl /XF *.sh /MT:%NUMBER_OF_PROCESSORS% > nul
robocopy %conda_env%\Library\Mod %copy_dir%\Mod /S /XD __pycache__ /MT:%NUMBER_OF_PROCESSORS% > nul
robocopy %conda_env%\Library\doc %copy_dir%\doc ThirdPartyLibraries.html LICENSE.html /MT:%NUMBER_OF_PROCESSORS% > nul
REM Apply Patches
rename %copy_dir%\bin\Lib\ssl.py ssl-orig.py
copy ssl-patch.py %copy_dir%\bin\Lib\ssl.py
cd %copy_dir%\..
ren %copy_dir% %freecad_version_name%
dir
REM if errorlevel1 exit 1
"%ProgramFiles%\7-Zip\7z.exe" a -t7z -mx9 -mmt=%NUMBER_OF_PROCESSORS% %freecad_version_name%.7z %freecad_version_name%\ -bb
certutil -hashfile "%freecad_version_name%.7z" SHA256 > "%freecad_version_name%.7z"-SHA256.txt
echo %date%-%time% >>"%freecad_version_name%.7z"-SHA256.txt
+45 -21
View File
@@ -3,23 +3,9 @@
set -e
set -x
conda_env="fc_env"
conda_env="$(pwd)/../.pixi/envs/default/"
mkdir -p ${conda_env}
cp -a ../.pixi/envs/default/* ${conda_env}
export PATH="${PWD}/${conda_env}/bin:${PATH}"
export CONDA_PREFIX="${PWD}/${conda_env}"
# remove arm binaries that fail to extract unless using latest 7zip
rm $(find ${conda_env} -name \*arm\*.exe)
# delete unnecessary stuff
rm -rf ${conda_env}/include
find ${conda_env} -name \*.a -delete
copy_dir="FreeCAD_Conda_Build"
copy_dir="FreeCAD_Windows"
mkdir -p ${copy_dir}/bin
# Copy Conda's Python and (U)CRT to FreeCAD/bin
@@ -48,16 +34,28 @@ cp -a ${conda_env}/Library/lib ${copy_dir}/lib
cp -a ${conda_env}/Library/Mod ${copy_dir}/Mod
mkdir -p ${copy_dir}/doc
cp -a ${conda_env}/Library/doc/{ThirdPartyLibraries.html,LICENSE.html} ${copy_dir}/doc
rm -rf ${conda_env}/bin_tmp
# delete unnecessary stuff
find ${copy_dir} -name \*.a -delete
find ${copy_dir} -name \*.lib -delete
find ${copy_dir} -name \*arm\*.exe -delete # arm binaries that fail to extract unless using latest 7zip
# Apply Patches
mv ${copy_dir}/bin/Lib/ssl.py ssl-orig.py
mv ${copy_dir}/bin/Lib/ssl.py .ssl-orig.py
cp ssl-patch.py ${copy_dir}/bin/Lib/ssl.py
echo '[Paths]' >> ${copy_dir}/bin/qt6.conf
echo 'Prefix = ../lib/qt6' >> ${copy_dir}/bin/qt6.conf
python_version=$(python -c 'import platform; print("py" + platform.python_version_tuple()[0] + platform.python_version_tuple()[1])')
# convenient shortcuts to run the binaries
if [ -x /c/ProgramData/chocolatey/tools/shimgen.exe ]; then
pushd ${copy_dir}
/c/ProgramData/chocolatey/tools/shimgen.exe -p bin/freecadcmd.exe -i "$(pwd)/../../../WindowsInstaller/icons/FreeCAD.ico" -o "$(pwd)/FreeCADCmd.exe"
/c/ProgramData/chocolatey/tools/shimgen.exe --gui -p bin/freecad.exe -i "$(pwd)/../../../WindowsInstaller/icons/FreeCAD.ico" -o "$(pwd)/FreeCAD.exe"
popd
fi
python_version=$("${copy_dir}"/bin/python.exe -c 'import platform; print("py" + platform.python_version_tuple()[0] + platform.python_version_tuple()[1])')
version_name="FreeCAD_${BUILD_TAG}-Windows-$(uname -m)-${python_version}"
echo -e "################"
@@ -69,11 +67,37 @@ sed -i '1s/.*/\nLIST OF PACKAGES:/' ${copy_dir}/packages.txt
mv ${copy_dir} ${version_name}
"${PROGRAMFILES}/7-Zip/7z.exe" a -t7z -mx9 -mmt=${NUMBER_OF_PROCESSORS} ${version_name}.7z ${version_name} -bb
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
if [ "${MAKE_INSTALLER}" == "true" ]; then
FILES_FREECAD="$(cygpath -w $(pwd))\\${version_name}"
nsis_cpdir=$(pwd)/.nsis_tmp
cp -r "${CONDA_PREFIX}/NSIS" "${nsis_cpdir}"
# curl -L -o ".nsis-log.zip" http://prdownloads.sourceforge.net/nsis/nsis-3.11-log.zip # we use the log variant of the package already
# curl -L -o ".nsis-strlen_8192.zip" "http://prdownloads.sourceforge.net/nsis/nsis-3.11-strlen_8192.zip"
curl -L -o ".NsProcess.7z" "https://nsis.sourceforge.io/mediawiki/images/1/18/NsProcess.zip"
if [ ! $(echo fc19fc66a5219a233570fafd5daeb0c9b85387b379f6df5ac8898159a57c5944 .NsProcess.7z | sha256sum --check --status) ]; then
7z x .NsProcess.7z -o"${nsis_cpdir}" -y
mv "${nsis_cpdir}"/Plugin/nsProcess.dll "${nsis_cpdir}"/Plugins/x86-ansi/nsProcess.dll
mv "${nsis_cpdir}"/Plugin/nsProcessW.dll "${nsis_cpdir}"/Plugins/x86-unicode/nsProcess.dll
"${nsis_cpdir}"/makensis.exe -V4 \
-D"ExeFile=${version_name}-installer.exe" \
-D"FILES_FREECAD=${FILES_FREECAD}" \
-X'SetCompressor /FINAL lzma' \
../../WindowsInstaller/FreeCAD-installer.nsi
mv ../../WindowsInstaller/${version_name}-installer.exe .
sha256sum ${version_name}-installer.exe > ${version_name}-installer.exe-SHA256.txt
else
echo "Error: Failed to get NsProcess plugin. Aborting installer creation..."
fi
rm -rf "${nsis_cpdir}"
fi
if [ "${UPLOAD_RELEASE}" == "true" ]; then
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
fi
@@ -83,8 +83,11 @@ fi
# Check for dmgbuild executable
if ! command -v dmgbuild &> /dev/null; then
echo "Error: dmgbuild not installed. Please install it for example using pip:"
echo 'pip3 install "dmgbuild[badge_icons]>=1.6.0,<1.7.0"'
echo 'Error: dmgbuild not installed. Please install it'
echo '- using pixi:'
echo 'pixi g install dmgbuild --with pyobjc-framework-Quartz'
echo '- using pip:'
echo 'pip3 install dmgbuild pyobjc-framework-Quartz'
exit 1
fi
@@ -119,8 +122,96 @@ run_codesign "${CONTAINING_FOLDER}/${APP_NAME}"
echo "Creating disk image ${DMG_NAME}"
dmgbuild -s ${DMG_SETTINGS} -Dcontaining_folder="${CONTAINING_FOLDER}" -Dapp_name="${APP_NAME}" "${VOLUME_NAME}" "${DMG_NAME}"
# Submit it for notarization (requires that an App Store API Key has been set up in the notarytool)
time xcrun notarytool submit --wait --keychain-profile "${KEYCHAIN_PROFILE}" "${DMG_NAME}"
ID_FILE="${DMG_NAME}.notarization_id"
# Assuming that notarization succeeded, it's a good practice to staple that notarization to the DMG
xcrun stapler staple "${DMG_NAME}"
# Submit it for notarization (requires that an App Store API Key has been set up in the notarytool)
# This is a *very slow* process, and occasionally the GitHub runners lose the internet connection for a short time
# during the run. So in order to be fault-tolerant, this script polls, instead of using --wait
submit_notarization_request() {
if [[ -s "${ID_FILE}" ]]; then
cat "${ID_FILE}"
return
fi
local out
if ! out=$(xcrun notarytool submit --keychain-profile "${KEYCHAIN_PROFILE}" \
--output-format json --no-progress "${DMG_NAME}" 2>&1); then
print -r -- "$out" >&2
return 1
fi
# We asked for JSON output so we had something stable, but of course parsing JSON with ZSH is ugly, so a quick bit of
# Python does it instead...
local id
id=$(print -r -- "$out" |
/usr/bin/python3 -c 'import sys, json; print(json.load(sys.stdin).get("id",""))'
)
[[ -n "$id" ]] || { print -r -- "Could not parse submission id" >&2; return 1; }
print -r -- "$id" > "${ID_FILE}"
print -r -- "$id" # ID is a string here, not an integer, so I can't just return it
}
wait_for_notarization_result() {
local id="$1" attempt=0
while :; do
if xcrun notarytool wait "$id" --keychain-profile "${KEYCHAIN_PROFILE}" \
--timeout 10m --no-progress >/dev/null; then
return 0
fi
(( attempt++ ))
# If the failure was transient (timeout/HTTP/connection) just retry, but make sure to check to see if the problem
# was actually that the signing failed before retrying.
local tmp_json
tmp_json=$(mktemp)
trap 'rm -f "$tmp_json"' EXIT INT TERM
xcrun notarytool info "$id" --keychain-profile "${KEYCHAIN_PROFILE}" --output-format json 2>/dev/null > "$tmp_json"
/usr/bin/python3 - "$tmp_json" <<'PY'
import sys, json
try:
with open(sys.argv[1]) as f:
s = (json.load(f).get("status") or "").lower()
if s in ("invalid", "rejected"):
sys.exit(2)
else:
sys.exit(0)
except Exception:
sys.exit(1)
PY
rc=$?
rm -f "$tmp_json"
if [[ $rc == 2 ]]; then
print -r -- "Notarization was not accepted by Apple:" >&2
xcrun notarytool log "$id" --keychain-profile "${KEYCHAIN_PROFILE}" >&2
return 3
fi
if [[ $attempt -gt 120 ]]; then
print -r -- "🏳️ Notarization is taking too long, bailing out. 🏳️" >&2
return 4
fi
sleep $(( (attempt<6?2**attempt:60) + RANDOM%5 )) # Increasing timeout plus jitter for multi-run safety
done
}
if ! id="$(submit_notarization_request)"; then
print -r -- "❌ Failed to submit notarization request" >&2
exit 1
fi
if [[ -z "$id" ]]; then
print -r -- "❌ Submission succeeded but no ID was returned" >&2
exit 1
fi
print "Notarization submission ID: $id"
if wait_for_notarization_result "$id"; then
print "✅ Notarization succeeded. Stapling..."
xcrun stapler staple "${DMG_NAME}"
print "Stapled: ${DMG_NAME}"
rm -f "${ID_FILE}"
else
rc=$?
print "❌ Notarization failed (code $rc)." >&2
exit "$rc"
fi
@@ -11,12 +11,10 @@ import SubWCRev
gitInfo = SubWCRev.GitControl()
gitInfo.extractInfo("","")
gitDescription = os.environ['BUILD_TAG']
i = open("src/Build/Version.h.cmake")
content = []
for line in i.readlines():
line = line.replace("-${PACKAGE_VERSION_SUFFIX}",gitDescription)
line = line.replace("${PACKAGE_WCREF}",gitInfo.rev)
line = line.replace("${PACKAGE_WCDATE}",gitInfo.date)
line = line.replace("${PACKAGE_WCURL}",gitInfo.url)
@@ -28,6 +26,14 @@ with open("src/Build/Version.h.cmake", "w") as o:
content.append('#define FCRepositoryBranch "%s"\n' % (gitInfo.branch))
o.writelines(content)
with open("src/Tools/SubWCRev.py", "r") as f:
new_subwcrev = f.read()
new_subwcrev = new_subwcrev.replace("lines = i.writeVersion(lines)",
"#lines = i.writeVersion(lines) # this source package already has git info, we do nothing here")
with open("src/Tools/SubWCRev.py", "w") as f:
f.writelines(new_subwcrev)
with open(os.sys.argv[1], "w") as f:
f.write(f"rev_number: {gitInfo.rev}\n")
f.write(f"branch_name: {gitInfo.branch}\n")
@@ -35,8 +41,9 @@ with open(os.sys.argv[1], "w") as f:
f.write(f"commit_hash: {gitInfo.hash}\n")
f.write(f"remote_url: {gitInfo.url}\n")
p = subprocess.Popen(["git", "-c", "user.name='github-actions[bot]'", "-c", "user.email='41898282+github-actions[bot]@users.noreply.github.com'",
"commit", "-a", "-m", "add git information"], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
p = subprocess.Popen(["git", "-c", "user.name='github-actions[bot]'", "-c",
"user.email='41898282+github-actions[bot]@users.noreply.github.com'", "commit", "-a", "-m",
"add git version information"], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
out, err = p.communicate()
+10 -10
View File
@@ -152,24 +152,24 @@ freecad-stubs = "*"
## Qt 6 Configuration Presets
[target.linux-64.tasks]
configure-debug = { cmd = [ "cmake", "--preset", "conda-linux-debug", "-DBUILD_REVERSEENGINEERING=OFF" ], depends-on = ["initialize"], env={ CFLAGS="", CXXFLAGS="", DEBUG_CFLAGS="", DEBUG_CXXFLAGS="" }}
configure-release = { cmd = [ "cmake", "--preset", "conda-linux-release", "-DBUILD_REVERSEENGINEERING=OFF" ], depends-on = ["initialize"], env={ CFLAGS="", CXXFLAGS="", DEBUG_CFLAGS="", DEBUG_CXXFLAGS="" }}
configure-debug = { cmd = [ "cmake", "--preset", "conda-linux-debug" ], depends-on = ["initialize"], env={ CFLAGS="", CXXFLAGS="", DEBUG_CFLAGS="", DEBUG_CXXFLAGS="" }}
configure-release = { cmd = [ "cmake", "--preset", "conda-linux-release" ], depends-on = ["initialize"], env={ CFLAGS="", CXXFLAGS="", DEBUG_CFLAGS="", DEBUG_CXXFLAGS="" }}
[target.linux-aarch64.tasks]
configure-debug = { cmd = [ "cmake", "--preset", "conda-linux-debug", "-DBUILD_REVERSEENGINEERING=OFF" ], depends-on= ["initialize"], env={ CFLAGS="", CXXFLAGS="", DEBUG_CFLAGS="", DEBUG_CXXFLAGS="" }}
configure-release = { cmd = [ "cmake", "--preset", "conda-linux-release", "-DBUILD_REVERSEENGINEERING=OFF" ], depends-on= ["initialize"], env={ CFLAGS="", CXXFLAGS="", DEBUG_CFLAGS="", DEBUG_CXXFLAGS="" }}
configure-debug = { cmd = [ "cmake", "--preset", "conda-linux-debug" ], depends-on= ["initialize"], env={ CFLAGS="", CXXFLAGS="", DEBUG_CFLAGS="", DEBUG_CXXFLAGS="" }}
configure-release = { cmd = [ "cmake", "--preset", "conda-linux-release" ], depends-on= ["initialize"], env={ CFLAGS="", CXXFLAGS="", DEBUG_CFLAGS="", DEBUG_CXXFLAGS="" }}
[target.osx-64.tasks]
configure-debug = { cmd = [ "cmake", "--preset", "conda-macos-debug", "-DBUILD_REVERSEENGINEERING=OFF" ], depends-on = ["initialize"], env={ CFLAGS="", CXXFLAGS="", DEBUG_CFLAGS="", DEBUG_CXXFLAGS="" }}
configure-release = { cmd = [ "cmake", "--preset", "conda-macos-release", "-DBUILD_REVERSEENGINEERING=OFF" ], depends-on = ["initialize"], env={ CFLAGS="", CXXFLAGS="", DEBUG_CFLAGS="", DEBUG_CXXFLAGS="" }}
configure-debug = { cmd = [ "cmake", "--preset", "conda-macos-debug" ], depends-on = ["initialize"], env={ CFLAGS="", CXXFLAGS="", DEBUG_CFLAGS="", DEBUG_CXXFLAGS="" }}
configure-release = { cmd = [ "cmake", "--preset", "conda-macos-release" ], depends-on = ["initialize"], env={ CFLAGS="", CXXFLAGS="", DEBUG_CFLAGS="", DEBUG_CXXFLAGS="" }}
[target.osx-arm64.tasks]
configure-debug = { cmd = [ "cmake", "--preset", "conda-macos-debug", "-DBUILD_REVERSEENGINEERING=OFF" ], depends-on = ["initialize"], env={ CFLAGS="", CXXFLAGS="", DEBUG_CFLAGS="", DEBUG_CXXFLAGS="" }}
configure-release = { cmd = [ "cmake", "--preset", "conda-macos-release", "-DBUILD_REVERSEENGINEERING=OFF" ], depends-on = ["initialize"], env={ CFLAGS="", CXXFLAGS="", DEBUG_CFLAGS="", DEBUG_CXXFLAGS="" }}
configure-debug = { cmd = [ "cmake", "--preset", "conda-macos-debug" ], depends-on = ["initialize"], env={ CFLAGS="", CXXFLAGS="", DEBUG_CFLAGS="", DEBUG_CXXFLAGS="" }}
configure-release = { cmd = [ "cmake", "--preset", "conda-macos-release" ], depends-on = ["initialize"], env={ CFLAGS="", CXXFLAGS="", DEBUG_CFLAGS="", DEBUG_CXXFLAGS="" }}
[target.win-64.tasks]
configure-debug = { cmd = [ "cmake", "--preset", "conda-windows-debug", "-DBUILD_REVERSEENGINEERING=OFF", "-DCMAKE_GENERATOR_PLATFORM=", "-DCMAKE_GENERATOR_TOOLSET=" ], depends-on = ["initialize"], env={ CFLAGS="", CXXFLAGS="", DEBUG_CFLAGS="", DEBUG_CXXFLAGS="" }}
configure-release = { cmd = [ "cmake", "--preset", "conda-windows-release", "-DBUILD_REVERSEENGINEERING=OFF", "-DCMAKE_GENERATOR_PLATFORM=", "-DCMAKE_GENERATOR_TOOLSET=" ], depends-on = ["initialize"], env={ CFLAGS="", CXXFLAGS="", DEBUG_CFLAGS="", DEBUG_CXXFLAGS="" }}
configure-debug = { cmd = [ "cmake", "--preset", "conda-windows-debug", "-DCMAKE_GENERATOR_PLATFORM=", "-DCMAKE_GENERATOR_TOOLSET=" ], depends-on = ["initialize"], env={ CFLAGS="", CXXFLAGS="", DEBUG_CFLAGS="", DEBUG_CXXFLAGS="" }}
configure-release = { cmd = [ "cmake", "--preset", "conda-windows-release", "-DCMAKE_GENERATOR_PLATFORM=", "-DCMAKE_GENERATOR_TOOLSET=" ], depends-on = ["initialize"], env={ CFLAGS="", CXXFLAGS="", DEBUG_CFLAGS="", DEBUG_CXXFLAGS="" }}
freecad-debug = { cmd = [ ".pixi/envs/default/Library/bin/FreeCAD.exe" ], depends-on = ["install-debug"]}
freecad-release = { cmd = [ ".pixi/envs/default/Library/bin/FreeCAD.exe" ], depends-on = ["install-release"]}
+44 -23
View File
@@ -31,31 +31,38 @@ namespace App
class Application;
/// Helper class to manager transaction (i.e. undo/redo)
/**
* @brief A helper class to manage transactions (i.e. undo/redo).
*
* An AutoTransaction object is meant to be allocated on the stack and governs
* the transactions in that scope.
*/
class AppExport AutoTransaction
{
public:
/// Private new operator to prevent heap allocation
/// Delete the new operator to prevent heap allocation.
void* operator new(std::size_t) = delete;
public:
/** Constructor
/**
* @brief Construct an auto transaction.
*
* @param name: optional new transaction name on construction
* @param tmpName: if true and a new transaction is setup, the name given is
* @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 transaction being setup. It also prevents close (i.e. commits) the
* current active transaction until it reaches zero. It does not have any
* effect on aborting transaction, though.
* 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.
*/
AutoTransaction(const char* name = nullptr, bool tmpName = false);
/** Destructor
/**
* @brief Destruct an auto transaction.
*
* This destructor decrease an internal counter
* (Application::_activeTransactionGuard), and will commit any current
@@ -63,15 +70,19 @@ public:
*/
~AutoTransaction();
/** Close or abort the transaction
/**
* @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
* the constructor. For aborting, it will abort any current transaction.
*
* @param[in] abort: if true, abort the transaction; otherwise, commit it.
*/
void close(bool abort = false);
/** Enable/Disable any AutoTransaction instance in the current stack
/**
* @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
@@ -79,6 +90,8 @@ public:
*
* 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);
@@ -87,47 +100,55 @@ private:
};
/** Helper class to lock a transaction from being closed or aborted.
/**
* @brief Helper class to lock a transaction from being closed or aborted.
*
* The helper class is used to protect some critical transaction from being
* The helper class is used to protect some critical transactions from being
* closed prematurely, e.g. when deleting some object.
*/
class AppExport TransactionLocker
{
public:
/** Constructor
* @param lock: whether to activate the lock
/**
* @brief Construct a transaction locker.
*
* @param[in] lock: whether to activate the lock
*/
TransactionLocker(bool lock = true);
/** Destructor
* Unlock the transaction is this locker is active
/**
* @brief Destruct a transaction locker.
*
* Unlock the transaction if this locker is active
*/
~TransactionLocker();
/** Activate or deactivate this locker
* @param enable: whether to activate the locker
/**
* @brief Activate or deactivate this locker.
*
* An internal counter is used to support recursive locker. When activated,
* the current active transaction cannot be closed or aborted. But the
* closing call (Application::closeActiveTransaction()) will be remembered,
* and performed when the internal lock counter reaches zero.
*
* @param enable: whether to activate the locker
*/
void activate(bool enable);
/// Check if the locker is active
/// Check if the locker is active.
bool isActive() const
{
return active;
}
/// Check if transaction is being locked
/// Check if transaction is being locked.
static bool isLocked();
friend class Application;
public:
/// Private new operator to prevent heap allocation
/// Delete the new operator to prevent heap allocation.
void* operator new(std::size_t) = delete;
private:
+16
View File
@@ -1792,6 +1792,12 @@ bool Document::saveToFile(const char* filename) const
// realpath is canonical filename i.e. without symlink
std::string nativePath = canonical_path(filename);
// check if file is writeable, then block the save if it is not.
Base::FileInfo originalFileInfo(nativePath);
if (originalFileInfo.exists() && !originalFileInfo.isWritable()) {
throw Base::FileException("Unable to save document because file is marked as read-only or write permission is not available.", originalFileInfo);
}
// make a tmp. file where to save the project data first and then rename to
// the actual file name. This may be useful if overwriting an existing file
// fails so that the data of the work up to now isn't lost.
@@ -2086,6 +2092,16 @@ bool Document::afterRestore(const std::vector<DocumentObject*>& objArray, bool c
FC_ERR("Failed to restore " << obj->getFullName() << ": " << e.what());
}
catch (...) {
// If a Python exception occurred, it must be cleared immediately.
// Otherwise, the interpreter remains in a dirty state, causing
// Segfaults later when FreeCAD interacts with Python.
if (PyErr_Occurred()) {
Base::Console().error("Python error during object restore:\n");
PyErr_Print(); // Print the traceback to stderr/Console
PyErr_Clear(); // Reset the interpreter state
}
d->addRecomputeLog("Unknown exception on restore", obj);
FC_ERR("Failed to restore " << obj->getFullName() << ": " << "unknown exception");
}
+1 -1
View File
@@ -1,5 +1,5 @@
import sys
from os import sys, path
from os import path
# Actual code generation is done in Base/param_utils.py.
+5 -4
View File
@@ -140,16 +140,17 @@ public:
bool operator==(const Material& m) const
{
// clang-format off
return _matType == m._matType
&& shininess == m.shininess
if (!uuid.empty() && uuid == m.uuid) {
return true;
}
return shininess == m.shininess
&& transparency == m.transparency
&& ambientColor == m.ambientColor
&& diffuseColor == m.diffuseColor
&& specularColor == m.specularColor
&& emissiveColor == m.emissiveColor
&& image == m.image
&& image == m.imagePath
&& uuid == m.uuid;
&& imagePath == m.imagePath;
// clang-format on
}
bool operator!=(const Material& m) const
+47
View File
@@ -35,6 +35,7 @@
#include <Base/Console.h>
#include <Base/Exception.h>
#include <Base/Interpreter.h>
#include <Base/ProgramVersion.h>
#include <Base/Reader.h>
#include <Base/Writer.h>
#include <Base/Quantity.h>
@@ -2226,6 +2227,25 @@ unsigned int PropertyBoolList::getMemSize() const
// PropertyColor
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
namespace
{
/// The definition of "alpha" was corrected in FreeCAD 1.1 -- returns true if the reader is working
/// on a file that pre-dates that correction.
bool readerRequiresAlphaConversion(const Base::XMLReader &reader)
{
return Base::getVersion(reader.ProgramVersion) < Base::Version::v1_1;
}
/// Given a material, invert the alpha channel of all of its colors.
void convertAlphaInMaterial(App::Material& material)
{
material.ambientColor.a = 1.0F - material.ambientColor.a;
material.diffuseColor.a = 1.0F - material.diffuseColor.a;
material.specularColor.a = 1.0F - material.specularColor.a;
material.emissiveColor.a = 1.0F - material.emissiveColor.a;
}
}
TYPESYSTEM_SOURCE(App::PropertyColor, App::Property)
//**************************************************************************
@@ -2367,6 +2387,12 @@ void PropertyColor::Restore(Base::XMLReader& reader)
reader.readElement("PropertyColor");
// get the value of my Attribute
unsigned long rgba = reader.getAttribute<unsigned long>("value");
if (readerRequiresAlphaConversion(reader)) {
// Convert transparency / alpha value
constexpr unsigned long alphaMax = 0xff;
unsigned long alpha = alphaMax - (rgba & alphaMax);
rgba = rgba - (rgba & alphaMax) + alpha;
}
setValue(rgba);
}
@@ -2448,6 +2474,8 @@ void PropertyColorList::Restore(Base::XMLReader& reader)
// initiate a file read
reader.addFile(file.c_str(), this);
}
requiresAlphaConversion = readerRequiresAlphaConversion(reader);
}
}
@@ -2472,6 +2500,11 @@ void PropertyColorList::RestoreDocFile(Base::Reader& reader)
str >> value;
it.setPackedValue(value);
}
if (requiresAlphaConversion) {
for (auto& it : values) {
it.a = 1.0F - it.a;
}
}
setValues(values);
}
@@ -2702,6 +2735,9 @@ void PropertyMaterial::Restore(Base::XMLReader& reader)
_cMat.emissiveColor.setPackedValue(reader.getAttribute<unsigned long>("emissiveColor"));
_cMat.shininess = (float)reader.getAttribute<double>("shininess");
_cMat.transparency = (float)reader.getAttribute<double>("transparency");
if (readerRequiresAlphaConversion(reader)) {
convertAlphaInMaterial(_cMat);
}
if (reader.hasAttribute("image")) {
_cMat.image = reader.getAttribute<const char*>("image");
}
@@ -3247,6 +3283,8 @@ void PropertyMaterialList::Restore(Base::XMLReader& reader)
// initiate a file read
reader.addFile(file.c_str(), this);
}
requiresAlphaConversion = readerRequiresAlphaConversion(reader);
}
}
@@ -3330,6 +3368,7 @@ void PropertyMaterialList::RestoreDocFileV0(uint32_t count, Base::Reader& reader
str >> valueF;
it.transparency = valueF;
}
convertAlpha(values);
setValues(values);
}
@@ -3360,9 +3399,17 @@ void PropertyMaterialList::RestoreDocFileV3(Base::Reader& reader)
readString(str, it.imagePath);
readString(str, it.uuid);
}
convertAlpha(values);
setValues(values);
}
void PropertyMaterialList::convertAlpha(std::vector<App::Material>& materials) const
{
if (requiresAlphaConversion) {
std::ranges::for_each(materials, convertAlphaInMaterial);
}
}
void PropertyMaterialList::readString(Base::InputStream& str, std::string& value)
{
uint32_t uCt {};
+5
View File
@@ -1091,6 +1091,9 @@ public:
protected:
Base::Color getPyValue(PyObject* py) const override;
private:
bool requiresAlphaConversion {false}; // In 1.1 the handling of alpha was inverted
};
@@ -1294,8 +1297,10 @@ private:
void verifyIndex(int index) const;
void setMinimumSizeOne();
int resizeByOneIfNeeded(int index);
void convertAlpha(std::vector<App::Material>& materials) const;
Format formatVersion {Version_0};
bool requiresAlphaConversion {false}; // In 1.1 the handling of alpha was inverted
};
+22 -2
View File
@@ -32,20 +32,40 @@ namespace App
class Document;
class TransactionObject;
/** Base class of transactional objects
/**
* @brief Base class of transactional objects.
*
* A transactional object provides functionality that is inherited by its
* children to ensure that these children objects can be targeted by a
* transaction.
*/
class AppExport TransactionalObject: public App::ExtensionContainer
{
PROPERTY_HEADER_WITH_OVERRIDE(App::TransactionalObject);
public:
/// Constructor
TransactionalObject();
~TransactionalObject() override;
/// Check if this object is attached to a document.
virtual bool isAttachedToDocument() const;
/**
* @brief Deteach this object from the document.
*
* @return the name of the document this object was attached to.
*/
virtual const char* detachFromDocument();
protected:
/**
* @brief Notify the document that a property is about to be changed.
*
* This function is called before the property is changed.
*
* @param[in,out] doc the document this object is attached to.
* @param[in] prop the property that is about to be changed.
*/
void onBeforeChangeProperty(Document* doc, const Property* prop);
};
+1 -13
View File
@@ -52,10 +52,6 @@ Transaction::Transaction(int id)
transID = id;
}
/**
* A destructor.
* A more elaborate description of the destructor.
*/
Transaction::~Transaction()
{
auto& index = _Objects.get<0>();
@@ -291,16 +287,8 @@ TYPESYSTEM_SOURCE_ABSTRACT(App::TransactionObject, Base::Persistence)
//**************************************************************************
// Construction/Destruction
/**
* A constructor.
* A more elaborate description of the constructor.
*/
TransactionObject::TransactionObject() = default;
/**
* A destructor.
* A more elaborate description of the destructor.
*/
TransactionObject::~TransactionObject()
{
for (auto& v : _PropChangeMap) {
@@ -344,7 +332,7 @@ void TransactionObject::applyChn(Document& /*Doc*/, TransactionalObject* pcObj,
}
// getPropertyName() is specially coded to be safe even if prop has
// been destroies. We must prepare for the case where user removed
// been destroyed. We must prepare for the case where user removed
// a dynamic property but does not recordered as transaction.
auto name = pcObj->getPropertyName(prop);
if (!name || (!data.name.empty() && data.name != name)
+164 -32
View File
@@ -40,52 +40,105 @@ class TransactionObject;
class TransactionalObject;
/** Represents a atomic transaction of the document
/**
* @brief A class that represents an atomic transaction of the document.
*
* A transaction can contain multiple actions. These actions are represented
* by TransactionObject objects. Actions can be on objects: adding one,
* removing one, or changing one. It can also be on properties: adding one or
* removing one.
*/
class AppExport Transaction: public Base::Persistence
{
TYPESYSTEM_HEADER_WITH_OVERRIDE();
public:
/** Construction
/**
* @brief Construct a transaction.
*
* @param id: transaction id. If zero, then it will be generated
* @param[in] id: The transaction id. If zero, then it will be generated
* automatically as a monotonically increasing index across the entire
* application. User can pass in a transaction id to group multiple
* transactions from different document, so that they can be undo/redo
* application. Users can pass in a transaction id to group multiple
* transactions from different document, so that they can be undone/redone
* together.
*/
explicit Transaction(int id = 0);
/// Construction
~Transaction() override;
/// apply the content to the document
/**
* @brief Apply the content of this transaction to the document.
*
* @param[in] Doc The document to apply the transaction to.
* @param[in] forward If true, apply the transaction; otherwise, undo it.
*/
void apply(Document& Doc, bool forward);
// the utf-8 name of the transaction
/// The UTF-8 name of the transaction
std::string Name;
unsigned int getMemSize() const override;
void Save(Base::Writer& writer) const override;
/// This method is used to restore properties from an XML document.
void Restore(Base::XMLReader& reader) override;
/// Return the transaction ID
/// Get the transaction ID of this transaction.
int getID() const;
/// Generate a new unique transaction ID
/// Generate a new unique transaction ID.
static int getNewID();
/// Get the last transaction ID.
static int getLastID();
/// Returns true if the transaction list is empty; otherwise returns false.
/// Check if the transaction list is empty.
bool isEmpty() const;
/// check if this object is used in a transaction
/**
* @brief Check if this object is used in a transaction.
*
* @param[in] Obj The object to check.
* @return true if the object is used in a transaction; otherwise false.
*/
bool hasObject(const TransactionalObject* Obj) const;
/**
* @brief Record renaming a property.
*
* @param[in] Obj The object of which the property to rename.
* @param[in] pcProp The property with a new name.
* @param[in] oldName The old name of the property.
*/
void renameProperty(TransactionalObject* Obj, const Property* pcProp, const char* oldName);
/**
* @brief Record adding or removing a property from an object.
*
* @param[in] Obj The object to add or remove the property from.
* @param[in] pcProp The property to add or remove.
* @param[in] add If true, add the property; otherwise, remove it.
*/
void addOrRemoveProperty(TransactionalObject* Obj, const Property* pcProp, bool add);
/**
* @brief Record adding a new object to the transaction.
*
* @param[in] Obj The object to add.
*/
void addObjectNew(TransactionalObject* Obj);
/**
* @brief Record removing an object from the transaction.
*
* @param[in] Obj The object to remove.
*/
void addObjectDel(const TransactionalObject* Obj);
/**
*@brief Record changing an object in the transaction.
*
* @param[in] Obj The object to change.
* @param[in] Prop The property that is changed.
*/
void addObjectChange(const TransactionalObject* Obj, const Property* Prop);
private:
@@ -103,41 +156,87 @@ private:
_Objects;
};
/** Represents an entry for an object in a Transaction
/**
* @brief Class that represents an entry for an object in a Transaction.
*
* This class is used to store the information about the object and its
* properties. It should not be confused with the TransactionalObject class
* that is a base class that contains functionality for a DocumentObject
* regarding transactions.
*/
class AppExport TransactionObject: public Base::Persistence
{
TYPESYSTEM_HEADER_WITH_OVERRIDE();
public:
/// Construction
TransactionObject();
/// Destruction
~TransactionObject() override;
virtual void applyNew(Document& Doc, TransactionalObject* pcObj);
virtual void applyDel(Document& Doc, TransactionalObject* pcObj);
virtual void applyChn(Document& Doc, TransactionalObject* pcObj, bool Forward);
/**
* @brief Apply the transaction that adds a new object to the document.
*
* @param[in,out] doc The document to apply the transaction to.
* @param[in,out] obj The object that is added in the transaction.
*/
virtual void applyNew(Document& doc, TransactionalObject* obj);
void setProperty(const Property* pcProp);
void renameProperty(const Property* pcProp, const char* newName);
void addOrRemoveProperty(const Property* pcProp, bool add);
/**
* @brief Apply the transaction that removes an object from the document.
*
* @param[in,out] doc The document to apply the transaction to.
* @param[in,out] obj The object that is removed in the transaction.
*/
virtual void applyDel(Document& doc, TransactionalObject* obj);
/**
* @brief Apply the transaction that changes an object in the document.
*
* @param[in,out] doc The document to apply the transaction to.
* @param[in,out] obj The object that is changed in the transaction.
* @param[in] forward If true, apply the transaction; otherwise, undo it.
*/
virtual void applyChn(Document& doc, TransactionalObject* obj, bool forward);
/**
* @brief Set the property of the object that is affected by the transaction.
*
* @param[in] prop The property that is affected by the transaction.
*/
void setProperty(const Property* prop);
/**
* @brief Rename a property.
*
* @param[in] pcProp The property with the new name.
* @param[in] oldName The old name of the property.
*/
void renameProperty(const Property* pcProp, const char* oldName);
/**
* @brief Add or remove a property from the object.
*
* @param[in] prop The property to add or remove.
* @param[in] add If true, add the property; otherwise, remove it.
*/
void addOrRemoveProperty(const Property* prop, bool add);
unsigned int getMemSize() const override;
void Save(Base::Writer& writer) const override;
/// This method is used to restore properties from an XML document.
void Restore(Base::XMLReader& reader) override;
friend class Transaction;
protected:
/// The status of the transaction object.
enum Status
{
New,
Del,
Chn
New, ///< A new object is added to the document.
Del, ///< An object is deleted from the document.
Chn ///< An object is changed in the document.
} status {New};
/// Struct to maintain property information.
struct PropData: DynamicProperty::PropData
{
Base::Type propertyType;
@@ -145,34 +244,59 @@ protected:
// for property renaming
std::string nameOrig;
};
/// A map to maintain the properties of the object.
std::unordered_map<int64_t, PropData> _PropChangeMap;
/// The name of the object in the document.
std::string _NameInDocument;
};
/** Represents an entry for a document object in a transaction
/**
* @brief Class that represents an entry for a document object in a transaction.
*/
class AppExport TransactionDocumentObject: public TransactionObject
{
TYPESYSTEM_HEADER_WITH_OVERRIDE();
public:
/// Construction
TransactionDocumentObject();
/// Destruction
~TransactionDocumentObject() override;
void applyNew(Document& Doc, TransactionalObject* pcObj) override;
void applyDel(Document& Doc, TransactionalObject* pcObj) override;
};
/**
* @brief Class that represents a factory for creating transaction objects.
*
* This class is used to create transaction objects for different types of
* transactions.
*/
class AppExport TransactionFactory
{
public:
/// Get the singleton instance of the TransactionFactory.
static TransactionFactory& instance();
/// Destruct the singleton instance of the TransactionFactory.
static void destruct();
/**
* @brief Create a transaction object for the given type.
*
* @param[in] type The type of the transaction object to create.
* @return A pointer to the created transaction object.
*/
TransactionObject* createTransaction(const Base::Type& type) const;
/**
* @brief Add a producer for a transaction object.
*
* @param[in] type The type id of the transaction object.
* @param[in,out] producer The producer to add.
*/
void addProducer(const Base::Type& type, Base::AbstractProducer* producer);
private:
@@ -183,10 +307,20 @@ private:
~TransactionFactory() = default;
};
/**
* @brief Class that represents a producer for creating transaction objects.
*
* @tparam CLASS The class of the transaction object to produce.
*/
template<class CLASS>
class TransactionProducer: public Base::AbstractProducer
{
public:
/**
* @brief Construct a transaction producer.
*
* @param[in] type The type of the transaction object.
*/
explicit TransactionProducer(const Base::Type& type)
{
TransactionFactory::instance().addProducer(type, this);
@@ -194,9 +328,7 @@ public:
~TransactionProducer() override = default;
/**
* Creates an instance of the specified transaction object.
*/
/// Creates an instance of the specified transaction object.
void* Produce() const override
{
return (new CLASS);
+38
View File
@@ -336,6 +336,44 @@ bool FileInfo::isWritable() const
if (fs::is_directory(path)) {
return directoryIsWritable(path);
}
#ifdef FC_OS_WIN32
// convert filename from UTF-8 to windows WSTRING
std::wstring fileNameWstring = toStdWString();
// requires import of <windows.h>
DWORD attributes = GetFileAttributes(fileNameWstring.c_str());
if (attributes == INVALID_FILE_ATTRIBUTES) {
// Log the error?
std::clog << "GetFileAttributes failed for file: " << FileName << '\n';
// usually indicates some kind of network file issue, so the file is probably not writable
return false;
}
if ((attributes & FILE_ATTRIBUTE_READONLY) != 0) {
return false;
}
// TEST if file is truly writable, because windows ACL does not map well to POSIX perms,
// and there are other potential blockers (app or shared file locks, etc)
HANDLE hFile = CreateFileW(
fileNameWstring.c_str(),
GENERIC_WRITE,
0, // ----> no sharing: fail if anyone else has it open
nullptr,
OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL,
nullptr
);
if (hFile == INVALID_HANDLE_VALUE) {
DWORD err = GetLastError();
if (err == ERROR_SHARING_VIOLATION || err == ERROR_LOCK_VIOLATION) {
return false;
}
return false;
}
if (!CloseHandle(hFile)) {
std::clog << "CloseHandle failed for file: " << FileName
<< " while checking for write access." << '\n';
}
#endif
fs::file_status stat = fs::status(path);
fs::perms perms = stat.permissions();
return (perms & fs::perms::owner_write) == fs::perms::owner_write;
+84
View File
@@ -0,0 +1,84 @@
// SPDX-License-Identifier: LGPL-2.1-or-later
/***************************************************************************
* Copyright (c) 2024 Werner Mayer <wmayer[at]users.sourceforge.net> *
* *
* This file is part of FreeCAD. *
* *
* FreeCAD is free software: you can redistribute it and/or modify it *
* under the terms of the GNU Lesser General Public License as *
* published by the Free Software Foundation, either version 2.1 of the *
* License, or (at your option) any later version. *
* *
* FreeCAD is distributed in the hope that it will be useful, but *
* WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
* Lesser General Public License for more details. *
* *
* You should have received a copy of the GNU Lesser General Public *
* License along with FreeCAD. If not, see *
* <https://www.gnu.org/licenses/>. *
* *
**************************************************************************/
#ifndef BASE_PROGRAM_VERSION_H
#define BASE_PROGRAM_VERSION_H
#include <algorithm>
#include <cstdint>
#include <string_view>
#include <FCGlobal.h>
namespace Base
{
enum class Version : std::uint8_t
{
v0_1x,
v0_16,
v0_17,
v0_18,
v0_19,
v0_20,
v0_21,
v0_22,
v1_0,
v1_1,
v1_x,
};
inline Version getVersion(std::string_view str)
{
// clang-format off
struct VersionItem
{
std::string_view name;
Version version;
};
static const std::initializer_list<VersionItem> items = {
{.name="0.16", .version=Version::v0_16},
{.name="0.17", .version=Version::v0_17},
{.name="0.18", .version=Version::v0_18},
{.name="0.19", .version=Version::v0_19},
{.name="0.20", .version=Version::v0_20},
{.name="0.21", .version=Version::v0_21},
{.name="0.22", .version=Version::v0_22},
{.name="1.0" , .version=Version::v1_0 },
{.name="1.1" , .version=Version::v1_1 },
};
// clang-format on
auto it = std::ranges::find_if(items, [str](const auto& item) {
return str.compare(0, item.name.size(), item.name) == 0;
});
if (it != items.end()) {
return it->version;
}
if (!str.empty() && str[0] == '0') {
return Version::v0_1x;
}
return Version::v1_x;
}
} // namespace Base
#endif // BASE_PROGRAM_VERSION_H
-4
View File
@@ -65,11 +65,7 @@ using namespace std;
Base::XMLReader::XMLReader(const char* FileName, std::istream& str)
: _File(FileName)
{
#ifdef _MSC_VER
str.imbue(std::locale::empty());
#else
str.imbue(std::locale::classic());
#endif
// create the parser
parser = XMLReaderFactory::createXMLReader(); // NOLINT
-8
View File
@@ -318,11 +318,7 @@ void Writer::putNextEntry(const char* file, const char* obj)
ZipWriter::ZipWriter(const char* FileName)
: ZipStream(FileName)
{
#ifdef _MSC_VER
ZipStream.imbue(std::locale::empty());
#else
ZipStream.imbue(std::locale::classic());
#endif
ZipStream.precision(std::numeric_limits<double>::digits10 + 1);
ZipStream.setf(std::ios::fixed, std::ios::floatfield);
}
@@ -330,11 +326,7 @@ ZipWriter::ZipWriter(const char* FileName)
ZipWriter::ZipWriter(std::ostream& os)
: ZipStream(os)
{
#ifdef _MSC_VER
ZipStream.imbue(std::locale::empty());
#else
ZipStream.imbue(std::locale::classic());
#endif
ZipStream.precision(std::numeric_limits<double>::digits10 + 1);
ZipStream.setf(std::ios::fixed, std::ios::floatfield);
}

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