Commit Graph

74 Commits

Author SHA1 Message Date
Abdullah Tahiri
893d7afccc Sketcher: PCH 2019-05-02 07:12:27 +02:00
Abdullah Tahiri
ee99340558 Make Open vertices detection routine accesible to Python 2018-12-03 12:11:11 +01:00
luz.paz
cfbfa9dc6b Misc. typo, grammar, and whitespace fixes
[skip ci]
2018-11-27 15:02:58 -03:00
wmayer
a67ee5648c remove trailing spaces 2018-11-05 10:53:01 +01:00
Abdullah Tahiri
843f636d85 Sketcher: Expose mass datum commands to python 2018-11-04 14:41:20 -03:00
Abdullah Tahiri
a93a5e9c93 Sketcher: Use transparent exception mechanism for fillets
=========================================================

This ensures that the exception back in the c++ that invoked python retains the type of exception and can be properly catched.
2018-10-28 18:34:50 +01:00
Abdullah Tahiri
49a71e9399 Sketcher: Python SketchObject support 2018-07-30 00:47:20 +02:00
Abdullah Tahiri
9f969e558c Sketcher: Python command to delete all the constraints at once 2018-07-29 13:44:07 +02:00
Abdullah Tahiri
6e865aa3e5 Sketcher: Python SketchObject implementation
Exposure of all the functionality in the previous commits to Python
2018-07-29 13:44:07 +02:00
Abdullah Tahiri
2c89860a38 Sketcher: Wrong DoF reported - Fixes #3503 2018-06-09 11:11:46 +02:00
Abdullah Tahiri
eacb14c3d4 Sketcher: Python interface to solveraid 2018-06-09 11:02:53 +02:00
Abdullah Tahiri
8ebb8ce90b Sketcher: Empty list means all geometry for Python addCopy addRectangularArray and addMove 2018-05-31 14:36:21 +02:00
Abdullah Tahiri
93843aee9f Sketcher: Python support for moving Geometry 2018-05-31 14:34:58 +02:00
Abdullah Tahiri
5e11e37712 Sketcher: Python Interface for Constraint Virtual Space
=======================================================

set/get/toggle python interface to enable to set the virtual space status of a constraint via SketchObject.
2018-01-26 17:02:46 +01:00
wmayer
adaf9323f3 improve whitespaces 2018-01-13 14:07:15 +01:00
Abdullah Tahiri
e1bf2045dd Sketcher: Overload delConstraintonPoint Python to allow deletion on GeoId and Pos 2018-01-13 13:55:56 +01:00
Abdullah Tahiri
6210b602de Sketcher: Python command to delete all internal geometry and constraints of an sketch 2017-11-06 14:18:12 +01:00
wmayer
a5a04e359c fix bug in pr774, improve whitespaces 2017-06-19 13:32:27 +02:00
Alexander Lin
144e4759ce Adds extend feature to Mod/Sketcher
Fixes #1187
2017-06-19 13:07:37 +02:00
Peter Lama
fa4bebf2e0 Use OCCT Handle macro for Handle_ classes
This is the result of running OCCT's upgrade script provided
with OCCT 7.0. See
https://www.opencascade.com/content/freecad-occt710-and-windows-rtti-data-missing#comment-form
and
https://www.forum.freecadweb.org/viewtopic.php?f=4&t=21405&start=120#p169019
for why this is necessary for OCCT >= 7.1
2017-04-20 12:27:34 +02:00
Abdullah Tahiri
3cfef62381 Sketcher: Carbon copy Python command 2017-04-10 08:57:25 +02:00
Abdullah Tahiri
7a2760695a Sketcher: SketchObject - Python command to increase knot multiplicity 2017-04-08 12:58:06 +02:00
Kunda
9410e751e9 source typo fixes pt4 (only on py3 merged code) 2017-03-02 13:47:21 +01:00
wmayer
03c232fa82 py3: ported Skechter to python3 2017-03-01 17:20:20 +01:00
wmayer
a0aa4fdfef Some fixes of pr 538
fix -Wreturn-type
homogenous naming style
use official spelling of B-spline
2017-02-21 13:30:43 +01:00
Abdullah Tahiri
edc20e7a84 Sketcher: IncreaseBSplineDegree python implementation 2017-02-21 13:24:10 +01:00
Abdullah Tahiri
52240401ae Sketcher: ConverttoNURBS python implementation 2017-02-21 13:24:10 +01:00
wmayer
d065c2fe5b fix whitespaces 2017-01-20 19:22:50 +01:00
Abdullah Tahiri
ddd8ce238c Sketcher: Enable BSpline creation in SketchObjectPy 2017-01-05 21:52:35 +01:00
Abdullah Tahiri
369f1f9368 Sketcher: Enable Parabola creation in SketchObjectPy 2016-12-18 00:46:01 +01:00
Abdullah Tahiri
e928e418ec Sketcher: New Feature: Hyperbola/ArcOfHyperbola
===============================================

- ArcOfHyperbola creation method
- Solver representation (undefined moving)
- SketchObjectPyImp (here we still miss the Part->Partdesign conversion)
- Sketch validation for hyperbola
- Hyperbola creation method: shows the "proof of concept", but it is very buggy!!

Notes:
- Missing icons, probably missing geo normal curve implementation - rebasing -
- Fixes to adapt Hyperbola to Derivector implementation and make it compile
2016-11-27 18:45:33 +01:00
Alexander Golubev
305151be34 App/Origin: big refactoring
- Rebase App::Origin on App::DocumentObject
 - Keep all control over the Origin structure inside the Origin and it's
   ViewProvider
 - Add OriginFeature class as common base for App::Plane and App::Line
 - Rebase App::Plane and App::Line on top of newly created class and
   move to the file.
 - Change Origin's ViewProvider API associated with temporary display
 - Lots of associated changes to files
 - Several minor fixes
 - Lots of new bugs
2016-04-12 18:12:18 +02:00
jrheinlaender
99e68a2a75 Improved SketchObject error reporting 2016-04-12 18:11:55 +02:00
jrheinlaender
2acee44b89 Centralize the check for valid external geometry to ensure consistency (part 2) 2016-04-12 18:11:55 +02:00
jrheinlaender
73d55c538b Allow geometry from other bodies in the same par as external geometry for sketches 2016-04-12 18:11:52 +02:00
jrheinlaender
857ede8847 Moved generic Datum class to Part module to avoid Sketcher dependency on PartDesign 2016-04-12 18:11:49 +02:00
wmayer
ab449f5dd8 + on rename of contraint make sure that new name is different, on swap constraint names make sure they have user-defined names 2016-03-12 20:02:18 +01:00
Abdullah Tahiri
52b79c1764 Sketcher: Bug fix: unable to move geometry after addition of a constraint
=========================================================================

This fixes issue:
http://www.freecadweb.org/tracker/view.php?id=2281

Discussed in:
http://forum.freecadweb.org/viewtopic.php?p=101910#p101910

How to reproduce?
With Auto-Update mode unchecked, execute the sequence in the bug tracker. You will reach to a geometry assembly successfully solved that can not be moved.

Why?
The coincident constraint is partially redundant within the meaning of redundancy of the solver.
The solve within "addconstraint" in SketchObjectPy.cpp causes the geometry to move to meet the coincident constraint.
At the end of the solve, the initial solution used in diagnostics is no longer valid (the geometry moved). This causes a subsequente move not to be executed.

The Solution:
Recalculate just the initial solution after the addition.
2015-10-23 00:13:20 +02:00
wmayer
92b330bbcb + support of unicode names for sketch constraints 2015-09-24 03:17:47 +02:00
Mateusz Skowroński
05f95c0506 Fix files encoding. Go from ISO8859-1 to UTF-8. 2015-09-21 19:50:49 -03:00
Eivind Kvedalen
cacf7bdaf1 Sketcher: Added support for expressions. 2015-09-21 14:51:10 +02:00
wmayer
1a66bc4c45 + improve whitespaces 2015-08-31 13:53:48 +02:00
Abdullah Tahiri
3ec90116f1 Sketcher: Extension of Copy/Array functionality to clone
=============================================================

This commit allows the user to select in advance whether he wants a simple copy or a clone.

This involves substitution of dimensional constraints in the copies by equality and parallel constraints.

Terminology change for Arrays, now it is Rectangular array
2015-08-30 12:08:43 +02:00
Abdullah Tahiri
7b053b5602 Sketcher: UI Copy Support & 2D Array python command rework
==========================================================

- Support for copying geometric elements in the sketcher with Ctrl+C (or using the still missing icon). It will show you the vector of displacement from the
"reference point". The reference point can be chosen by the user (although it is not necessary to do it so) by making the point the user wish to be the reference point
the last selected element. It conveniently incorporates "autoconstraints", so that you can make this point (the one of the copy) directly coincident with any other point in the sketch.

- Python 2D array command modified to lock elements position using construction lines and constraints.
- Support for different spacing between u and v directions (the direction of the cols and the direction of the rows).

- Support to avoid copying DistanceX and DistanceY constraints when used for locking a point. This means that if the geometry that you copy(array) is
fully constraint, the resulting 2D array is also fully constraint.

- UI support for creating 2D linear arrays in the sketcher.
- Bug fix in python addArray, wrong line copy startingpoint calculation fixed.

How to create a 2D array in the sketcher:
1. Select your geometric elements.
2. Click the button
3. Fill in the rows/cols and preferences on spacing and constraining each element of the array
4. Click Ok
5. Define the direction of the cols of the array and click
2015-08-30 12:08:42 +02:00
Abdullah Tahiri
4a0fa00e9e Sketcher: New Features: Python copy and array commands
======================================================

Two new python commands (no UI yet).

Copy: Copies the geoids in a list by a displacement given by a Vector3d:

App.ActiveDocument.Sketch001.addCopy([0,1,2,3,4,5],App.Vector(150,150,0))

Array: Copies the geoids in a list cols times in the displacement vector
direction and rows times in the perpendicular to the displacement vector:

App.ActiveDocument.Sketch001.addArray([0,1,2,3,4,5], App.Vector(150,150,0),3,4)

N.B.: You need to recompute or solve to update the view

App.ActiveDocument.recompute()

or

App.ActiveDocument.Sketch001.solve()
2015-08-30 12:08:40 +02:00
Abdullah Tahiri
38256931af Sketcher: New Feature: Symmetric tool
=====================================

Creates geometry symmetric to the selected one with respect to the last selected point or line.

It does not support the following constraints:

- Angle
- Horiz/vertical distance
- SnellLaw

Horizontal and Vertical (directional) dimensions removed from the the copying process when created
on a single edge (by picking one edge instead of two points), i.e. Constraint involving only one GeoId at "First".
2015-08-30 12:08:40 +02:00
wmayer
96219e72b5 + fix various warnings 2015-08-30 11:48:26 +02:00
Abdullah Tahiri
143c87799a Sketcher: new Feature: Group creation of Sketcher geometry and other improvements and bug fixes
===============================================================================================

Group creation:
- complex geometries (consisting of several geometry elements and constraints) have been rewritten to use python list (one command call for all geometries and constraints)
- Ellipse ExposeInternalGeo as group creation of geometries and constraints

To construction mode creation:
- addGeometry python and SketchObject functions modified to take an additional optional parameter "construction" to create the geometry/geometries directly as construction.
  In addition to the shorter form, this helps generate less amount of onChange propagation and Redraws.
- all the geometry creation commands in CommandCreateGeo.cpp have been rewritten to use the new construction argument. This includes modifying the regular polygon script to
take a new optional parameter to create geometry as construction in addGeometry.
- special care is taken in group creation not make construction points
- Show/hide internal geometry implemented with this option.

To solving:
- the solve previously included after every geometry addition (when in no Update, e.i. no Recompute mode) has been removed and each Gui::Command calls either an UpdateActive
for recompute or a Solve in no Update mode. This is behaviour is less intrusive and uniform with group creation.

Bug fixes and redrawing reduction:
- Fixes the CheckId exception problem. The solution also helps further remove redraws during creation of complex geometry (e.g. Slot)
- Fixes touching the sketch by only opening it.
- Code clean up.
2015-06-15 22:56:36 +02:00
Abdullah Tahiri
48c5b79b81 Sketcher: Major re-structuration: New Solving Model: General Sketch Solve call reduction
=======================================================================================

ActSketch in ViewProvider dissapears. The temporal sketch (sketch.cpp) for solving is now a data member of SketchObject.cpp (hereinafter solvedSketch). All the solving is concentrated in SketchObject.cpp.

SketchObject provides an interface to expose its solver, as it is still currently needed for some UI operations from ViewProviderSketch, like dragging points (solving rubber bands).

ViewProviderSketch still can select whether to draw the solvedSketch geometry (previously ActSketch) geometry (UI staff) or the SketchObject geometry. Performancewise, it makes sense to separate this two
geometries, as the SketchObject one involves modifying the Geometry and Constraint Properties (including all the undo related functionality), which would mess the undo functinality and incur in a big
peformance penalisation while dragging. One characteristic of solvedSketch is that its geometry is solved, whereas the geometry of SketchObject may not have been solved yet.

These geometries may differ at for the following reasons:
1. The geometry corresponds to an ongoing dragging operation, so solvedSketch has the last calculated dragging geometry, while SketchObject has the one corresponding to initial position.
2. Geometry/constraints were added to the sketch, but no solve/execute was triggered yet (envisioned situation is the future group creation functionality not in this commit).

What do I gain?

- Inserting a (simple) geometry element now costs 1 solver execution.
- Inserting a constraint now costs 1 solver executions.

For reference, in previous versions inserting a constraint involved 5 solver executions.

The following information provide a historical review of the coding of this commit (formed of 10 squashed commits):

This is a general sketch solve call reduction, not only during geometry creation (this commit does not include until here any specific measure to reduce calls on geometry creation, that is another branch)

After a lot of profiling, it seems that the "cause"(tm) that creates so many solver calls is that every update generates a solving in ViewProviderSketch, regardless of the need for that update,
many times with the only aim of providing the DoF for the message dialog and keeping ActSketch in sync with SketchObject in case it is needed (currently UI moving points, constraints,...).

Sketch solver is now a data member of SketchObject instead of a temporal object that gets initilized and destroyed.

This allows:
1. Potentially more synergy reducing calls to setUpSketch (still to be seen, still to be optimized)
2. Allowing SketchObject to access the latest geometry that has been solved => In future, allow objects that use SketchObject to obtain the latest
solved geometry instead the geometry of SketchObject that may still be unsolved. This is relevant for drawing the geometry

No more solving in ViewProviderSketch. Solving a Sketch is now an exclusive competence of SketchObject.

There is however a lot of cleaning to do in ViewProviderSketch

(I mean, not that these commits are making a mess in VPSketch,
but that as a consequence of the changes, it should be possible to
optimize VPSketch, specially moving and drawing methods)

Very useful comment for future developers that may wonder why a solve per constraint just upon addition is necessary.

Added a new function to get the size of the geometry of the instance of the solver object (Sketch.cpp).
The previous way was to extract the geometry, which is costly and error prone, as you have to delete it afterwards.

Inserted comment about the necessity of triggering a Part2D update during edit mode
2015-06-15 22:53:59 +02:00
Abdullah Tahiri
4a052bebb5 Sketcher: Driving/reference creation improvements and some other fixes
======================================================================

- Changing from Driving to reference does not include unnecessary solvings.
- Added some checks to avoid making Driving constraints when calling directly from python and involving only external geometry (would give redundant constraints).
- New python command toggleDriving to just change the status from reference to Driving
- New UI toolbar Command to toggle constraints
- Fix to allow switching from/to construction mode during continuous mode creation.
- Enable/Disable for constraints in constraints widget has changed to operate on multiselection and now effects "toggle" instead of enable/disable.
- Disable the option to directly create a SnellsLaw non-driving constraint (this constraint does not support direct creation, it can be toggled to non-driving after creation though).
2015-05-30 16:39:32 +02:00