Commit Graph

121 Commits

Author SHA1 Message Date
Yorik van Havre
c0efc7fa32 Draft: added AutoUpdate property to shape2Dviews to disambiguate with VisibleOnly property 2021-07-07 15:45:22 +02:00
Yorik van Havre
3a6becbfe7 Arch: Added Depth property to SectionPlanes 2021-07-01 13:46:24 +02:00
Yorik van Havre
e2dd61119c Draft: Added ExclusionPoints property to shape2dview object 2021-06-01 11:30:04 +02:00
Matthijs Kooijman
1cabfd8e6b Draft: Simplify code using getattr default value
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.
2021-05-22 17:44:04 +02:00
Yorik van Havre
4ff9b768dd Draft: Changed shapestring FillLetters property to MakeFace 2021-05-05 15:41:28 +02:00
Yorik van Havre
a5bab10ff7 Draft: Added a 'solid faces' projection mode to shape2dviews to treat individual faces 2021-04-30 16:44:20 +02:00
tomate44
c48ec7cff2 Draft.ShapeString : add option to choose wires or faces output 2021-04-05 12:20:04 +02:00
David Osterberg
a243ce6346 Draft: Fix PathTwistedArray bug 2021-02-22 08:01:34 +01:00
Yorik van Havre
abee35f38a Draft: Fixed broken translations everywhere 2021-02-12 14:44:58 +01:00
Chris Hennes
a7522c384e [DRAFT] Catch only Exception, not BaseException 2021-02-11 11:52:45 +01:00
luz paz
19d0e1123f Draft: fix LGTM 'Testing for None should use the 'is' operator' alerrts
https://lgtm.com/projects/g/FreeCAD/FreeCAD/alerts/?mode=tree&ruleFocus=7900090
2021-02-03 21:58:47 +01:00
Stefan Tröger
ec5ac30756 Remove ExtensionProxy and rely on default Python proxy for extensions. fixes #0004534 2021-01-30 16:00:48 +01:00
luz paz
fc99ff2def Draft: fix header uniformity + trailing whitespace
[skip ci]
2020-12-11 13:19:49 +01:00
Zheng, Lei
1127321320 Draft: support object without shape in DraftLink 2020-10-19 13:22:20 +02:00
marioalexis
1ad7b9788b Improve make_sketch and geometric related functions 2020-10-19 13:15:14 +02:00
vocx-fc
330a5098b5 Arch: consider DraftText objects in the section plane for compatibility
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.
2020-10-12 11:43:37 +02:00
Zheng, Lei
7ee075325a Draft: fix point array without using link 2020-09-21 14:01:42 +02:00
Zheng, Lei
e3e7686773 Draft: add support for point link array 2020-09-21 14:01:39 +02:00
vocx-fc
b202b0d469 Draft: move getDXF to draftfunctions submodule
Update the appropriate interface in `Draft.py`.
2020-09-16 13:09:13 +02:00
vocx-fc
29a52d0dbc Draft: move getSVG to draftfunctions submodule
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.
2020-09-09 12:53:54 +02:00
vocx-fc
513c0e9eb4 Draft: new PathTwistedArray object
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.
2020-09-03 12:34:16 +02:00
vocx-fc
ee11678a58 Draft: migrate Layer object and function to the new structure
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`.
2020-07-20 14:21:15 +02:00
vocx-fc
27fc2e89fb Draft: add modules of draftobjects to the proper Doxygen group
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.
2020-07-17 13:01:45 +02:00
vocx-fc
1c65c7dc92 Draft: add Doxygen strings to the packages' __init__ files
The packages are `draftfunctions`, `draftgeoutils`, `draftguitools`,
`draftmake`, `draftobjects`, `drafttaskpanels`, `drafttests`,
`draftutils`, `draftviewproviders`.
2020-07-17 13:01:45 +02:00
vocx-fc
314637e945 Draft: move grouping functions to draftutils.groups module
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.
2020-07-13 14:35:38 +02:00
vocx-fc
0f30c8ba2b Draft: migrate DraftText type to Text 2020-07-10 12:23:43 +02:00
vocx-fc
70617e2e85 Draft: set a space before the Link group
For some reason all `App::Link` properties are in a group that
starts with a space, so `' Link'`, not just `'Link'`.

This was changed in 9873eb0a74.
2020-07-07 10:15:14 +02:00
luz.paz
ef37cc3930 Fix typos [skip-ci]
Found via codespell v1.18.0.dev0  
```
codespell -q 3 -L aci,ake,aline,alle,alledges,alocation,als,ang,anid,ba,beginn,behaviour,bloaded,byteorder,calculater,cancelled,cancelling,cas,cascade,centimetre,childs,colour,colours,commen,connexion,currenty,dof,doubleclick,dum,eiter,elemente,ende,feld,finde,findf,freez,hist,iff,indicies,initialisation,initialise,initialised,initialises,initialisiert,ist,kilometre,lod,mantatory,methode,metres,millimetre,modell,nd,noe,normale,normaly,nto,numer,oder,orgin,orginx,orginy,ot,pard,pres,programm,que,recurrance,rougly,seperator,serie,sinc,strack,substraction,te,thist,thru,tread,uint,unter,vertexes,wallthickness,whitespaces -S ./.git,*.po,*.ts,./ChangeLog.txt,./src/3rdParty,./src/Mod/Assembly/App/opendcm,./src/CXX,./src/zipios++,./src/Base/swig*,./src/Mod/Robot/App/kdl_cp,./src/Mod/Import/App/SCL,./src/WindowsInstaller,./src/Doc/FreeCAD.uml
```
2020-06-29 20:52:23 +02:00
vocx-fc
245fa7af0f Draft: clean up the ViewProviderDraftAnnotation class
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.
2020-06-19 12:15:25 +02:00
vocx-fc
8f0a7696c2 Draft: add prototype function to AngularDimension to link 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.
2020-06-17 12:53:29 +02:00
vocx-fc
d5cafc3138 Draft: organize execute code of the dimension classes
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.
2020-06-17 12:53:29 +02:00
vocx-fc
462b303c49 Draft: set properties of the Dimension class through functions
There are three classes `DimensionBase`, `LinearDimension`, and
`AngularDimension`, their properties are set only if they don't
already exist.

Provide also better documentation in the tooltips,
and use `setPropertyStatus` to hide and show the intended
properties in the property editor.

The `Support` property is not used at all except as a way to
store an object, so it should probably be removed in the future.
2020-06-17 12:53:29 +02:00
vocx-fc
93f1e87bc0 Draft: move make_dimension function to its own module
Previously the `make_dimension` and `make_angular_dimension`
functions were in `draftobjects/dimension.py`.
Now they are moved to `draftmake/make_dimension.py`.

The original `makeAngularDimension` function requires angles
in radians which is counterintuitive for most cases. Also
the order is `[big, small]`.

The new function `make_angular_dimension` accepts angles
in degrees, and the order is `[small, big]`. The older
function is retained for compatibility purposes.

Also perform several improvements such as PEP8 cleanup,
writing complete docstrings, type checking the input arguments,
and depreacting the older call.

The `Draft.py` module, Gui Command, unit test, and test script
are updated accordingly.
2020-06-17 12:53:29 +02:00
vocx-fc
63df9aa7dc Draft: clean up the internal DraftAnnotation class
Add a function to clarify the added properties,
and clean up the PEP8 style of the code.
2020-06-17 12:53:29 +02:00
vocx-fc
d8bb119768 Draft: adjust text of tooltip in arrays 2020-06-17 12:13:39 +02:00
vocx-fc
61f8ab8829 Draft: fix small warning for the DraftLink class used in arrays 2020-06-17 12:13:39 +02:00
vocx-fc
48fe9d4088 Draft: hide properties not used in the Label object
When `LabelType` is `'Custom'`, the `Target` property
is hidden and `CustomText` is shown.

For other values of `LabelType`, `Target` is shown,
and in turn `CustomText` is hidden.

This avoids showing unused information in the property editor.
2020-06-15 10:01:04 +02:00
vocx-fc
6b14fa35dc Draft: combine two types of labels using functions
We use smaller functions to return a list of strings corresponding
to each basic value of `LabelType`. Then the final `Text` value
can be defined as a simple value, or as the concatenation
of two smaller lists, depending on the value of `LabelType`.

Since we have 8 basic values, we could return up to 8^2
combinations, but at the moment we only return 8 basic
values and 5 simple combinations, which are the ones
that make the most sense.

In the future we could define new properties, say, `LabelType2`
and `LabelType3`, to be able to combine two or three types
of strings in an arbitrary fashion. At the moment, the possible
combinations are hard coded in `LabelType`.
2020-06-15 10:01:04 +02:00
vocx-fc
8c3ee6e4b3 Draft: organize the execute code of the Label in a function
Instead of placing the entire code in the `execute` method,
a `return_info` function is used to return the specific string
that we wish to display depending on the `Target` object,
 the `LabelType`, and subelement in `Target`, if any.

We also make the code more readable by using smaller variables,
and avoiding notations with lists of lists (`variable[0][1][6:]`).
2020-06-15 10:01:04 +02:00
vocx-fc
d23b664a2e Draft: set the properties of the Label class through functions
There are three general types of properties, target, leader,
and label; so we set the 9 properties using three functions,
and provide better documentation in the tooltips
for each property.
2020-06-15 10:01:04 +02:00
vocx-fc
fa092ae3df Draft: move make_label function to its own module
Also perform several improvements such as PEP8 cleanup,
writing complete docstrings, type checking the input arguments,
and deprecating the older call.

Update `Draft.py`, the Gui Command, the unit test, and test script
as well.
2020-06-15 10:01:04 +02:00
vocx-fc
9dc454ea2a Draft: add some explanation on the properties of PathArray
The use of `App::PropertyLinkSubList` for `'PathSubelements'`
is a mistake because we could use a single `App::PropertyLinkSub`
to handle both `'PathObject'` and `'PathSubelements'` properties.

This commit doesn't change any code, it just adds comments
explaining the situation so that it is not forgotten,
and we remember to address it in the future.

Ideally we should migrate the objects, but we may also decide
to break compatibility with older `PathArrays` if both properties
can't be migrated easily.
2020-06-09 12:02:25 +02:00
carlopav
1983172f5a Draft: fixed wrong QT_TRANSLATE_NOOP usage in Draft Objects
.
2020-06-09 11:55:46 +02:00
vocx-fc
f6378b1c0b Draft: improve handling of Part::Vertex when used with PointArray
The `Part::Vertex` object has both `Placement`, and `X`, `Y`, `Z`
properties. The net displacement is the sum of both of these two
properties.

Previously, the `PointArray` would only use the `Placement`
which would produce a seemingly erroneous result
because `X`, `Y`, and `Z` would be ignored.
2020-06-05 13:21:02 +02:00
vocx-fc
286be34765 Draft: move make_text function to its own module
Also perform several improvements such as PEP8 cleanup,
write complete docstring, type checking of the input arguments,
accepting a full placement to modify the position,
and deprecating the older call.

Update the Gui Command as well.
2020-06-05 13:20:35 +02:00
vocx-fc
f955519903 Draft: migrate older properties of PathArray 2020-06-05 13:14:46 +02:00
vocx-fc
17de210655 Draft: rename PathArray properties
`PathObj` becomes `PathObject`, `Xlate` becomes `ExtraTranslation`,
and `PathSubs` becomes `PathSubelements`.

Update `make_path_array` function and the Gui Command.
2020-06-05 13:14:46 +02:00
vocx-fc
641a7d596a Draft: hide properties not used in the PathArray
Certain properties do not need to be shown in the property editor
when a particular `AlignMode` is chosen. This keeps the number
of properties displayed organized and easy to manage.
2020-06-05 13:14:46 +02:00
vocx-fc
07ee03b928 Draft: set the properties of PathArray through functions 2020-06-05 13:14:46 +02:00
vocx-fc
da2504efdd Draft: cleanup logic of PathArray proxy object code
Return early from the `execute` method if no base or path exist.

Add method `get_wires` which internally uses `get_wire_from_subelements`
(renamed method), to get the edges from the path object,
and its subelements, if any. If no wires are found
return early from `execute`.

The final rotation applied to the copies will be the base rotation
of the base object's shape. The only exception is when the
`AlignMode` is `'Tangent'`; in this case, it performs
a pre-rotation with the `TangentVector`.
2020-06-05 13:14:46 +02:00