Commit Graph

234 Commits

Author SHA1 Message Date
Roy-043
8add557e2f Draft: fix setting of self.Type
Fixes #17750.

`self.Type` should be set in `__init__` and `loads`, and not in `onDocumentRestored`.
2025-06-30 11:05:25 -05:00
Roy-043
66cf7b4c36 Draft/BIM: change BezCurve, BSpline and Wire to Part::FeaturePython
Fixes: #7387.

See comment: https://github.com/FreeCAD/FreeCAD/issues/7387#issuecomment-2915599566

PR to change the base object of BezCurve, BSpline and Wire to `Part::FeaturePython`. This will only affect new objects. So code will have to also keep handling the old object type (`Part::Part2DObjectPython`).

The modification of BimPreflight.py needs to be verified. The steps in the old code lacked logic IMO. But I may have misunderstood.
2025-06-02 17:27:20 +02:00
Roy-043
fcee9ccb08 Draft: ShapeString fix stick font check for small character (#21522)
Fixes #21501.

For some fonts `Part.makeWireString()` returns characters that are much smaller than the given height. This would lead to a false positive for the 'sticky font' check (which checks the area of the "L" character).
2025-05-22 17:26:00 +02:00
Roy-043
d9ad0f0800 Draft: ShapeString: use an actual font file as default, allow TTC files
* To help novice users supply an actual font file from the OS as the default for ShapeStringFontFile.
* The Draft code blocked the use of TTC font files. `Part.makeWireString()` can however handle them (although only the first font in the file can be used).

Additonally:
In a previous PR the bottom spacer was removed from the task panel. This PR brings it back as it is required in some cases. Without it  the "..." button of the file selector can become huge.
2025-05-05 18:15:47 +02:00
Florian Foinant-Willig
36b8e9a703 Draft: Prevent user to remove core properties 2025-04-22 23:52:17 +02:00
Florian Foinant-Willig
ef0ca1cff3 Core: Part::PartFeature should be Part::Feature 2025-04-21 10:51:15 -05:00
Luz Paz
8bc4b8d1af Draft: fix source typo in draftobjects/patharray.py 2025-04-01 10:05:08 -04:00
Luz Paz
6564a7b107 Fix various typos 2025-03-14 12:37:12 -04:00
Roy-043
af20bf003f Draft: change 'Filled' to 'Make face' in UI
Fixes #19715.

The related parameter has been renamed as well and other references to 'fill mode' have been updated.
2025-02-24 17:10:13 +00:00
Roy-043
1de045ae66 Draft: make arrays explodable
Fixes #13085.

This PR adds the `PlacementList` property to non-link arrays.
2025-02-08 19:20:33 +01:00
Roy-043
d93cec7063 Draft: add some checks for font file of shapestring
Fixes #19447.
2025-02-07 20:03:49 +01:00
Roy-043
20c920375c Draft: Fix line length input issue
Fixes #19451.
2025-02-07 13:38:56 +01:00
Roy-043
e47af7645c Draft: improved handling of 'crazy' edges in hatch
See #14114.
2025-02-06 13:43:52 +01:00
Paweł Pohl
2087ce149f Draft: New path array features - reverse path, etc (#19017)
Some missing quality-of-life features in Path Array:
1. A setting to reverse path
2. A "Fixed spacing" mode
3. Ability to use spacing patterns
2025-02-05 15:16:25 +01:00
Paul Lee
7e06bb1ec2 [Draft_shape2dview] Fix Bug : Closed Wall Wrong Fill
Git-hub issues : https://github.com/FreeCAD/FreeCAD/issues/16363#issuecomment-2619643946

"Problem description

In a group of closed walls, the entire interior is completely filled, which should not be the case."
2025-02-05 10:09:09 +01:00
Roy-043
41d55abcd2 Draft: allow objects in layers to have overrides (#19207)
* Draft: allow objects in layers to have overrides

Fixes #17844.

1. When an object is put in a layer it always adopts the properties of that layer.
2. Properties of the object that are subsequently changed are considered overrides.
3. When the properties of the layer, or the object in the layer, are then changed so that they match again, there is no longer an override, and properties are synced again.
4. The layer and the layer container object get an extra Tree view context menu option "Reassign properties of layer"/"Reassign properties of all layers".
2025-01-28 20:42:45 +01:00
Roy-043
2ee620ab42 Draft: make move, rotate and scale commands link-aware (#18795)
* Draft: make move, rotate and scale commands link-aware

Fixes #12836.
Fixes #15681.

These changes are presented as a single ('big') PR because the mentioned commands have several similarities. Working on them seperately would have made less sense.

The commands have been made 'link-aware' meaning they can now handle Links and objects in linked containers.

This required several changes in the following main files. For each command all options are handled by a single function now (the `move`, `rotate` and `scale` functions). This was the only reasonable solution to correctly handle nested placements. As a result there is no longer a need to build very complex 'cmd' strings in the gui_*.py files (which is a good thing IMO).

Main files:

* move.py
* rotate.py
* scale.py
* gui_move.py
* gui_rotate.py
* gui_scale.py
* gui_trackers.py

The following files have also been updated:

* Draft.py: Imports updated.
* DraftGui.py: If `CopyMode` is changed the ghosts have to be updated. The move and rotate commands now also show previews of movable children. But since those are not copied they should be removed from the ghosts if `CopyMode` is changed to `True`.
* utils.py: Some helper functions have been added. An existing helper function (only used internally) has been renamed.
* gui_utils.py: The `select` function has been updated to accept a list of tuples to allow the reselection of nested objects.
* clone.py: A new property `ForceCompound`, necessary for non-uniform scaling, has been added.
* join.py: The `join_wires` function now returns the resultant wire objects.
* task_scale.py: Updated to allow negative scale factors. Support for `SubelementMode` preference added.
* dimension.py: `transform` methods added.
* layer.py: `get_layer` function added.
* svg.py: Updated to use `get_layer`.
* view_text.py: Instead of two added `coin.SoTransform()` nodes the main transform node is used instead. This was done so that ghosts of Draft Texts can be handled properly without requiring dedicated code in gui_trackers.py.

Notes:

* Support for "App::Annotation" is limited. Only their `Position` is handled (by the move and rotate commands).
* Support for "Image::ImagePlane" has been removed from the scale command. The object has its own calibrate feature (see https://wiki.freecad.org/Std_Import).
* Copies and clones are always created in the global space.

* Fix several unit test issues.

* Reset value that was changed while testing

* Rebase and update test_modification.py

* Reintroduce scaling of image planes
2025-01-20 18:23:36 +01:00
Roy-043
31d8120d2e Draft: Clone: avoid B-spline faces in more cases
B-spline faces can be avoided if the absolute values of the scaling factors are the same. The `transformShape` method can handle this if two additional arguments are provided.
2025-01-16 13:39:11 +01:00
Roy-043
9a7786edd8 Draft: Closed corners for extruded Facebinders (#18901)
* Draft: props_changed_placement_only should ignore material props

The new material related properties (Density, Volume and Mass) must be ignored by the `props_changed_placement_only` function.

Without this moving a Draft_Point will fail for example.

* Draft: Closed corners for extruded Facebinders

Fixes #13816.

The `makeOffsetShape` method that creates the extruded shape is quite picky. For example, it will work for a pyramidal shell (4 triangles) with a square floorplan, but not if the floorplan is slightly rectangular. To get closed corners the `Sew` property of the Facebinder must be set to `True`. If extruding does not work properly, the code will retry with `Sew` disabled.

There is also some code that tries to convert flat B-spline faces created between the main offset faces into planar faces. In some cases that code will fail (the results of `makeOffsetShape` can already contain errors). If that is the case the original shape created by `makeOffsetShape` is used.

* Rebase to restore base.py
2025-01-07 10:23:33 +01:00
Roy-043
55f923b863 Draft: props_changed_placement_only should ignore material props
The new material related properties (Density, Volume and Mass) must be ignored by the `props_changed_placement_only` function.

Without this moving a Draft_Point will fail for example.
2025-01-06 17:23:37 +01:00
Yorik van Havre
14585a760e BIM: NativeIFC 2D support - section planes 2024-12-11 10:24:43 +01:00
Roy-043
432befd79a Merge pull request #17379 from yorikvanhavre/draft-fix-annotation
Draft: better check for Gui object
2024-12-06 18:05:41 +01:00
Gauthier Brière
740f5f18df [Draft] add font path relative (#17819)
* Permit a font file path relative to the FreeCAD file

* Use obj.Document instead of App.ActiveDocument

* use filename = instead of directory =
2024-11-16 18:02:02 +01:00
Yorik van Havre
87779387cc Draft: minor fixes (#17793)
- more tolerance on faultly solids in shape2Dview
- fixed display of dimensions in arch override unit
2024-11-16 17:52:55 +01:00
Roy-043
bb89edc83e Draft: Fix extra_scale error in hatch.py (#17715)
Fixes #17712.
2024-11-16 17:49:35 +01:00
Yorik van Havre
37f50c1b10 Draft: Independence from BIM (#17444)
* Draft: Independence from BIM - follow-up of #17390

* Draft: More info in DXF importer if BIM not present
2024-11-16 17:48:28 +01:00
Roy-043
ca370ec9f3 Catch potential index error 2024-10-25 10:15:53 +02:00
Roy-043
0fac810797 Restore ViewObject implementation for all Draft objects
In my tests the code works fine. Using @AIRCAP's instructions,  I have created a 'broken' file from draft_test_objects.FCStd.
2024-10-24 15:24:13 +02:00
Roy-043
8c4d696180 Restore the ViewObject
I think we need to restore the ViewObject in such cases. I assume this problems exists for all Draft and BIM objects. So this commit is just an example implementation.
2024-10-24 15:11:22 +02:00
Yorik van Havre
460df78dcc Draft: better check for Gui object - fixes #17342 2024-10-24 15:11:22 +02:00
Roy-043
48a3be1106 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:04 +02:00
Roy-043
b6f07e9e04 Fix linter warning 2024-09-25 15:59:49 +02:00
Roy-043
2b51ae9be5 Draft: ShapeString Fuse caused single face string to lose fill
The `faces.concatenate` function can return a Face or a Compound. The code did not take that into account.
2024-09-25 15:59:49 +02:00
Roy-043
d10b1ba96a Use max instead of if-else for numerical checks (as per linter warning) 2024-09-13 12:07:52 +02:00
Roy-043
9ec88feabc Draft: fix division by zero and count is zero for path arrays
Fixes #16468.
2024-09-13 12:07:52 +02:00
Roy-043
02e45a8e0c Draft: fix Draft_Shape2DView warnings
Fixes #15144.
2024-07-04 09:11:10 +02:00
FEA-eng
be32fc6773 Update shape2dview.py 2024-06-17 11:22:18 -05:00
Roy-043
eaa67e1bfe Draft: _get_shapes in shape2dview.py did not handle null shapes (#14646)
Null shapes do not have a ShapeType (strange IMO). The function did not take that into account.

Forum topic:
https://forum.freecad.org/viewtopic.php?t=88397
2024-06-13 15:27:47 +02:00
Roy-043
a7c38eab09 Draft: Fix two Layer warnings (#14506)
There are two unnecessary Layer warnings:
1. A 'might break' warning when deleting an object nested in a layer.
2. An 'out of scope' warning for objects also nested in f.e. a Std_Part.

To avoid them the Group property type was changed to `App::PropertyLinkListHidden`.
2024-06-06 15:53:49 +02:00
Roy-043
f7d8af592b Draft: fix _get_shapes in shape2dview.py (#14319)
Fixes #14312.

The `new _get_shapes` function could return the original object shape. This caused a problem if `sh.reverse()` executed.

Note that the file in the linked issue does not produce the error as it does not contain a shape with a negative volume.
2024-05-28 09:45:48 +02:00
Roy-043
0557bac0d3 Draft: Draft_Layer new Material handling (#13949)
Discussion: #13657.

This PR adds  the ShapeAppearance view property to Draft Layers.

The DefaultShapeColor is used for the DiffuseColor of the ShapeAppearance material. Other material properties are not based on the preferences when a layer is created.

The old ShapeColor and Transparency properties remain (ShapeColor as a hidden property) and are kept in synch with the ShapeAppearance. This is consistent with how ShapeAppearance is implemented in Core.

The gui_layers.py and make_layer.py files do not have to be changed. They manipulate the vobj via the mentioned old properties.
2024-05-28 09:45:05 +02:00
Roy-043
5eeaeed104 Draft: update fuse behavior in facebinder.py
Fixes #14242.

In the current dev fusing an empty shape with a face or solid no longer works (probably introduced with #14169). The reason for starting with an empty shape was the assumption that the end result would then always have a default placement. But that is only correct if multiple objects are fused.

In the new version of the code fusing no longer starts with an empty shape. The default placement issue is solved by always returning a compound.

Additionally the value for the Area property is now taken after offsetting and fusing the faces.
2024-05-27 12:16:24 +02:00
Roy-043
69d405b011 Draft: Draft_Hatch workaround for TD edge length limit (#14114)
Edges longer than ca. 10m are considered 'crazy' in the TD Workbench. Hatch patterns are also checked. As a workaround some intermediate scaling is applied.

Addionally: `transformShape` instead of `transformGeometry`. The latter results in B-splines.
2024-05-18 11:39:08 +02:00
Roy-043
30b3fcd045 Draft: Update v0.22 references to v1.0 (#13934) 2024-05-12 09:47:51 +02:00
Roy-043
8ff3a1ec39 Draft: add Fuse property to patharray and pathtwistedarray
See #13172.
2024-03-28 12:03:46 +01:00
Roy-043
7dc1ce17c9 Draft: add Fuse property to pointarray
Fixes #12906.
2024-03-26 22:36:18 +01:00
Roy-043
2dd27ec276 Draft: fix handling of shapes in shape2dview.py
Fixes a problem introduced with #10712. If the Shape is not a Compound, the shape itself, and not its SubShapes should be used.
2024-03-22 18:17:04 +01:00
Roy-043
de65f805b9 Draft: Improve logic of Draft_Label texts
The proposed code fixes the following issues:
1. There is no check if the target object itself has a property that matches the label type.
2. If a subelement is selected that does not have the label type property, the value from the main object is displayed instead.
3. The default text is an empty string.

Example:

Currently If you select a vertex of a wire, and select "Length" as the label type, you will get the length of the wire. With the new code the text will then be "Length not available for (sub)object".

Forum topic (issue #1):
https://forum.freecad.org/viewtopic.php?t=86222
2024-03-20 18:29:01 +01:00
Roy-043
c06ceba0da Draft: ShapeString improve stick font detection and fix fuse error
Forum topic:
https://forum.freecad.org/viewtopic.php?t=85147
2024-02-10 16:10:55 +01:00
Roy-043
eb4feef5ab Draft: Fix messages for Draft_Fillet
There were still too many messages.
2024-02-03 19:46:20 +01:00