Commit Graph

96 Commits

Author SHA1 Message Date
Furgo
5a6af2e41f Assembly: fix delete shortcut parameter mismatch
Fixes: https://github.com/FreeCAD/FreeCAD/issues/23792
2025-09-24 22:19:00 -05:00
Mathieu GRENET
692101bd1b Assembly: Fix inconsistent positioning in distance joint validation
When validating distance joints, parts would move from preview position to
a different valid solution. This was caused by preSolve() being called
inconsistently - applied during offset changes for all joint types, but
distance joints are not in JointUsingPreSolve list.

Fix: Only call preSolve() for joint types that are designed to use it,
matching the logic used elsewhere in the codebase.
2025-08-31 21:31:45 -05:00
PaddleStroke
a52a130a03 Assembly: Screw Joint, fix distance name to Thread Pitch 2025-08-25 16:44:04 -05:00
PaddleStroke
b527c1ae6a Assembly: Move label change logic to onChange 2025-08-25 11:06:11 -05:00
tetektoza
568e63f8d5 Assembly: Allow editing joint references
As the title says - root cause of this problem was imprecise reference
matching by moving_part and TNP string processing incosistencies, so the
solution is to give enhanced matching and TNP string mapping for
reliable deletion.

Also added context menu with keyboard shortucs so user is able to delete
stuff with right click.
2025-08-24 22:58:57 -05:00
tetektoza
a6e0b91758 Assembly: Auto close on deleted doc for dialogs to avoid segfaults
Currently if we close document on Assembly WB while having dialog
opened, it will throw segfault because it is not being auto closed
automatically during document close. This in turn resulted in dialog
having dangling references to document that was no longer existing,
throwing segfaults in random places.

So solution is simple - add `setAutoCloseOnDeletedDocument` for every
dialog in Assembly to avoid this situation and close every dialog upon
document close.
2025-08-24 22:22:19 -05:00
Max Wilfinger
9fc40b33de Fix source string mistakes reported on Crowdin (#23157)
* Fix source string mistakes reported on Crowdin

* Update src/Mod/Draft/Resources/ui/TaskPanel_CircularArray.ui

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

* Update src/Mod/Draft/Resources/ui/TaskPanel_CircularArray.ui

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

* Update src/Mod/Draft/draftfunctions/upgrade.py

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

* Update src/Mod/Draft/draftfunctions/upgrade.py

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

* Update src/Mod/Draft/draftguitools/gui_downgrade.py

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

* Update src/Mod/Draft/Resources/ui/TaskPanel_SetStyle.ui

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

---------

Co-authored-by: Roy-043 <70520633+Roy-043@users.noreply.github.com>
2025-08-24 20:51:32 -05:00
PaddleStroke
ae5564d50c Assembly: Replace "Activated" property by the core "Suppressed" mecha… (#22409)
* Assembly: Replace "Activated" property by the core "Suppressed" mechanism.

* Fix inaccuracy

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

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

* move the change to migrationScript5 function

* Update JointObject.py

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

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

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2025-07-28 18:20:01 +02:00
PaddleStroke
a8b655d602 Assembly: Use icon overlay for unconnected joints instead of annoying warning. (#22662)
* Core: FeaturePython : Add getOverlayIcons to python interface

* Assembly: unconnected joints icon overlay Fix #22643

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

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

* Update AssemblyObject.cpp

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

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

* Update ViewProviderFeaturePython.h

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

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

* Update ViewProviderFeaturePython.h

* Update JointObject.py

* Update ViewProviderFeaturePython.h

* Update ViewProviderFeaturePython.cpp

* Update Application.cpp

* Update ViewProviderFeaturePython.cpp

* Update ViewProviderFeaturePython.h

* Update ViewProviderAssembly.cpp

---------

Co-authored-by: Kacper Donat <kadet1090@gmail.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2025-07-26 22:35:24 +02:00
PaddleStroke
f468e4c4ac Assembly: Fix error message flexible assembly #22561 2025-07-18 15:20:27 -05:00
Florian Foinant-Willig
b41b294292 Assembly: prevent user to remove core properties 2025-04-22 23:52:17 +02:00
PaddleStroke
3b6cb37dd9 Assembly: ignore joints in error (#20253)
Co-authored-by: drwho495 <drwho495555@gmail.com>
2025-03-22 18:27:24 +01:00
PaddleStroke
cac8eb0859 Assembly: Joint creation presolve: move part2 rather than part1 when both are unconnected. 2024-12-20 11:37:04 -05:00
PaddleStroke
024fee7f97 Assembly: Enable the use of App::Datums 2024-12-13 18:04:10 +01:00
PaddleStroke
396963006b Core: SoShapeScale fix weird scaling on viewport resize. See https://github.com/FreeCAD/FreeCAD/issues/18382#issuecomment-2527623758 2024-12-10 17:15:13 +01:00
Vincent
ebf528a653 Assembly: fix gears created with null radius and de-sync (#18275) 2024-12-09 11:23:05 -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
PaddleStroke
f6268ffd28 Assembly: Insert new part (#17922)
* Assembly: Joint Object : encapsulate the joint creation widget such that the task can be subclassed and ui customized by other commands.

* Assembly: Insert New Part

* Update src/Mod/Assembly/CommandInsertNewPart.py

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

---------

Co-authored-by: Kacper Donat <kadet1090@gmail.com>
2024-12-02 18:34:02 +01:00
Jiří Mácha
71f0104bb2 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 17:46:44 +01:00
PaddleStroke
22d278c7c0 Assembly: Fix regressions of https://github.com/FreeCAD/FreeCAD/pull/16671 2024-11-09 10:16:47 -05:00
PaddleStroke
b3d9c471ee Assembly: JointObject refactor adaptUi 2024-11-09 10:10:57 -05:00
PaddleStroke
bf64ab9f51 Assembly: Improve joint taskbox offset ui. 2024-11-09 10:10:57 -05:00
PaddleStroke
1b1e355b9b Assembly: Fix reverse button in joint task (#17663) 2024-11-04 18:23:17 +01:00
PaddleStroke
1b35d8b0f1 Update JointObject.py 2024-11-04 18:18:21 +01:00
PaddleStroke
28a977b5fc Assembly: Joint creation: add expression support to spinboxes 2024-11-04 18:07:12 +01:00
Yorik van Havre
15100357df Merge pull request #15629 from Ondsel-Development/asm_assembly_link
Assembly: Flexible sub-assemblies.
2024-10-28 17:07:26 +01:00
PaddleStroke
f111d46002 Assembly: Fix limits disappearing on edit (#17289) 2024-10-17 20:19:21 -05:00
PaddleStroke
9b407eed07 Fix regressions of #16726 2024-10-17 20:13:23 -05:00
PaddleStroke
62575f2d63 Assembly: Create SoSwitchMarker.py to externalize the coin stuff that draw the joint's markers(JCS) 2024-10-16 15:39:23 +02:00
PaddleStroke
fe5c883e4c Assembly: Joint creation UI : add advanced offset handling. 2024-10-16 15:39:23 +02:00
PaddleStroke
876389af23 JointObject: fix flip one part 2024-10-14 08:58:35 -05:00
PaddleStroke
eab65cc42c Assembly: Remove JointObject camera callbacks. And fix lock highlight. 2024-10-14 08:27:36 -05:00
PaddleStroke
82a98d6e31 Assembly: Joint: add support to non ascii characters. 2024-10-10 20:36:54 -05:00
PaddleStroke
a445b01869 Assembly: Fix joint labels bad auto-rename issue. 2024-10-10 20:36:54 -05:00
PaddleStroke
736f03caf2 Assembly: Fix gear/belt switch on checkbox toggle 2024-10-10 20:26:18 -05:00
PaddleStroke
13eeb7b8c2 Assembly: Fix migrationScript2 error with bad joints (#17010)
* Fix migrationScript2 to handle bad joints
2024-10-07 18:48:38 -05:00
Chris Hennes
7a37ea9bc0 Merge pull request #16726 from bgbsww/bgbsww-AssemblySubNames
Assembly: Correctly build reference from selection subname
2024-10-03 13:46:35 -05:00
bgbsww
d535c5a6e7 Refine further 2024-09-27 13:00:19 -04:00
bgbsww
7bed7ef370 Return to python; simplify to work with only classic names, provide migration 2024-09-26 00:01:10 -04:00
bgbsww
f0053e5388 Correctly build reference from selection subname 2024-09-24 22:01:14 -04:00
bgbsww
a715a4d161 Support macros and console logs in Assembly 2024-09-23 14:10:55 -05:00
PaddleStroke
7f83336ba8 Assembly: Replace Offset and Rotation properties by Offset1 and Offset2, giving full control over JCS positions. 2024-09-09 18:22:06 +02:00
PaddleStroke
7c6dde17fb Assembly: Fix case of link groups 2024-09-02 18:20:18 +02:00
PaddleStroke
4f79c675b7 Assembly: Property change from Object/Part to Reference 2024-07-29 17:48:25 +02:00
PaddleStroke
a3436c2d5f Assembly: Create joint: prevent errors on undo/ctrl-Z 2024-07-10 08:44:08 +02:00
Max Wilfinger
7d21d9edb8 Fix source string typos mentioned on Crowdin (#15261) 2024-07-08 17:18:31 -05:00
PaddleStroke
cf5314919a Assembly: Change Object1/2 from strings to PropertyXLinkSub and Remove Element1/2 and Vertex1/2 2024-07-01 11:22:30 -05:00
Chris Hennes
0a39ab952d Merge pull request #14738 from Ondsel-Development/asm_limits
Assembly: Limits: Set one checkbox for each limit.
2024-07-01 10:54:19 -05:00
PaddleStroke
e7699b531e Assembly: Gears: Fix crash if user selected first elements before triggering tool. 2024-06-28 12:07:11 -05:00
PaddleStroke
632780ce35 Assembly: Create Joint limit: Moving objects updates the spinboxes values if they are disabled. 2024-06-27 09:10:38 +02:00