Compare commits

...

303 Commits

Author SHA1 Message Date
Adrian Insaurralde Avalos 2fcc5317fe cmake: remove rc4 suffix from version info 2024-11-18 13:48:00 -03:00
Jiří Mácha 78a2a9c002 Assembly: fixed defect in the migrationScript4 function
The old CAD model created by the development version of FreeCAD
(in which the Assembly workbench was used) contained joints that,
for some reason, had an empty Joint Connector 1 reference (Reference1).

This was causing an exception and a crash of the Python function
called migrationScript4. The FreeCAD Report view contained:

23:28:29  pyException: Traceback (most recent call last):
  File "/FreeCAD/Mod/Assembly/JointObject.py", line 175, in onDocumentRestored
    self.createProperties(joint)
  File "/FreeCAD/Mod/Assembly/JointObject.py", line 181, in createProperties
    self.migrationScript4(joint)
  File "/FreeCAD/Mod/Assembly/JointObject.py", line 514, in migrationScript4
    if hasattr(joint, "Reference1") and joint.Reference1[0] is not None:
                                        ~~~~~~~~~~~~~~~~^^^
<class 'TypeError'>: 'NoneType' object is not subscriptable

This patch attempts to avoid such exceptions by validating the type of
the property variable before accessing it.
2024-11-18 10:46:53 -06:00
PaddleStroke 076623ef73 Assembly: Store DocumentObject instead of mbdPart for the dragged parts. Fixing the bug where doDragStep was 50% of time failing to find the correct DocumentObject due to bundling. 2024-11-18 10:44:03 -06:00
Jonas Bähr bbd366b5a7 CAM: Fix Helix Defaults in Setup Sheet
With PR #17655 (commit 1027926), the property "Direction" was changed
being an input to an output and the new "Cut Mode" took over (to
implement #14314). Unfortunately, this change was not reflected in the
Setup Sheet (or "Op Defaults" as it's called on the Job panel). This
commit fixes this.
2024-11-18 10:39:24 -06:00
Jonas Bähr 1ef5bd3fc3 CAM: Fix creating Helix on Prototype
For the "Op Defaults" from the setup sheet the operations get created
with a `OpPrototype` instead of a real document object. This prototype
provides only a small subset of FreeCAD's document object API. When a
new Job is created via the GUI, each registered operation is created
with such a dummy to populate the setup sheet panel. And if such an
operation uses document APIs not provided by the prototype, the enire
job creation fails, see #17871.
Unfortunately we don't have tests for the GUI part, where all the
operations are regsitered and thus the integration with all of them
could be verified, this I just created a local test for the helix, where
the actual issue was reported -- this can be verified with headlessly.
2024-11-18 10:39:11 -06:00
Adrián Insaurralde Avalos 83646753e0 Update version to 1.0.0RC4 2024-11-13 22:01:49 -03:00
PaddleStroke bdcf40a17c Assembly: JointObject refactor adaptUi 2024-11-13 12:15:16 -03:00
PaddleStroke 24e5b181b5 Assembly: Improve joint taskbox offset ui. 2024-11-13 12:15:16 -03:00
Adrián Insaurralde Avalos d548f81525 Revert "Assembly: JointObject refactor adaptUi"
This reverts commit 00c992ff34.
2024-11-13 12:15:16 -03:00
Adrian Insaurralde Avalos 3c1047103c Update version to 1.0.0RC3 2024-11-11 18:23:38 -03:00
wwmayer 47d557545e PD: Add test case for #17184 (#17707) 2024-11-11 18:21:43 -03:00
Adrian Insaurralde Avalos 487b206edb Gui: extend version info to specify flatpak and conda builds 2024-11-11 15:30:59 -03:00
Alfredo Monclus 411b6cf4e9 fix(PD): initialization of thread class and fit 2024-11-11 14:19:37 -03:00
Yorik van Havre 70f8141a7d Merge pull request #17655 from jbaehr/cam-fix-rename-cw-ccw-climb-conventional
CAM: Fix CW/CCW to Climb/Conventional rename
2024-11-11 18:03:50 +01:00
marioalexis e4fefd67b0 Fem: Save empty UUID if customizing material from task panel 2024-11-11 13:59:23 -03:00
marioalexis bfe65acf87 Fem: Use quantity spin boxes in material task panel 2024-11-11 13:59:23 -03:00
marioalexis b84e78ac2c Fem: Use new material editor in materials task panels - fixes #16814 2024-11-11 13:59:23 -03:00
marioalexis 6943363280 Material: Propagate changes to MaterialTreeWidget even if UUID does not change 2024-11-11 13:59:23 -03:00
wmayer 9b67ca9c42 Assembly: Handle thrown Base::Exception in ViewProviderAssembly 2024-11-11 13:56:29 -03:00
wmayer 0df319e430 Core: In View3DInventorViewer::getPointOnXYPlaneOfPlacement throw exception
If no intersection point can be found throw a Base::RuntimeError
2024-11-11 13:56:29 -03:00
PaddleStroke 7601857582 Techdraw: Fix assembly exploded view (#17726) 2024-11-11 13:53:52 -03:00
Eric Price 7d28404ad8 Part: bugfix #17468 recursively unpack compounds for boolean fuse (#17469)
* fix #17468  recursively unpack compounds for boolean fuse

* fix and into &&, add ctest case for multifuse with compounds and recursive compounds

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

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

* remove unneeded duplicated code - allow Part::Common to be created with a single object (compound or shape) - will result in Unity and possibly a warning message

* prevent endless loop in case of endless recursive compounds as suggested in chat

* Update src/Mod/Part/App/FeaturePartFuse.cpp

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

* implemented suggestion by wwmayer

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Benjamin Nauck <benjamin@nauck.se>
2024-11-11 13:52:19 -03:00
Florian Foinant-Willig 5ea9a672c3 Fix revolution with ShapeBinder profile (#17489)
* Fix revolution with ShapeBinder profile

* Remove log level init

---------

Co-authored-by: Chris Hennes <chennes@pioneerlibrarysystem.org>
2024-11-11 13:48:35 -03:00
Eric Price 6d68d22258 increase tolerance on helical shapes to avoid crash / broken geometry (#17356)
* increase tolerance on helical shapes to avoid crash

fix #17113
fix #9377
fix #11083

* added test cases for additive and subtractive helix

* fixed whitespace issue, reduced turncount for speed

* relaxed large scale testcases for OCCT 7.3 and below, work around windows CI error #17394

* Further reduce max size in test for buggy Ubuntu OCCT
2024-11-11 13:45:49 -03:00
Eric Price 8362c5af8b Fix boolean operations (#17119)
* add BRepAlgoAPI wrapper files to CMakeList

* introduce wrapper for BRepAlgoAPI_BooleanOperation and derivatives, set sensible default Fuzzyness for boolean operations

* allow default fuzzyness to be set in settings - including off

* backwards compatibility with OCCT 7.3.3 - removed newer paramateres from wrapper

* added missing header

* reverted src/Mod/Part/App/OpenCascadeAll.h to original state

* implement some changes suggested by @wwmayer

* removed unneeded destructor definitions

* moved getDefaultFuzzyValue into its own helper class

* removed unneeded references to base class default constructor

* default to SetRunParallel(Standard_True) as suggested by @FlachyJoe

* fixed license header as requested

* Added new method to autocalculate fuzzyness to BooleanOperation base class and use it for those parts that do not call the obsolete constructor but also do not set precision

* implemented static variable solution as suggested by @wwmayer

* added helix for test case

* Refactoring FCRepAlgoAPI to FCBRepAlgoAPI

* Added Test Case (fuse cylinder with helix with different working and non-working Fuzzy values)

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

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

* increased default value of FuzzyBoolean and made tests more robust for compatibility with OCCT 7.3

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

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

* fixes for FREECAD_USE_PCH - allow testing of FREECAD_USE_PCH on linux with cmake switch (default OFF)

* removed surplus line - wasn't needed after all

* included precompiled as instructed

* set anti-corruption flag in boolean operations, ensures source shape is not damaged in OCCT 7.1 and higher

* fix #17085

* disable subtests that were too specific for now

* fixed all CLI tests - see comments in Pull Request https://github.com/FreeCAD/FreeCAD/pull/17119#issuecomment-2420772452

* Update src/Mod/PartDesign/PartDesignTests/TestTopologicalNamingProblem.py

suggested updated test by CalligaroV

Co-authored-by: Vincenzo Calligaro <vincenzo.calligaro@gmail.com>

* Update tests/src/Mod/Part/App/TopoShapeExpansion.cpp

suggested updated test by CalligaroV

Co-authored-by: Vincenzo Calligaro <vincenzo.calligaro@gmail.com>

* Update tests/src/Mod/Part/App/TopoShapeExpansion.cpp

suggested updated test by CalligaroV

Co-authored-by: Vincenzo Calligaro <vincenzo.calligaro@gmail.com>

* Update tests/src/Mod/Part/App/TopoShapeExpansion.cpp

suggested updated test by CalligaroV

Co-authored-by: Vincenzo Calligaro <vincenzo.calligaro@gmail.com>

* Update tests/src/Mod/Part/App/TopoShapeExpansion.cpp

suggested updated test by CalligaroV

Co-authored-by: Vincenzo Calligaro <vincenzo.calligaro@gmail.com>

* Update tests/src/Mod/Part/App/TopoShapeExpansion.cpp

suggested updated test by CalligaroV

Co-authored-by: Vincenzo Calligaro <vincenzo.calligaro@gmail.com>

* Update tests/src/Mod/Part/App/TopoShapeExpansion.cpp

suggested updated test by CalligaroV

Co-authored-by: Vincenzo Calligaro <vincenzo.calligaro@gmail.com>

* Update tests/src/Mod/Part/App/TopoShapeExpansion.cpp

suggested updated test by CalligaroV

Co-authored-by: Vincenzo Calligaro <vincenzo.calligaro@gmail.com>

* Update tests/src/Mod/Part/App/TopoShapeExpansion.cpp

suggested updated test by CalligaroV

Co-authored-by: Vincenzo Calligaro <vincenzo.calligaro@gmail.com>

* Update tests/src/Mod/Part/App/TopoShapeExpansion.cpp

suggested updated test by CalligaroV

Co-authored-by: Vincenzo Calligaro <vincenzo.calligaro@gmail.com>

* Update tests/src/Mod/Part/App/TopoShapeExpansion.cpp

suggested updated test by CalligaroV

Co-authored-by: Vincenzo Calligaro <vincenzo.calligaro@gmail.com>

* Update tests/src/Mod/Part/App/TopoShapeExpansion.cpp

suggested updated test by CalligaroV

Co-authored-by: Vincenzo Calligaro <vincenzo.calligaro@gmail.com>

* Update tests/src/Mod/Part/App/TopoShapeExpansion.cpp

suggested updated test by CalligaroV

Co-authored-by: Vincenzo Calligaro <vincenzo.calligaro@gmail.com>

* Update tests/src/Mod/Part/App/TopoShapeExpansion.cpp

suggested updated test by CalligaroV

Co-authored-by: Vincenzo Calligaro <vincenzo.calligaro@gmail.com>

* Update tests/src/Mod/Part/App/TopoShapeExpansion.cpp

Co-authored-by: Vincenzo Calligaro <vincenzo.calligaro@gmail.com>

* remove surplus tests from github suggestion interface bug

* hide the BooleanFuzzy variable - can now be only set by manually editing the config file
i
in FCParamGroup "Boolean"
<FCFloat Name="BooleanFuzzy" Value="10.000000000000"/>

* Suggestion by @FlachyJoe - add validity checks to the base and tool shape in any direct boolean op

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Vincenzo Calligaro <vincenzo.calligaro@gmail.com>
2024-11-11 17:36:30 +01:00
paul 51449826a3 ArchWall : Bug Fix Length Property Accuracy Problem (#17496)
* ArchWall : Bug Fix Length Property Accuracy Problem

See https://github.com/FreeCAD/FreeCAD/issues/15794

* [ArchWall] Fix regression with multi-material and align center

* ArchWall - Regression Typo

---------

Co-authored-by: Yorik van Havre <yorik@uncreated.net>
2024-11-11 17:26:55 +01:00
Roy-043 10ccab5227 Draft: Fix Shape2DView finish bug
The Draft_Shape2DView did not finish properly if no object was selected.

Forum topic:
https://forum.freecad.org/viewtopic.php?t=92031
2024-11-11 17:15:52 +01:00
Yorik van Havre 5b00d7f1f2 Translations 2024-11-11 17:09:27 +01:00
Jonas Bähr 1027926be9 CAM: Configure Helix via CutMode, not Direction (#14314)
To harmonize the various CAM operations, the helical drill shall also be
configured using the cut mode (Climb/Conventional) just like Pocket or
FaceMill.
This means, the path direction (CW/CCW) is now a hidden read-only output
property, calculated from the side (Inside/OutSide) and the here newly
introduced cut mode.
The spindle direction is not yet taken into account and is always assumed
to be "Forward".
The GUI strings are kept compatible with what RP#14364 introduced becasue
of the v1.0 release string freeze. They need revision once back on the
main branch.
2024-11-10 23:23:23 +01:00
PaddleStroke 97aef3b3b1 Sketcher: Dimension: Handle case of vertical/horizontal lines 2024-11-09 10:00:08 -06:00
Roy-043 12e15dc739 Draft: Fix _param_observer_callback_scalemultiplier error
Fixes #17741.
2024-11-09 09:27:25 -06:00
marioalexis 9291671fe1 Fem: Fix spelling in Netgen enumeration property 2024-11-09 09:25:36 -06:00
wmayer df971b1014 Material: Replace YAML::LoadFile() with YAML::Load()
YAML::LoadFile() cannot be used on Windows because it doesn't support UTF-16 to load a file from an arbitrary location

This fixes #17097
2024-11-09 09:23:33 -06:00
PaddleStroke cd138ae5d7 Assembly: Fix problem with App::Link to AssemblyObject : they would not go back to position. 2024-11-09 09:20:54 -06:00
PaddleStroke c15e018bb1 Assembly: Fix regressions of https://github.com/FreeCAD/FreeCAD/pull/16671 2024-11-09 09:20:39 -06:00
PaddleStroke 00c992ff34 Assembly: JointObject refactor adaptUi 2024-11-09 09:13:25 -06:00
PaddleStroke 7ab212dced Update CommandExportASMT.py 2024-11-09 09:10:35 -06:00
Jonas Bähr 509fef6877 Revert "CAM: Rename CW/CCW to Climb/Conventional for consistency (#14364)"
This reverts commit 7e62d07538 and adapts
to the in between commits where necessary.
 - CAM: apply precommit 7274dac185
 - CAM: rename "Tests" to "CAMTests" 2ff4914fd8

Motivations for the revert:
 - Instead of actually implementing #14364 only a search and replace in
   the enums values has been performed. But this does not mean the
   feature is there, becasue "climb"/"conventional" milling depends not
   only on the path's direction, but also on the spindle direction and
   whether the milled feature is "inside" or "outside".
 - In half of the cases of every changed operation or dressup, depending
   on whether we mill "inside" or "outside", we now get the wrong results.
 - In the (rarer) case of a reversed spindle direction, the "other half"
   is wrong.
 - Files created with previous versions of FreeCAD cannot be recomputed
   any longer because there were no precautions on document restore.
 - In files created with previous versions of FreeCAD one cannot change
   the broken operation as the choices are now invalid.
 - The original search/replace was incomplete.
 - Only property values have been changed, the property names are still
   inconsistent ("Direction" vs "Cutting Mode").
 - The original search/replace also changed internal APIs where the
   "climb"/"conventional" wording is not applicable as there is no
   notation of "inside"/"outside" or "forward"/"reverse". If only the
   path's direction is concerned, "CW"/"CCW" fits better.
2024-11-08 23:02:44 +01:00
Jonas Bähr 2df29a80f4 CAM: Fix and enable TestPathHelix again
Since the fixture in use has holes smaller than the default tool dimeter,
executing a helix operation with default parameters (i.e. all holes)
used to fail with an exception. Some tests work around this by actively
chaning the tool diameter, and this fix is now moved into the global
setup where the respective fixture is loaded.

The reason why the tests got disabled in the first place is unclear.
2024-11-07 22:31:32 +01:00
Roy-043 9b3329ff9c Draft: avoid race condition in todo code
The doTasks function is called multiple times when using Draft tools. In some cases the ToDo.commitlist belonging to a previous call was not fuly processed, resulting in the same list being processed twice. To avoid this the list is stored as a local variable and then immediately reset.

Forum topic:
https://forum.freecad.org/viewtopic.php?t=91832
2024-11-07 11:13:58 +01:00
Yorik van Havre ac9b2da210 Merge branch 'releases/FreeCAD-1-0' of github.com:FreeCAD/FreeCAD into releases/FreeCAD-1-0 2024-11-07 09:41:44 +01:00
Benjamin Bræstrup Sayoc 53ef8030ca [Gui] Fix 100% CPU usage due to StartView (#17565)
* [Gui] Fix 100% CPU usage due to StartView

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

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

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-11-06 13:50:21 -06:00
marioalexis 5f8ae401d3 Fem: Prevent race condition between signals in timer update 2024-11-06 13:43:12 -06:00
wmayer 41806782e7 Import: Fix index error with legacy STEP export
Fixes #17677
2024-11-06 12:53:54 -06:00
wmayer af993d1f6b Core: Generate a static random number in Application::applicationPid()
Using Qt's QCoreApplication::applicationPid() doesn't always give a unique ID so that multiple FreeCAD instances cannot be executed at the same time.
This fixes #17678
2024-11-06 12:52:48 -06:00
Benjamin Bræstrup Sayoc 52cf32c910 [Gui] Fix 100% CPU usage due to StartView (#17565)
* [Gui] Fix 100% CPU usage due to StartView

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

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

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-11-06 16:11:59 +01:00
Chris Mayo e495f83667 Mod: Remove Doxygen special commands from Python docstrings
These don't work by default in Doxygen [1] and cause Python syntax
warnings.

[1] https://www.doxygen.nl/manual/docblocks.html#pythonblocks
2024-11-05 16:19:03 -06:00
wmayer ddb42b134e PD: Fix default display mode of ViewProviderBoolean
Make sure that by default display mode is set to 'Flat Lines' instead of 'Group' as otherwise it won't show the result object
2024-11-05 15:24:51 -06:00
Eric Price fd64529bfe FEM: Allow assigning materials to compounds to avoid having to assign the same material by hand to all subsolids (#17562)
* fix #17561

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

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

* added missing code to have it also work without MeshRegions

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-11-05 10:15:38 -06:00
Jarno de Wit 7293718606 Fix excessive selection pruning in dae exporter for PartDesign Objects (#17529) (#17654)
* Fixes excessive export selection pruning for PartDesign objects (#17529)

* Raises selection prune message log-level from Log to Warning (#17529)
2024-11-05 14:44:51 +01:00
mwganson df18d88d96 [Sketcher] Address issue #17629, where Attach sketch command allows sketch to be attached to itself 2024-11-05 14:41:34 +01:00
Yorik van Havre 3b7bae0323 BIM: Fixed imports of IfcOpenShell 0.8 - fixes #17628 2024-11-05 14:28:41 +01:00
Chris Mayo 66a2163104 BIM: Fix imports of Python importers 2024-11-05 13:00:02 +01:00
Jonas Bähr 96fa7efee5 CAM: Add tests loading a helical path created with v0.21
This demonstrates a regression introduced with PR #14364, where documents
containing helix operations cannot be recomputed any more (see #15643).
This is in preparation for a fix and to ensure we don't break it again.
The fixture has been created with the official mac build of FreeCAD-0.21.1
2024-11-04 22:54:09 +01:00
marioalexis 81a28b5402 Fem: Print real-time log messages in mesher task panels - fixes #17594 2024-11-04 12:34:17 -06:00
PaddleStroke f5fa6f80b3 Assembly: Fix reverse button in joint task (#17663) 2024-11-04 11:23:33 -06:00
PaddleStroke 2958940463 Update JointObject.py 2024-11-04 11:18:30 -06:00
wmayer 644f0bf48b PD: If needed open another transaction for sketch creation
When creating a sketch in PartDesign a dialog is opened that gives the user the possibility to perform another action that may close the
active transaction. To make sure the creation of the sketch can be undone a new transaction must be opened.
2024-11-04 11:14:36 -06:00
wmayer f2bf2a4bcc Core: Fixes #17553 2024-11-04 11:14:36 -06:00
wmayer 8e3b8e3172 Tests: Add unit test to demonstrate failure of #17553 2024-11-04 11:14:36 -06:00
wmayer c7f40bc111 Core: Write a log message instead of warning when locking a file fails 2024-11-04 11:09:06 -06:00
wmayer 9daf71417a Core: Add wrapper function Application::applicationPid() 2024-11-04 11:09:06 -06:00
wmayer 94adf177ee Core: Don't freeze application if lock file already exists 2024-11-04 11:09:05 -06:00
PaddleStroke eff8826ca7 Assembly: Joint creation: add expression support to spinboxes 2024-11-04 11:07:25 -06:00
mwganson 6cd80f52f3 [Part Booleans] fix issue with copying visuals when doing Part workbench booleans using App::Part objects, see https://forum.freecad.org/viewtopic.php?t=91813&sid=eea2494d6d02882c3be7df74d7e2b689 2024-11-04 11:02:44 -06:00
WandererFan e1948f79d4 [TD]handle short&wide hatch area (#17630)
* [TD]handle short&wide hatch area

* [TD]sync .h and .cpp parameter names
2024-11-04 11:01:42 -06:00
James e57599c3f0 Safe mode message added as per #17580 (#17640)
* Safe mode message added as per #17580

* Fixed extra whitespace after return

Removed extra whitespace after return spotted by @hyarion

* Incorporated comments by @hyarion
2024-11-04 11:00:38 -06:00
Bas Ruigrok 4b5e09043d Gui: Fix camera behavior when rotation center is far from object
Also fixes a regression in turntable navigation speed
2024-11-04 10:59:31 -06:00
wmayer 7a48443897 DAG: Add method hasRecord() and use it in Model::slotChangeObject
to avoid a possible failing assert().

Fixes #17572
2024-11-04 10:57:09 -06:00
Benjamin Nauck a3f8ec0fd4 macOS+win+qt6.4+: Hide classic and auto choose light or dark mode depending on os setting (#17410)
* mac, win, qt6.4+: Hide classic and auto choose light or dark mode

* Add dark mode qt6.5 check

* Start: Add QStyleHints to PreCompiled.h

---------

Co-authored-by: Chris Hennes <chennes@pioneerlibrarysystem.org>
2024-11-04 10:55:56 -06:00
David Carter 364ae2ca12 Materials: Disable editor right click menu
The right click context menu in the materials editor was implemented
as a place holder but is currently non-functional. It should be
disabled for 1.0. This will be revisited post 1.0 as all editor
functionality is reviewed and improved.

Fixes #17110
2024-11-04 10:51:11 -06:00
wmayer 7082b086a5 Mat: Clean-up code in DlgDisplayPropertiesImp 2024-11-04 10:44:17 -06:00
wmayer 279e39bd2b Mat: Tmp. block signals of material widget
Fixes #17523
2024-11-04 10:44:17 -06:00
Adrian Insaurralde Avalos 4ebf28b6a4 CAM: rename "Tests" to "CAMTests" to avoid python name conflicts 2024-11-04 10:36:32 -06:00
Yorik van Havre 1d11f0b9e7 BIM: Fixed case bug in library tool 2024-11-04 14:48:52 +01:00
Chris Mayo 62ff8820dd BIM: IFC explorer Qt 6 compatibility and other fixes (#17649)
* BIM: IFC - Fixes for Qt 6 due to QtGui.QFont.setWeight()

PySide6 replaced:
  PySide6.QtGui.QFont.setWeight(int)

with:
  PySide6.QtGui.QFont.setWeight(PySide6.QtGui.QFont.Weight)

* BIM: Fix IFC explorer addEntity() and addProperties() on Qt 6

Qt 6 removed QTreeWidget.setFirstItemColumnSpanned()

https://doc.qt.io/qt-5/qtreewidget-obsolete.html#setFirstItemColumnSpanned

Running the Python command 'BIM_IfcExplorer' failed:
Traceback (most recent call last):
  File "/usr/lib64/freecad/Mod/BIM/bimcommands/BimIfcExplorer.py", line 170, in Activated
    self.open()
  File "/usr/lib64/freecad/Mod/BIM/bimcommands/BimIfcExplorer.py", line 223, in open
    self.addEntity(eid, children, self.tree)
  File "/usr/lib64/freecad/Mod/BIM/bimcommands/BimIfcExplorer.py", line 455, in addEntity
    self.tree.setFirstItemColumnSpanned(item, True)

* BIM: Fix IFC explorer exception on toggle mesh

Traceback (most recent call last):
  File "/usr/lib64/freecad/Mod/BIM/bimcommands/BimIfcExplorer.py", line 278, in toggleMesh
    import importIFCHelper
ModuleNotFoundError: No module named 'importIFCHelper'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib64/freecad/Mod/BIM/bimcommands/BimIfcExplorer.py", line 282, in toggleMesh
    import importIFC
ModuleNotFoundError: No module named 'importIFC'

* BIM: Fix IFC explorer layout warnings

QLayout: Attempting to add QLayout "" to QDialog "IfcExplorer", which already has a layout
QLayout: Attempting to add QLayout "" to QDialog "IfcExplorer", which already has a layout

https://doc.qt.io/qt-6/qtwidgets-tutorials-widgets-nestedlayouts-example.html

* BIM: Output an error if IFC explorer can't explore a file

---------

Co-authored-by: Roy-043 <info@b-k-g.nl>
2024-11-04 14:02:44 +01:00
PaddleStroke 4bee4ca3dd Sketcher: DrawSketchHandlerRotate : Fix unwanted copy of DistanceX/Y constraints 2024-10-31 15:30:28 -05:00
PaddleStroke 17a7ddee2f Formating PythonConverter.cpp 2024-10-31 15:30:18 -05:00
PaddleStroke 52903e281c Sketcher: PythonConverter: use getRange to handle bad arcs. 2024-10-31 15:30:10 -05:00
marioalexis 9cfec546cc Fem: fix Gmsh analysis mesh groups - fixes #17427 2024-10-31 15:29:14 -05:00
wmayer e4a24f0789 Core: Fix compiler warning 2024-10-30 18:14:36 -05:00
wmayer b67d2d0881 Fix compiler warnings 2024-10-30 18:14:36 -05:00
Eric Price 29f2dbdebf fix #17578 - RIP bgbsww , don't worry, we got this. 2024-10-30 18:12:51 -05:00
Ulices 6945472e36 Help: Fix function return to avoid error when clicking URL on built-in browser (#17498)
* Help: Fix function return to avoid error when clicking URL on built-in browser

* fixup! Help: Fix function return to avoid error when clicking URL on built-in browser

Co-authored-by: Yorik van Havre <yorik.vanhavre@gmail.com>

---------

Co-authored-by: Yorik van Havre <yorik.vanhavre@gmail.com>
2024-10-30 12:52:13 +01:00
PaddleStroke ee60379138 Core: Enable TaskDialogs to associate view (#17373)
* Core: Add possibility for task dialogs to associate a view and be able to close when associated view is closed.

* TaskImage: Use task dialog view association.

* Sketcher: Use task dialog view association. Preventing crash (https://github.com/FreeCAD/FreeCAD/issues/16702)

* EditableDatumLabel: Use QPointer to prevent crash
2024-10-29 10:01:41 -05:00
hoshengwei 42832ee6af Fix IFC export elevation with wrong unit 2024-10-29 15:14:39 +01:00
David Carter ec2f666344 Materials: Selectively apply appearances
Change the appearance only if the appearance hasn't been set explicitly.
A cached material appearance is used to see if the current appearance
matches the last material. It is also compared against an empty
material to see if the saved material value has been initialized.

This solves the problem of material changes overwriting appearance
changes
2024-10-28 21:49:55 -05:00
Adrian Insaurralde Avalos 065029b6a0 Gui: show cpu architecture in version info instead of word size
Fix #15833
2024-10-28 21:48:43 -05:00
Benjamin Nauck 6fea3dc5f4 Fix crashes when importing and opening .csv files on macOS (#17084)
* Open recent documents from start same way as in menu

* Make insert spreadsheet create document if not available.

* [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>
Co-authored-by: Chris Hennes <chennes@pioneerlibrarysystem.org>
# Conflicts:
#	src/Mod/Start/Gui/StartView.cpp
2024-10-28 21:46:55 -05:00
Bas Ruigrok 52982c0c67 Gui: Correct spin sensitivity 2024-10-28 12:08:09 -05:00
Bas Ruigrok f313de1ce3 Gui: Set spin projector sphere depending on rotation center 2024-10-28 12:08:08 -05:00
Adrian Insaurralde Avalos 82204a7b06 Gui: use wildcard for some warnings filters. Fix #16687 2024-10-28 11:39:29 -05:00
Adrian Insaurralde Avalos a435a81c8a Fix OpenSCAD test failing when using pipe transfer mechanism 2024-10-28 11:34:36 -05:00
Pieter Hijma edbfbe40f5 Gui: Make VarSet dialog modal
Also tracks its own transactions to prevent interfering with other
transactions.
2024-10-28 11:33:25 -05:00
wmayer 231d734b7c Draft: Fixes #17461 2024-10-28 11:31:41 -05:00
wmayer 216b130761 Core: Extend DocumentObjectPy
* expose isAttachedToDocument to Python
* change DocumentObjectPy::getName() to return None instead of throwing an exception if object is not part of a document
2024-10-28 11:31:41 -05:00
wmayer c6a6e9d4b0 Sketch: Make sure that variable 'ActiveSketch' is defined in macro
Fixes #17502
2024-10-28 11:24:00 -05:00
Yorik van Havre dc230a8ce0 Draft: Warn user if using trimex on unsupported curve type - fixes #17346 2024-10-28 11:12:17 -05:00
marioalexis 57a6c5aed7 Fem: Remove unnecessary system name check 2024-10-28 11:11:18 -05:00
mwganson 69e40ba5c7 [Macros Dialog] Fix broken toolbar walkthrough 2024-10-28 11:10:26 -05:00
PaddleStroke c0db00e5cd Assembly: AssemblyLinks. 2024-10-28 11:07:47 -05:00
PaddleStroke 69df04e6a6 Assembly: Create SoSwitchMarker.py to externalize the coin stuff that draw the joint's markers(JCS) 2024-10-28 11:07:47 -05:00
PaddleStroke eb352fe34f Assembly: Joint creation UI : add advanced offset handling. 2024-10-28 11:07:46 -05:00
Yorik van Havre e3aa8ef9b8 BIM: Fixed export of boolean IFC properties - fixes #17425 2024-10-28 10:58:45 -05:00
Yorik van Havre 6029b79885 Draft: Fixed trimex bug when snapping to itself - fixes #17345 2024-10-28 10:58:07 -05:00
Yorik van Havre 1c6e5b9664 BIM: Fixed online search mode - fixes #17353 2024-10-28 10:51:46 -05:00
Benjamin Bræstrup Sayoc cd99adc094 [Gui] Make styles update on paint (#17376)
* [Gui] Make styles update on paint

Fixes #15756. Similar implementation to that already in FileCardDelegate.cpp

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

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

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-10-28 10:48:58 -05:00
Benjamin Nauck 734b327ef0 Reuse Std_Delete shortcut instead of hardcoding Delete (#16682)
* Reuse Std_Delete shortcut in TaskBooleanParameters

* Reuse Std_Delete shortcut in TaskDressUpParameters

* Reuse Std_Delete shortcut in TaskLoftParameters

* Reuse Std_Delete shortcut in TaskPipeParameters

* Reuse Std_Delete shortcut in TaskSapeBinder

* Reuse Std_Delete shortcut in TaskTransformedParameters

* Reuse Std_Delete shortcut in TaskExtrudeParameters

* Reuse Std_Delete shortcut in TaskSections

* Reuse Std_Delete shortcut in MaterialSave

* Reuse Std_Delete shortcut in Array2D

* Reuse Std_Delete shortcut in TaskFemConstraint

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

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

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-10-28 09:51:52 -05:00
wandererfan 471fce1f50 [TD]remove spurious mouseReleaseEvent (fix #17519) 2024-10-28 09:47:53 -05:00
wandererfan 5e8e6568e9 [TD]fix line style regression from #17331 2024-10-28 09:47:28 -05:00
wandererfan e0f6298d5d [TD]handle cut profiles with only a single edge 2024-10-28 09:46:54 -05:00
wandererfan 9fcb04c0b3 [TD]do not mark document as changed after print 2024-10-28 09:46:23 -05:00
wmayer 146f5055d7 Core: Refactor Document::setEdit 2024-10-27 13:13:38 -05:00
Benjamin Nauck 2d14dcec7d Repost QFileOpenEvent event to avoid an undefined state 2024-10-25 12:25:31 -05:00
marioalexis fe8f0acbef Fem: Do not try to set EndStep property for legacy Netgen 2024-10-25 12:11:28 -05:00
PaddleStroke c6e0f838ba Fix circle tangent issue 2024-10-25 10:03:59 -05:00
mwganson cd74b7b5ea [Part RuledSurface] fix issue where ruled surface is failing if both edges are from same object and the object is not at the identity placement, addresses issue #17235 2024-10-25 09:59:25 -05:00
wmayer 9854b2a3c8 Core: Handle possible nested calls of TreeWidget::onUpdateStatus()
Fixes #17460
2024-10-24 23:11:53 -05:00
PaddleStroke a76027ce91 Assembly: CommandInsertLink: Hide hidden objects 2024-10-24 23:08:05 -05:00
Pieter Hijma 72316d0f96 Gui: Fix tooltip/documentation in VarSet dialog 2024-10-24 23:01:24 -05:00
PaddleStroke e9b9c788d2 Sketcher: Symmetric: Do not copy names of constraints (#17433)
* Sketcher: Symmetric: Do not copy names of constraints

* Sketcher: Symmetric : Fix https://github.com/FreeCAD/FreeCAD/issues/17442
2024-10-24 22:59:15 -05:00
Jiří Pinkava 2cfa89fb56 Disable Qt bug 129596 workeround for QT >= 6.8.1
The fix is also in 6.5.8+, but honestly I would not bother ...
2024-10-24 22:30:54 -05:00
Kacper Donat d046d4848b PD: Fix TwoLengths and Midplane both enabled
This scenario makes no sense, so it is removed from the code.
2024-10-24 22:29:54 -05:00
wmayer d7bcba730c Test: Add test for MeasureDistance with two circles 2024-10-24 21:56:22 -05:00
wmayer 8c1c24656a Measure: When measuring the distance between circles then use the center points as reference
See forum: https://forum.freecad.org/viewtopic.php?t=91570
2024-10-24 21:56:22 -05:00
PaddleStroke 4432d6dc16 Update Workbench.cpp 2024-10-24 21:54:02 -05:00
PaddleStroke 8780c645b7 Part Design: Remove legacy/modern workflow checks. 2024-10-24 21:54:02 -05:00
Michael Fuchs ff3729614e Remove unused LibraryInfo class 2024-10-24 21:51:37 -05:00
Michael Fuchs be3307d198 Inject version information into 3rd Party libraries html 2024-10-24 21:51:37 -05:00
Michael Fuchs e2956efcb1 Replace About/Libraries with ThirdPartyLibraries.html
Use system browser to open external links
2024-10-24 21:51:37 -05:00
mwganson 515b9b0ef9 [Python Console] prevent crash on autocomplete if python module is invalid, fixes issue #17299 2024-10-24 21:23:47 -05:00
Roy-043 c3565499f2 Updated 2 file paths to make the code work with AppImage
As advised in this forum post:
https://forum.freecad.org/viewtopic.php?p=788556#p788556
2024-10-24 14:09:41 +02:00
Roy-043 41b5df3883 Draft: fix errors in draft_test_objects.py
* Label property TextSize should be FontSize.
* Added missing recomputes.
2024-10-24 14:09:26 +02:00
wmayer e3bf086e49 Start: Use ModuleIO in StartView::fileCardSelected 2024-10-22 22:50:44 -05:00
wmayer 25bfdc92c8 Core: Use ModuleIO in MainWindow::loadUrls 2024-10-22 22:41:38 -05:00
wmayer 6df7231cfb Core: Use ModuleIO in RecentFilesAction & RecentMacrosAction 2024-10-22 22:41:35 -05:00
marioalexis 5b68566b5b Fem: Netgen meshing parameters improvements 2024-10-22 22:41:01 -05:00
pre-commit-ci[bot] 71734d87ac [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2024-10-22 22:39:37 -05:00
wmayer 569c2f9538 Measure: Use Base::toDegrees to convert radian to degree 2024-10-22 22:39:28 -05:00
wmayer 969b0dad8d Robot: Use Base::toRadians to convert degree to radian 2024-10-22 22:39:17 -05:00
wmayer 4b9d03772f Part: Use Base::toRadians to convert degree to radian 2024-10-22 22:38:00 -05:00
Yorik van Havre 0101b5dfc7 Revert "Horrible hack to work around bug in OCCT7.7.2"
This reverts commit 60640fa441.
2024-10-22 13:28:17 +02:00
Chris Mayo 3ea129fa0b Tux: Avoid warning on startup when BIM is not installed
os.listdir() raises an exception if modpath does not exist.
2024-10-22 11:02:54 +02:00
Roy-043 c4854b8cba Draft: suppress patharray offset warnings if values are already zero
See forum topic:
https://forum.freecad.org/viewtopic.php?t=91517
2024-10-22 10:52:30 +02:00
Benjamin Nauck e6f97126d3 Remove broken robot example file
fixes #17303
2024-10-21 21:03:11 -05:00
marioalexis 1f27df4e9c Fem: Set startupinfo for gmsh subprocess - fixes #17298 2024-10-21 21:00:29 -05:00
Adrián Insaurralde Avalos 597d417564 Gui: extend warning filters
filter out:
-qt.qpa.wayland
-kf.config.core
-kf.kio.widgets
-kf.service.sycoca
-kf.solid.backends.udisks2
2024-10-21 11:33:35 -05:00
PaddleStroke ab7987a149 Core: Fix Ctrl-deselection issue 2024-10-21 11:31:16 -05:00
David Carter c9f0b81855 Materials: Child ignoring parent material
Inherit the material from the parent object when creating a new object,
such as during a boolean operation, or when extruding a sketch.

fixes #15503
2024-10-21 11:20:30 -05:00
wmayer 109f481a6d Core: Set unit scheme when switching between unsaved documents
Fixes #17297
2024-10-21 11:17:37 -05:00
Chris Mayo ddfdb2ee10 CMake: Add inter-module dependency of ReverseEngineering on Points
Building with -DBUILD_POINTS=no -DBUILD_REVERSEENGINEERING=yes fails with:

src/Mod/ReverseEngineering/App/AppReverseEngineering.cpp
src/Mod/ReverseEngineering/App/AppReverseEngineering.cpp:36:10: fatal error: Mod/Points/App/PointsPy.h: No such file or directory
   36 | #include <Mod/Points/App/PointsPy.h>
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
2024-10-21 11:13:29 -05:00
wmayer d59160b2ce PD: Explicitly switch off AllowCompound for some tests to make them succeed
Fixes #17363
2024-10-21 11:12:50 -05:00
Chris Mayo 4014ae1dc9 CMake: Add inter-module dependency of Part on Material
Building with -DBUILD_PART=ON and -DBUILD_MATERIAL=no fails with:

/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../x86_64-pc-linux-gnu/bin/ld: cannot find -lMaterials: No such file or directory
collect2: error: ld returned 1 exit status
2024-10-21 11:12:07 -05:00
Michael Fuchs bad2d2a37a Switch back to default filename for exports after the active document changes. Fixes #16839 2024-10-21 11:10:51 -05:00
Benjamin Nauck 5f303edf30 Add "Safe mode" which temporarily disables configs and addons (#16858)
* Add safe-mode which starts freecad in a clean environment

* Integrate safe-mode

* Show "(Safe Mode)" in main window title

* Show safe mode info when safe mode is started

* Created Safe Mode Icon

* Use new icon

* Add PreCompiled.h

* Add exports for windows

---------

Co-authored-by: Gabriel <gaz082@gmail.com>
2024-10-21 11:09:03 -05:00
Eric Price 4322c16e0f disable tesselation limit in ViewProviderGUI to prevent large parts from freezing FreeCAD 2024-10-21 10:59:03 -05:00
wandererfan 718c2746ae [TD]Fix leader line style (fix #17307) 2024-10-21 10:58:03 -05:00
PaddleStroke 16277b2f8d Fix datum not being cancelled 2024-10-21 10:56:58 -05:00
Yorik van Havre a338d8f544 BIM: Better objects filtering when IFC locking/unlocking - fixes #17193 (#17285) 2024-10-21 10:55:24 -05:00
wmayer c3e3d2ec99 Part/PD: Fix cone creation if both radii are equal
The cone features in Part and PartDesign automatically create a cylinder if top and bottom radius are identical. However, the algorithm
ignores the angle and always creates a full cylinder.
2024-10-21 10:53:36 -05:00
marioalexis 96e65ac0f6 Fem: Set converted property value after property type change 2024-10-21 10:43:27 -05:00
Jiří Pinkava 7a342d11fb Sketch: refactor GeoHistory 2024-10-21 10:42:03 -05:00
wmayer 4c71f47f9b Core: Add convenience class ModuleIO to open files 2024-10-21 10:40:18 -05:00
mwganson c3ecbcef21 [PartDesign DuplicateSelected] do not put duplicated feature into active body if it is already in another body -- addresses issue #6278 2024-10-21 10:37:26 -05:00
Adrian Insaurralde Avalos 7094af67f5 Gui: try calling graphviz binaries from PATH by default [fix #15224] 2024-10-21 10:33:04 -05:00
Florian Foinant-Willig 24bbd0769e Fix uptoshape crash when selecting a face without assigned shape 2024-10-17 20:26:27 -05:00
PaddleStroke 48beaa066e Assembly: Fix limits disappearing on edit (#17289) 2024-10-17 20:23:42 -05:00
Yorik van Havre b4cee0cd18 GUI: Added dedication to @bgbsww in about dialog/credits 2024-10-17 20:17:57 -05:00
Pieter Hijma d7a3517296 Core: Fix VarSet add property dialog Esc segfault (#17215)
* Core: Fix VarSet add property dialog Esc segfault

* Core: Improve the way disconnect is handled

* Core: Add a check for a non-existing property
2024-10-17 20:15:04 -05:00
PaddleStroke 8dd04d5fb3 Fix regressions of #16726 2024-10-17 20:13:47 -05:00
Roy-043 79e0e72aca Draft: Improve layer drag-drop fix.
The fix in #16212 only checks the LayerContainer for layers. Since we do not stop users from moving layers out of that container, we should search the whole document instead.

Fixes: #16201.
2024-10-17 12:30:42 +02:00
Roy-043 acb18c2745 BIM: Fix BIM_Leader callback bug
Probably due to changes in gui_lines `self.call` was no longer ended.

Fixes: #17283.

Forum topic:
https://forum.freecad.org/viewtopic.php?t=91413
2024-10-17 12:14:20 +02:00
Kris Wilk 64d8ab5e55 Use Qt built-in to determine the system's preferred fixed-width font 2024-10-16 08:50:15 -05:00
marioalexis 42d0dfa121 Fem: Do not use main window widget from another thread - fixes #17255 2024-10-16 08:32:06 -05:00
wmayer af4a7800ce Sketch: Fix creating the shape of a sketch
SketchObject::buildShape() used the geometries as they were created by the user. However, they are not accurate enough in order
to create a closed wire. Instead the geometries after running the solver must be used because they are guaranteed to be accurate.
2024-10-15 23:22:43 -05:00
ronak a50ee5ee6a final returned at line 461 2024-10-15 08:48:08 -05:00
Syres916 b093191da5 [TechDraw] Fix error for some compilers 2024-10-15 08:45:18 -05:00
wmayer 7a58bbf6b4 Start: Fix build failure with enabled PCH 2024-10-15 08:44:19 -05:00
Adrián Insaurralde Avalos 868a0f174b Bim remove py2 compatibility code (#17229)
* BIM: remove py2 compatibility code

* remove unused six from conda environments
2024-10-14 11:25:23 -05:00
Yorik van Havre ef667e8409 BIM: Fixed adding missing windows when converting to IFC - Fixes issue #16631 2024-10-14 11:23:14 -05:00
Benjamin Bræstrup Sayoc b16bd50f73 [Gui] Fix isBad asserts, by removing old monkey patch
Multiple places in code, asserts for bad types would trigger SIGABRT. This is not just limited to #16316 with SoZoomTranslation, but multiple more places, not described in issue, but I experienced myself. Fixes #16316
2024-10-14 11:16:33 -05:00
wmayer 227588350d Core: Directly store text changes made in text object
Store changes made in TextDocumentEditorView immediately to TextDocument. This fixes the issue reported in
https://forum.freecad.org/viewtopic.php?p=786175#p786175
2024-10-14 11:04:57 -05:00
pre-commit-ci[bot] 9a377c6e98 [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2024-10-14 17:55:51 +02:00
Yorik van Havre 4bf0553ea7 crowdin translations 2024-10-14 17:55:51 +02:00
wmayer bcab31e047 PD: Disable PartDesign_CompDatums & PartDesign_CompSketches if dialog is open
A group command is not disabled if its default command is disabled. This allows it to invoke the command when it should be impossible.
To fix the problem override the isActive() method in the sub-classes CmdPartDesignCompDatums & CmdPartDesignCompSketches

This fixes #16294
2024-10-14 10:55:21 -05:00
hlorus 2018b7b5ed MeasureGui: Revert temporary measure object creation (#17109)
* MeasureGui: Revert temporary measure object creation

Reverts the temporary creation of measurement objects that was added in #15122

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

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

* MeasureGui: Adress review comments

- Remove _mDocument and _mGuiDocument
- Replace c-style casts with dynamic_cast
- Add file guard
- Remove leftover canAnnotate method

* MeasureGui: Fix crash when selecting elements from different documents

* MeasureGui: Add additional type check in ensureGroup

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

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

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-10-14 10:54:23 -05:00
H. Tsubota 69ae9b2c46 Change to enclose field values ​​with quotation character in exported CSV file if they contain delimiters in Spreadsheet workbench (#17140)
* Change to enclose field values ​​with quotation character in exported CSV file if they contain delimiters

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

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

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-10-14 10:52:48 -05:00
Furgo c8b53bdba6 Properly scale link overlays 2024-10-14 10:50:48 -05:00
WandererFan 010c3c9f4b [TD]Fix bad circles (fix #16980) (#17182)
* [TD]fix spurious messages in GeometryMatcher

* [TD]fix closed circle test (fix #16980)
2024-10-14 10:47:13 -05:00
wandererfan 3042d8d951 [TD]throttle over aggressive dimension autocorrect 2024-10-14 10:46:02 -05:00
Jiří Pinkava c9450422d6 Gui: add Qt Platform name to splashscreen information dump
There is several bugs in FreeCAD which are related to platform (mostly wayland),
the hope is this will make it easier to identify the dependence of bug on the platform
2024-10-14 10:45:02 -05:00
Furgo 9516391ed3 Assembly: make "Solve failed" error more verbose (#17117)
* Add FC_ERR macro for the 'Solve failed' Assembly error

* Handle standard exceptions during assembly solve

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

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

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-10-14 10:43:27 -05:00
Yorik van Havre d82c2d6d61 BIM: Fixed missing object creation in IFC document conversion (#17093)
* BIM: Fixed missing object creation in IFC document conversion - fixes #17031

* BIM: fixed deleting of non-existing objects - fixes #17032
2024-10-14 10:37:43 -05:00
Florian Foinant-Willig ebe2777d68 Disable closed Loft for less than 3 profiles 2024-10-14 10:36:08 -05:00
Jiří Pinkava 1d7b05c607 Gui: Workaround for crash on close of MDI window
The Qt6 (up to Qt 6.7.3 now) contains bug, which can lead, under
specific circumstances, to crash of the application, when the
MDI window is closed. The circumstances are:

* at least 2 MDI windows needs to be open
* stylesheet muset set different size (border, margin) for activated and un-activated tabBar tab
* the closed window must be inactive, but created before the window now active and open
* race condition must occur betwee the closing and resize event handlers for the tabBar
  (see qt bug for details)

So this bug only occures with Qt6 with the Dark or Light styles selected (no classic) and only if
specific sequence of steps is followed during opening and closing the MDI windows.

The bug is in Qt code path executed when QMdiArea::ActivationHistoryOrder is set.

The other possible workaround might be to change all the affected stylesheets, but this seems to me
impractical and also fragile, because the affected code path will be still active.

https://bugreports.qt.io/browse/QTBUG-129596
2024-10-14 10:33:21 -05:00
Shai Seger 9365e358dd Fix shader compilation error on linux. (#17236) 2024-10-14 09:58:48 -05:00
wmayer 9dba811236 Part: Fix XML output of PropertyGeometryList::Save
Write all XML attributes of the Geometry element into a single line.

Currently the XML output looks:
                        <Geometry type="Part::GeomLineSegment"
 id="-1" migrated="1">

With the fix it will be:
                        <Geometry type="Part::GeomLineSegment" id="-1" migrated="1">
2024-10-14 09:08:07 -05:00
marioalexis 131ce95ee6 Fem: Use default height for mesh task panel quantity spin boxes 2024-10-14 09:02:03 -05:00
PaddleStroke 3d665fab34 AssemblyObject.cpp : add failsafe checks 2024-10-14 08:58:59 -05:00
marioalexis a31cde78d9 Fem: Fix examples affected by Part workbench preference parameter 2024-10-14 08:52:08 -05:00
marioalexis84 84c3457a28 Fem: Remove highlighted nodes if ccx finish without error - fixes #14855 (#17203) 2024-10-14 08:51:03 -05:00
Benjamin Bræstrup Sayoc c4e71656db [Gui] TextEdit, zoom on Ctrl + wheel
Fixes #13861
2024-10-14 08:31:45 -05:00
PaddleStroke de1b1dca21 Assembly: Fix context menu 'Activate object' not working and causing crash (#17092)
* Assembly: Add setupContextMenu to ViewProviderAssembly.h

* Assembly: Fix right click 'activate object' menu not setting edit

* add QMenu header

* Add NOLINT

* Add one more space before //NOLINT or clang cries...

* Fix isInEditMode

* add isInEditMode to ViewProviderAssemblyPy.xml

* add isInEditMode to ViewProviderAssemblyPyImp.cpp

* update activeAssembly() in Utils to make sure isInEditMode
2024-10-14 08:30:09 -05:00
PaddleStroke 3fe73e5ba4 Assembly: Remove JointObject camera callbacks. And fix lock highlight. 2024-10-14 08:27:52 -05:00
Roy-043 1dbeb9d143 Draft: Fix upgrade function: delete argument was ignored in case of draftify
Forum topic:
https://forum.freecad.org/viewtopic.php?t=91357
2024-10-14 08:19:22 -05:00
MisterMakerNL 1b50abbafe fixing the checked toolbutton issue in Qsint
https://github.com/FreeCAD/FreeCAD/issues/17230
2024-10-14 08:14:40 -05:00
wmayer 7c842eea13 PD: Fix crash when clicking on invalid edge in task panel
Fixes #10843
2024-10-13 13:34:31 -05:00
Pieter Hijma f5c138884b Gui: Fix showing multiple dialogs VarSet add prop 2024-10-11 08:55:50 -05:00
PaddleStroke bc5b0bb610 Assembly: Joint: add support to non ascii characters. 2024-10-10 20:37:09 -05:00
wmayer dcd048e00a Core: Check returned pointer of convertSWIGPointerObj 2024-10-10 20:36:22 -05:00
marioalexis 5f3e4ceb4d Fem: Remove reduntant info from geometry selector widget title 2024-10-10 20:34:29 -05:00
PaddleStroke fdca32a577 Assembly: Fix gear/belt switch on checkbox toggle 2024-10-10 20:26:35 -05:00
Syres916 dab0cb1ba9 [Gui] Disable the ability to change themes and preference packs... 2024-10-10 20:25:46 -05:00
marioalexis 5cd2862aab Fem: Fix gap in constraint fixed symbol 2024-10-10 20:23:24 -05:00
Adrian Insaurralde Avalos 6c64197cdb CI: update lint action for ubuntu 24.04 2024-10-10 12:26:11 -03:00
Roy-043 0e1bc2b716 BIM: Remove calls to end_all_events to avoid Linux crash
Fixes #15723.
2024-10-10 13:47:32 +02:00
Paul Lee c30d087385 [Arch] Bug: ArchRemove Creates Cyclic Dependency and TNP
FreeCAD Discussion Forum -
https://forum.freecad.org/viewtopic.php?t=91180&start=30#p786308
2024-10-10 10:06:46 +02:00
PaddleStroke c02ad52bfd Sketcher: Fix double click of wire and remove selection that was not working 2024-10-08 10:53:27 -05:00
PaddleStroke 259d21c565 Core: Fix #7580 (#17013)
Fixes several undo/redo issues with the attachment dialog
2024-10-08 09:05:49 -05:00
PaddleStroke bf804beb21 Assembly: Fix migrationScript2 error with bad joints (#17010)
* Fix migrationScript2 to handle bad joints
2024-10-07 18:49:01 -05:00
Bas Ruigrok e3af254dd6 Gui: Fix Touchpad navigation style panning in edit mode 2024-10-07 12:41:02 -05:00
marioalexis ac8d084924 Fem: Add option to use old Netgen mesher implementation 2024-10-07 11:11:25 -05:00
mwganson 3ad9565f56 [Part Workbench] Fix issue with Sketcher_NewSketch icon moving on changing back to workbench 2024-10-07 10:53:03 -05:00
Furgo 0e1e7dcf03 Create the assembly object inside the list of commands 2024-10-07 10:50:20 -05:00
mwganson 6e5375002f [Step Import] fix issue with non-latin characters in import path 2024-10-07 10:43:26 -05:00
marcuspollio 4d9685ae0d Start: little layout tweak to First Start Region 2024-10-07 10:41:58 -05:00
wmayer 3d97955f7d TD: Fix compiler warnings
This fixes the compiler warning: unused parameter 'mode' [-Wunused-parameter]

It's a regression of #16889 to not initialize the class member m_createMode any more that causes UB,
i.e. whenever m_createMode is accessed it may return an unexpected value.
2024-10-07 10:40:47 -05:00
Florian Foinant-Willig 69823f7abc [PD] Fix subtractive primitive placement 2024-10-07 10:39:48 -05:00
Florian Foinant-Willig 22a8ffdbe4 [PD] fix change primitive AttachmentOffset move the body 2024-10-07 10:39:48 -05:00
Unl0gic ad9e6231f9 Update SurfaceSupport.py
- Fixed mapping v_bit to ConeCutter
2024-10-07 10:35:14 -05:00
wandererfan 32c664bdaa [TD]fix parallel edge test (fix #16851)
- missing normalization before test
2024-10-07 10:34:28 -05:00
Benjamin Bræstrup Sayoc 664805fa4d [Sketcher] If origin selected: don't do distance to origin
In auto constrainer. Fixes #12684
2024-10-07 09:02:56 -05:00
mwganson fd8ef079d0 [PartDesign AllowCompound] recompute all features when AllowCompound property is changed either from true to false or from false to true 2024-10-07 08:56:25 -05:00
shai 3d400211da Fix issue #17035 2024-10-07 08:35:56 -05:00
Eric Price 0909816af6 Changed QuickMeasurement to be conservative (#17060)
* Changed QuickMeasurement to be conservative

QuickMeasurement should not measure while tool dialogs are open
this includes but is not limited to editing sketches
also changed several other sanity checks to be opt-in vs opt-out, as discussed.

* move the test if it is safe to measure to when the measurement actually happens - avoids any potential race conditions
2024-10-07 08:33:46 -05:00
Roy-043 344ff7b946 BIM: BimWall add missing imports
Fixes #16996.
2024-10-07 15:21:41 +02:00
Roy-043 00610a62c5 Draft: avoid confusing SVG warning for nested circles and ellipses
Forum topic:
https://forum.freecad.org/viewtopic.php?t=90942
2024-10-07 15:08:31 +02:00
bgbsww bd4afe9f6e Disallow end_all_events in Gesture Nav Style 2024-10-07 15:03:47 +02:00
Roy-043 1119303d36 More logical implementation of the fix. 2024-10-07 15:00:44 +02:00
Max Wilfinger ea0b0bacac Update images on XDGData and README 2024-10-07 14:55:11 +02:00
Furgo ab49392da3 Prepend a single quote to BOM index to be interpreted as a string in generated spreadsheets 2024-10-04 08:53:27 -05:00
Roy-043 8932d52107 BIM: Compatibility fix for walls based on wire or face with -Z normal
In V1.0 the handling of wall normals has changed. As a result existing walls with their Normal set to [0, 0, 0], based on wires or faces with a shape normal pointing towards -Z, would be extruded in that direction instead of towards +Z as before. To avoid this their Normal property is changed to [0, 0, 1].
2024-10-04 13:55:01 +02:00
Ajinkya Dahale 7acf6274a4 [Sketcher] Apply tangent autoconstraint only when Dir given
This relates to `seekAutoConstraint` and `seekAndRenderAutoConstraint`.

Fixes #16321.
2024-10-03 23:18:07 -05:00
Florian Foinant-Willig f14917e8d4 [PD Helix] allow refinement to fail 2024-10-03 21:54:29 -05:00
bgbsww c587d6b8f9 Refine further 2024-10-03 13:47:37 -05:00
bgbsww 40239810cc Return to python; simplify to work with only classic names, provide migration 2024-10-03 13:47:37 -05:00
bgbsww 9aba82d5d6 Correctly build reference from selection subname 2024-10-03 13:47:37 -05:00
Jiří Pinkava cdec2159f1 Gui: fix warning with duplicate name in DlgSettingsLightSources 2024-10-03 13:23:04 -05:00
Kris Wilk e76ebea729 Placement Dialog: Use default tab order (Fix #16944) 2024-10-03 11:44:07 -05:00
wmayer baa57f5ee4 Fix compiler warning 2024-10-03 11:31:45 -05:00
Kris Wilk c43e19820d Prevent using reserved names for properties or aliases (Fix #16846) (#16902)
* Prevent naming properties with reserved words (Fix #16846)

* Prevent using reserved constant names for properties or aliases

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

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

* App: Add unit test for isTokenAConstant

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Chris Hennes <chennes@pioneerlibrarysystem.org>
2024-10-03 10:03:21 -05:00
PaddleStroke 3325ae99a9 Chennes fix
Co-authored-by: Chris Hennes <chennes@pioneerlibrarysystem.org>
2024-10-03 10:01:31 -05:00
PaddleStroke c6f5def7d7 Assembly: Use cpp getGlobalPlacement python binding rather than reimplementing it. 2024-10-03 10:01:31 -05:00
PaddleStroke 3475cf42d2 Core: GeoFeature: Add python binding to the new getGlobalPlacement() 2024-10-03 10:01:31 -05:00
Frank Martinez efb79d1c96 [AddonManager] Set default filter to ANY package type 2024-10-03 09:55:17 -05:00
PaddleStroke 3931953bc7 QuickMeasure: Prevent crash by limiting selection to Part::Features (#16921)
* QuickMeasure: Prevent crash by limiting selection to Part::Features

* chennes' fix

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

---------

Co-authored-by: Chris Hennes <chennes@pioneerlibrarysystem.org>
2024-10-03 09:49:31 -05:00
Roy-043 72441c3a27 BIM: check if Width and Height of window are not zero 2024-10-02 22:49:44 -05:00
André Althaus a953eb20e3 Only omit edges for group children in the dependecy graph
All edges for GeoFeatureGroupExtension where omited even if the
dependency was not a child of the object.
2024-10-02 22:45:05 -05:00
wmayer 5feb628feb Core: Fix macro recording when using module_io 2024-10-02 22:13:40 -05:00
Benjamin Nauck 11bc6c6b69 Fix macos crashes when unhandled exceptions reaches qt 2024-10-02 22:12:03 -05:00
wmayer 484a262c31 Core: Do not save changes of a text object if the GUI document is about to be closed
This fixes #16873: Text document breaks some Analysis container objects
2024-10-02 21:42:16 -05:00
David Carter 1b33aedb56 Materials: Correct DiffuseColor custom attribute
Custom attributes were modified to maintain the behaviour of setting
transparencies using the DiffuseColor alpha channels
2024-10-02 21:35:28 -05:00
Pieter Hijma c70093d22f Gui: Fix segfault in Expression Editor/VarSet 2024-10-02 21:31:33 -05:00
André Althaus 5410d92eb1 Remove the explicit dependency on Version.h from the fc_version target
This caused problems witht the Makefile generator because it doesn't
support the BYPRODUCTS option.
2024-10-02 21:31:00 -05:00
David Carter dbf849a592 FEM: Translation error causing a crash
An error in the Italian translation added an extra '{}' to the
translation string resulting in a dump when formatting.

This has also been updated in CrowdIn but as it's causing a crash is
also beiung changed via this PR. It should updated correctly when
doing the next translation pull.

Fixes #16704
2024-10-02 21:29:50 -05:00
hlorus 2b5dca48a5 MeasureGui: Also hide delta measurements 2024-09-30 11:24:31 -05:00
hlorus 9830160821 MeasureGui: Remove leftover reset of _mMeasureObject
This was introduced in af9097ce87 due to a faulty resolve of a merge conflict
2024-09-30 11:23:11 -05:00
WandererFan 5ac53527df [TD]Fix auto correct msg missing16892 (#16909)
* [TD]fix bad return code on auto-correct fail

* [TD]prevent changing references in property editor

- this is a "shoot yourself in the foot" practice
2024-09-30 11:21:02 -05:00
mwganson 70befd69d5 [Part CheckGeometry] prevent crash when attempting to check origin axis 2024-09-30 11:19:22 -05:00
Benjamin Nauck 20c552693d Include a warning to devs for unhandled exceptions
The same situation will cause a crash on at least macOS.
2024-09-30 11:15:26 -05:00
wandererfan 0117d6994a [TD]fix no dim repair on area (fix #16894) 2024-09-30 11:13:40 -05:00
André Althaus 49ee02277b Regenerate Version.h if the git hash changes
Prevous Version.h was not regenerated after it was initially created.
This prevented an accurate commit hash in the About dialog when
incrementally building from source.

Now the file is always rewritten when it's content is changed.
2024-09-30 11:12:54 -05:00
Shai Seger 41d8ed4c78 [CAM Simulator][1.0] Change usage of sample shader code to one with compatible license. (#16899)
* Change usage of sample shader code to one with compatible license.

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

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

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-09-30 11:08:52 -05:00
Frank Martinez e00765506c Revert 9b409da due to a regression in some platforms 2024-09-30 11:07:04 -05:00
wmayer 66ec2642a4 Core: Do not set to XY plane by default if the rotation of the image doesn't match 2024-09-30 11:04:16 -05:00
wmayer cec0213799 Core: Fix resetting placement of transformed image
The restored Euler angles of a rotation may significantly differ from the input Euler angles so that determining the plane isn't very reliable.
To get the plane reliably multiply (0,0,1) with the rotation and use this as reference normal of the plane.
2024-09-30 11:04:01 -05:00
wandererfan 5b4fac652d [TD]fix solid line detail highlight not shown 2024-09-30 11:01:53 -05:00
wandererfan c4bf46e97a [TD]fix handling of projection convention (fix #16788 #16785) 2024-09-30 11:00:56 -05:00
wandererfan b885af57b2 [TD]add preference methods for Projection Group 2024-09-30 11:00:56 -05:00
Eric Price 4d54b458a7 Do not allow loft where the segment shapes are too close ( fix #5855 )
A loft or pocket only makes sense if the segments used for it have some minimum separation. Having the shapes identical causes segfaults in OCCT

Checking for CoG is a hack. Identical shapes have identical CoG - but an identical CoG does not necessarily mean identical shapes - however it can be argued that a shape that is not offset at least somewhat in the direction of the loft doesnt make a valid shape for a loft (it will typically freeze OCCT instead of crashing it) and a sufficiently suitable shape will have a different CoG

throwing the exception will make it easy to identify if there ever is a case where this is a bad thing - and exceptions are better than segfaults.
2024-09-30 10:58:25 -05:00
bgbsww 13f719f285 Tiny doc format changes to make pybin11_stubgen happy 2024-09-30 10:54:04 -05:00
marioalexis 1c53cde453 Fem: Add offset between faces and wireframe in FemPostObject view provider 2024-09-30 10:50:24 -05:00
Eric Price d2c9078fd3 PadDesign: Work around issue 16690
This is a stopgap measure, I don't know if the underlying issue is fully understood - but this prevents it from happening in the given test case.

By overriding the base for the pocket prism, which is a trick also applied by
TopoShape::makeElementPrismUntil() if the prism creation fails on first try, the bug where said prism goes to the wrong shape is avoided - this on its own would however break a pad in the inverse case, so we only do that when pocketing
2024-09-30 10:48:01 -05:00
Benjamin Nauck 5575ad7085 Fixes name 'PyExc_FC_AbortIOException' is not defined 2024-09-30 10:46:21 -05:00
wandererfan 587e0b2bf9 [TD]fix bad default value (fix #16783) 2024-09-30 10:45:20 -05:00
bgbsww 469379de61 Make python Regex Strings raw to avoid py3.12 SyntaxError 2024-09-30 10:43:10 -05:00
wandererfan 3bccd5bd6a [TD]allow override of Balloon drag modifier (fix #15388) 2024-09-30 10:40:54 -05:00
wandererfan 668d72dfe2 [TD]add preferences for Balloon drag modifiers 2024-09-30 10:40:45 -05:00
PaddleStroke b327870fd4 Assembly: Fix lag during dragging of large assemblies. Bundle fix joints together. Show only the movingJoint during dragging. Do not recompute joints during dragging. 2024-09-30 10:39:06 -05:00
Syres916 57a94ff4f3 [Gui] Qt6 OpenGLWidget - move black rectangle off screen (#16863) 2024-09-27 22:52:07 -04:00
Jacob Oursland 734ea2e8bc CI: Fix conda builds. 2024-09-27 09:39:27 -04:00
Eric Price d4db6e1432 Measurement: Avoid null shapes to be returned in all code branches (Fix #16820)
Returning a null shape would have triggered an exception in the bottom branch but not in the top one - which later leads to a segfault - solution - raise an exception. OOC doesn't like null shapes.
2024-09-25 12:30:06 -05:00
David Carter 1d4d524932 Materials: Fix QT6 error
The MaterialTreeWidget was not working in QT6 due to a type check for a
QT5 widget
2024-09-25 11:49:16 -05:00
Roy-043 aca050d47c Fix linter warning 2024-09-25 16:01:06 +02:00
Yorik van Havre f34c43d56e Merge branch 'releases/FreeCAD-1-0' of github.com:FreeCAD/FreeCAD into releases/FreeCAD-1-0 2024-09-25 16:00:14 +02:00
Eric Price 843b724b6d Measurement: Correctly handle unknown selections to avoid segfaults (Fix 16794)
The measurement code did not handle mixed selections of known and unknown types correctly. Although a unknown selected object would leave the type at Invalid, selecting both known and unknown objects would have the type determined by the known object type and treat the unknown as the same. This causes exceptions and - worst case a segmentation fault.

This fix introduces a new category "other" which - if present in a selection always forces type to Invalid. This should be forward compatible in case new types are introduced in the future.
2024-09-25 07:49:10 -05:00
chris 118cc02c74 issue #15329 add missing include to resolve build error 2024-09-24 19:10:01 -05:00
Eric Price 6bab0c2787 PartDesign: Loft Intelligence - Select the whole sketch if the selected shape is … (#16791)
* Loft Intelligence - Select the whole sketch if the selected shape is a component of a sketch that is not a vertex (Fix #16630)

In fa8f29aed4 FeatureLoft.cpp was refactured, dropping some functionality, mainly the ability to create lofts to entire sketches or other 2d shapes if a single component that was not a single vertex was selected as either the base shape or a section

the old code was:

1     auto getSectionShape =
2          [](App::DocumentObject* feature, const std::vector<std::string> &subs) -> TopoDS_Shape {
3              if (!feature ||
4                  !feature->isDerivedFrom(Part::Feature::getClassTypeId()))
5                  throw Base::TypeError("Loft: Invalid profile/section");
6
7              auto subName = subs.empty() ? "" : subs.front();
8
9              // only take the entire shape when we have a sketch selected, but
10             // not a point of the sketch
11             if (feature->isDerivedFrom(Part::Part2DObject::getClassTypeId()) &&
12                 subName.compare(0, 6, "Vertex") != 0)
13                 return static_cast<Part::Part2DObject*>(feature)->Shape.getValue();
14             else {
15                 if(subName.empty())
16                     throw Base::ValueError("No valid subelement linked in Part::Feature");
17                 return static_cast<Part::Feature*>(feature)->Shape.getShape().getSubShape(subName.c_str());
18             }
19         };

this commit forward-ports the missing functionality provided by line 7-12 in above snippet

* Code cleanup as suggested by (#16791)
2024-09-24 15:01:49 -05:00
Florian Foinant-Willig 55e912b060 [PD] Fix Pad uptoface with custom direction (#16539)
* [PD] Fix Pad uptoface with custom direction

* Add unit test
2024-09-24 11:30:17 -05:00
wandererfan d272722d9d [TD]fix crash on bad selection (fix #16727) 2024-09-24 10:08:05 -05:00
Benjamin Nauck 690f06e618 Swaps out the hard coded icon to the standard svg icon 2024-09-24 10:04:32 -05:00
Syres916 ea9d1c4fd2 [BIM] Fix error starting BIM Wb for certain new users 2024-09-24 14:22:58 +02:00
Eric Price cf9e2e9c9a CLI: Enforce LC_NUMERIC=C on Posix systems (#16724) (#16763)
* Enforce LC_NUMERIC=C on Posix systems (#16724)

Initialising Qt with native LC_NUMERIC affects XML import on CLI (freecad -c)

This causes sketch constraints and potentially other components relying on numeric constants to break or have incorrect values.

Forcing LC_NUMERIC to C avoids this issue and enforces reproducible behaviour on all locales.
This does not affect the number format displayed in the GUI, as set in preferences.
2024-09-23 19:10:28 -05:00
1251 changed files with 102615 additions and 86773 deletions
Binary file not shown.

After

Width:  |  Height:  |  Size: 431 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 416 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 540 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 570 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 464 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 459 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 457 KiB

@@ -78,7 +78,7 @@ jobs:
with:
activate-environment: .conda/freecad
environment-file: conda/conda-env.yaml
channels: conda-forge,defaults
channels: conda-forge
channel-priority: true
miniforge-version: latest
- name: Install FreeCAD dependencies
@@ -78,7 +78,7 @@ jobs:
with:
activate-environment: .conda/freecad
environment-file: conda/conda-env.yaml
channels: conda-forge,defaults
channels: conda-forge
channel-priority: true
miniforge-version: latest
- name: Install FreeCAD dependencies
@@ -76,7 +76,7 @@ jobs:
with:
activate-environment: .conda/freecad
environment-file: conda/conda-env.yaml
channels: conda-forge,defaults
channels: conda-forge
channel-priority: true
miniforge-version: latest
- name: Install FreeCAD dependencies
@@ -76,7 +76,7 @@ jobs:
with:
activate-environment: .conda/freecad
environment-file: conda/conda-env-qt6.yaml
channels: conda-forge,defaults
channels: conda-forge
channel-priority: true
miniforge-version: latest
- name: Install FreeCAD dependencies
+1 -1
View File
@@ -71,7 +71,7 @@ jobs:
with:
activate-environment: .conda/freecad
environment-file: conda/conda-env.yaml
channels: conda-forge,defaults
channels: conda-forge
channel-priority: true
miniforge-version: latest
- name: Install FreeCAD dependencies
+5 -6
View File
@@ -318,7 +318,7 @@ jobs:
pylintWarnings=0
pylintRefactorings=0
pylintConventions=0
pip install pylint
pip install --break-system-packages pylint
# List enabled pylint checks
pylint --list-msgs-enabled > ${{ env.logdir }}pylint-enabled-checks.log
# Run pylint on all python files
@@ -378,7 +378,7 @@ jobs:
run: |
blackReformats=0
blackFails=0
pip install black
pip install --break-system-packages black
set +e
black --check ${{ inputs.changedPythonFiles }} &> ${{ env.logdir }}black.log
exitCode=$?
@@ -444,7 +444,7 @@ jobs:
libqt5x11extras5-dev \
libshiboken2-dev \
libspnav-dev \
libvtk7-dev \
libvtk9-dev \
libx11-dev \
libxerces-c-dev \
libyaml-cpp-dev \
@@ -452,7 +452,6 @@ jobs:
netgen \
netgen-headers \
occt-draw \
pyqt5-dev-tools \
pyside2-tools \
python3-dev \
python3-git \
@@ -516,7 +515,7 @@ jobs:
continue-on-error: ${{ inputs.cpplintFailSilent }}
run: |
cpplintErrors=0
pip install cpplint
pip install --break-system-packages cpplint
# Run cpplint
for file in ${{ inputs.changedCppFiles }}
do
@@ -581,7 +580,7 @@ jobs:
if: inputs.checkSpelling && always()
continue-on-error: ${{ inputs.codespellFailSilent }}
run: |
pip install codespell
pip install --break-system-packages codespell
wget https://raw.githubusercontent.com/codespell-project/codespell/master/codespell_lib/data/dictionary.txt
#wget https://raw.githubusercontent.com/codespell-project/codespell/master/codespell_lib/data/dictionary_rare.txt
set +e
+1 -1
View File
@@ -30,7 +30,7 @@ project(FreeCAD)
set(PACKAGE_VERSION_MAJOR "1")
set(PACKAGE_VERSION_MINOR "0")
set(PACKAGE_VERSION_PATCH "0") # number of patch release (e.g. "4" for the 0.18.4 release)
set(PACKAGE_VERSION_SUFFIX "RC2") # either "dev" for development snapshot or "" (empty string)
set(PACKAGE_VERSION_SUFFIX "") # 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)
set(PACKAGE_VERSION "${PACKAGE_VERSION_MAJOR}.${PACKAGE_VERSION_MINOR}.${PACKAGE_VERSION_PATCH}")
+2 -2
View File
@@ -2,7 +2,7 @@
### Your own 3D parametric modeler
[Website](https://www.freecad.org) •
[Website](https://www.freecad.org) •
[Documentation](https://wiki.freecad.org) •
[Forum](https://forum.freecad.org/) •
[Bug tracker](https://github.com/FreeCAD/FreeCAD/issues) •
@@ -12,7 +12,7 @@
[![Release](https://img.shields.io/github/release/freecad/freecad.svg)](https://github.com/freecad/freecad/releases/latest) [![Crowdin](https://d322cqt584bo4o.cloudfront.net/freecad/localized.svg)](https://crowdin.com/project/freecad) [![Liberapay](https://img.shields.io/liberapay/receives/FreeCAD.svg?logo=liberapay)](https://liberapay.com/FreeCAD)
<img src="https://user-images.githubusercontent.com/1828501/174066870-1692005b-f8d7-43fb-a289-6d2f07f73d7f.png" width="800"/>
<img src="/.github/images/partdesign.png" width="800"/>
Overview
--------
@@ -28,10 +28,11 @@ macro(CheckInterModuleDependencies)
REQUIRES_MODS(BUILD_MESH_PART BUILD_PART BUILD_MESH BUILD_SMESH)
REQUIRES_MODS(BUILD_FLAT_MESH BUILD_MESH_PART)
REQUIRES_MODS(BUILD_OPENSCAD BUILD_MESH_PART BUILD_DRAFT)
REQUIRES_MODS(BUILD_PART BUILD_MATERIAL)
REQUIRES_MODS(BUILD_PART_DESIGN BUILD_SKETCHER)
# REQUIRES_MODS(BUILD_CAM BUILD_PART BUILD_MESH BUILD_ROBOT)
REQUIRES_MODS(BUILD_CAM BUILD_PART BUILD_MESH)
REQUIRES_MODS(BUILD_REVERSEENGINEERING BUILD_PART BUILD_MESH)
REQUIRES_MODS(BUILD_REVERSEENGINEERING BUILD_PART BUILD_MESH BUILD_POINTS)
REQUIRES_MODS(BUILD_ROBOT BUILD_PART)
REQUIRES_MODS(BUILD_SANDBOX BUILD_PART BUILD_MESH)
REQUIRES_MODS(BUILD_SKETCHER BUILD_PART)
+1
View File
@@ -2,6 +2,7 @@ name: freecad
channels:
- conda-forge
dependencies:
- conda-forge/noarch::conda-libmamba-solver==24.7.0
- conda-devenv
- mamba
- python==3.12.*
+1
View File
@@ -2,6 +2,7 @@ name: freecad
channels:
- conda-forge
dependencies:
- conda-forge/noarch::conda-libmamba-solver==24.7.0
- conda-devenv
- mamba
- python==3.11.*
+1 -1
View File
@@ -3,6 +3,7 @@ channels:
- conda-forge
- conda-forge/label/pivy_rc
dependencies:
- conda-forge/noarch::conda-libmamba-solver==24.7.0
- libspnav # [linux]
- kernel-headers_linux-64 # [linux and x86_64]
- libdrm-cos7-x86_64 # [linux and x86_64]
@@ -90,7 +91,6 @@ dependencies:
- python==3.12.*
- pyyaml
- qt6-main
- six
- smesh
- swig
- vtk==9.2.6
+1 -1
View File
@@ -2,6 +2,7 @@ name: freecad
channels:
- conda-forge
dependencies:
- conda-forge/noarch::conda-libmamba-solver==24.7.0
- libspnav # [linux]
- kernel-headers_linux-64 # [linux and x86_64]
- libdrm-cos6-x86_64 # [linux and x86_64]
@@ -90,7 +91,6 @@ dependencies:
- python==3.11.*
- pyyaml
- qt-main
- six
- smesh
- swig
- vtk==9.2.6
-1
View File
@@ -4,7 +4,6 @@ SET(Examples_Files
draft_test_objects.FCStd
EngineBlock.FCStd
PartDesignExample.FCStd
RobotExample.FCStd
BIMExample.FCStd
FEMExample.FCStd
AssemblyExample.FCStd
Binary file not shown.
+32
View File
@@ -35,6 +35,8 @@
# endif
# include <boost/program_options.hpp>
# include <boost/date_time/posix_time/posix_time.hpp>
# include <chrono>
# include <random>
#endif
#ifdef FC_OS_WIN32
@@ -47,6 +49,7 @@
#include <sys/sysctl.h>
#endif
#include <QCoreApplication>
#include <QDir>
#include <QFileInfo>
#include <QProcessEnvironment>
@@ -137,6 +140,8 @@
#include <App/TestScript.h>
#include <App/CMakeScript.h>
#include "SafeMode.h"
#ifdef _MSC_VER // New handler for Microsoft Visual C++ compiler
# pragma warning( disable : 4535 )
# if !defined(_DEBUG) && defined(HAVE_SEH)
@@ -1112,6 +1117,21 @@ Application::TransactionSignaller::~TransactionSignaller() {
}
}
int64_t Application::applicationPid()
{
static int64_t randomNumber = []() {
auto tp = std::chrono::high_resolution_clock::now();
auto dur = tp.time_since_epoch();
auto seed = dur.count();
std::mt19937 generator(static_cast<unsigned>(seed));
constexpr int64_t minValue {1};
constexpr int64_t maxValue {1000000};
std::uniform_int_distribution<int64_t> distribution(minValue, maxValue);
return distribution(generator);
}();
return randomNumber;
}
std::string Application::getHomePath()
{
return mConfig["AppHomePath"];
@@ -1742,6 +1762,7 @@ void Application::destruct()
Base::InterpreterSingleton::Destruct();
Base::Type::destruct();
ParameterManager::Terminate();
SafeMode::Destruct();
}
void Application::destructObserver()
@@ -2230,6 +2251,7 @@ void parseProgramOptions(int ac, char ** av, const string& exe, variables_map& v
("module-path,M", value< vector<string> >()->composing(),"Additional module paths")
("python-path,P", value< vector<string> >()->composing(),"Additional python paths")
("single-instance", "Allow to run a single instance of the application")
("safe-mode", "Force enable safe mode")
("pass", value< vector<string> >()->multitoken(), "Ignores the following arguments and pass them through to be used by a script")
;
@@ -2557,6 +2579,10 @@ void Application::initConfig(int argc, char ** argv)
// extract home paths
ExtractUserPath();
if (vm.count("safe-mode")) {
SafeMode::StartSafeMode();
}
# ifdef FC_DEBUG
mConfig["Debug"] = "1";
@@ -2645,6 +2671,12 @@ void Application::initConfig(int argc, char ** argv)
mConfig["BuildVersionPoint"].c_str(),
mConfig["BuildVersionSuffix"].c_str(),
mConfig["BuildRevision"].c_str());
if (SafeMode::SafeModeEnabled()) {
Base::Console().Message("FreeCAD is running in _SAFE_MODE_.\n"
"Safe mode temporarily disables your configurations and "
"addons. Restart the application to exit safe mode.\n\n");
}
}
LoadParameters();
+1
View File
@@ -399,6 +399,7 @@ public:
static std::map<std::string, std::string> &Config(){return mConfig;}
static int GetARGC(){return _argc;}
static char** GetARGV(){return _argv;}
static int64_t applicationPid();
//@}
/** @name Application directories */
+5 -3
View File
@@ -86,7 +86,7 @@ PyMethodDef Application::Methods[] = {
{"getUserAppDataDir", (PyCFunction) Application::sGetUserAppDataPath, METH_VARARGS,
"Get the root directory of application data"},
{"getUserMacroDir", (PyCFunction) Application::sGetUserMacroPath, METH_VARARGS,
"getUserMacroDir(bool=False) -> string"
"getUserMacroDir(bool=False) -> str\n\n"
"Get the directory of the user's macro directory\n"
"If parameter is False (the default) it returns the standard path in the"
"user's home directory, otherwise it returns the user-defined path."},
@@ -169,11 +169,13 @@ PyMethodDef Application::Methods[] = {
"active transaction causes any document changes to open a transaction with\n"
"the given name and ID."},
{"getActiveTransaction", (PyCFunction) Application::sGetActiveTransaction, METH_VARARGS,
"getActiveTransaction() -> (name,id) return the current active transaction name and ID"},
"getActiveTransaction() -> (name,id)\n\n"
"return the current active transaction name and ID"},
{"closeActiveTransaction", (PyCFunction) Application::sCloseActiveTransaction, METH_VARARGS,
"closeActiveTransaction(abort=False) -- commit or abort current active transaction"},
{"isRestoring", (PyCFunction) Application::sIsRestoring, METH_VARARGS,
"isRestoring() -> Bool -- Test if the application is opening some document"},
"isRestoring() -> bool\n\n"
"Test if the application is opening some document"},
{"checkAbort", (PyCFunction) Application::sCheckAbort, METH_VARARGS,
"checkAbort() -- check for user abort in length operation.\n\n"
"This only works if there is an active sequencer (or ProgressIndicator in Python).\n"
+1
View File
@@ -288,6 +288,7 @@ SET(FreeCADApp_CPP_SRCS
Metadata.cpp
MetadataPyImp.cpp
ElementNamingUtils.cpp
SafeMode.cpp
StringHasher.cpp
StringHasherPyImp.cpp
StringIDPyImp.cpp
+11 -7
View File
@@ -931,18 +931,21 @@ Document::~Document()
std::string Document::getTransientDirectoryName(const std::string& uuid, const std::string& filename) const
{
// Create a directory name of the form: {ExeName}_Doc_{UUID}_{HASH}_{PID}
std::stringstream s;
std::stringstream out;
QCryptographicHash hash(QCryptographicHash::Sha1);
#if QT_VERSION < QT_VERSION_CHECK(6,3,0)
hash.addData(filename.c_str(), filename.size());
#else
hash.addData(QByteArrayView(filename.c_str(), filename.size()));
#endif
s << App::Application::getUserCachePath() << App::Application::getExecutableName()
<< "_Doc_" << uuid
<< "_" << hash.result().toHex().left(6).constData()
<< "_" << QCoreApplication::applicationPid();
return s.str();
out << App::Application::getUserCachePath() << App::Application::getExecutableName()
<< "_Doc_"
<< uuid
<< "_"
<< hash.result().toHex().left(6).constData()
<< "_"
<< App::Application::applicationPid();
return out.str();
}
//--------------------------------------------------------------------------
@@ -3625,9 +3628,10 @@ void Document::_removeObject(DocumentObject* pcObject)
else {
// for a rollback delete the object
signalTransactionRemove(*pcObject, 0);
breakDependency(pcObject, true);
}
breakDependency(pcObject, true);
// remove from map
pcObject->setStatus(ObjectStatus::Remove, false); // Unset the bit to be on the safe side
d->objectIdMap.erase(pcObject->_Id);
+8 -1
View File
@@ -232,6 +232,13 @@ Return tuple(obj,newElementName,oldElementName)
</UserDocu>
</Documentation>
</Methode>
<Methode Name="isAttachedToDocument" Const="true">
<Documentation>
<UserDocu>
isAttachedToDocument(): return true if the object is part of a document, false otherwise
</UserDocu>
</Documentation>
</Methode>
<Attribute Name="OutList" ReadOnly="true">
<Documentation>
<UserDocu>A list of all objects this object links to.</UserDocu>
@@ -266,7 +273,7 @@ Return tuple(obj,newElementName,oldElementName)
<Documentation>
<UserDocu>Return the internal name of this object</UserDocu>
</Documentation>
<Parameter Name="Name" Type="String"/>
<Parameter Name="Name" Type="Object"/>
</Attribute>
<Attribute Name="Document" ReadOnly="true">
<Documentation>
+14 -3
View File
@@ -49,14 +49,14 @@ std::string DocumentObjectPy::representation() const
return str.str();
}
Py::String DocumentObjectPy::getName() const
Py::Object DocumentObjectPy::getName() const
{
DocumentObject* object = this->getDocumentObjectPtr();
const char* internal = object->getNameInDocument();
if (!internal) {
throw Py::RuntimeError(std::string("This object is currently not part of a document"));
return Py::None();
}
return {std::string(internal)};
return Py::String(internal);
}
Py::String DocumentObjectPy::getFullName() const
@@ -76,6 +76,17 @@ Py::Object DocumentObjectPy::getDocument() const
}
}
PyObject* DocumentObjectPy::isAttachedToDocument(PyObject *args)
{
if (!PyArg_ParseTuple(args, "")) {
return nullptr;
}
DocumentObject* object = this->getDocumentObjectPtr();
bool ok = object->isAttachedToDocument();
return Py::new_reference_to(Py::Boolean(ok));
}
PyObject* DocumentObjectPy::addProperty(PyObject *args, PyObject *kwd)
{
char *sType,*sName=nullptr,*sGroup=nullptr,*sDoc=nullptr;
+7
View File
@@ -3855,6 +3855,13 @@ bool ExpressionParser::isTokenAnIndentifier(const std::string & str)
return (status == 0 && (token == IDENTIFIER || token == CELLADDRESS));
}
bool ExpressionParser::isTokenAConstant(const std::string & str)
{
int token{}, status{};
std::tie(token, status) = getTokenAndStatus(str);
return (status == 0 && token == CONSTANT);
}
bool ExpressionParser::isTokenAUnit(const std::string & str)
{
int token{}, status{};
+1
View File
@@ -500,6 +500,7 @@ AppExport Expression * parse(const App::DocumentObject *owner, const char *buffe
AppExport UnitExpression * parseUnit(const App::DocumentObject *owner, const char *buffer);
AppExport ObjectIdentifier parsePath(const App::DocumentObject *owner, const char* buffer);
AppExport bool isTokenAnIndentifier(const std::string & str);
AppExport bool isTokenAConstant(const std::string & str);
AppExport bool isTokenAUnit(const std::string & str);
AppExport std::vector<std::tuple<int, int, std::string> > tokenize(const std::string & str);
+2 -1
View File
@@ -108,8 +108,9 @@ public:
const DocumentObject *filter=nullptr,const char **element=nullptr, GeoFeature **geo=nullptr);
/**
* @brief Calculates the placement in the global reference coordinate system
* @brief Deprecated. Calculates the placement in the global reference coordinate system
*
* Deprecated: This does not handle App::Links correctly. Use getGlobalPlacement() instead.
* In FreeCAD the GeoFeature placement describes the local placement of the object in its parent
* coordinate system. This is however not always the same as the global reference system. If the
* object is in a GeoFeatureGroup, hence in another local coordinate system, the Placement
+17
View File
@@ -30,6 +30,7 @@ Note: Not implemented.</UserDocu>
<Methode Name="getGlobalPlacement">
<Documentation>
<UserDocu>getGlobalPlacement() -> Base.Placement
Deprecated: This function does not handle Links correctly. Use getGlobalPlacementOf instead.
Returns the placement of the object in the global coordinate space, respecting all stacked
relationships.
@@ -37,6 +38,22 @@ Note: This function is not available during recompute, as there the placements o
can change after the execution of this object, rendering the result wrong.</UserDocu>
</Documentation>
</Methode>
<Methode Name="getGlobalPlacementOf" Static="true">
<Documentation>
<UserDocu>getGlobalPlacementOf(targetObj, rootObj, subname) -> Base.Placement
Selection example: obj = "part1" sub = "linkToPart2.LinkToBody.Pad.face1"
Global placement of Pad in this context :
getGlobalPlacementOf(pad, part1, "linkToPart2.LinkToBody.Pad.face1")
Global placement of linkToPart2 in this context :
getGlobalPlacementOf(linkToPart2, part1, "linkToPart2.LinkToBody.Pad.face1")
Returns the placement of the object in the global coordinate space, respecting all stacked
relationships.
</UserDocu>
</Documentation>
</Methode>
<Methode Name="getPropertyNameOfGeometry">
<Documentation>
<UserDocu>getPropertyNameOfGeometry() -> str or None
+21
View File
@@ -57,6 +57,27 @@ PyObject* GeoFeaturePy::getGlobalPlacement(PyObject * args) {
}
}
PyObject* GeoFeaturePy::getGlobalPlacementOf(PyObject * args) {
PyObject* pyTargetObj {nullptr};
PyObject* pyRootObj {nullptr};
char* pname;
if (!PyArg_ParseTuple(args, "OOs", &pyTargetObj, &pyRootObj, &pname)) {
return nullptr;
}
auto* targetObj = static_cast<App::DocumentObjectPy*>(pyTargetObj)->getDocumentObjectPtr();
auto* rootObj = static_cast<App::DocumentObjectPy*>(pyRootObj)->getDocumentObjectPtr();
try {
Base::Placement p = GeoFeature::getGlobalPlacement(targetObj, rootObj, pname);
return new Base::PlacementPy(new Base::Placement(p));
}
catch (const Base::Exception& e) {
throw Py::RuntimeError(e.what());
}
}
PyObject* GeoFeaturePy::getPropertyNameOfGeometry(PyObject * args)
{
if (!PyArg_ParseTuple(args, ""))
+22 -15
View File
@@ -120,7 +120,14 @@ void Document::exportGraphviz(std::ostream& out) const
*/
std::string getId(const DocumentObject * docObj) {
return std::string((docObj)->getDocument()->getName()) + "#" + docObj->getNameInDocument();
std::string id;
if (docObj->isAttachedToDocument()) {
auto doc = docObj->getDocument();
id.append(doc->getName());
id.append("#");
id.append(docObj->getNameInDocument());
}
return id;
}
/**
@@ -434,11 +441,14 @@ void Document::exportGraphviz(std::ostream& out) const
if (obj) {
std::map<std::string,Vertex>::const_iterator item = GlobalVertexList.find(getId(obj));
if (item == GlobalVertexList.end())
add(obj,
std::string(obj->getDocument()->getName()) + "#" + obj->getNameInDocument(),
std::string(obj->getDocument()->getName()) + "#" + obj->Label.getValue(),
CSSubgraphs);
if (item == GlobalVertexList.end()) {
if (obj->isAttachedToDocument()) {
add(obj,
std::string(obj->getDocument()->getName()) + "#" + obj->getNameInDocument(),
std::string(obj->getDocument()->getName()) + "#" + obj->Label.getValue(),
CSSubgraphs);
}
}
}
}
}
@@ -486,23 +496,20 @@ void Document::exportGraphviz(std::ostream& out) const
// Add edges between document objects
for (const auto & It : d->objectMap) {
if(omitGeoFeatureGroups) {
//coordinate systems are represented by subgraphs
if(It.second->hasExtension(GeoFeatureGroupExtension::getExtensionClassTypeId()))
continue;
//as well as origins
if(It.second->isDerivedFrom(Origin::getClassTypeId()))
continue;
if(omitGeoFeatureGroups && It.second->isDerivedFrom(Origin::getClassTypeId())) {
continue;
}
std::map<DocumentObject*, int> dups;
std::vector<DocumentObject*> OutList = It.second->getOutList();
const DocumentObject * docObj = It.second;
const bool docObj_is_group = docObj->hasExtension(GeoFeatureGroupExtension::getExtensionClassTypeId());
for (auto obj : OutList) {
if (obj) {
if(omitGeoFeatureGroups && docObj_is_group && GeoFeatureGroupExtension::getGroupOfObject(obj) == docObj) {
continue;
}
// Count duplicate edges
bool inserted = edge(GlobalVertexList[getId(docObj)], GlobalVertexList[getId(obj)], DepList).second;
if (inserted) {
+1
View File
@@ -69,6 +69,7 @@
// STL
#include <bitset>
#include <chrono>
#include <exception>
#include <functional>
#include <iterator>
+2 -2
View File
@@ -272,7 +272,7 @@ void PropertyLinkBase::_registerElementReference(App::DocumentObject *obj, std::
return;
}
if (shadow.newName.empty()) {
_updateElementReference(0, obj, sub, shadow, false);
_updateElementReference(nullptr, obj, sub, shadow, false);
return;
}
GeoFeature* geo = nullptr;
@@ -283,7 +283,7 @@ void PropertyLinkBase::_registerElementReference(App::DocumentObject *obj, std::
elementName,
true,
GeoFeature::ElementNameType::Export,
0,
nullptr,
&element,
&geo);
if (!geo || !element || !element[0]) {
+10
View File
@@ -3099,6 +3099,16 @@ float PropertyMaterialList::getTransparency(int index) const
return _lValueList[index].transparency;
}
std::vector<float> PropertyMaterialList::getTransparencies() const
{
std::vector<float> list;
for (auto& material : _lValueList) {
list.push_back(material.transparency);
}
return list;
}
Material PropertyMaterialList::getPyValue(PyObject* value) const
{
if (PyObject_TypeCheck(value, &(MaterialPy::Type))) {
+1
View File
@@ -1176,6 +1176,7 @@ public:
float getTransparency() const;
float getTransparency(int index) const;
std::vector<float> getTransparencies() const;
PyObject* getPyObject() override;
+1 -1
View File
@@ -13,7 +13,7 @@ that reference the same configurable object</source>
<context>
<name>QObject</name>
<message>
<location filename="../../Application.cpp" line="463"/>
<location filename="../../Application.cpp" line="468"/>
<source>Unnamed</source>
<translation>Без назвы</translation>
</message>
+1 -1
View File
@@ -13,7 +13,7 @@ that reference the same configurable object</source>
<context>
<name>QObject</name>
<message>
<location filename="../../Application.cpp" line="463"/>
<location filename="../../Application.cpp" line="468"/>
<source>Unnamed</source>
<translation>Sense nom</translation>
</message>
+1 -1
View File
@@ -14,7 +14,7 @@ které odkazují na stejný konfigurovatelný objekt</translation>
<context>
<name>QObject</name>
<message>
<location filename="../../Application.cpp" line="463"/>
<location filename="../../Application.cpp" line="468"/>
<source>Unnamed</source>
<translation>Nepojmenovaný</translation>
</message>
+1 -1
View File
@@ -13,7 +13,7 @@ that reference the same configurable object</source>
<context>
<name>QObject</name>
<message>
<location filename="../../Application.cpp" line="463"/>
<location filename="../../Application.cpp" line="468"/>
<source>Unnamed</source>
<translation>Unavngivet</translation>
</message>
+1 -1
View File
@@ -14,7 +14,7 @@ angewendet werden soll, die das gleiche konfigurierbare Objekt referenzieren</tr
<context>
<name>QObject</name>
<message>
<location filename="../../Application.cpp" line="463"/>
<location filename="../../Application.cpp" line="468"/>
<source>Unnamed</source>
<translation>Unbenannt</translation>
</message>
+1 -1
View File
@@ -14,7 +14,7 @@ that reference the same configurable object</source>
<context>
<name>QObject</name>
<message>
<location filename="../../Application.cpp" line="463"/>
<location filename="../../Application.cpp" line="468"/>
<source>Unnamed</source>
<translation>Ανώνυμο</translation>
</message>
+1 -1
View File
@@ -14,7 +14,7 @@ que hacen referencia al mismo objeto configurable</translation>
<context>
<name>QObject</name>
<message>
<location filename="../../Application.cpp" line="463"/>
<location filename="../../Application.cpp" line="468"/>
<source>Unnamed</source>
<translation>Sin nombre</translation>
</message>
+1 -1
View File
@@ -13,7 +13,7 @@ that reference the same configurable object</source>
<context>
<name>QObject</name>
<message>
<location filename="../../Application.cpp" line="463"/>
<location filename="../../Application.cpp" line="468"/>
<source>Unnamed</source>
<translation>Sin nombre</translation>
</message>
+1 -1
View File
@@ -13,7 +13,7 @@ that reference the same configurable object</source>
<context>
<name>QObject</name>
<message>
<location filename="../../Application.cpp" line="463"/>
<location filename="../../Application.cpp" line="468"/>
<source>Unnamed</source>
<translation>Izenik gabea</translation>
</message>
+1 -1
View File
@@ -14,7 +14,7 @@ that reference the same configurable object</translation>
<context>
<name>QObject</name>
<message>
<location filename="../../Application.cpp" line="463"/>
<location filename="../../Application.cpp" line="468"/>
<source>Unnamed</source>
<translation>Nimetön</translation>
</message>
+1 -1
View File
@@ -13,7 +13,7 @@ that reference the same configurable object</source>
<context>
<name>QObject</name>
<message>
<location filename="../../Application.cpp" line="463"/>
<location filename="../../Application.cpp" line="468"/>
<source>Unnamed</source>
<translation>Nouveau</translation>
</message>
+1 -1
View File
@@ -14,7 +14,7 @@ na sve veze koje referenciraju isti konfigurabilni objekt</translation>
<context>
<name>QObject</name>
<message>
<location filename="../../Application.cpp" line="463"/>
<location filename="../../Application.cpp" line="468"/>
<source>Unnamed</source>
<translation>Neimenovano</translation>
</message>
+1 -1
View File
@@ -14,7 +14,7 @@ amelyek ugyanarra a konfigurálható tárgyra hivatkoznak</translation>
<context>
<name>QObject</name>
<message>
<location filename="../../Application.cpp" line="463"/>
<location filename="../../Application.cpp" line="468"/>
<source>Unnamed</source>
<translation>Névtelen</translation>
</message>
+1 -1
View File
@@ -14,7 +14,7 @@ che fanno riferimento allo stesso oggetto configurabile</translation>
<context>
<name>QObject</name>
<message>
<location filename="../../Application.cpp" line="463"/>
<location filename="../../Application.cpp" line="468"/>
<source>Unnamed</source>
<translation>Senza nome</translation>
</message>
+1 -1
View File
@@ -13,7 +13,7 @@ that reference the same configurable object</source>
<context>
<name>QObject</name>
<message>
<location filename="../../Application.cpp" line="463"/>
<location filename="../../Application.cpp" line="468"/>
<source>Unnamed</source>
<translation></translation>
</message>
+1 -1
View File
@@ -13,7 +13,7 @@ that reference the same configurable object</source>
<context>
<name>QObject</name>
<message>
<location filename="../../Application.cpp" line="463"/>
<location filename="../../Application.cpp" line="468"/>
<source>Unnamed</source>
<translation></translation>
</message>
+1 -1
View File
@@ -13,7 +13,7 @@ that reference the same configurable object</source>
<context>
<name>QObject</name>
<message>
<location filename="../../Application.cpp" line="463"/>
<location filename="../../Application.cpp" line="468"/>
<source>Unnamed</source>
<translation></translation>
</message>
+1 -1
View File
@@ -13,7 +13,7 @@ that reference the same configurable object</source>
<context>
<name>QObject</name>
<message>
<location filename="../../Application.cpp" line="463"/>
<location filename="../../Application.cpp" line="468"/>
<source>Unnamed</source>
<translation>Be pavadinimo</translation>
</message>
+1 -1
View File
@@ -14,7 +14,7 @@ die verwijzen naar hetzelfde configureerbare object</translation>
<context>
<name>QObject</name>
<message>
<location filename="../../Application.cpp" line="463"/>
<location filename="../../Application.cpp" line="468"/>
<source>Unnamed</source>
<translation>Naamloos</translation>
</message>
+1 -1
View File
@@ -14,7 +14,7 @@ które odnoszą się do tego samego obiektu konfigurowalnego</translation>
<context>
<name>QObject</name>
<message>
<location filename="../../Application.cpp" line="463"/>
<location filename="../../Application.cpp" line="468"/>
<source>Unnamed</source>
<translation>Nienazwany</translation>
</message>
+1 -1
View File
@@ -14,7 +14,7 @@ que referenciam o mesmo objeto configurável</translation>
<context>
<name>QObject</name>
<message>
<location filename="../../Application.cpp" line="463"/>
<location filename="../../Application.cpp" line="468"/>
<source>Unnamed</source>
<translation>Sem nome</translation>
</message>
+1 -1
View File
@@ -14,7 +14,7 @@ that reference the same configurable object</translation>
<context>
<name>QObject</name>
<message>
<location filename="../../Application.cpp" line="463"/>
<location filename="../../Application.cpp" line="468"/>
<source>Unnamed</source>
<translation>Sem nome</translation>
</message>
+1 -1
View File
@@ -14,7 +14,7 @@ care fac referire la același obiect configurabil</translation>
<context>
<name>QObject</name>
<message>
<location filename="../../Application.cpp" line="463"/>
<location filename="../../Application.cpp" line="468"/>
<source>Unnamed</source>
<translation>Nedenumit</translation>
</message>
+1 -1
View File
@@ -13,7 +13,7 @@ that reference the same configurable object</source>
<context>
<name>QObject</name>
<message>
<location filename="../../Application.cpp" line="463"/>
<location filename="../../Application.cpp" line="468"/>
<source>Unnamed</source>
<translation>Безымянный</translation>
</message>
+1 -1
View File
@@ -14,7 +14,7 @@ za vse povezave, ki se sklicujejo na isti nastavljivi predmet</translation>
<context>
<name>QObject</name>
<message>
<location filename="../../Application.cpp" line="463"/>
<location filename="../../Application.cpp" line="468"/>
<source>Unnamed</source>
<translation>Neimenovan</translation>
</message>
+1 -1
View File
@@ -14,7 +14,7 @@ that reference the same configurable object</translation>
<context>
<name>QObject</name>
<message>
<location filename="../../Application.cpp" line="463"/>
<location filename="../../Application.cpp" line="468"/>
<source>Unnamed</source>
<translation>Bez imena</translation>
</message>
+1 -1
View File
@@ -14,7 +14,7 @@ that reference the same configurable object</source>
<context>
<name>QObject</name>
<message>
<location filename="../../Application.cpp" line="463"/>
<location filename="../../Application.cpp" line="468"/>
<source>Unnamed</source>
<translation>Без имена</translation>
</message>
+1 -1
View File
@@ -14,7 +14,7 @@ that reference the same configurable object</translation>
<context>
<name>QObject</name>
<message>
<location filename="../../Application.cpp" line="463"/>
<location filename="../../Application.cpp" line="468"/>
<source>Unnamed</source>
<translation>Namnlös</translation>
</message>
+1 -1
View File
@@ -14,7 +14,7 @@ uygulanmayacağına ilişkin son kullanıcı seçimini saklar</translation>
<context>
<name>QObject</name>
<message>
<location filename="../../Application.cpp" line="463"/>
<location filename="../../Application.cpp" line="468"/>
<source>Unnamed</source>
<translation>İsimsiz</translation>
</message>
+1 -1
View File
@@ -13,7 +13,7 @@ that reference the same configurable object</source>
<context>
<name>QObject</name>
<message>
<location filename="../../Application.cpp" line="463"/>
<location filename="../../Application.cpp" line="468"/>
<source>Unnamed</source>
<translation>Без назви</translation>
</message>
+1 -1
View File
@@ -14,7 +14,7 @@ that reference the same configurable object</translation>
<context>
<name>QObject</name>
<message>
<location filename="../../Application.cpp" line="463"/>
<location filename="../../Application.cpp" line="468"/>
<source>Unnamed</source>
<translation>Sense nom</translation>
</message>
+1 -1
View File
@@ -13,7 +13,7 @@ that reference the same configurable object</source>
<context>
<name>QObject</name>
<message>
<location filename="../../Application.cpp" line="463"/>
<location filename="../../Application.cpp" line="468"/>
<source>Unnamed</source>
<translation></translation>
</message>
+1 -1
View File
@@ -13,7 +13,7 @@ that reference the same configurable object</source>
<context>
<name>QObject</name>
<message>
<location filename="../../Application.cpp" line="463"/>
<location filename="../../Application.cpp" line="468"/>
<source>Unnamed</source>
<translation></translation>
</message>
+79
View File
@@ -0,0 +1,79 @@
/***************************************************************************
* Copyright (c) 2024 Benjamin Nauck <benjamin@nauck.se> *
* *
* This file is part of the FreeCAD CAx development system. *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU Library General Public License (LGPL) *
* as published by the Free Software Foundation; either version 2 of *
* the License, or (at your option) any later version. *
* for detail see the LICENCE text file. *
* *
* 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 Library General Public License for more details. *
* *
* You should have received a copy of the GNU Library General Public *
* License along with FreeCAD; if not, write to the Free Software *
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
* USA *
* *
***************************************************************************/
#include "PreCompiled.h"
#include <QTemporaryDir>
#include "Application.h"
#include "FCConfig.h"
#include "SafeMode.h"
static QTemporaryDir * tempDir = nullptr;
static bool _createTemporaryBaseDir() {
tempDir = new QTemporaryDir();
if (!tempDir->isValid()) {
delete tempDir;
tempDir = nullptr;
}
return tempDir;
}
static void _replaceDirs()
{
auto &config = App::GetApplication().Config();
auto const temp_base = tempDir->path().toStdString();
auto const dirs = {
"UserAppData",
"UserConfigPath",
"UserCachePath",
"AppTempPath",
"UserMacroPath",
"UserHomePath",
};
for (auto const d : dirs) {
auto const path = temp_base + PATHSEP + d + PATHSEP;
auto const qpath = QString::fromStdString(path);
QDir().mkpath(qpath);
config[d] = path;
}
}
void SafeMode::StartSafeMode()
{
if (_createTemporaryBaseDir()) {
_replaceDirs();
}
}
bool SafeMode::SafeModeEnabled() {
return tempDir;
}
void SafeMode::Destruct() {
delete tempDir;
}
+30
View File
@@ -0,0 +1,30 @@
/***************************************************************************
* Copyright (c) 2024 Benjamin Nauck <benjamin@nauck.se> *
* *
* This file is part of the FreeCAD CAx development system. *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU Library General Public License (LGPL) *
* as published by the Free Software Foundation; either version 2 of *
* the License, or (at your option) any later version. *
* for detail see the LICENCE text file. *
* *
* 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 Library General Public License for more details. *
* *
* You should have received a copy of the GNU Library General Public *
* License along with FreeCAD; if not, write to the Free Software *
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
* USA *
* *
***************************************************************************/
#pragma once
namespace SafeMode {
AppExport bool SafeModeEnabled();
AppExport void StartSafeMode();
AppExport void Destruct();
};
+1 -1
View File
@@ -36,7 +36,7 @@
<message>
<location filename="../../UnitsApi.cpp" line="81"/>
<source>Metric small parts &amp; CNC (mm, mm/min)</source>
<translation type="unfinished">Metric small parts &amp; CNC (mm, mm/min)</translation>
<translation>Metrički mali dijelovi &amp; CNC (mm, mm/min)</translation>
</message>
<message>
<location filename="../../UnitsApi.cpp" line="83"/>
@@ -26,27 +26,27 @@
<message>
<location filename="../../UnitsApi.cpp" line="77"/>
<source>Building Euro (cm, m², m³)</source>
<translation type="unfinished">Building Euro (cm, m², m³)</translation>
<translation>(, , )</translation>
</message>
<message>
<location filename="../../UnitsApi.cpp" line="79"/>
<source>Building US (ft-in, sqft, cft)</source>
<translation type="unfinished">Building US (ft-in, sqft, cft)</translation>
<translation> (ft-in/sqft/cuft)</translation>
</message>
<message>
<location filename="../../UnitsApi.cpp" line="81"/>
<source>Metric small parts &amp; CNC (mm, mm/min)</source>
<translation type="unfinished">Metric small parts &amp; CNC (mm, mm/min)</translation>
<translation> (, )</translation>
</message>
<message>
<location filename="../../UnitsApi.cpp" line="83"/>
<source>Imperial for Civil Eng (ft, ft/s)</source>
<translation type="unfinished">Imperial for Civil Eng (ft, ft/s)</translation>
<translation> (ft, ft/s)</translation>
</message>
<message>
<location filename="../../UnitsApi.cpp" line="85"/>
<source>FEM (mm, N, s)</source>
<translation type="unfinished">FEM (mm, N, s)</translation>
<translation>(mm, N, s)</translation>
</message>
<message>
<location filename="../../UnitsApi.cpp" line="87"/>
+7 -9
View File
@@ -10,19 +10,17 @@ if (NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/Version.h)
${CMAKE_CURRENT_BINARY_DIR}/Version.h.in)
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/Version.h
OUTPUT version_file
BYPRODUCTS ${CMAKE_CURRENT_BINARY_DIR}/Version.h
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/src/Tools/SubWCRev.py
--srcdir=${CMAKE_SOURCE_DIR} --bindir=${CMAKE_BINARY_DIR}
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_BINARY_DIR}/Version.h.out
${CMAKE_CURRENT_BINARY_DIR}/Version.h
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
DEPENDS version_check)
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/Version.h.in)
set_source_files_properties(version_file PROPERTIES SYMBOLIC true)
add_custom_command(
OUTPUT version_check
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/src/Tools/SubWCRev.py
--srcdir=${CMAKE_SOURCE_DIR} --bindir=${CMAKE_BINARY_DIR}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
ADD_CUSTOM_TARGET(fc_version DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/Version.h)
ADD_CUSTOM_TARGET(fc_version DEPENDS version_file)
else (NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/Version.h)
+3 -4
View File
@@ -1,13 +1,12 @@
configure_file(ThirdPartyLibraries.html
${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_DOCDIR}/ThirdPartyLibraries.html COPYONLY)
configure_file(ThirdPartyLibraries.html.cmake
${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_DOCDIR}/ThirdPartyLibraries.html)
configure_file(LICENSE.html
${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_DOCDIR}/LICENSE.html COPYONLY)
# The CONTRIBUTORS file is now compiled into the FreeCAD GUI Qt resource file
INSTALL(FILES
ThirdPartyLibraries.html
${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_DOCDIR}/ThirdPartyLibraries.html
LICENSE.html
DESTINATION ${CMAKE_INSTALL_DOCDIR}
)
@@ -24,6 +24,7 @@ List of Open Source components<br />
<h3><a name="_TocBoost"></a>Boost</h3>
<p>Version: ${Boost_VERSION}</p>
<p>Web site: <a href="https://www.boost.org/">https://www.boost.org/</a></p>
<p>License: Boost Software License: <a href="https://www.boost.org/users/license.html">https://www.boost.org/users/license.html</a></p>
@@ -31,6 +32,7 @@ List of Open Source components<br />
<hr>
<h3><a name="_TocCoin3D"></a>Coin3D</h3>
<p>Version: ${COIN3D_VERSION}</p>
<p>Web site: <a href="https://coin3d.github.io">https://coin3d.github.io</a></p>
<p>License: BSD 3-Clause: <a href="https://github.com/coin3d/coin/blob/master/COPYING">https://github.com/coin3d/coin/blob/master/COPYING</a></p>
@@ -38,6 +40,7 @@ List of Open Source components<br />
<hr>
<h3><a name="_TocEigen"></a>Eigen</h3>
<p>Version: ${EIGEN3_VERSION}</p>
<p>Web site: <a href="https://eigen.tuxfamily.org">https://eigen.tuxfamily.org</a></p>
<p>License: MPL version 2.0: <a href="https://www.mozilla.org/en-US/MPL/2.0/">https://www.mozilla.org/en-US/MPL/2.0/</a></p>
@@ -45,6 +48,7 @@ List of Open Source components<br />
<hr>
<h3><a name="_TocFreeType"></a>FreeType</h3>
<p>Version: ${FREETYPE_VERSION_STRING}</p>
<p>Web site: <a href="https://www.freetype.org/">https://www.freetype.org/</a></p>
<p>License: FreeType License: <a href="https://gitlab.freedesktop.org/freetype/freetype/-/blob/master/docs/FTL.TXT">https://gitlab.freedesktop.org/freetype/freetype/-/blob/master/docs/FTL.TXT</a></p>
@@ -66,6 +70,7 @@ List of Open Source components<br />
<hr>
<h3><a name="_Ondsel"></a>Ondsel Solver</h3>
<p>Version: 1.0.1</p>
<p>Web site: <a href="https://github.com/Ondsel-Development/OndselSolver">https://github.com/Ondsel-Development/OndselSolver</a></p>
<p>License: LGPL version 2.1: <a href="#_LGPLv21">LGPL v2.1</a></p>
@@ -73,12 +78,14 @@ List of Open Source components<br />
<hr>
<h3><a name="_TocOCCT"></a>Open CASCADE Technology</h3>
<p>Version: ${OCC_VERSION_STRING}</p>
<p>Web site: <a href="https://www.opencascade.com/open-cascade-technology/">https://www.opencascade.com/open-cascade-technology/</a></p>
<p>License: LGPL version 2.1 with additional exception:<a href="https://dev.opencascade.org/resources/licensing">https://dev.opencascade.org/resources/licensing</a></p>
<hr>
<h3><a name="_TocPcl"></a>Point Cloud Library</h3>
<p>Version: ${PCL_VERSION}</p>
<p>Web site: <a href="https://www.pointclouds.org">https://www.pointclouds.org</a></p>
<p>License: BSD-3-clause<a href="https://github.com/PointCloudLibrary/pcl/blob/master/LICENSE.txt">https://github.com/PointCloudLibrary/pcl/blob/master/LICENSE.txt</a></p>
@@ -86,6 +93,7 @@ List of Open Source components<br />
<hr>
<h3><a name="_TocPyCXX"></a>PyCXX</h3>
<p>Version: ${PYCXX_VERSION}</p>
<p>Web site: <a href="http://cxx.sourceforge.net">http://cxx.sourceforge.net</a></p>
<p>License: BSD-3-clause</p>
<pre>
@@ -149,6 +157,7 @@ Additional BSD Notice
<hr>
<h3><a name="_TocPython"></a>Python</h3>
<p>Version: ${PYTHON_VERSION_STRING}</p>
<p>Web site: <a href="https://www.python.org/">https://www.python.org/</a></p>
<p>License: <a href="https://docs.python.org/3.6/license.html">https://docs.python.org/3.6/license.html</a></p>
@@ -156,6 +165,7 @@ Additional BSD Notice
<hr>
<h3><a name="_TocPySide"></a>Qt for Python (Shiboken / PySide)</h3>
<p>Version: ${PySide2_VERSION}</p>
<p>Web site: <a href="https://wiki.qt.io/Qt_for_Python">https://wiki.qt.io/Qt_for_Python</a></p>
<p>License: LGPL version 3 / GPL version 2: <a href="https://tldrlegal.com/license/gnu-lesser-general-public-license-v3-(lgpl-3)">LGPLv3</a> / <a href="https://tldrlegal.com/license/gnu-general-public-license-v2">GPLv2</a>
@@ -163,6 +173,7 @@ Additional BSD Notice
<hr>
<h3><a name="_TocQt"></a>Qt</h3>
<p>Version: ${QtCore_VERSION}</p>
<p>Web site: <a href="https://www.qt.io/">https://www.qt.io/</a></p>
<p>License: LGPL version 3.0: <a href="https://www.gnu.org/licenses/lgpl-3.0.en.html">https://www.gnu.org/licenses/lgpl-3.0.en.html</a></p>
@@ -170,6 +181,7 @@ Additional BSD Notice
<hr>
<h3><a name="_TocSalomeSMESH"></a>Salome SMESH</h3>
<p>Version: ${SMESH_VERSION_MAJOR}.${SMESH_VERSION_MINOR}.${SMESH_VERSION_PATCH}.${SMESH_VERSION_TWEAK}</p>
<p>Web site: <a href="https://www.salome-platform.org/">https://www.salome-platform.org/</a></p>
<p>License: LGPL version 2.1: <a href="#_LGPLv21">LGPL v2.1</a></p>
</pre>
@@ -177,6 +189,7 @@ Additional BSD Notice
<hr>
<h3><a name="_TocVtk"></a>Visualization Toolkit</h3>
<p>Version: ${VTK_VERSION}</p>
<p>Web site: <a href="https://www.vtk.org">https://www.vtk.org</a></p>
<p>License: BSD-3-clause: <a href="https://vtk.org/Wiki/VTK/License">https://vtk.org/Wiki/VTK/License</a></p>
@@ -184,6 +197,7 @@ Additional BSD Notice
<hr>
<h3><a name="_TocXercesC"></a>Xerces-C</h3>
<p>Version: ${XercesC_VERSION}</p>
<p>Web site: <a href="https://xerces.apache.org/xerces-c">https://xerces.apache.org/xerces-c</a></p>
<p>License: Apache License Version 2.0: <a href="https://www.apache.org/licenses/LICENSE-2.0.html">https://www.apache.org/licenses/LICENSE-2.0.html</a></p>
@@ -198,6 +212,7 @@ Additional BSD Notice
<hr>
<h3><a name="_TocZlib"></a>zlib</h3>
<p>Version: ${ZLIB_VERSION_STRING}</p>
<p>Web site: <a href="https://zlib.net/">https://zlib.net/</a></p>
<p>License: zlib: <a href="https://zlib.net/zlib_license.html">https://zlib.net/zlib_license.html</p>
+7 -2
View File
@@ -1,13 +1,18 @@
def OpenInsertObject(importerModule, objectPath, importMethod, docName = ""):
from FreeCAD import Base
import importlib
def OpenInsertObject(importerName, objectPath, importMethod, docName = ""):
try:
importArgs = []
importKwargs = {}
importerModule = importlib.import_module(importerName)
if docName:
importArgs.append(docName)
if hasattr(importerModule, "importOptions"):
importKwargs["options"] = importerModule.importOptions(objectPath)
getattr(importerModule, importMethod)(objectPath, *importArgs, **importKwargs)
except PyExc_FC_AbortIOException:
except Base.AbortIOException:
pass
+9 -9
View File
@@ -45,7 +45,7 @@
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<property name="sizeHint">
<size>
<width>430</width>
<height>17</height>
@@ -74,7 +74,7 @@
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<property name="sizeHint">
<size>
<width>31</width>
<height>20</height>
@@ -97,7 +97,7 @@
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<property name="sizeHint">
<size>
<width>31</width>
<height>20</height>
@@ -172,14 +172,14 @@
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="labelPlatform">
<widget class="QLabel" name="labelArchitecture">
<property name="text">
<string>Word size</string>
<string>Architecture</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QLabel" name="labelBuildPlatform">
<widget class="QLabel" name="labelBuildRunArchitecture">
<property name="text">
<string notr="true">&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style="font-weight:600;"&gt;Unknown&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
@@ -231,7 +231,7 @@
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<property name="sizeHint">
<size>
<width>40</width>
<height>20</height>
@@ -246,7 +246,7 @@
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<property name="sizeHint">
<size>
<width>430</width>
<height>17</height>
@@ -371,7 +371,7 @@ p, li { white-space: pre-wrap; }
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<property name="sizeHint">
<size>
<width>160</width>
<height>31</height>
+5 -13
View File
@@ -28,8 +28,8 @@
# include <QActionGroup>
# include <QApplication>
# include <QEvent>
# include <QFileInfo>
# include <QMenu>
# include <QMessageBox>
# include <QRegularExpression>
# include <QScreen>
# include <QTimer>
@@ -50,8 +50,8 @@
#include "PreferencePages/DlgSettingsWorkbenchesImp.h"
#include "Document.h"
#include "EditorView.h"
#include "FileDialog.h"
#include "Macro.h"
#include "ModuleIO.h"
#include "MainWindow.h"
#include "PythonEditor.h"
#include "WhatsThis.h"
@@ -902,20 +902,13 @@ void RecentFilesAction::activateFile(int id)
}
QString filename = files[id];
QFileInfo fi(filename);
if (!fi.exists() || !fi.isFile()) {
QMessageBox::critical(getMainWindow(), tr("File not found"), tr("The file '%1' cannot be opened.").arg(filename));
if (!ModuleIO::verifyFile(filename)) {
files.removeAll(filename);
setFiles(files);
save();
}
else {
// invokes appendFile()
SelectModule::Dict dict = SelectModule::importHandler(filename);
for (SelectModule::Dict::iterator it = dict.begin(); it != dict.end(); ++it) {
Application::Instance->open(it.key().toUtf8(), it.value().toLatin1());
break;
}
ModuleIO::openFile(filename);
}
}
@@ -1102,8 +1095,7 @@ void RecentMacrosAction::activateFile(int id)
QString filename = files[id];
QFileInfo fi(filename);
if (!fi.exists() || !fi.isFile()) {
QMessageBox::critical(getMainWindow(), tr("File not found"), tr("The file '%1' cannot be opened.").arg(filename));
if (!ModuleIO::verifyFile(filename)) {
files.removeAll(filename);
setFiles(files);
}
+56 -58
View File
@@ -42,6 +42,7 @@
#endif
#include <QLoggingCategory>
#include <fmt/format.h>
#include <App/Document.h>
#include <App/DocumentObjectPy.h>
@@ -448,6 +449,13 @@ Application::Application(bool GUIenabled)
PyModule_AddFunctions(module, Application::Methods);
}
Py::Module(module).setAttr(std::string("ActiveDocument"), Py::None());
Py::Module(module).setAttr(std::string("HasQtBug_129596"),
#ifdef HAS_QTBUG_129596
Py::True()
#else
Py::False()
#endif
);
UiLoaderPy::init_type();
Base::Interpreter().addType(UiLoaderPy::type_object(), module, "UiLoader");
@@ -637,21 +645,10 @@ void Application::open(const char* FileName, const char* Module)
}
}
else {
// Load using provided python module
{
Base::PyGILStateLocker locker;
Py::Module moduleIo(PyImport_ImportModule("freecad.module_io"));
const auto dictS = moduleIo.getDict().keys().as_string();
if (!moduleIo.isNull() && moduleIo.hasAttr("OpenInsertObject"))
{
const Py::TupleN args(
Py::Module(PyImport_ImportModule(Module)),
Py::String(unicodepath),
Py::String("open")
);
moduleIo.callMemberFunction("OpenInsertObject", args);
}
}
std::string code = fmt::format("from freecad import module_io\n"
"module_io.OpenInsertObject(\"{}\", \"{}\", \"{}\")\n",
Module, unicodepath, "open");
Gui::Command::runCommand(Gui::Command::App, code.c_str());
// ViewFit
if (sendHasMsgToActiveView("ViewFit")) {
@@ -690,7 +687,7 @@ void Application::importFrom(const char* FileName, const char* DocName, const ch
wc.setIgnoreEvents(WaitCursor::NoEvents);
Base::FileInfo File(FileName);
std::string te = File.extension();
string unicodepath = Base::Tools::escapedUnicodeFromUtf8(File.filePath().c_str());
string unicodepath = File.filePath().c_str();
unicodepath = Base::Tools::escapeEncodeFilename(unicodepath);
if (Module) {
@@ -716,22 +713,10 @@ void Application::importFrom(const char* FileName, const char* DocName, const ch
}
}
// Load using provided python module
{
Base::PyGILStateLocker locker;
Py::Module moduleIo(PyImport_ImportModule("freecad.module_io"));
const auto dictS = moduleIo.getDict().keys().as_string();
if (!moduleIo.isNull() && moduleIo.hasAttr("OpenInsertObject"))
{
const Py::TupleN args(
Py::Module(PyImport_ImportModule(Module)),
Py::String(unicodepath),
Py::String("insert"),
Py::String(DocName)
);
moduleIo.callMemberFunction("OpenInsertObject", args);
}
}
std::string code = fmt::format("from freecad import module_io\n"
"module_io.OpenInsertObject(\"{}\", \"{}\", \"{}\", \"{}\")\n",
Module, unicodepath, "insert", DocName);
Gui::Command::runCommand(Gui::Command::App, code.c_str());
// Commit the transaction
if (doc && !pendingCommand) {
@@ -1042,7 +1027,7 @@ void Application::slotActiveDocument(const App::Document& Doc)
// Update the application to show the unit change
ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath(
"User parameter:BaseApp/Preferences/Units");
if (Doc.FileName.getValue()[0] != '\0' && !hGrp->GetBool("IgnoreProjectSchema")) {
if (!hGrp->GetBool("IgnoreProjectSchema")) {
int userSchema = Doc.UnitSystem.getValue();
Base::UnitsApi::setSchema(static_cast<Base::UnitSystem>(userSchema));
getMainWindow()->setUserSchema(userSchema);
@@ -1426,6 +1411,11 @@ void Application::viewActivated(MDIView* pcView)
}
}
/// Gets called if a view gets closed
void Application::viewClosed(MDIView* pcView)
{
signalCloseView(pcView);
}
void Application::updateActive()
{
@@ -1923,8 +1913,11 @@ void setCategoryFilterRules()
QTextStream stream(&filter);
stream << "qt.qpa.xcb.warning=false\n";
stream << "qt.qpa.mime.warning=false\n";
stream << "qt.qpa.wayland.warning=false\n";
stream << "qt.qpa.wayland.*.warning=false\n";
stream << "qt.svg.warning=false\n";
stream << "qt.xkb.compose.warning=false\n";
stream << "kf.*.warning=false\n";
stream.flush();
QLoggingCategory::setFilterRules(filter);
}
@@ -2179,46 +2172,51 @@ void setAppNameAndIcon()
void tryRunEventLoop(GUISingleApplication& mainApp)
{
std::stringstream s;
s << App::Application::getUserCachePath() << App::Application::getExecutableName() << "_"
<< QCoreApplication::applicationPid() << ".lock";
std::stringstream out;
out << App::Application::getUserCachePath()
<< App::Application::getExecutableName()
<< "_"
<< App::Application::applicationPid()
<< ".lock";
// open a lock file with the PID
Base::FileInfo fi(s.str());
Base::FileInfo fi(out.str());
Base::ofstream lock(fi);
// In case the file_lock cannot be created start FreeCAD without IPC support.
#if !defined(FC_OS_WIN32) || (BOOST_VERSION < 107600)
std::string filename = s.str();
std::string filename = out.str();
#else
std::wstring filename = fi.toStdWString();
#endif
std::unique_ptr<boost::interprocess::file_lock> flock;
try {
flock = std::make_unique<boost::interprocess::file_lock>(filename.c_str());
flock->lock();
boost::interprocess::file_lock flock(filename.c_str());
if (flock.try_lock()) {
Base::Console().Log("Init: Executing event loop...\n");
QApplication::exec();
// Qt can't handle exceptions thrown from event handlers, so we need
// to manually rethrow SystemExitExceptions.
if (mainApp.caughtException) {
throw Base::SystemExitException(*mainApp.caughtException.get());
}
// close the lock file, in case of a crash we can see the existing lock file
// on the next restart and try to repair the documents, if needed.
flock.unlock();
lock.close();
fi.deleteFile();
}
else {
Base::Console().Warning("Failed to create a file lock for the IPC.\n"
"The application will be terminated\n");
}
}
catch (const boost::interprocess::interprocess_exception& e) {
QString msg = QString::fromLocal8Bit(e.what());
Base::Console().Warning("Failed to create a file lock for the IPC: %s\n",
msg.toUtf8().constData());
}
Base::Console().Log("Init: Executing event loop...\n");
QApplication::exec();
// Qt can't handle exceptions thrown from event handlers, so we need
// to manually rethrow SystemExitExceptions.
if (mainApp.caughtException) {
throw Base::SystemExitException(*mainApp.caughtException.get());
}
// close the lock file, in case of a crash we can see the existing lock file
// on the next restart and try to repair the documents, if needed.
if (flock) {
flock->unlock();
}
lock.close();
fi.deleteFile();
}
void runEventLoop(GUISingleApplication& mainApp)
+8
View File
@@ -32,6 +32,10 @@
#include <App/Application.h>
#if QT_VERSION >= QT_VERSION_CHECK(6,0,0) && QT_VERSION < QT_VERSION_CHECK(6,8,1)
# define HAS_QTBUG_129596
#endif
class QCloseEvent;
class SoNode;
class NavlibInterface;
@@ -95,6 +99,8 @@ public:
void detachView(Gui::BaseView* pcView);
/// get called if a view gets activated, this manage the whole activation scheme
void viewActivated(Gui::MDIView* pcView);
/// get called if a view gets closed
void viewClosed(Gui::MDIView* pcView);
/// call update to all documents and all views (costly!)
void onUpdate();
/// call update to all views of the active document
@@ -135,6 +141,8 @@ public:
boost::signals2::signal<void (const Gui::Document&)> signalShowHidden;
/// signal on activating view
boost::signals2::signal<void (const Gui::MDIView*)> signalActivateView;
/// signal on closing view
boost::signals2::signal<void (const Gui::MDIView*)> signalCloseView;
/// signal on entering in edit mode
boost::signals2::signal<void (const Gui::ViewProviderDocumentObject&)> signalInEdit;
/// signal on leaving edit mode
+5
View File
@@ -1577,6 +1577,11 @@ PyObject* Application::sCoinRemoveAllChildren(PyObject * /*self*/, PyObject *arg
PY_TRY {
void* ptr = nullptr;
Base::Interpreter().convertSWIGPointerObj("pivy.coin","_p_SoGroup", pynode, &ptr, 0);
if (!ptr) {
PyErr_SetString(PyExc_RuntimeError, "Conversion of coin.SoGroup failed");
return nullptr;
}
coinRemoveAllChildren(static_cast<SoGroup*>(ptr));
Py_Return;
}
+10
View File
@@ -3,6 +3,14 @@ add_subdirectory(Stylesheets)
add_subdirectory(PreferencePacks)
add_subdirectory(PreferencePackTemplates)
if(BUILD_WITH_CONDA)
add_definitions(-DFC_CONDA)
endif(BUILD_WITH_CONDA)
if(FC_FLATPAK)
add_definitions(-DFC_FLATPAK)
endif(FC_FLATPAK)
if(WIN32)
add_definitions(-DFCGui -DQSINT_MAKEDLL -DOVR_OS_WIN32 -DQUARTER_INTERNAL -DQUARTER_MAKE_DLL -DCOIN_DLL)
endif(WIN32)
@@ -1231,6 +1239,7 @@ SET(FreeCADGui_CPP_SRCS
GuiConsole.cpp
Macro.cpp
MergeDocuments.cpp
ModuleIO.cpp
Namespace.h
resource.cpp
Control.cpp
@@ -1266,6 +1275,7 @@ SET(FreeCADGui_SRCS
Macro.h
MergeDocuments.h
MetaTypes.h
ModuleIO.h
Notifications.h
PreCompiled.cpp
PreCompiled.h
+4
View File
@@ -204,7 +204,11 @@ QMap<QString, CallTip> CallTipsList::extractTips(const QString& context) const
return tips;
try {
PyErr_Clear();
Py::Module module("__main__");
if (module.ptr() == nullptr) {
return tips;
}
Py::Dict dict = module.getDict();
// this is used to filter out input of the form "1."
+7 -4
View File
@@ -408,6 +408,7 @@ void StdCmdExport::activated(int iMsg)
static QString lastExportFullPath = QString();
static bool lastExportUsedGeneratedFilename = true;
static QString lastExportFilterUsed = QString();
static Document* lastActiveDocument;
auto selection = Gui::Selection().getObjectsOfType(App::DocumentObject::getClassTypeId());
if (selection.empty()) {
@@ -434,15 +435,16 @@ void StdCmdExport::activated(int iMsg)
// Create a default filename for the export
// * If this is the first export this session default, generate a new default.
// * If this is a repeated export during the same session:
// * If this is a repeated export during the same session and file:
// * If the user accepted the default filename last time, regenerate a new
// default, potentially updating the object label.
// * If not, default to their previously-set export filename.
QString defaultFilename = lastExportFullPath;
bool filenameWasGenerated = false;
// We want to generate a new default name in two cases:
if (defaultFilename.isEmpty() || lastExportUsedGeneratedFilename) {
bool didActiveDocumentChange = lastActiveDocument != getActiveGuiDocument();
// We want to generate a new default name in three cases:
if (defaultFilename.isEmpty() || lastExportUsedGeneratedFilename || didActiveDocumentChange) {
// First, get the name and path of the current .FCStd file, if there is one:
QString docFilename = QString::fromUtf8(
App::GetApplication().getActiveDocument()->getFileName());
@@ -461,7 +463,7 @@ void StdCmdExport::activated(int iMsg)
defaultExportPath = Gui::FileDialog::getWorkingDirectory();
}
if (lastExportUsedGeneratedFilename /*<- static, true on first call*/ ) {
if (lastExportUsedGeneratedFilename || didActiveDocumentChange) { /*<- static, true on first call*/
defaultFilename = defaultExportPath + QLatin1Char('/') + createDefaultExportBasename();
// Append the last extension used, if there is one.
@@ -499,6 +501,7 @@ void StdCmdExport::activated(int iMsg)
else
lastExportUsedGeneratedFilename = false;
lastExportFullPath = fileName;
lastActiveDocument = getActiveGuiDocument();
}
}
+51
View File
@@ -29,6 +29,9 @@
# include <QRegularExpression>
# include <QRegularExpressionMatch>
# include <QWhatsThis>
# include <QAbstractButton>
# include <QTimer>
# include <QProcess>
#endif
#include <App/Document.h>
@@ -319,6 +322,53 @@ void StdCmdWhatsThis::activated(int iMsg)
QWhatsThis::enterWhatsThisMode();
}
//===========================================================================
// Std_RestartInSafeMode
//===========================================================================
DEF_STD_CMD(StdCmdRestartInSafeMode)
StdCmdRestartInSafeMode::StdCmdRestartInSafeMode()
:Command("Std_RestartInSafeMode")
{
sGroup = "Help";
sMenuText = QT_TR_NOOP("Restart in safe mode");
sToolTipText = QT_TR_NOOP("Restart in safe mode");
sWhatsThis = "Std_RestartInSafeMode";
sStatusTip = QT_TR_NOOP("Restart in safe mode");
sPixmap = "safe-mode-restart";
eType = 0;
}
void StdCmdRestartInSafeMode::activated(int iMsg)
{
Q_UNUSED(iMsg);
QMessageBox restartBox;
restartBox.setIcon(QMessageBox::Warning);
restartBox.setWindowTitle(QObject::tr("Restart in safe mode"));
restartBox.setText(QObject::tr("Are you sure you want to restart FreeCAD and enter safe mode?"));
restartBox.setInformativeText(QObject::tr("Safe mode temporarily disables your configuration and addons."));
restartBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
restartBox.setDefaultButton(QMessageBox::No);
if (restartBox.exec() == QMessageBox::Yes) {
//restart FreeCAD after a delay to give time to this dialog to close
const int ms = 1000;
QTimer::singleShot(ms, []()
{
QStringList args = QApplication::arguments();
args.pop_front();
auto const safeModeArgument = QString::fromLatin1("--safe-mode");
if (!args.contains(safeModeArgument)) {
args.append(safeModeArgument);
}
if (getMainWindow()->close()) {
QProcess::startDetached(QApplication::applicationFilePath(), args);
}
});
}
}
//===========================================================================
// Std_DlgParameter
//===========================================================================
@@ -938,6 +988,7 @@ void CreateStdCommands()
rcCmdMgr.addCommand(new StdCmdRecentFiles());
rcCmdMgr.addCommand(new StdCmdRecentMacros());
rcCmdMgr.addCommand(new StdCmdWhatsThis());
rcCmdMgr.addCommand(new StdCmdRestartInSafeMode());
rcCmdMgr.addCommand(new StdCmdPythonHelp());
rcCmdMgr.addCommand(new StdCmdOnlineHelp());
rcCmdMgr.addCommand(new StdCmdOnlineHelpWebsite());
+1
View File
@@ -166,6 +166,7 @@ void StdCmdVarSet::activated(int iMsg)
group->addObject(doc->getObject(VarSetName.c_str()));
}
}
commitCommand();
doCommand(Doc, "App.ActiveDocument.getObject('%s').ViewObject.doubleClicked()", VarSetName.c_str());
}
+12 -6
View File
@@ -308,15 +308,21 @@ void Model::slotChangeObject(const ViewProviderDocumentObject &VPDObjectIn, cons
//renaming of objects.
if (std::string("Label") == name)
{
const GraphLinkRecord &record = findRecord(&VPDObjectIn, *graphLink);
auto text = (*theGraph)[record.vertex].text.get();
text->setPlainText(QString::fromUtf8(record.DObject->Label.getValue()));
if (hasRecord(&VPDObjectIn, *graphLink))
{
const GraphLinkRecord &record = findRecord(&VPDObjectIn, *graphLink);
auto text = (*theGraph)[record.vertex].text.get();
text->setPlainText(QString::fromUtf8(record.DObject->Label.getValue()));
}
}
else if (propertyIn.isDerivedFrom(App::PropertyLinkBase::getClassTypeId()))
{
const GraphLinkRecord &record = findRecord(&VPDObjectIn, *graphLink);
boost::clear_vertex(record.vertex, *theGraph);
graphDirty = true;
if (hasRecord(&VPDObjectIn, *graphLink))
{
const GraphLinkRecord &record = findRecord(&VPDObjectIn, *graphLink);
boost::clear_vertex(record.vertex, *theGraph);
graphDirty = true;
}
}
}
+8
View File
@@ -55,6 +55,14 @@ bool Gui::DAG::hasRecord(const App::DocumentObject* dObjectIn, const GraphLinkCo
return it != list.end();
}
bool Gui::DAG::hasRecord(const ViewProviderDocumentObject* VPDObjectIn, const GraphLinkContainer &containerIn)
{
using List = GraphLinkContainer::index<GraphLinkRecord::ByVPDObject>::type;
const List &list = containerIn.get<GraphLinkRecord::ByVPDObject>();
List::const_iterator it = list.find(VPDObjectIn);
return it != list.end();
}
const GraphLinkRecord& Gui::DAG::findRecord(Vertex vertexIn, const GraphLinkContainer &containerIn)
{
using List = GraphLinkContainer::index<GraphLinkRecord::ByVertex>::type;
+1
View File
@@ -284,6 +284,7 @@ namespace Gui
>;
bool hasRecord(const App::DocumentObject* dObjectIn, const GraphLinkContainer &containerIn);
bool hasRecord(const ViewProviderDocumentObject* VPDObjectIn, const GraphLinkContainer &containerIn);
const GraphLinkRecord& findRecord(Vertex vertexIn, const GraphLinkContainer &containerIn);
const GraphLinkRecord& findRecord(const App::DocumentObject* dObjectIn, const GraphLinkContainer &containerIn);
const GraphLinkRecord& findRecord(const Gui::ViewProviderDocumentObject* VPDObjectIn, const GraphLinkContainer &containerIn);
+8
View File
@@ -28,6 +28,7 @@
#include <App/Application.h>
#include <App/Document.h>
#include <App/DocumentObject.h>
#include <App/ExpressionParser.h>
#include <Base/Tools.h>
#include "DlgAddProperty.h"
@@ -111,6 +112,13 @@ void DlgAddProperty::accept()
if(ui->chkAppend->isChecked())
name = group + "_" + name;
if (App::ExpressionParser::isTokenAUnit(name) || App::ExpressionParser::isTokenAConstant(name)) {
QMessageBox::critical(getMainWindow(),
QObject::tr("Invalid name"),
QObject::tr("The property name is a reserved word."));
return;
}
for(auto c : containers) {
auto prop = c->getPropertyByName(name.c_str());
if(prop && prop->getContainer() == c) {
+127 -42
View File
@@ -30,13 +30,13 @@
#include <App/Application.h>
#include <App/Document.h>
#include <App/DocumentObject.h>
#include <App/ExpressionParser.h>
#include <App/PropertyUnits.h>
#include <Base/Tools.h>
#include "DlgAddPropertyVarSet.h"
#include "ui_DlgAddPropertyVarSet.h"
#include "MainWindow.h"
#include "ViewProviderDocumentObject.h"
#include "ViewProviderVarSet.h"
FC_LOG_LEVEL_INIT("DlgAddPropertyVarSet", true, true)
@@ -47,6 +47,8 @@ using namespace Gui::Dialog;
const std::string DlgAddPropertyVarSet::GROUP_BASE = "Base";
const bool CLEAR_NAME = true;
const bool ABORT = true;
const bool COMMIT = false;
DlgAddPropertyVarSet::DlgAddPropertyVarSet(QWidget* parent,
ViewProviderVarSet* viewProvider)
@@ -55,7 +57,8 @@ DlgAddPropertyVarSet::DlgAddPropertyVarSet(QWidget* parent,
ui(new Ui_DlgAddPropertyVarSet),
comboBoxGroup(this),
completerType(this),
editor(nullptr)
editor(nullptr),
transactionID(0)
{
ui->setupUi(this);
@@ -66,12 +69,9 @@ DlgAddPropertyVarSet::~DlgAddPropertyVarSet() = default;
void DlgAddPropertyVarSet::initializeGroup()
{
connect(&comboBoxGroup, &EditFinishedComboBox::editFinished,
this, &DlgAddPropertyVarSet::onEditFinished);
comboBoxGroup.setObjectName(QString::fromUtf8("comboBoxGroup"));
comboBoxGroup.setInsertPolicy(QComboBox::InsertAtTop);
comboBoxGroup.setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
comboBoxGroup.setEditable(true);
auto formLayout = qobject_cast<QFormLayout*>(layout());
formLayout->setWidget(1, QFormLayout::FieldRole, &comboBoxGroup);
@@ -101,6 +101,8 @@ void DlgAddPropertyVarSet::initializeGroup()
}
comboBoxGroup.setEditText(QString::fromStdString(groupNamesSorted[0]));
connComboBoxGroup = connect(&comboBoxGroup, &EditFinishedComboBox::editFinished,
this, &DlgAddPropertyVarSet::onEditFinished);
}
void DlgAddPropertyVarSet::getSupportedTypes(std::vector<Base::Type>& types)
@@ -140,8 +142,8 @@ void DlgAddPropertyVarSet::initializeTypes()
ui->comboBoxType->setCompleter(&completerType);
ui->comboBoxType->setInsertPolicy(QComboBox::NoInsert);
connect(ui->comboBoxType, &QComboBox::currentTextChanged,
this, &DlgAddPropertyVarSet::onEditFinished);
connComboBoxType = connect(ui->comboBoxType, &QComboBox::currentTextChanged,
this, &DlgAddPropertyVarSet::onEditFinished);
}
/*
@@ -167,9 +169,9 @@ void DlgAddPropertyVarSet::initializeWidgets(ViewProviderVarSet* viewProvider)
connect(this, &QDialog::finished,
this, [viewProvider](int result) { viewProvider->onFinished(result); });
connect(ui->lineEditName, &QLineEdit::editingFinished,
this, &DlgAddPropertyVarSet::onEditFinished);
connect(ui->lineEditName, &QLineEdit::textChanged,
connLineEditNameEditFinished = connect(ui->lineEditName, &QLineEdit::editingFinished,
this, &DlgAddPropertyVarSet::onEditFinished);
connLineEditNameTextChanged = connect(ui->lineEditName, &QLineEdit::textChanged,
this, &DlgAddPropertyVarSet::onNamePropertyChanged);
std::string title = "Add a property to " + varSet->getFullName();
@@ -200,6 +202,7 @@ void DlgAddPropertyVarSet::clearEditors(bool clearName)
ui->lineEditName->blockSignals(beforeBlocked);
}
removeEditor();
ui->lineEditToolTip->clear();
setOkEnabled(false);
namePropertyToAdd.clear();
}
@@ -260,19 +263,19 @@ void DlgAddPropertyVarSet::createProperty()
std::string name = ui->lineEditName->text().toStdString();
std::string group = comboBoxGroup.currentText().toStdString();
std::string type = ui->comboBoxType->currentText().toStdString();
std::string doc = ui->lineEditToolTip->text().toStdString();
App::Property* prop;
try {
prop = varSet->addDynamicProperty(type.c_str(), name.c_str(),
group.c_str());
group.c_str(), doc.c_str());
}
catch (Base::Exception& e) {
e.ReportException();
QMessageBox::critical(this,
QObject::tr("Add property"),
QObject::tr("Failed to add property to '%1': %2").arg(
QString::fromLatin1(varSet->getFullName().c_str()),
QString::fromUtf8(e.what())));
critical(QObject::tr("Add property"),
QObject::tr("Failed to add property to '%1': %2").arg(
QString::fromLatin1(varSet->getFullName().c_str()),
QString::fromUtf8(e.what())));
clearEditors();
return;
}
@@ -293,6 +296,17 @@ void DlgAddPropertyVarSet::createProperty()
setOkEnabled(true);
}
App::Property* DlgAddPropertyVarSet::getPropertyToAdd() {
// This function should be called only if it is certain the property exists.
// It will throw a runtime error if not.
App::Property* prop = varSet->getPropertyByName(namePropertyToAdd.c_str());
if (prop == nullptr) {
FC_THROWM(Base::RuntimeError, "A property with name '" << namePropertyToAdd << "' does not exist.");
}
return prop;
}
void DlgAddPropertyVarSet::changePropertyToAdd() {
// we were already adding a new property, the only option to get here
// is a change of type or group.
@@ -300,11 +314,13 @@ void DlgAddPropertyVarSet::changePropertyToAdd() {
std::string name = ui->lineEditName->text().toStdString();
assert(name == namePropertyToAdd);
App::Property* prop = varSet->getPropertyByName(namePropertyToAdd.c_str());
// performs a check for nullptr
App::Property* prop = getPropertyToAdd();
std::string group = comboBoxGroup.currentText().toStdString();
std::string doc = ui->lineEditToolTip->text().toStdString();
if (prop->getGroup() != group) {
varSet->changeDynamicProperty(prop, group.c_str(), nullptr);
varSet->changeDynamicProperty(prop, group.c_str(), doc.c_str());
}
std::string type = ui->comboBoxType->currentText().toStdString();
@@ -316,13 +332,40 @@ void DlgAddPropertyVarSet::changePropertyToAdd() {
}
/* We use these functions rather than the functions provided by App::Document
* because this dialog may be opened when another transaction is in progress.
* An example is opening a sketch. If this dialog uses the functions provided
* by App::Document, a reject of the dialog would close that transaction. By
* checking whether the transaction ID is "our" transaction ID, we prevent this
* behavior.
*/
void DlgAddPropertyVarSet::openTransaction()
{
transactionID = App::GetApplication().setActiveTransaction("Add property VarSet");
}
bool DlgAddPropertyVarSet::hasPendingTransaction()
{
return transactionID != 0;
}
void DlgAddPropertyVarSet::closeTransaction(bool abort)
{
if (transactionID != 0) {
App::GetApplication().closeActiveTransaction(abort, transactionID);
transactionID = 0;
}
}
void DlgAddPropertyVarSet::clearCurrentProperty()
{
removeEditor();
varSet->removeDynamicProperty(namePropertyToAdd.c_str());
App::Document* doc = varSet->getDocument();
if (doc->hasPendingTransaction()) {
doc->abortTransaction();
if (hasPendingTransaction()) {
closeTransaction(ABORT);
}
setOkEnabled(false);
namePropertyToAdd.clear();
@@ -343,10 +386,16 @@ private:
void DlgAddPropertyVarSet::checkName() {
std::string name = ui->lineEditName->text().toStdString();
if(name.empty() || name != Base::Tools::getIdentifier(name)) {
QMessageBox::critical(getMainWindow(),
QObject::tr("Invalid name"),
QObject::tr("The property name must only contain alpha numericals,\n"
"underscore, and must not start with a digit."));
critical(QObject::tr("Invalid name"),
QObject::tr("The property name must only contain alpha numericals,\n"
"underscore, and must not start with a digit."));
clearEditors(!CLEAR_NAME);
throw CreatePropertyException("Invalid name");
}
if(App::ExpressionParser::isTokenAUnit(name) || App::ExpressionParser::isTokenAConstant(name)) {
critical(QObject::tr("Invalid name"),
QObject::tr("The property name is a reserved word."));
clearEditors(!CLEAR_NAME);
throw CreatePropertyException("Invalid name");
}
@@ -355,11 +404,10 @@ void DlgAddPropertyVarSet::checkName() {
// we are adding a new property, check whether it doesn't already exist
auto prop = varSet->getPropertyByName(name.c_str());
if(prop && prop->getContainer() == varSet) {
QMessageBox::critical(this,
QObject::tr("Invalid name"),
QObject::tr("The property '%1' already exists in '%2'").arg(
QString::fromLatin1(name.c_str()),
QString::fromLatin1(varSet->getFullName().c_str())));
critical(QObject::tr("Invalid name"),
QObject::tr("The property '%1' already exists in '%2'").arg(
QString::fromLatin1(name.c_str()),
QString::fromLatin1(varSet->getFullName().c_str())));
clearEditors(!CLEAR_NAME);
throw CreatePropertyException("Invalid name");
}
@@ -370,10 +418,9 @@ void DlgAddPropertyVarSet::checkGroup() {
std::string group = comboBoxGroup.currentText().toStdString();
if (group.empty() || group != Base::Tools::getIdentifier(group)) {
QMessageBox::critical(this,
QObject::tr("Invalid name"),
QObject::tr("The group name must only contain alpha numericals,\n"
"underscore, and must not start with a digit."));
critical(QObject::tr("Invalid name"),
QObject::tr("The group name must only contain alpha numericals,\n"
"underscore, and must not start with a digit."));
comboBoxGroup.setEditText(QString::fromUtf8("Base"));
throw CreatePropertyException("Invalid name");
}
@@ -401,6 +448,7 @@ void DlgAddPropertyVarSet::onEditFinished() {
checkName();
checkGroup();
checkType();
// no check for tooltip, we accept any string
}
catch (const CreatePropertyException&) {
if (!namePropertyToAdd.empty()) {
@@ -411,8 +459,7 @@ void DlgAddPropertyVarSet::onEditFinished() {
if (namePropertyToAdd.empty()) {
// we are adding a new property
App::Document* doc = varSet->getDocument();
doc->openTransaction("Add property VarSet");
openTransaction();
createProperty();
}
else {
@@ -430,6 +477,15 @@ void DlgAddPropertyVarSet::onNamePropertyChanged(const QString& text)
}
}
void DlgAddPropertyVarSet::critical(const QString& title, const QString& text) {
static bool criticalDialogShown = false;
if (!criticalDialogShown) {
criticalDialogShown = true;
QMessageBox::critical(this, title, text);
criticalDialogShown = false;
}
}
void DlgAddPropertyVarSet::valueChanged()
{
QVariant data;
@@ -437,14 +493,34 @@ void DlgAddPropertyVarSet::valueChanged()
propertyItem->setData(data);
}
void DlgAddPropertyVarSet::addDocumentation() {
/* Add the documentation to an existing property.
* Note that this method assumes the property exists.
*
* Since there is no check on documentation (we accept any string), there
* is no signal handler for the documentation field. This method updates
* the property that is being added with the text inserted as
* documentation/tooltip.
*
* This function should be called at a late stage, before doing the accept.
*/
std::string group = comboBoxGroup.currentText().toStdString();
std::string doc = ui->lineEditToolTip->text().toStdString();
// performs a check for nullptr
App::Property* prop = getPropertyToAdd();
varSet->changeDynamicProperty(prop, group.c_str(), doc.c_str());
}
void DlgAddPropertyVarSet::accept()
{
App::Document* doc = varSet->getDocument();
doc->commitTransaction();
addDocumentation();
closeTransaction(COMMIT);
if (ui->checkBoxAdd->isChecked()) {
clearEditors();
doc->openTransaction();
openTransaction();
ui->lineEditName->setFocus();
return;
}
@@ -460,10 +536,19 @@ void DlgAddPropertyVarSet::accept()
void DlgAddPropertyVarSet::reject()
{
App::Document* doc = varSet->getDocument();
// On reject we can disconnect the signal handlers because nothing useful
// is to be done. Otherwise, signals may activate the handlers that assume
// that a new property has been created, an assumption that will be
// violated by aborting the transaction because it will remove the newly
// created property.
disconnect(connComboBoxGroup);
disconnect(connComboBoxType);
disconnect(connLineEditNameEditFinished);
disconnect(connLineEditNameTextChanged);
// a transaction is not pending if a name has not been determined.
if (doc->hasPendingTransaction()) {
doc->abortTransaction();
if (hasPendingTransaction()) {
closeTransaction(ABORT);
}
QDialog::reject();
}
+28 -4
View File
@@ -42,14 +42,21 @@ namespace Dialog {
class EditFinishedComboBox : public QComboBox {
Q_OBJECT
public:
explicit EditFinishedComboBox(QWidget *parent = nullptr) : QComboBox(parent) {}
explicit EditFinishedComboBox(QWidget *parent = nullptr) : QComboBox(parent) {
setEditable(true);
connect(this, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &EditFinishedComboBox::onIndexChanged);
connect(this->lineEdit(), &QLineEdit::editingFinished, this, &EditFinishedComboBox::onEditingFinished);
}
Q_SIGNALS:
void editFinished();
protected:
void focusOutEvent(QFocusEvent *event) override {
QComboBox::focusOutEvent(event);
private:
void onEditingFinished() {
Q_EMIT editFinished();
}
void onIndexChanged() {
Q_EMIT editFinished();
}
};
@@ -89,13 +96,21 @@ private:
void createProperty();
void changePropertyToAdd();
void openTransaction();
bool hasPendingTransaction();
void abortTransaction();
void closeTransaction(bool abort);
void checkName();
void checkGroup();
void checkType();
void onEditFinished();
void onNamePropertyChanged(const QString& text);
void critical(const QString& title, const QString& text);
void getSupportedTypes(std::vector<Base::Type>& types);
App::Property* getPropertyToAdd();
void addDocumentation();
private:
std::unordered_set<std::string> typesWithoutEditor = {
@@ -117,6 +132,15 @@ private:
std::string namePropertyToAdd;
std::unique_ptr<PropertyEditor::PropertyItem> propertyItem;
std::unique_ptr<App::ObjectIdentifier> objectIdentifier;
// a transactionID of 0 means that there is no active transaction.
int transactionID;
// connections
QMetaObject::Connection connComboBoxGroup;
QMetaObject::Connection connComboBoxType;
QMetaObject::Connection connLineEditNameEditFinished;
QMetaObject::Connection connLineEditNameTextChanged;
};
} // namespace Dialog
+14
View File
@@ -118,6 +118,15 @@ DlgExpressionInput::DlgExpressionInput(const App::ObjectIdentifier & _path,
DlgExpressionInput::~DlgExpressionInput()
{
disconnect(ui->checkBoxVarSets, &QCheckBox::stateChanged,
this, &DlgExpressionInput::onCheckVarSets);
disconnect(ui->comboBoxVarSet, qOverload<int>(&QComboBox::currentIndexChanged),
this, &DlgExpressionInput::onVarSetSelected);
disconnect(ui->lineEditGroup, &QLineEdit::textChanged,
this, &DlgExpressionInput::onTextChangedGroup);
disconnect(ui->lineEditPropNew, &QLineEdit::textChanged,
this, &DlgExpressionInput::namePropChanged);
delete ui;
}
@@ -428,6 +437,11 @@ static bool isNamePropOk(const QString& nameProp, App::DocumentObject* obj,
return false;
}
if (ExpressionParser::isTokenAUnit(name) || ExpressionParser::isTokenAConstant(name)) {
message << name << " is a reserved word";
return false;
}
auto prop = obj->getPropertyByName(name.c_str());
if (prop && prop->getContainer() == obj) {
message << name << " already exists";
+34 -30
View File
@@ -28,6 +28,7 @@
#include <QComboBox>
#include <QSignalBlocker>
#include <QTextStream>
#include <QTimer>
#endif
#include <App/Document.h>
@@ -45,6 +46,8 @@
#include "Macro.h"
#include "MainWindow.h"
#include "PythonEditor.h"
#include "Workbench.h"
#include "WorkbenchManager.h"
using namespace Gui;
@@ -757,7 +760,7 @@ Note: your changes will be applied when you next switch workbenches\n"));
**/
QString instructions2 =
tr("Walkthrough instructions: Click right arrow button (->), then Close.");
tr("Walkthrough instructions: Select macro from list, then click right arrow button (->), then Close.");
auto workbenchBox =
setupToolbarPage->findChild<QComboBox*>(QString::fromLatin1("workbenchBox"));
if (!workbenchBox) {
@@ -769,10 +772,7 @@ Note: your changes will be applied when you next switch workbenches\n"));
int globalIdx = workbenchBox->findData(QString::fromLatin1("Global"));
if (globalIdx != -1) {
workbenchBox->setCurrentIndex(globalIdx);
QMetaObject::invokeMethod(setupToolbarPage,
"on_workbenchBox_activated",
Qt::DirectConnection,
Q_ARG(int, globalIdx));
setupToolbarPage->activateWorkbenchBox(globalIdx);
}
else {
Base::Console().Warning("Toolbar walkthrough: Unable to find Global workbench\n");
@@ -786,7 +786,7 @@ Note: your changes will be applied when you next switch workbenches\n"));
}
else {
newButton->setStyleSheet(QString::fromLatin1("color:red"));
instructions2 = tr("Walkthrough instructions: Click New, then right arrow (->) "
instructions2 = tr("Walkthrough instructions: Click New, select macro, then right arrow (->) "
"button, then Close.");
}
}
@@ -812,10 +812,6 @@ Note: your changes will be applied when you next switch workbenches\n"));
int macrosIdx = categoryBox->findText(tr("Macros"));
if (macrosIdx != -1) {
categoryBox->setCurrentIndex(macrosIdx);
QMetaObject::invokeMethod(setupToolbarPage,
"on_categoryBox_activated",
Qt::DirectConnection,
Q_ARG(int, macrosIdx));
}
else {
Base::Console().Warning("Toolbar walkthrough: Unable to find Macros in categoryBox\n");
@@ -832,31 +828,39 @@ Note: your changes will be applied when you next switch workbenches\n"));
toolbarTreeWidget->expandAll();
}
/** preselect macro command for user **/
auto commandTreeWidget =
setupToolbarPage->findChild<QTreeWidget*>(QString::fromLatin1("commandTreeWidget"));
if (!commandTreeWidget) {
Base::Console().Warning("Toolbar walkthrough: Unable to find commandTreeWidget\n");
}
else {
if (!hasMacroCommand) { // will be the last in the list, the one just created
commandTreeWidget->setCurrentItem(
commandTreeWidget->topLevelItem(commandTreeWidget->topLevelItemCount() - 1));
commandTreeWidget->scrollToItem(commandTreeWidget->currentItem());
/** preselect macro command for user after a short delay to allow time for the
tree widget to populate all the actions
**/
QTimer::singleShot(500, [=]() {
auto commandTreeWidget =
setupToolbarPage->findChild<QTreeWidget*>(QString::fromLatin1("commandTreeWidget"));
if (!commandTreeWidget) {
Base::Console().Warning("Toolbar walkthrough: Unable to find commandTreeWidget\n");
}
else { // pre-select it for the user (will be the macro menu text)
QList<QTreeWidgetItem*> items =
commandTreeWidget->findItems(macroMenuText,
Qt::MatchFixedString | Qt::MatchWrap,
1);
if (!items.empty()) {
commandTreeWidget->setCurrentItem(items[0]);
else {
if (!hasMacroCommand) { // will be the last in the list, the one just created
commandTreeWidget->setCurrentItem(
commandTreeWidget->topLevelItem(commandTreeWidget->topLevelItemCount() - 1));
commandTreeWidget->scrollToItem(commandTreeWidget->currentItem());
}
else { // pre-select it for the user (will be the macro menu text)
QList<QTreeWidgetItem*> items =
commandTreeWidget->findItems(macroMenuText,
Qt::MatchFixedString | Qt::MatchWrap,
1);
if (!items.empty()) {
commandTreeWidget->setCurrentItem(items[0]);
commandTreeWidget->scrollToItem(commandTreeWidget->currentItem());
}
}
}
}
});
dlg.exec();
// refresh toolbar so new icon shows up immediately
Workbench* active = Gui::WorkbenchManager::instance()->active();
if (active) {
active->activate();
}
}
+5
View File
@@ -172,6 +172,11 @@ void DlgCustomToolbars::hideEvent(QHideEvent* event)
void DlgCustomToolbars::onActivateCategoryBox()
{}
// called from DlgMacroExecuteImp toolbar walkthrough function
void DlgCustomToolbars::activateWorkbenchBox(int index) {
onWorkbenchBoxActivated(index);
}
void DlgCustomToolbars::onWorkbenchBoxActivated(int index)
{
QVariant data = ui->workbenchBox->itemData(index, Qt::UserRole);
+3
View File
@@ -52,6 +52,9 @@ protected:
explicit DlgCustomToolbars(Type, QWidget* parent = nullptr);
~DlgCustomToolbars() override;
public:
void activateWorkbenchBox(int index); // Public accessor for DlgMacroExecuteImp
protected:
void setupConnections();
void onWorkbenchBoxActivated(int index);

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