Using the default argument supported by getattr makes this code a bit
simpler and probably (ever so slightly) faster.
See https://forum.freecadweb.org/viewtopic.php?f=10&t=58611 for previous
discussion.
This is not an exhaustive change, these are just a few I encounted while
working with the code.
Draft_PointArray and Draft_TwistedArray have Count problems:
1. Draft_PointArray: Count is always zero.
2. Draft_PathTwistedArray: Number of items is Count+1.
3. Draft_PathTwistedLinkArray: Count is increased whenever object is recomputed.
Also the first item in a twisted array should be unrotated.
This uses the default value that can be passed to getattr to simplify
code that uses it. By choosing an appropriate default value, a separate
call to hasattr can be avoided and in some cases duplicate code can be
avoided.
This applies this trick where possible in wire.py and circle.py.
This commit does not change behavior.
After the reorganization of the Draft Workbench,
the `'DraftText'` objects are now of Proxy.Type `'Text'`.
In the `DraftAnnotation` class the `__setstate__` method
was defined to automatically migrate the Type.
The `Arch SectionPlane` only handles `'Text'` objects. If for
some reason there is still an old `'DraftText'` object
which has not been migrated to the new Type, it won't be found.
This is corrected by adding `'DraftText'` to the list of objects
to process.
Small fixes where the `get_svg` function is used, for example,
in the (obsolete) `DrawingView` class and `Arch_SectionPlane`.
Also update the unit tests accordingly.
It takes a `Shape` and replicates it around a path, while at the
same time adding a rotation to each copy. This can be used to create
a twisted "ribcage" from a frame-like object, which can be used
in a more complicated `Shape`, for example, a tunnel or bridge
object.
Move `make_layer` to `draftmake`; `Layer` and `LayerContainer`
to `draftobjects`; `ViewProviderLayer` and `ViewProviderLayerContainer`
to `draftviewproviders`.
The make function and the classes are imported in `Draft.py`
to support the usage of the older `VisGroup`.
This includes `array`, `base`, `bezcurve`, `block`, `bspline`,
`circle`, `clone`, `dimension`, `draft_annotation`, `draftlink`,
`drawingview`, `ellipse`, `facebinder`, `fillet`, `label`,
`patharray`, `point`, `pointarray`, `polygon`, `rectangle`,
`shape2dview`, `shapestring`, `text`, `wire`, `wwproxy`.
These are added to the `draftobjects` Doxygen group
so that the functions and classes contained in each module
are listed appropriately in the automatically generated
documentation.
These functions were previously in `draftutils.utils`,
and are related to grouping objects and finding objects
inside groups. These include `get_group_names`, `ungroup`,
`get_windows`, `get_group_contents`, `get_movable_children`.
These are imported in the main `Draft.py` module, so compatibility
is retained.
Modules which use these functions are updated; these include
Gui Commands like `Move`, `Rotate`, `Scale`, `AddToGroup`,
as well as objects like `DrawingView` and `Shape2DView`,
and `ViewProviderClone`.
The code inside the `importDXF` module is also updated.
The Arch Workbench uses many of these functions
but it does so from the `Draft` namespace, so these edits
don't change the situation for these commands.
This class is the base of the viewproviders of annotation-type
objects like dimensions (linear, radial, angular), labels,
and texts.
The basic properties of `ViewProviderDraftAnnotation`
are set up by a method `set_properties`, which can be called
in the derived classes.
In the general proxy object `DraftAnnotation` we implement
the `onDocumentRestored` method in order to add the missing
view property `AnnotationStyle` to older objects.
At the moment the user must manually modify `FirstAngle`
and `LastAngle` to obtain a new `Angle`, but since the values
are manually entered the result is not tied to any actual object
in the document.
We introduce a function `measure_two_obj_angles`
to calculate the corresponding parameters from a pair of objects
and their edges.
Currently this function is deactivated because it is intended
for testing purposes only.
This needs to be improved because at the moment it only gives
two possible angles. We should be able to get the four angles
of a two-line intersection. Maybe a new property is required
to indicate the quadrant to choose and display.
Instead of placing the entire code in the `execute` method,
we use three medthods to extract the `Start` and `End` dimension
points from different combinations of edges.
One method to get the dimension from a single object, from the edge,
either linear or circular; one method to get the dimension
from a single object, from two vertices; one method to measure
the distance between two objects, from two different vertices.