Commit Graph

61 Commits

Author SHA1 Message Date
Benjamin Nauck
08fe94ef25 Add template based Document::countObjectsOfType
Also convert code to use this new method
2025-01-14 14:23:46 +01:00
Chris Hennes
ea7e17ba00 Merge pull request #18126 from Ondsel-Development/core_LCS2
Core datums : Card2 : Core implementation
2024-12-06 12:12:04 -05:00
PaddleStroke
598e32cdb3 PartDesign: revert e49cfde and 7331dc3 to fix https://github.com/FreeCAD/FreeCAD/issues/17949 2024-12-06 11:36:51 -05:00
PaddleStroke
a558475d8a Rename 'OriginFeature' to 'DatumElement' 2024-11-26 15:36:48 +01:00
PaddleStroke
8f43f3cc8b Core: Rename 'OriginFeature' file to 'Datums' 2024-11-26 15:36:48 +01:00
PaddleStroke
b1d5d4c105 Part Design: Remove legacy/modern workflow checks. 2024-10-24 21:52:38 -05:00
wmayer
43ec38ec9e Issue #11989: Segfault on "Move Object to Other Body"
The reason of the crash is a static_cast of an unknown type that causes undefined behaviour. The feature AdditiveLoft has the
property Section of type PropertyLinkSubList but the function does a static_cast to PropertyLinkList.

The solution is to use a dynamic_cast that returns null if the cast fails.
2024-03-20 18:06:23 +01:00
Josh Coalson
fbd8767242 Part: Rename AttachExtension::Support property to AttachmentSupport, to avoid name conflict with base features. Fixes #7052 2024-03-04 18:22:43 +01:00
André Caldas
89dbab9b0e Avoids using getNameInDocument() to test if DocumentObject is attached to a Document.
This patch substitutes by isAttachedToDocument() (almost) everywhere where
getNameInDocument() is used for this purpose.

The very few places not touched by this patch demand a (just a little) less trivial change.
When we change the returning type of getNameInDocument() to std::string,
those places will be easily found, because they shall generate a compiler error
(converting std::string to bool).

Rationale:
The fact that getNameInDocument() return nullptr to indicate
that the object is not attached to a document is responsible for lots of bugs
where the developer does not check for "nullptr".

The idea is to eliminate all those uses of getNameInDocument() and, in the near future,
make getNameInDocument() return always a valid std::string.
2023-12-11 17:37:58 +01:00
Florian Foinant-Willig
24934d7843 PartDesign: modernize type checking 2023-10-23 18:08:16 +02:00
wmayer
7a3106d31b modernize C++: use bool literals 2023-08-06 01:35:39 +02:00
wmayer
22e6e2cd40 Part/PD: modernize C++: redundant void arg 2023-08-05 16:50:31 +02:00
Adrián Insaurralde Avalos
25da7af5b8 Fix #9792: PD tasks fail to launch if body is inside Part and activated
introduced by PR #9557
2023-07-09 17:24:26 +02:00
wmayer
72f5428592 PD: fixes #9538: sometimes can't deselect things in newly created sketches 2023-05-31 21:25:08 -04:00
xtemp09
c2ad4a4222 Fixed segmentation fault in PartDesign workbench
Closes #9382.
2023-05-04 18:12:34 -04:00
wmayer
7c2b91cfdc PD: do not record Gui command as Doc command 2023-03-26 18:41:56 +02:00
luz paz
d265c9ff63 PD: remove trailing whitespace 2022-11-10 10:32:04 +01:00
Uwe
16b25c5dab [PD] remove superfluous nullptr checks 2022-07-17 18:12:41 +02:00
Chris Hennes
65aa374083 PD: PR6497 move return statement to new line 2022-03-29 12:37:21 -05:00
wmayer
d1d4b996e7 PD: modernize C++11
* use nullptr
2022-03-23 19:26:14 +01:00
Uwe
f5da0f3c56 [PD] Body and utils: remove unused includes 2022-02-20 21:23:05 +01:00
wmayer
b35623e680 App: Bugfix for NULL-Pointer dereference of Property->getName() 2022-01-16 14:30:51 +01:00
luz paz
1a56a24d07 PD: Adjust header uniformity 2021-12-16 23:55:48 +01:00
Ajinkya Dahale
28d8d808a8 PartDesign: Add new need active body dialog with option to choose body (#4949)
* [PD] Add new need active body dialog

Intended for use wherever an active body is needed but none exists. The dialog
contains a list with the bodies present in the document, with an extra option to
make a new body. Custom text can be provided if needed.

This commit also replaces the warnings used by "new sketch" and "primitive"
command with this new dialog.

Addresses issue #4288.
2021-09-16 12:27:46 -05:00
wmayer
2565ef5f69 PD: in setEdit() helper function make sure that recorded macro is handled as Gui command 2021-03-28 18:39:44 +02:00
wmayer
da90fa3ba7 PD: [skip ci] drop some superfluous static_cast 2021-02-18 22:51:15 +01:00
Chris Hennes
da7c6d9172 [PD] Fix isFeatureMovable() to check null status of property
As reported by @donovaly, if you try to move a pipe that does not have
an auxilliary spine, the code segfaults. This commit adds a check to ensure
that not only does the property exist (which in this case it always does), but
also that it does not contain a null. That is a valid value for the property
to have, but cannot be itself interrogated for moveability by the isFeatureMovable
recursive call. This fix is also applied to the other similar conditions in that
function to ensure they never yield the same segmentation fault.

Forums topic: https://forum.freecadweb.org/viewtopic.php?p=479388#p479388
2021-02-18 22:44:13 +01:00
wmayer
b1dd1e61a7 force strict ISO C++ (-Wpedantic)
for Fem, Import, PartDesign, Robot, Sketcher, TechDraw
2019-09-18 14:18:07 +02:00
Zheng, Lei
cd2b7e297c PartDesign changes
* Mostly for supporting in-place editing

* Add new SubShapeBinder that support cross coordinate system,
  external, and sub-object binding
2019-08-17 15:15:47 +02:00
wmayer
c3763479da activate/create 3d view when setting or getting active objects 2019-07-05 18:53:35 +02:00
wmayer
00de5bb7ad Replace Base::Exception with appropriate subclass 2018-11-14 19:28:00 +01:00
luz.paz
360e581672 Misc. typo and whitespace fixes
ref: https://forum.freecadweb.org/viewtopic.php?f=3&t=30988#p256964
along with other misc. fixes
2018-09-19 17:26:03 +02:00
wmayer
ef42cfb5d6 add method to activate 3d view when setting active object list 2018-09-12 15:38:28 +02:00
wmayer
57732f7441 add option to getBodyFor to suppress dialog to set workflow style to modern 2018-01-03 21:35:03 +01:00
luzpaz
0bafb04924 PartDesign: typos 2017-12-25 11:04:43 +01:00
Peter Lama
033334474c Rename superPlacement property to AttachmentOffset
The name Attachment Offset gives a better picture of what the
property does.
2017-11-05 16:41:25 +01:00
wmayer
d563e50632 do not auto activate single body in document when opening context-menu 2017-09-21 15:59:32 +02:00
wmayer
fde42545ba fix various coverity issues 2017-09-15 11:48:38 +02:00
Kurt Kremitzki
82391b9460 PDN: Automatically activate body if document has only 1 2017-08-12 14:45:28 +02:00
Ian Rees
3f9aead061 Make Body object on creation of Sketch/Primitive 2017-04-06 19:26:19 +02:00
Stefan Tröger
22c26d043a PartDesign: Adopt python interface to body group 2017-01-04 16:01:58 +01:00
Stefan Tröger
526d895a5d PartDesign: Port body to be a origin group 2017-01-04 16:01:58 +01:00
Stefan Tröger
c0a6b2ab11 PartDesign: Primitives are attachable directly
With the recently introduced AttachExtension the PartDesign primitives can be attachable by themself and don't need anymore the helping coordinate system datum. This simplyfies the code and the TreeView largely
2016-12-07 06:41:40 +01:00
Stefan Tröger
67d76b309c Port Attacher codde to the extension framework
AttachableObjects are desired in multiple occasions, and the current AttachableObject is not flexible enough to handle all cases. Hence the code is portet to an extension, which gives the needed flexibility.
2016-12-07 06:41:40 +01:00
Stefan Tröger
0ae9346b3c Extenions: Drop virtual inheritance
Due to problems onthe windows platform the virtual inheritance approach must be dropped. NExt to the already reimplemented proeprty interface the Type interface is reimplemented too. This change allows to revert some earlier changes.
2016-10-08 12:48:34 +02:00
Stefan Tröger
6fa964c53f Extensions: Introduce classes and port App groups 2016-10-08 12:48:34 +02:00
wmayer
9e4bed2983 fix whitespaces 2016-08-25 12:27:08 +02:00
Sergo
8df9f9603e fix relinkToOrigin, remove source body from list, etc 2016-08-24 19:11:26 +02:00
Sergo
52bf940110 PD MoveFeature:Check if feature has dependencies in source body 2016-08-24 19:11:26 +02:00
Sergo
bb78c1fd8f PartDesignGui: move feature with its dependencies 2016-08-24 19:11:26 +02:00