Commit Graph

92 Commits

Author SHA1 Message Date
Yorik van Havre
f13c8974b5 Draft: Colored grid axes 2020-12-03 15:15:15 +01:00
Yorik van Havre
bff31175cb Draft: better checks for no active document 2020-11-16 13:25:12 +01:00
Yorik van Havre
88f5fc20b1 Draft: Condensed the Draft toolbar style buttons into one with more options 2020-11-10 14:14:18 +01:00
Yorik van Havre
0fdd157394 Draft: Added TechDraw patterns 2020-10-26 11:52:14 +01:00
Yorik van Havre
71cd301ca7 Draft: Added pref option to set default dimension unit 2020-10-14 17:21:27 +02:00
Yorik van Havre
4134315434 Draft: Fixed translation of construction group 2020-10-12 16:11:31 +02:00
Yorik van Havre
5609b38e9a Draft: Fixed patterns + added default pattern size pref option 2020-10-12 15:12:50 +02:00
vocx-fc
49e1ff1bcf Draft: get_bbox function to get the bounding box from RootNode
Normally the bounding box is taken from `Shape.BoundBox`.
Certain objects don't have a `Shape`, like `App::FeaturePythons`,
so the bounding box is calculated from `ViewObject.RootNode`.
2020-09-30 12:06:48 +02:00
Amritpal Singh
21e1dff25c Adopted vocx-fc comment. 2020-09-29 18:50:30 +02:00
Amritpal Singh
c64d0bf991 Fixed bug: In exporting IFC with shared clone shapes geometry, clone of clone object displaced because of bug in Draft.get_clone_base function. 2020-09-29 18:50:30 +02:00
vocx-fc
c79f890112 Draft: move getDXF to draftfunctions submodule
Update the appropriate interface in `Draft.py`.
2020-09-16 13:09:13 +02:00
carlopav
28c00f8383 Draft: provide the possibility to implement support for Edit in objs
As suggested by @Vanuan. and already implemented in new experimental BIM Wall: 1084a4b0a9
Draft: updated Draft Edit

thanks to the suggestions by @Vanuan
Draft: further bugfixing and improvements in Draft_Edit


Draft: moved Draft_Edit preview code into respective GuiTools
2020-09-09 14:13:29 +02:00
vocx-fc
6a3de864e7 Draft: add modules of draftutils to the proper Doxygen group
This includes `gui_utils`, `init_draft_statusbar`, `init_tools`,
`messages`, `todo`, `translate`, `utils`.

These are added to the `draftutils` Doxygen group
so that the functions contained in each module are listed
appropriately in the automatically generated documentation.
2020-07-17 13:01:45 +02:00
vocx-fc
91a23e4a40 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
6503d9351d 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
ec1a720bfb Draft: move the convertDraftTexts function to make_text
The old `convertDraftTexts` function was moved from the `Draft.py`
module to the `draftutils.utils` module; however, here it is
not possible to use because the `makeText` function
is not accessible. Therefore, the function is moved to
`draftmake.make_text`.
2020-07-13 14:35:38 +02:00
vocx-fc
aaeab8bc5d Draft: move units functions outside DraftGui.py
The functions `getDefaultUnit`, `makeFormatSpec`, `displayExternal`
are used to get the default unit schema for lengths and angles,
and display a string with a particular format.

They aren't used in `DraftGui.py`, but are used by the
viewprovider of the Dimension objects. Therefore, they are moved
into a separate module, so that they can be imported without
using the entire `DraftGui` module.
2020-07-10 12:29:30 +02:00
vocx-fc
94b0fe1599 Draft: clean up ViewProviderLabel class
Various improvements in style, PEP8, spacing, docstrings.

Improve the methods to update the text, the arrow, and the frame
of the label.

Options to handle `Justification` and `LineSpacing` are added.
These can be handled just like with the `ViewProviderText` object,
as the internal text node is the same, a `SoAsciiText`.

Nevertheless, currently the leader line and the frame that are
drawn for the label don't consider the correction in position
for the `Justification` or `Linespacing` so the graphics
may be overlapped in certain situations.
2020-07-10 12:23:43 +02:00
vocx-fc
22e9cf8921 Draft: clean up ViewProviderText class
Various improvements in style, PEP8, spacing, docstrings.

The list of strings is set to empty before being assigned again.
This solves a problem of the text not being updated correctly.

In the past some `try-except` blocks were there to catch and
ignore certain exceptions that apparently were caused by a
race condition, where certain properties are not assigned
to the object before they are used. These errors
don't seem to occur in v0.19, so we removed the exception
handling. We leave comments mentioning the issue
in case it re-appears.

The `DisplayMode` is swapped, so now `'2D text'` means that the
text always faces the camera, and `'3D text'` means that the
text can be positioned in different orientations in the 3D space.
This is consistent with the `Draft Label` behavior.

A function `draftutils.gui_utils.migrate_text_display_mode`
is provided to help migrate older objects of type `Text`
or `DraftText` to the new display mode.
2020-07-10 12:23:43 +02:00
vocx-fc
270e4b100a Draft: move default annotation style properties to utils module
These style properties are used by `ViewProviderDraftAnnotation`
and by the Gui Command `Draft_AnnotationStyleEditor`.

Therefore, they are moved from `draftguitools.gui_annotationstyleeditor`
module to the `draftutils.utils` module, so that they
are in a central location where they won't cause circular
dependencies.
2020-06-19 12:15:25 +02:00
luz.paz
720b0b96d0 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-15 10:11:22 +02:00
vocx-fc
a719859054 Draft: adjust the text size for Labels with format_object
This function, `draftutils.gui_utils.format_object`,
takes the value defined in the `DrafToolBar`, and uses it
to specify the `FontSize` for `Text` objects.

Now it specifies the `TextSize` for `Label` elements as well.
2020-06-15 09:59:57 +02:00
hlg
0759436661 Arch/Draft: minor fixes 2020-06-03 14:50:17 +02:00
vocx-fc
c5193ec6f7 Draft: add use_instead function to warn users about old functions
This can be used to deprecate older definitions
and suggest users to try a different function. This will be used
in the make functions in `draftmake`.
2020-06-02 12:29:50 +02:00
vocx-fc
78d7616ddc Draft: add find_object function to find objects by label in a document
Also add `find_doc` to be able to test the existence of an
active document before searching for the object.

These can be used in the make functions of most modifier commands.
2020-06-02 12:29:50 +02:00
vocx-fc
fea82942d3 Draft: clean up the utils module a bit, PEP8, style 2020-06-02 12:29:50 +02:00
Yorik van Havre
43c4f9af3d Draft: Added a border around the Draft grid (can be disabled in prefs) 2020-05-27 18:02:04 +02:00
carlopav
a98e2076db Draft: Edit reordering 1
Started a general refactor to handle all the conversion between global and object coordinate system inside the main methods and just use object coordinates inside object functions.
Draft: Edit reordering 2

Fixed Editing of Part objects according to the new refactor
Draft: fix in autogroup function for dimensions


Draft: fixed Polygon editing when inscribed or circumscribed


Draft: Edit support for Ellipse object


.


Draft: Edit docstrings


Draft: Edit reordering 3


Draft: Fixed Edit for structure object

And also refactor Edit methods that control special object display during editing.
Draft: Fixed edit for arch wall object
2020-05-25 13:37:55 +02:00
carlopav
5d7ae69c54 Draft: fix Statusbar snap and scale if Draft is the default startup wb
ref: https://forum.freecadweb.org/viewtopic.php?f=23&t=43990&start=50#p396139
2020-05-18 12:19:27 +02:00
carlopav
2c4de88132 Draft: moved ConvertDraftText to utils.py 2020-05-15 14:43:26 +02:00
carlopav
b1e2574f1c Draft: move get_DXF to utils.py 2020-05-15 14:43:26 +02:00
carlopav
3a44b4e2c0 Draft: moved getrgb to utils.py 2020-05-15 14:43:26 +02:00
vocx-fc
d438aec821 Draft: remove old DraftFillet class, and make it a redirect
Remove the make function that creates the old object,
its corresponding Gui Command, and the old `DraftFillet.Fillet`
proxy class, which now is a redirection to the new `Fillet`
class defined in `draftobjects.fillet`.

Also change the unit test, and the `draft_test_object` script
to run `Draft.make_fillet`.
2020-05-13 11:37:56 +02:00
vocx-fc
68e6d8d164 Draft: activate both Fillet commands to test
In this moment the old fillet tool is `Draft_Fillet`
and the new tool is `Draft_Fillet_new`. They are imported both,
so they can both be tested from the interface.
2020-05-13 11:37:56 +02:00
carlopav
64619a615a Draft: Bugfix to getCloneBase after objects splitting 2020-05-12 10:37:20 +02:00
vocx-fc
fee81e8290 Draft: correct description of draftutils package
These utilities are general in the entire workbench,
some of them can be used without a GUI, and some of them
absolutely require the GUI to function.
2020-05-06 12:46:24 +02:00
vocx-fc
da413bd2c2 Draft: small improvements to the todo module
Small ammeds to the docstrings and the use of `App` and `Gui`
namespaces, and the explicit use of the `ToDo` class
in `PascalCase`.
2020-05-04 10:55:18 +02:00
vocx-fc
14423df83c Draft: show the error message of the ToDo class in the terminal
The error is both sent to the log file and to the console
instead of only the log.

This is helpful to troubleshoot problems with the delayed
execution of commands, such as when testing a relatively
broken version like d7a9f2ebf9.
2020-05-04 10:55:18 +02:00
carlopav
ad0a400da2 Draft: split isClosedEdge form Draft.py
.
2020-05-04 10:51:08 +02:00
carlopav
8157b86629 Draft: split FilterObjectsForModifiers from Draft.py 2020-05-04 10:51:08 +02:00
vocx-fc
4ed80cdf83 Draft: move Drawing GuiCommand to gui_drawing module
Also, finally the command is removed from the toolbar
as the Drawing Workbench is obsolete since v0.17.

The command is still loaded and defined by the workbench
but it is no longer presented to the user interface in the menu
or toolbar.
2020-04-24 13:49:13 +02:00
Yorik van Havre
5b3fea59e0 Draft: Annotation editor 2020-04-22 13:38:17 +02:00
carlopav
18cfafeed8 Draft: reintroduced grid button in snap toolbar 2020-04-22 12:14:23 +02:00
carlopav
c857754460 [Draft] Further cleanup of the branch
thanks to vocx revisions
2020-04-20 12:38:06 +02:00
carlopav
be75f4febc [Draft] Statusbar widgets, preferences to disable draft statusba
.


.


.


.
2020-04-20 12:38:06 +02:00
carlopav
a23224da88 [Draft] Added Draft Snap Statusbar
.
2020-04-20 12:38:06 +02:00
carlopav
55e537d79d [Draft] Improved Snapper Toolbar Behaviour
Changed snap toolbar behaviour:
- create a list of available snaps (Gui.Snapper.snaps)
- make it consistent with Snap Gui Commands (in gui_snaps module)
- create a list of active snaps (Gui.Snapper.active_snaps)
- refactor the isEnabled() method to allow it to check if the given snap is in Gui.Snapper.active_snaps and not if the snap toolbar button isChecked()
- updated and reordered the new list of gui snap commands in draftutils.init_tools and used it as a base to refactor the creation of draft toolbar
- updated all the draft snap gui tools to make them control the toolbar buttons directly
.


.


.
2020-04-20 12:38:06 +02:00
vocx-fc
1f3a88f1ce Draft: move Draft_AddConstruction to gui_groups module
Also add a new icon for adding to the construction group.
2020-04-16 11:40:58 +02:00
vocx-fc
60f3155651 Draft: move Draft_Slope to gui_lineslope module
The class name was renamed to `LineSlope` as it is fundamentally
inteded to control slopes of lines.
2020-04-16 11:40:58 +02:00
vocx-fc
8aeb33f203 Draft: move Draft_FlipDimension to gui_dimension_ops module 2020-04-16 11:40:58 +02:00