Commit Graph

29789 Commits

Author SHA1 Message Date
lorenz
a3a0d316b1 cam: remove imghdr import (#18081) 2024-12-06 11:27:36 -06:00
Dan Henderson
95ef2d5147 Path: Add G84/G74 Tapping Operation (#8069) 2024-12-06 11:21:49 -06:00
Jiří Mácha
878d9525dc Assembly: migrationScript2 and migrationScript4 improved and refactored
Description of Defects in migrationScript2 and migrationScript4:

Several additional issues have been identified in the Assembly
functions migrationScript4 and migrationScript2, beyond those fixed in
patch 71f0104bb2.

One common problem is that the Joint property Reference1 or Reference2
can be set to an invalid format. For example, user can manually cause
this issue by assigning an incorrect reference (e.g., the Z-axis) to
these properties via the FreeCAD GUI.  When this happens, internal
errors (exceptions and their corresponding Python call stack) are
reported in the Report View.  However, such information is not helpful
for the user to fix their 3D model.

Issues with the Current Implementation (Using migrationScript4 as
Reference):

- Lack of Type Validation for Reference1 and Reference2:

  The script does not check whether joint.Reference1[1] or
  joint.Reference2[1] is a sequence. If this condition is not met,
  statements like:

    sub1 = joint.Reference1[1][0]

  will throw an exception, printing the Python call stack.

- Lack of Length Validation for Sequences:

  The script does not ensure that the sequence length is sufficient
  for indexing. For example, joint.Reference1 and joint.Reference2
  must each have at least two elements to allow:

    joint.Reference1[1][1]
    joint.Reference2[1][1]

  Without validation, such calls can result in exceptions, printing the
  Python call stack.

- No Feedback on Problematic Joint:

  The user is not informed about which Assembly joint in the object
  hierarchy has an invalid Reference1 or Reference2. Depending on the
  size of the 3D model, identifying the defect can be time-consuming
  and frustrating without proper feedback.

This patch is focused on:

- Reporting Problematic Joint Path:

  A new function has been added to retrieve the full path to the
  Assembly joint. The return value (a string) is used to report the
  issue.

- Improved Exception Handling:

  Instead of adding more conditional checks (see above), exception
  handling is implemented. AttributeError, IndexError, and TypeError
  exceptions are caught. The exception message (excluding the call
  stack) is displayed at the end of a user-friendly warning.

- User-Friendly Warnings in the Report View:

  A single-line warning is now shown in the Report View, containing
  the following details:

    - Source of Warning:              'Assembly joint'
    - Location in the 3D Model: e.g., 'Assembly_XY.object_XY.joint_XY'
    - Problematic Attribute: e.g.,    'ReferenceXY'
    - Exception Message: e.g.,        'list index out of range'

- Refactoring and Optimization:

  The functions were refactored and optimized at the end of the
  conversion process.

Advantages:

- Cleaner Report View:
  Internal errors (e.g., Python call stacks) are no longer logged in
  the Report View, as they are not useful for end users. Only the
  exception message is displayed.

- Improved User Feedback:
  Users can now identify the problematic Assembly joint in the object
  hierarchy, saving significant time and effort.

- Robust and Concise Code:
  The solution simplifies the code while increasing its robustness.
2024-12-06 12:13:41 -05:00
marioalexis
726eee50c2 Fem: Fix references assignment in centrif example 2024-12-06 12:12:55 -05:00
Chris Hennes
b87bdc1f84 Merge pull request #18126 from Ondsel-Development/core_LCS2
Core datums : Card2 : Core implementation
2024-12-06 12:12:04 -05:00
Roy-043
28749e44dd Merge pull request #17379 from yorikvanhavre/draft-fix-annotation
Draft: better check for Gui object
2024-12-06 18:05:41 +01:00
Chris Hennes
cdf6af935e Merge pull request #17315 from mwganson/ssclearall
[Spreadsheet] avoid removing user dynamic properties when clearing ce…
2024-12-06 11:57:45 -05:00
Florian Foinant-Willig
1eb8496aae [Core] Fix for frozen status
A frozen object prevents the document to be saved
The frozen status propagates into object inheritance
A frozen sketch is no more editable
Transform and Placement can't be changed for a frozen object
The freeze icon is reduced
2024-12-06 11:56:48 -05:00
Andrea
b6697c12eb MOD: ImportOcaf2::getcolor
getcolor()
      fucntion optimizzazion.
      removed duplicated check.

Clean class ImportOCAF2
[pre-commit.ci] auto fixes from pre-commit.com hooks

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

.

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

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

.

Update ImportOCAF2.cpp

.
2024-12-06 11:55:51 -05:00
Andrea
6d899e7d57 [Mod] clean JoinFeatures.py
Removed dead code
.
2024-12-06 11:55:09 -05:00
Jiří Pinkava
3164ee1849 [PartDesign]: Sort sketches in Attach sketch tool alphabetically
The order of sketches in sketch attaching tool is now determined
by the order in which they were added to document.
Sorting them alphabetically makes IMHO much easier to find a sketch
by user, compared to current state, especially in large and complex
projects with lot of sketches. Of cuser thix expects the user
use sensible names for the sketches.
2024-12-06 11:52:59 -05:00
Nicola Cerone
571018807e Gui: Added SendToPythonConsole item in PartDesign tree view right-click menu. 2024-12-06 11:46:46 -05:00
marioalexis
7411ffd199 Fem: Add box and elliptical beam section types - fixes #12614 2024-12-06 11:44:05 -05:00
PaddleStroke
4a80af74f4 PartDesign: revert c09ef94 and a3c4f4b to fix https://github.com/FreeCAD/FreeCAD/issues/17949 2024-12-06 11:36:51 -05:00
Roy-043
e28286a2ef Draft: allow point for Trimex extrusion to be co-planar with the face
Fixes #14826.

If the point for the extrusion height is co-planar with the face, the normal of the face is used for the direction of the extrusion. The user can then enter a positive or negative value in the task panel. It is probably not the ideal solution, but better than what we have now I think.
2024-12-06 13:10:18 +01:00
FEA-eng
870e260bc9 FEM: Update checksanalysis.py 2024-12-05 21:21:17 +01:00
Roy-043
6858a1c0b4 Draft: make Trimex extrude mode link-aware
Fixes #14670.
2024-12-05 15:53:38 +01:00
PaddleStroke
760091bc8a Sketcher: Fix first external geo deletion failure. 2024-12-05 15:23:25 +01:00
Yorik van Havre
d6c415e268 BIM: Fixed IFC type icon 2024-12-05 12:31:56 +01:00
Yorik van Havre
57637b6866 BIM: NativeIFC: Support for types 2024-12-05 12:31:56 +01:00
Roy-043
672819fd6b Merge pull request #18299 from Roy-043/Draft-change-position-of-Scale-multiplier-field-in-UI
Draft: change position of 'Scale multiplier' field in UI
2024-12-05 12:17:38 +01:00
Roy-043
e41ac03bcc Merge pull request #18307 from Roy-043/Draft-Fix-make_point-color-regression
Draft: Fix make_point color regression
2024-12-05 11:53:24 +01:00
Roy-043
32fa1f7411 Merge pull request #18212 from Roy-043/Draft-Fix-finish-behavior-of-Draft_Edit-on-doc-close
Draft: Fix finish behavior of commands on doc close
2024-12-05 11:52:07 +01:00
Roy-043
270d48b42b Draft: Fix make_point color regression
PR #12226 accidentally removed the handling of the color argument of the make_point function.
2024-12-05 08:36:34 +01:00
luzpaz
96c838f3b9 Fix various typos
Found with codespell
2024-12-04 23:18:00 -05:00
Roy-043
afdf07717d Draft: change position of 'Scale multiplier' field in UI
Fixes #16501.
2024-12-04 19:44:35 +01:00
wmayer
c1a75bbafc Fix compiler warnings 2024-12-04 09:50:09 -05:00
wmayer
e235e94fda Start: Fix opening file for writing 2024-12-04 09:49:53 -05:00
Roy-043
7a7c042ab8 Draft: Legacy DXF importer: fix layer block behavior (#18129)
Fixes #16550.
Fixes #16552.

* Layer blocks receive a name with the "LayerBlock_" prefix.
* They are put in a layer if the "Use layer" import option is checked.
* If Draft or Sketch objects are created a Part_Compound instead of a Draft_Block is created. This was done because a Draft_Block does not claim its children. I am not sure about this change. Maybe the behavior of the Draft_Block should be changed instead.

@yorikvanhavre: do you know why a Draft_Block does not claim its children?
2024-12-04 14:45:55 +01:00
Abhiram
d5be9cdafd Fix: Ensure IFC context menu actions are displayed correctly 2024-12-04 09:49:26 +01:00
Yorik van Havre
48b5543cf6 BIM: Added NativeIFC support to Add/remove tools 2024-12-04 09:46:26 +01:00
Yorik van Havre
5d1cba326b BIM: Fixed lock-unlock mode when opening IFC files - Fixes #18192 2024-12-04 09:25:06 +01:00
Ajinkya Dahale
05448b980a [Part] Avoid nullptr when using createArc
We could make `GeomCurve::createArc(...) = 0`, but then it needs to be
implemented in many subclasses which cannot be incomplete. It is implemented for
some of them, but others may need additional work (e.g. offsets), and would need
some exception throwing similar to what is now used.
2024-12-04 00:57:41 +05:30
Ajinkya Dahale
6c3d2eff64 [Sketcher] Use variable for frequently used static cast in trim 2024-12-04 00:57:41 +05:30
Ajinkya Dahale
b2c806d227 [Sketcher] Remove some commented code from SketchObject::trim()
...and replace with a TODO
2024-12-04 00:57:41 +05:30
Ajinkya Dahale
d8a86e4e9d [Sketcher] Remove some unneeded comments 2024-12-04 00:57:41 +05:30
Ajinkya Dahale
0b32db53ed [Sketcher] Use switch-case in getPointForGeometry()
Minor readability improvement.
2024-12-04 00:57:41 +05:30
Ajinkya Dahale
5262482bc4 [Sketcher] Refactor SketchObject::trim()
1. Use `Part::GeomCurve::createArc()`
2. Refactor constraint logic in `trim`
2024-12-04 00:57:40 +05:30
Ajinkya Dahale
1453d5680a [Part] Add methods to create an arc of the curve 2024-12-04 00:57:40 +05:30
Ajinkya Dahale
1cee07cb26 [Sketcher] Add some utility functions to Sketcher::Constraint
`involvesGeoId`, `invovesGeoIdAndPosId`, `substituteIndexAndPos`
2024-12-04 00:57:40 +05:30
Ajinkya Dahale
0d27efbc2f [Sketcher] Some trivial for loop changes in SketchObject 2024-12-04 00:57:40 +05:30
Ajinkya Dahale
ca989f73a2 [PartDesign] Fix TestTopologicalNamingProblem
Issue caused by refactor of `SketchObject::trim()`.
2024-12-04 00:57:40 +05:30
Ajinkya Dahale
7d8a8b7cc8 [Sketcher] Attempt to fix toponaming issue on trim refactor
TNP fix algorithm doesn't seem to like when edge with geoId 0 is deleted/made
construction after new geometry is added. Instead, we just ensure that one of
the newly added geometries becomes geoId 0 instead.

Making a `generateId(const Part::Geometry*)` was part of earlier attempts, but
still appears to remain relevant. This part can be reverted if necessary.
2024-12-04 00:57:40 +05:30
Ajinkya Dahale
263331f6fb [Sketcher] Refactor SketchObject::trim()
DO NOT MERGE because not complete: not all constraints are not transferred.

Includes:

* Adjust `deriveConstraintsForPieces` for trim
* Make sure new points are constrained on the cutting edges
* Add constraints at trim end(s) dependent on pre-exisiting ones with cutting curve(s). Also change tests to reflect that auto-coincidence can now be applied to non-periodic curves as well.

Known issue(s):
* Some redundant constraints may be added under certain circumstances (e.g. in
presence of perpendicular-via-point)
2024-12-04 00:57:40 +05:30
Ajinkya Dahale
c823a6b270 [Sketcher] Refactor SketchObject::split() 2024-12-04 00:57:40 +05:30
Ajinkya Dahale
b991c2fbc2 [Sketcher] Add tests for split and trim
Includes:
* Tests for splitting and trimming of various types of curves
* Assertions on constraints expected to be added on these curves
2024-12-04 00:57:40 +05:30
Ajinkya Dahale
423fb77e1f [Sketcher] Refactor SketchObject::AutoLockTangencyAndPerpty() 2024-12-04 00:57:40 +05:30
Ajinkya Dahale
4cc21e26e1 [Sketcher] Refactor SketchObject::delGeometry()
Just dropped cognitive complexity to 25.
2024-12-04 00:57:40 +05:30
Ajinkya Dahale
5f86d7f5a8 [Sketcher] Refactor SketchObject::getPoint()
...to reduce cognitive complexity.

Use templates to break longer functions. Also makes it possible to avoid
repetition of type-checking logic.
2024-12-04 00:57:39 +05:30
Aik-Siong Koh
3326c33d83 Assembly: Simulation implementation 2024-12-03 20:07:04 +01:00