Commit Graph

2162 Commits

Author SHA1 Message Date
vocx-fc
3e67b469d4 Draft: clean up CircularArray code
Avoid `Draft.py` in the `make_circular_array` function because
it creates a circular dependency.

Use function to find the object in `make_circular_array`.

Now the make function accepts as input a `"String"` which must be
the `Label` of an object in the document, so it is easier to create
arrays interactively from the Python console.

Clean up the GuiCommand and task panel code, and avoid printing
messages to the terminal, as this is already done
by the make function.
2020-06-03 14:46:15 +02:00
vocx-fc
1ad8b16a81 Draft: clean up PolarArray code
Avoid `Draft.py` in the `make_polar_array` function because
it creates a circular dependency.

Use function to find the object in `make_polar_rarray`.

Now the make function accepts as input a `"String"` which must be
the `Label` of an object in the document, so it is easier to create
arrays interactively from the Python console.

Clean up the GuiCommand and task panel code, and avoid printing
messages to the terminal, as this is already done
by the make function.
2020-06-03 14:46:15 +02:00
vocx-fc
604e70fd20 Draft: clean up OrthoArray code
Avoid `Draft.py` in the `make_ortho_array` function because
it creates a circular dependency.

Use internal functions to abstract the orthogonal arrays.
The `_make_ortho_array` is a simple wrapper over the general
`make_array` function.

The result is four variants:
- `make_ortho_array`
- `make_ortho_array2d`, without the Z component
- `make_rect_array`, strictly rectangular components
- `make_rect_array2d`, strictly rectangular without the Z component

Also use functions to perform checking of the inputs,
whether these are vectors, numbers (integer and floats)
or integers.

Now the make function accepts as input a `"String"` which must be
the `Label` of an object in the document, so it is easier to create
arrays quickly from the Python console.

Clean up the GuiCommand and task panel code, and avoid printing
messages to the terminal, as this is already done
by the make function.
2020-06-03 14:46:15 +02:00
vocx-fc
6d1fdebca3 Draft: clean up make_array function 2020-06-03 14:46:15 +02:00
vocx-fc
22c9f9a762 Draft: migrate PointList property to PointObject in PointArray
Use the `onDocumentRestored` method to check for the old
property.

Also modify the position of the base object in the draft test
script.
2020-06-03 14:44:00 +02:00
vocx-fc
96736db93a Draft: add new options to the make_point_array function
It supports a new parameter `extra` that is used
to provide `ExtraPlacement` for the copies of the array.

Adjust the GuiCommand properly.
2020-06-03 14:44:00 +02:00
vocx-fc
eaea9bed6f Draft: add additional displacement property for PointArray
The displacement is added to the position already defined by
the point, in order to impart an additional shift in the copy.

The rotation is also added to the original shape's rotation
by multiplying the quaternions.

Implement `onDocumentRestore` to add the new property
to older objects.
2020-06-03 14:44:00 +02:00
vocx-fc
62d5df3508 Draft: clean up code, PEP8, and docstrings for PointArray
Test the inputs to the `make_point_array` function
and return `None` if there is a problem.

Now the make function accepts as input a `"String"` which must be
the `Label` of an object in the document, so it is easier to create
arrays quickly from the Python console.

Add a message deprecating the older call `makePointArray`.

Adjust the GuiCommand accordingly. Now it uses the commit
mechanism of the parent `Modifier` class so that the executed
functions are recorded in the Python console.

Clean up the `PointArray` class as well.
2020-06-03 14:44:00 +02:00
wandererfan
c203879b50 [Draft]Path Array tangent rotation direction 2020-06-02 13:55:44 -04:00
Yorik van Havre
d97ee0d4a5 Draft: Added Area and Offset properties to Facebinder 2020-06-02 14:00:25 +02:00
Yorik van Havre
83aaa29bb5 Draft: Fixed translation regression 2020-06-02 13:44:46 +02:00
vocx-fc
20ec1fe9bd 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
d80dc23f5b 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
84529ec5bc Draft: clean up the utils module a bit, PEP8, style 2020-06-02 12:29:50 +02:00
carlopav
011a0f0764 Draft: further cleanup of Draft Edit. 2020-05-29 13:35:51 +02:00
vocx-fc
8c3705599d Draft: small fix for older PathArray objects
Older PathLinkArray objects had a `useLink` attribute
which was migrated to `use_link`. A recent commit, 0db11da9cf,
made some improvements to the PathArray
object, but broke the migration of the property.

This fixes the migration, so that now all objects should
open correctly.
2020-05-29 13:34:34 +02:00
vocx-fc
d8f770989c Draft: move functions to draftgeoutils.linear_algebra 2020-05-29 13:31:28 +02:00
vocx-fc
2f41eaaf27 Draft: move functions to draftgeoutils.offsets 2020-05-29 13:31:28 +02:00
vocx-fc
851f6c02df Draft: move functions to draftgeoutils.fillets 2020-05-29 13:31:28 +02:00
vocx-fc
09daf7cfa1 Draft: move functions to draftgeoutils.arcs 2020-05-29 13:31:28 +02:00
vocx-fc
5637c0fc12 Draft: move functions to draftgeoutils.wires 2020-05-29 13:31:28 +02:00
Yorik van Havre
b74a2ba7ef Arch: Handle rectangle-and circle-based profiles in IFC import/export 2020-05-29 12:12:48 +02:00
Yorik van Havre
51fda743b0 Draft: Added a border around the Draft grid (can be disabled in prefs) 2020-05-27 18:02:04 +02:00
carlopav
c91df6e15d Draft: Edit arc by 3 points bugfix 2020-05-25 13:37:55 +02:00
carlopav
8749a75056 Draft: bugfix on Edit BezCurve 2020-05-25 13:37:55 +02:00
carlopav
aa92bfba80 Draft: Edit bugfix in Wire/BSpline curve editing 2020-05-25 13:37:55 +02:00
carlopav
8926651c0e Draft: Edit support for Part Sphere
.
2020-05-25 13:37:55 +02:00
carlopav
4507a5a21b Draft: Edit support for Part Cone 2020-05-25 13:37:55 +02:00
carlopav
cdbc11e2ad Draft: reordered supported edit objects and support for PartCylinder 2020-05-25 13:37:55 +02:00
carlopav
89d4a6e00c 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
4e8124e415 Draft: Split Draft Edit into 4 modules
One for interaction handling and 3 for object editing functions, divided between Draft, Part, Arch
2020-05-25 13:37:55 +02:00
carlopav
83b708127d Draft: Cleanup of Draft Edit 2020-05-25 13:37:55 +02:00
vocx-fc
9e50eb4785 Draft: move functions to draftgeoutils.geometry 2020-05-25 13:35:34 +02:00
vocx-fc
c10b006955 Draft: move functions to draftgeoutils.faces 2020-05-25 13:35:34 +02:00
vocx-fc
e1c371281b Draft: move functions to draftgeoutils.sort_edges 2020-05-25 13:35:34 +02:00
vocx-fc
15324a8e72 Draft: move functions to draftgeoutils.intersections 2020-05-25 13:35:34 +02:00
vocx-fc
d1405c9b11 Draft: move functions to draftgeoutils.edges 2020-05-25 13:35:34 +02:00
vocx-fc
378f1583fe Draft: move general functions to draftgeoutils.general
New package for organizing the geometrical utility functions of
the workbench, `draftgeoutils`.

The first submodule is one that deals with general operations.
2020-05-25 13:35:34 +02:00
wandererfan
6a3b2a02f5 [Draft]Post-review changes 2020-05-23 11:22:14 -04:00
wandererfan
770e6c57c2 [Draft]Trap missing ViewObject attribute
- sometimes VO does not have DiffuseColor
  attribute
2020-05-23 11:22:14 -04:00
wandererfan
a697c838fc [Draft]Additional modes for PathArray 2020-05-23 11:22:14 -04:00
vocx-fc
623cd5df35 Draft: activate new array make functions
They are made available in the `Draft` namespace,
and are also used in the unit tests, the test script,
and the GuiCommands.
2020-05-18 12:42:10 +02:00
vocx-fc
3172e82dc1 Draft: move circular, ortho, and polar make functions
Previously they were in `draftobjects`, but since they
don't define new objects, just create objects,
they are moved to `draftmake`.

Also ajust the `CMakeLists.txt` and the corresponding Gui Commands
which use these make functions.

These functions internally use the `Draft.makeArray` function.
We will put comments as reminders so that when this function
is moved to its own module, we can update the derived functions.
2020-05-18 12:42:10 +02:00
vocx-fc
79927f3504 Draft: restructure the draft test script
Add new function `_create_objects`.

Change annotations to use `App::Annotation` instead of `Draft Text`.
2020-05-18 12:41:24 +02:00
carlopav
e4c6949520 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
vocx-fc
0f5b61e280 Draft: check GUI in upgrade function before using viewprovider
Also make various improvements in style, PEP8, return value
is now a tuple of lists instead of a list of lists.

Delay the import of other modules like `Part` and `DraftGeomUtils`
using the `LazyLoader` class.

Update the Gui Command as well.
2020-05-18 12:17:59 +02:00
vocx-fc
bb4a7d783c Draft: check GUI in downgrade before using viewprovider
Also make various improvements in style, PEP8, return value
is now a tuple of lists instead of a list of lists.

Update the Gui Command as well.
2020-05-18 12:17:59 +02:00
vocx-fc
cb984ec492 Draft: check GUI before touching the ViewObject in cut 2020-05-18 12:17:59 +02:00
vocx-fc
1e29867ceb Draft: fix button and icon spacing in AnnotationStyleEditor
The maximum button size was too small to fit the icon
together with the text, if the text size was large.

Also added more tooltips to all widgets of the editor.
2020-05-18 12:16:33 +02:00
vocx-fc
015f51df29 Draft: cleanup code of AnnotationStyleEditor
Introduced in d087ccfa54, 7aa42a4406, 1e8d5d0355.

Make it PEP8 compliant, and shorten line lengths.

It is based on `GuiCommandSimplest` to inherit basic behavior
such as `IsActive` returning `True` when a document exists.
2020-05-18 12:16:33 +02:00