Commit Graph

457 Commits

Author SHA1 Message Date
wmayer
139c1b32dc Merge branch 'master' of ssh://git.code.sf.net/p/free-cad/code 2015-03-28 17:40:36 +01:00
DeepSOIC
e6931f22ed Sketcher: bugfix: disallow opening when geometry types changed 2015-03-28 17:35:10 +01:00
DeepSOIC
e4716e0e29 Sketcher: small asserts cleanup 2015-03-28 17:35:10 +01:00
DeepSOIC
51eab4cd14 Sketcher: add checks for null pointers
Made throws on null pointers.
2015-03-28 17:35:10 +01:00
DeepSOIC
0a83b2460c Sketcher: fix repr string for symmetric constr. 2015-03-28 17:19:37 +01:00
Yorik van Havre
22c17aafbc Merged crowdin translations 2015-03-07 15:17:58 -03:00
Yorik van Havre
87911ca46b Updated ts files from source 2015-02-27 18:56:51 -03:00
Yorik van Havre
7f98d14930 Updated translations from crowdin 2015-02-27 18:46:03 -03:00
Sebastian Hoogen
378c5bf62a enter rubberband after moved by dragIgnoredDistance
issue #1149
2015-02-24 23:51:11 +01:00
wmayer
af80c7493a + fix ambiguous shortcuts 2015-02-18 13:07:42 +01:00
DeepSOIC
55bea2fb6d Sketcher: bugfix in updating constraints after external geometry delete 2015-02-17 12:27:32 +01:00
DeepSOIC
52f062b9c6 Sketch:Validation: swap endpoints for reversed + constraint orientation locking controls
Added buttons to port sketches to CCW-emulation Sketcher.

Bonus =) : Added constraint orientation lock/unlock buttons (affects
point-wise modes of tangent and perpendicular constraints so far)
2015-02-17 12:27:32 +01:00
DeepSOIC
1bbc764e9e Sketcher: fix reversed geometry and rotated arcs
Fixes a bug where an arc, ellipse, or arc-of-ellipse, being reversed in
XY plane, behaved badly in sketcher (see forum thread "Sketch: how to
handle reversed external arcs?"
http://forum.freecadweb.org/viewtopic.php?f=10&t=9130 ).
Also fixes a problem with rotated arcs (see forum thread "Rotating Arc
in Sketcher"
http://forum.freecadweb.org/viewtopic.php?f=22&t=9145#p74262 ).

This is done by adding an emulation flag to a few methods in
Part::GeomXXX, which makes the shape to pretend being non-reversed
(CCW). This causes endpoints of reversed arcs of circles lineked as
external geometry to swap, causing broken sketches sometimes.
2015-02-17 12:27:31 +01:00
Abdullah Tahiri
3d26960f4a Ellipse: External geometry rotated fix
This commit solves the problem that a ellipse appears rotated when added as external geometry, if the face having the
elliptical shape has a direction vector in the -z axis.

This solves the problem. However, the issue with CW and CCW shapes in the sketcher shall be further investigated in order
to arrive to a general acceptable solution.
2015-02-17 12:27:31 +01:00
Yorik van Havre
310ab9e1f0 Updated translation files 2015-02-14 12:16:39 -02:00
Yorik van Havre
ac14a45064 Fixed typo 2015-02-12 13:46:13 +01:00
Yorik van Havre
c2226d02c0 Updated ts files 2015-01-26 16:23:48 -02:00
wmayer
81923b602e + fixes #0001916: Cannot cancel angle constraint dialogue in sketcher 2015-01-15 00:36:44 +01:00
Yorik van Havre
3e78e68f39 Updated base translation files for crowdin 2015-01-13 20:00:09 -02:00
wmayer
3398513a28 + remove useless stuff from Init files 2015-01-13 16:19:19 +01:00
wmayer
39a4b0f0b2 + re-enable reading/writing grid size 2015-01-12 16:29:31 +01:00
wmayer
1ada87b67c + fixes #0001791: Counterbores do not follow when hole is moved 2015-01-12 00:55:56 +01:00
wmayer
8a86559842 + fixes #0000692: Sketcher: Add angle constraint for arcs 2015-01-10 15:15:18 +01:00
wmayer
b8529456e0 + exception handling if moving sketch fails 2015-01-04 13:02:11 +01:00
wmayer
6af88e0ce1 + fixes #0001225: Allow User to Rotate Arc Radius Constraint Text and Leader 2015-01-02 21:26:03 +01:00
DeepSOIC
bfe7f30ee7 Sketcher: AngleViaPoint: revert from OCC angle precalculation
Returning back to the slow temporary-sketch-based
calculateAngleViaPoint, because OCC-based version was incompatible with
always-CCW sketcher geometry. More info in "Sketch: how to handle
reversed external arcs?" forum thread
http://forum.freecadweb.org/viewtopic.php?f=10&t=9130&sid=1b994fa1236db5ac2371eeb9a53de23f
2015-01-02 11:48:34 +01:00
DeepSOIC
58cae5bfb1 Sketcher: validateConstraint update
Refactor validateConstraint and add angle-via-point and snell's law
support there.
2015-01-02 11:48:33 +01:00
DeepSOIC
fd06982d53 Sketcher Ellipse: code cleanup
deleting redundant overloaded functions involving arc-of-ellipse, a few
todo comments, not implemented methods, System(constraintlist)
constructor.
2015-01-02 11:48:33 +01:00
DeepSOIC
45fe358be8 Sketcher: solver rebranding - renamed directory
Sketcher: solver rebranding - updated references

cleanup

Sketcher: GCS: remove unused NAN and INF
2015-01-02 11:48:32 +01:00
DeepSOIC
412d59f26b Sketcher Constraints: small code refactor
Unifying first checks in grad().
2015-01-02 11:48:32 +01:00
DeepSOIC
b814105d8c Sketcher Ellipse: porting to DeriVector2
Sketcher Ellipse: porting tangent-line to DeriVector2

Replacing a ton of unreadable, sage generated math code with
easy-to-manage C++ code.

Sketcher Ellipse: porting internal align-t to DeriVector2

Sketcher Ellipse: small math refactor; const members

Moving the repeating code computing deriv+value of major radius to a
method of GCS::Ellipse.
Marking several methods of DeriVector2 as const member functions.

Sketcher Ellipse: porting arc angle rules to DeriVector2

Just porting.
Probably a complete remake of the concept is worth... Angles can be
calculated explicitly, there's no need to load the solver. I see no
benefits whatsoever on using the solver to keep track of angle values.

Sketcher Ellipse: porting equality to DeriVector2
2015-01-02 11:48:31 +01:00
DeepSOIC
cf4e9df78d OpticConstraints: Adding Snell's law
Fix AngleViaPoint to support new derivative calculation technique.

OpticConstraints: Adding Snell's law. Fix AngleViaPoint to support new derivative calculation technique.

Snell's law constraint added to GCS, but not yet exposed and cannot be
tested.
Since the way CalculateNormal() returns derivatives had changed,
AngleViaPoint constraint needed modifications. Nothing serious.

OpticConstraints: SnellsLaw progress

Addable through python. Fix math. Some quick-and-dirty visual stuff to
get rid of hangs and to see the constraint in action.

OpticConstraints: SnellsLaw: flipping logic fix

OpticConstraints: SnellsLaw progress

Added toolbar button. Allowed editing a datum by doubleclick. New error
message approach during constraint creation.

OpticConstraints: SnellsLaw

OpticConstraints: SnellsLaw: list label improvement

OpticConstraints: SnellsLaw: fix after rebase

OpticConstraints: SnellsLaw: expose helper constraints

Snell's law internally is made of three constraints: point-on-object,
coincident and the Snell's sin/sin. They were all buried under one UI
constraint. Exposing them allows to construct reflection and
birefringence on the point (attempting to do so used to result in
redundant constraints and was often not functional at all).
This commit breaks compatibility with older files.

OpticConstraints: SnellsLaw: small refactor of math

Placing the duplicated code of error and gradient calculation into a
private method.

OpticConstraints: SnellsLaw: fix datum edit unit

OpticConstraints: SnellsLaw: fix datum edit bug

After previous fix, the dimensionless value was not accepted (the
constraint's value did not change, the changes were ignored).
2015-01-02 11:48:31 +01:00
DeepSOIC
88578489fb OpticConstraints: SnellsLaw: icon 2015-01-02 11:48:30 +01:00
DeepSOIC
9e3205eb54 GCS: fundamental changes to simplify derivatives
GCS::Vector2D was morphed into a DeriVector2, a derivative-aware vector.
A bunch of vector math methods were added that implicitly calculate
respective derivatives. Now, there is no need to calculate the partials
- most is done implicitly.
2015-01-02 11:48:30 +01:00
DeepSOIC
8cf34c723e AngleViaPoint Constraint
AngleViaPoint: fixes in UI routines + new messages

Goofed undo message in tangency via point is fixed.
Forgotten updateActive, clearSelection have been added.
New more informative error messages for tangent constraint.

AngleViaPoint: using it instead of via line tangency

* replaced the helper construction line for ellipse-to-ellipse and
similar tangency with a point. Using tangent-via-point there
* deleted tangency via line for point-to-point on
(cherry picked from commit 9e3fa8c8de0f49c0ef3c978e015eb905358dbdd9)

AngleViaPoint: internal/external tangency locking

*Added automatic tangency type lockdown for all new constraints (only
for point-wise tangency).
Tangency type is stored in the constraint datum field, as an angle value
shifted by Pi/2 (to be able to treat 0.0 as undefined type).
Added ability to switch the tangency by setting datum value from python
(can be abused by passing arbitrary angle).
Further simplified the tangency related code in Sketch.cpp.

AngleViaPoint: added license to Geo.cpp

AngleViaPoint: renames in Constraints.cpp/.h

Changed some names to increase self-explanatoryness:
bool "remapped" renamed to "pvecChangedFlag"
"ReconstructEverything()" renamed to "ReconstructGeomPointers()"

AngleViaPoint: renames in Constraints.cpp/.h

Changed some names to increase self-explanatoryness:
bool "remapped" renamed to "pvecChangedFlag"
"ReconstructEverything()" renamed to "ReconstructGeomPointers()"

AngleViaPoint: using for endpoint perpendicularity

+ direction lockdown, just as with tangency.
+ quite a lot of old code is gone because of that

AngleViaPoint: perp-ty UI routine made similar to tangent

(Git has made a very messy diff.)
The changes are:
* Perpendicularity-via-point (3-element selection) support added.
* Endpoint-to-curve and endpoint-to-endpoint supports all shape
combinations.
* a bit of code cleanup and clarifications.

AngleViaPoint: placement of perpendicular icon in 3d view

AngleViaPoint: fix: allow setDatum of perpendicular constraint

AngleViaPoint: fix: centers of ellipses are not endpoints

isSimpleVertex used to return false for centers of ellipses and arcs of
ellipses, which made them being accepted for point-to-point tangency.
Should be fixed forever, mo more changes are expected to be necessary
for new types of geometry.

AngleViaPoint: precalc with OCC (work in progress)

Work in progress (not yet working).
Using OCC's tangent to replace implementation of
SketchObject::calculateAngleViaPoint.

AngleViaPoint: fix math: normal now points inwards, where it was intended initially and goofed up.

AngleViaPoint: adding comments to the code

AngleViaPoint: using GeomCurve::closestParameterToBasicCurve for angle precalculation

AngleViaPoint: Py method: changeConstraintsLocking

changeConstraintsLocking(True) - locks/re-locks all lockable
tangency/perpendicularity constraints of the sketch (applicable to
existing sketches).
changeConstraintsLocking(False) - removes locking information from
lockable constraints

AngleViaPoint: final SketchObject::calculateAngleViaPoint

Now, finally, using OCC functionality (thanks Abdullah!), without
composing temporary Sketch object.
2015-01-02 11:48:29 +01:00
DeepSOIC
865ecca262 Sketcher: Responsivity tweaks and AngleViaPoint Constraint
Solver iteration limit independent of system size (reduces hangs when
solver fails to converge).
Repaint() instead of update() to force render for every movePoint.

Sketcher: New Constraint AngleViaPoint

* Adding generic CalculateNormal() method
* Reconfiguration of GCS geometry classes: adding a base class "Curve",
that has a pure virtual function CalculateNormal().
* Initial inplementation of the new function.
* adding Vector2D class (I wanted to reuse the existing, but got wierd
compile errors, so implemented a new one... TODO.)
* Adding redirection support into GCS shapes. Adding a Copy method to
GCS::Curve.
* Automatic point-on-object
* Angle precalculation: when AngleViaPoint is added, angle is properly calculated based on
existing geometry.
* Added tangency-via-point using one.
* Implemented placement of tangency-via-point icon in 3d view. Also
affected is the placement of point-on-object icon (since it is very
similar code, it is now shared with tangency-via-point)
* Placement and moving of angle datum
Functions: calculateAngleViaPoint, isPointOnCurve,
calculateConstraintError exposed to python
* Endpoint tangency: All endpoint-to-endpoint and endpoint-to-curve tangency now works
through AngleViaPoint constraint and obsolete code clean up (most procedures
addConstraintTangentXXX2YYY)
2015-01-02 11:48:28 +01:00
Abdullah Tahiri
948eb8e636 Part: Extension of Geometry::Curve
Part: Extension of Geometry::Curve to wrap more functions of OCC

Apart from:
    bool tangent(double u, gp_Dir&) const;
that was already implemented, now it also implements:
    Base::Vector3d pointAtParameter(double u) const;
    Base::Vector3d firstDerivativeAtParameter(double u) const;
    Base::Vector3d secondDerivativeAtParameter(double u) const;
    bool normal(double u, gp_Dir& dir) const;
    bool closestParameter(Base::Vector3d point, double &u);

i.e. apart from giving the tangent vector for a given curve at parameter value u,
it also gives:
   - The point cartesian coordinates of the curve point at parameter value u
   - The vector of the first derivative at parameter value u
   - The vector of the second derivative at parameter value u
   - The normal vector to the curve at parameter value u
   - The parameter value of a curve closest ot a given point

Code cleanup: Changing Trim functionality of Ellipse to use OCC calculations

Part Curve functions extension: closestParameterToBasicCurve

It provides the parameter of the curve closest to a given point. If the curve is a Trimmed curve, the parameter of the basic underlaying curve closest to the point is provided.
2015-01-02 11:48:28 +01:00
wmayer
cdb02f271f + fixes #0001656: Vertical/horizontal distance constraint confuses for a line or two points 2014-12-30 15:20:29 +01:00
wmayer
a6f973dcb8 + fixes #0001819: Getter Methods for Data inside a sketch 2014-12-29 22:28:12 +01:00
wmayer
830ee1d8dd + fix constraint evaluation function 2014-12-29 15:17:04 +01:00
wmayer
dc6159859a + fixes #0001616: crash when selecting 'Edit Sketch' 2014-12-29 01:13:03 +01:00
wmayer
a9d755501b + fixes #0001720: Freecad crash when handling invalid sketches 2014-12-28 17:10:54 +01:00
wmayer
6220246edb + fixes #0001060: Editing sketch crashes FreeCAD 2014-12-27 22:47:21 +01:00
wmayer
643c0f14d3 + fixes #0000957: Sketch view problem when go to edit 2014-12-27 17:50:37 +01:00
wmayer
87275639da + revert changes for issue 1873 2014-12-26 00:08:26 +01:00
wmayer
ca66811e2d + fix minor issue in toggle construction command 2014-12-25 23:13:01 +01:00
wmayer
e2a52a2a25 + improve whitespace 2014-12-25 23:10:42 +01:00
wmayer
af71d87f26 + fixes #0001838: When In Sketcher Make It Difficult To Mistakenly Delete A Feature 2014-12-25 22:43:09 +01:00
wmayer
10e786a756 + improve whitespace, fix warnings 2014-12-25 09:48:23 +01:00
wmayer
0d5472eb51 + fixes #0001873: Error working with getSelectionEx()[0].SubObjects 2014-12-23 22:04:34 +01:00