Commit Graph

51 Commits

Author SHA1 Message Date
carlopav
e366a3a961 Draft: cleaned imports of Draft.makeCopy 2020-07-07 10:12:49 +02:00
carlopav
fa1a77f21f Draft: support for Document.copyObject() API
Now Draft can copy every FreeCAD object that have a shape.
2020-07-07 10:12:49 +02:00
luz.paz
1da81df756 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
2877870318 Draft: new make_radial_dimension function for more precision
A single `make_dimension` handles three types of dimensions,
(1) simple linear, (2) linear linked to an object, and (3) linked
to a circular edge.

So, we provide a new function, `make_radial_dimension_obj`,
to handle the third case. In this way we can check the input
parameters much better.

We adjust the `Draft_Dimension` Gui Command accordingly.
2020-06-17 12:53:29 +02:00
vocx-fc
984de3b3da Draft: new make_linear_dimension functions for more precision
A single `make_dimension` handles three types of dimensions,
(1) simple linear, (2) linear linked to an object, and (3) linked
to a circular edge.

So, we provide two new functions, `make_linear_dimension`
and `make_linear_dimension_obj`, to handle the first two cases.
In this way we can check the input parameters much better.

We adjust the `Draft_Dimension` Gui Command accordingly.
2020-06-17 12:53:29 +02:00
vocx-fc
e81ca586a2 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
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
8679bdbdaf Draft: separate target into object and subelements in make_label
Before, the `make_label` function had a `target` parameter
that had to be a `LinkSub`, `[Part::Feature, "Edge1"]`.
However, it is easier to pass the individual components
separately using two parameters, `target_object` and `subelements`,
which can then be assembled into `[target_object, subelements]`.

The second element is optional, so it can be set to `None`,
and then the second element will be converted to an empty list,
`[target_object, []]`, as required by the Label's underlying `Target`
property.
2020-06-15 10:01:04 +02:00
vocx-fc
c7eab9c65e 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
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
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
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
66959b2688 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
33d3fb1fa9 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
5dcb4ea104 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
8573bc01e9 Draft: clean up make_array function 2020-06-03 14:46:15 +02:00
vocx-fc
31c8f49467 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
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
Yorik van Havre
7b94a6122b Arch: Handle rectangle-and circle-based profiles in IFC import/export 2020-05-29 12:12:48 +02:00
wandererfan
5f46999f94 [Draft]Post-review changes 2020-05-23 11:22:14 -04:00
wandererfan
bdc9b6d455 [Draft]Trap missing ViewObject attribute
- sometimes VO does not have DiffuseColor
  attribute
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
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
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
carlopav
64619a615a Draft: Bugfix to getCloneBase after objects splitting 2020-05-12 10:37:20 +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
52e1f03da7 Draft: add description of draftmake package
These modules provide the functions that are used to create
the scripted objects defined within the workbench.

The functions import and use the proxy classes
and viewprovider classes in `draftobjects`
and `draftviewproviders`.

These functions are imported in the main `Draft.py` module
so they form part of the public programming interface (API)
of the workbench.
2020-05-06 12:46:24 +02:00
carlopav
54fad8e46a Draft: split makeCopy from Draft.py
.
2020-05-04 10:51:08 +02:00
carlopav
ea19060f64 Draft: fix bspline and bezcurve viewproviders
Finished to fix bspline and bezcurve wiewproviders.
2020-04-30 13:48:33 +02:00
vocx-fc
fd151857b0 Draft: add view provider for Bezier curve object 2020-04-30 09:41:41 +02:00
vocx-fc
dfece47520 Draft: add view provider for BSpline object 2020-04-30 09:41:41 +02:00
Bernd Hahnebach
d7a9f2ebf9 Draft: workaround to be able to import Draft 2020-04-29 22:46:27 +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
bea4431b18 Draft: split makeSketch 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