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.
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).
* 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.
* 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".
* 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
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.
* 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
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.
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.
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`.
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.
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.
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.
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.
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