Commit Graph

77 Commits

Author SHA1 Message Date
vocx-fc
565f2b35b4 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
7caa8d4dcf Draft: migrate older properties of PathArray 2020-06-05 13:14:46 +02:00
vocx-fc
f2f22e155b 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
f1bcffbc16 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
572788edd7 Draft: set the properties of PathArray through functions 2020-06-05 13:14:46 +02:00
vocx-fc
9dd1c2efa5 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
835f4b424f 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 ff323ebdb5.

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
f56c4fa67f 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
7df2bb33c2 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
d6fba74d2f 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
bde91ccf15 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
5c273e7593 Draft: clean up code, PEP8, and docstrings for DraftLink
This class was created by realthunder during the `LinkMerge`,
in de66e563e0, 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
9919849de5 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
1a277967eb 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
4b65440112 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
25d419e1c0 [Draft]Path Array tangent rotation direction 2020-06-02 13:55:44 -04:00
Yorik van Havre
369f860998 Draft: Added Area and Offset properties to Facebinder 2020-06-02 14:00:25 +02:00
Yorik van Havre
811327620f Draft: Fixed translation regression 2020-06-02 13:44:46 +02:00
vocx-fc
547b9e4e20 Draft: small fix for older PathArray objects
Older PathLinkArray objects had a `useLink` attribute
which was migrated to `use_link`. A recent commit, ff323ebdb5,
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
wandererfan
5f46999f94 [Draft]Post-review changes 2020-05-23 11:22:14 -04:00
wandererfan
ff323ebdb5 [Draft]Additional modes for PathArray 2020-05-23 11:22:14 -04:00
vocx-fc
681b33dab8 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
carlopav
125d0ca84d Draft: various cleanup
Mainly added an empty line at the end of each file and changed docstrings.
2020-05-15 14:43:26 +02:00
carlopav
95fe3076bd Draft: split DrawingView from Draft.py 2020-05-15 14:43:26 +02:00
carlopav
ccad0fed30 Draft: cleanup of Array properties after splitting 2020-05-15 14:43:26 +02:00
carlopav
79ef4d991a Draft: split Array from Draft.py 2020-05-15 14:43:26 +02:00
carlopav
26e8adaee4 Draft: split PointArray from Draft.py 2020-05-15 14:43:26 +02:00
carlopav
dfee68d05a Draft: split Path Array and viewprovider Array from Draft.Py
Draft: fix typo in PathArray
2020-05-15 14:43:26 +02:00
carlopav
006a1a4036 Draft: Split DraftLink from Draft.py 2020-05-15 14:43:26 +02:00
vocx-fc
d437242924 Draft: split Fillet code into various modules
The original code was in `DraftFillet.py` which is split
into a different modules like the rest of the workbench.

The object code is in `draftobjects`, the viewprovider
is in `draftviewproviders`, and the function to create it
is in `draftmake`.
2020-05-13 11:37:56 +02:00
vocx-fc
8d0350ef0c Draft: small updates to the Annotation class
This annotation class implements `onDocumentRestored`
in order to add the `ScaleMultiplier` property to older
`Dimension`, `Label`, and `Text` objects.
2020-05-12 10:02:21 +02:00
vocx-fc
de9c9a6be2 Draft: move arc_3points to the make package
Also import it in the `Draft` namespace so that is available
as `Draft.make_arc_3points`.

Use this new function in the unit test `drafttests.test_creation`,
in the GuiCommand `draftguitools.gui_arcs`, and in the
`draft_test_objects` script.
2020-05-12 10:00:41 +02:00
vocx-fc
24c89f3370 Draft: update description of draftobjects package 2020-05-06 12:46:24 +02:00
carlopav
cbeca1b4a6 Draft: fix ScaleMultiplier on annotation objects
Object auto create the property when opening an old Draft annotation
.
2020-05-04 10:53:54 +02:00
luz.paz
d8b41f70d6 [skip-ci] Fix typos in Draft, Mesh, and src/Tools
Found via codespell v1.17.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-04-30 11:40:38 +02:00
carlopav
582a4c0d83 Draft: split Shape2DView from Draft.py 2020-04-29 11:41:02 +02:00
carlopav
0912046068 Draft: split Block from Draft.py 2020-04-29 11:41:02 +02:00
carlopav
a4f802847c Draft: split Shapestring from Draft.py 2020-04-29 11:41:02 +02:00
carlopav
00ec299e06 Draft: split Facebinder from Draft.py 2020-04-29 11:41:02 +02:00
carlopav
b94ba1bf4c Draft: split WorkingPlaneProxy from Draft.py 2020-04-29 11:41:02 +02:00
carlopav
d450c20f06 Draft: split Ellipse from Draft.py
.
2020-04-29 11:41:02 +02:00
carlopav
2d99a2f343 Draft: split Point from Draft.py
.
2020-04-29 11:41:02 +02:00
carlopav
e4bfb0b21d Draft: split clone from Draft.py
.


.
2020-04-29 11:41:02 +02:00
carlopav
f1eaa0b93c Draft: split wire related tools from Draft.py
Line Polyline BezCurve BSpline
.


.


.
2020-04-29 11:41:02 +02:00
carlopav
4eab0bb787 Draft: split Polygon from Draft.py
.


.


.


.
2020-04-29 11:41:02 +02:00
carlopav
96b2dde9b2 Draft: split rectangle code from Draft.py
.


.
2020-04-29 11:41:02 +02:00
carlopav
a34ca76a4e Draft: split circle from Draft.py
.


.
2020-04-29 11:41:02 +02:00
carlopav
8b15108501 Draft: compatible super for AngularDimension object 2020-04-29 11:41:02 +02:00
carlopav
43f6721c6e Draft: parent classes of all Draft objects
Add DraftObject and ViewProviderDraft to serve as
the parent classes of all Draft objects
and all Draft view providers.

Inside `Draft.py` we need to import
`_DraftObject` from `draftobjects.base`;
and `_ViewProviderDraft`, `_ViewProviderDraftAlt`,
and `_ViewProviderDraftPart` from `draftviewproviders.view_base`.
.


.


.


.
2020-04-29 11:41:02 +02:00
Yorik van Havre
5b3fea59e0 Draft: Annotation editor 2020-04-22 13:38:17 +02:00