Commit Graph

2190 Commits

Author SHA1 Message Date
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
aba904f1e2 Draft: move more functions to draftgeoutils.general 2020-06-05 13:15:31 +02:00
vocx-fc
0e82ae26cd Draft: move functions to draftgeoutils.circles_incomplete 2020-06-05 13:15:31 +02:00
vocx-fc
4dc6b975db Draft: move functions to draftgeoutils.circle_inversion 2020-06-05 13:15:31 +02:00
vocx-fc
1ea5b19ea4 Draft: move functions to draftgeoutils.circles_apollonius 2020-06-05 13:15:31 +02:00
vocx-fc
7f9e6ba16b Draft: move more functions to draftgeoutils.circles, part 2 2020-06-05 13:15:31 +02:00
vocx-fc
4c4531a5fd Draft: move functions to draftgeoutils.circles, part 1 2020-06-05 13:15:31 +02:00
vocx-fc
b6adbe98e4 Draft: move more functions to draftgeoutils.arcs 2020-06-05 13:15:31 +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
vocx-fc
466751c7a8 Draft: clean up code, PEP8, and docstrings in PathArray
Test the inputs to the `make_path_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 the new parameters to the make function, `align_mode`,
`tan_vector`, `force_vertical`, and `vertical_vector`.
These properties were added to the proxy object in 0db11da9cf.

Add  message deprecating the older call `makePathArray`.

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 `PathArray` class as well.
2020-06-05 13:14:46 +02:00
vocx-fc
c6bac1e58e Draft: move functions to draftgeoutils.cuboids 2020-06-03 15:22:09 +02:00
vocx-fc
3a572d50ca Draft: move more functions to draftgeoutils.faces 2020-06-03 15:22:09 +02:00
vocx-fc
5e25517c37 Draft: move more functions to draftgeoutils.intersections 2020-06-03 15:22:09 +02:00
vocx-fc
ae9850175a Draft: move more functions to draftgeoutils.geometry 2020-06-03 15:22:09 +02:00
vocx-fc
5622da6b90 Draft: move more functions to draftgeoutils.wires 2020-06-03 15:22:09 +02:00
vocx-fc
910ce96aed Draft: move more functions to draftgeoutils.edges 2020-06-03 15:22:09 +02:00
vocx-fc
538327995d Draft: move more functions to draftgeoutils.general 2020-06-03 15:22:09 +02:00
hlg
1da75f6971 Arch/Draft: minor fixes 2020-06-03 14:50:17 +02:00
vocx-fc
f40d0efee1 Draft: separate the placement functions from the Array class
This way they can be tested individually in the Python console
without needing the `Array` class at all. In the future these
methods could be moved to `DraftGeomUtils` or to `draftfunctions`.
2020-06-03 14:47:44 +02:00
vocx-fc
2ee20d1a7a Draft: hide properties of other array types in Array class
Leave only the corresponding properties by examining
the value of `ArrayType`.
2020-06-03 14:47:44 +02:00
vocx-fc
1c480fd5dc Draft: set the properties of the Array through functions
Since the `Array` class handles three different types, they
have different sets of properties. We add them to specific functions
so that they are clearly identified.
2020-06-03 14:47:44 +02:00
vocx-fc
ca9cfc6804 Draft: clean up code, PEP8, and docstrings for Array class
Added author of the `CircularArray` array type, "M. G. Berberich"
(berberic2) or "rynn" in the forum.
2020-06-03 14:47:44 +02:00
vocx-fc
d93e8518b0 Draft: clean up code, PEP8, and docstrings for DraftLink
This class was created by realthunder during the `LinkMerge`,
in 8cd9339b8c, to demonstrate how to use the `App::Link`
objects to create Link aware arrays.

It is used by `draftobject.array` (ortho, polar, circular)
and `draftobject.patharray` to create respective Link arrays.

This class is a bit mysterious. We need more documentation
on how the properties are being set, and how the code interacts
with the arrays that use it.
2020-06-03 14:47:44 +02:00
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