Commit Graph

56 Commits

Author SHA1 Message Date
wmayer
bfb80b058c extend Python interface of sketcher and make non-parametic version working 2016-08-14 11:52:37 +02:00
Wolfgang E. Sanyer
7f4a437cc2 This commit adds getShape and setShape to TopoShape 2016-08-06 23:42:55 +02:00
Kurt Kremitzki
205cf94594 Fix "construcion" typo 2016-05-18 11:34:32 +02:00
wmayer
ad2c4c23d0 + fix compiler warnings 2015-12-30 10:58:14 +01:00
Abdullah Tahiri
fc128d357d Sketcher: Solver information: Bug fix
=====================================

When the solver converged (but did not succeed) or when the solver succeded but the solution is not OCC-valid, no error message was shown in the solver messages dialog.
2015-10-22 23:48:04 +02:00
wmayer
32bcbda232 + fix various warnings 2015-08-30 11:48:26 +02:00
wmayer
023de9b0f8 + fix author notice 2015-08-29 18:49:16 +02:00
Alexander Golubev
80941aa0e0 Gui & Mod/Sketcher: use fabs() instead abs()
Warnings was like:
src/Mod/Sketcher/Gui/DrawSketchHandler.cpp|350 col 28| warning: using integer absolute value function 'abs' when argument is of floating point type [-Wabsolute-value]
Also see:
http://forum.freecadweb.org/viewtopic.php?t=10920
http://forum.freecadweb.org/viewtopic.php?f=10&t=5258
2015-08-29 18:35:54 +02:00
Abdullah Tahiri
796c9d79d4 Sketcher: New Features: SparseQR decomposition and Solver advanced control TaskBox
==================================================================================

The solver has been adapted to use Eigen's SparseQR QR decomposition algorithm. The original
Dense QR implementation is maintained and can be selected using the Advanced Control TaskBox (see below).

The use of SparseQR provides over an order of magnitude improvement in solving time in complex sketches due to
the Sparse nature of the Jacobian matrix of the system of equations.

The solver advanced control is a new TaskBox in the Sketcher that allows to select which algorithms are to be used for
the different solving operations and tweak its parameters. It is not intended to be a user control, but means to debug
solving problems and improve the algorithms and their configuration.

This commit also introduces multithread support for Eigen. Currently it is only limited to products and does not provide
a substantial speed improvement. It is expected to have more multithreaded operations in Eigen in the future.

As a bonus, the TaskBoxes in the Taskbar of the Sketcher remember the last state (collapsed or deployed).
2015-06-24 17:56:58 +02:00
wmayer
eef340f19c + fix whitespaces 2015-05-30 20:30:12 +02:00
Abdullah Tahiri
bc85670ce9 Sketcher new Feature: Non-driving constraints (aka Driven constraints or dimensions)
====================================================================================

It allows to enable and disable a constraint in the constraint list.

When disabled, the constraints current value is shown, but its value is not enforced (it is driven by the other constraints and user interaction).

A disabled constraint can be enabled (as far as it is enforceable, see non-driving constraints to external geometry below).

The sketcher functionality has been extended to support non-driving constraints to external geometry elements. This were previously excluded from
the possibility of creating a constraint on them (as their values depend on other sketches and would be redundant with the unchanged value or conflicting when value is changed).
Now these constraints are created as non-driving, but as they are not enforceable, the UI does not allow you to make them driving.

The constraint filter has been extended to include a Non-Driving constraints category.

Thanks again to Werner for his continuous support, and specially in this case to DeepSOIC, as he pointed towards a much better implementation solution than my original idea.
2015-05-30 16:39:25 +02:00
wmayer
dd2b39ddd6 + fixes #0002075: Analysis of FreeCAD by PVS-Studio static analyzer 2015-05-01 16:56:31 +02:00
DeepSOIC
3e6eb430fa Sketcher: small asserts cleanup 2015-03-28 17:35:10 +01:00
DeepSOIC
94c26629c0 Sketcher: add checks for null pointers
Made throws on null pointers.
2015-03-28 17:35:10 +01:00
DeepSOIC
0767cd35f8 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
wmayer
6a3437e28e + fixes #0000692: Sketcher: Add angle constraint for arcs 2015-01-10 15:15:18 +01:00
DeepSOIC
684036fae8 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
43e8b30846 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
397e37ad1c 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
3838bddcdb 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
9f821e06b5 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
501c40f0e6 Sketcher: Ellipse implementation enhancements
- ArcOfEllipse enhancement: Tangency ArcOfEllipse to ArcOfEllipse or ArcOfCircle by selecting end/starting points...
- Minor bug corrections (Thanks DeepSOIC)
- ExposeInternalGeometry python command
- DeleteUnusedInternalGeometry python command
- On deletion of an Ellipse/ArcOfEllipse all further unconstrained internal geometry is also deleted.
- This cleans up the code by eliminating code repetition in the creation methods.
- Major bug fix for autoconstraints for ellipse and arc of ellipse creation (for both creation methods)
- Major bug fix Start and Endpoint constraints of an arc of ellipse where not taking into account that Sketcher arcs are always CCW, so they have to be exchanged if we convert a CW arc into a CCW arc.

Sketcher: General bug fix: Tangency wrongly suggested

What?
=====
- On creation of a shape autoconstraints are suggested.
- Tangent autoconstraint was suggested even with lines perpendicular to the tangency direction

Reproduce
=========
- Make a circle on the origin and move the mouse along the X axis, it will suggest a tangency that is impossible
- Click on the axis and no circle will be created

Solution
========
- The SeekConstraint now can use the parameter dir to give a direction that is substantially perpendicular to the expected tangency, so that
if an object having a direction (a line) is hit, a tangency will not be suggested if within around 6 degrees of being parallel.
- Additionally, if such a line is an X,Y axis of the sketch, tangency will only be suggested if the direction is within 6 degrees of being perpendicular (i.e. it is almost tangent already while sketching).
- This difference is due to the fact that an X or Y axis can not "move" to meet the object under creation, whereas a line can.
2014-12-20 12:33:37 +01:00
Abdullah Tahiri
f5df65c4c4 Sketcher: Ellipse enhancement: All internal geometry is shown on creation
Elements that have internal geometry are created with the internal geometry on creation.

It has been under discussion for a long time. Ulrich was in favour (asked for it several times).
DeepSOIC implemented the focus because he hated the poor dragging of the ellipse when empty.
2014-12-20 12:33:33 +01:00
Abdullah Tahiri
d0362fa4a2 Sketcher Ellipse and ArcOfEllipse: Extra features and bug fixes
- Visual representation of equality constraint: Separate circle and arcofcircle implementation from ellipse and arcofellipse implementation
- Fix for Alignment constraint: Now it allows to assign a second element, one by one
- Box selection for ArcOfEllipses
  Fixes the bug that vertex far away got selected due to lack of sync between the selection and draw loops.
2014-12-20 12:33:32 +01:00
Abdullah Tahiri
a067a7c25a Sketcher Ellipse and ArcOfEllipse: Extra features and bug fixes
- Minor changes to alignment constraint selection to avoid to create objects just for simple calculations
- Equality constraint of Ellipse, ArcOfEllipse and combinations of those elements
- Bugfix for internalalignment creation of major and minor of ellipse and extension to arcofellipse
- Trim support for ellipses
- Solver threshold for rank calculation set at 1e-13.
- Trim support for arc of ellipse
- Ellipses and ArcOfEllipses as external geometry
- Validate Sketch now supports arcs of ellipse
- Tangents of Ellipse or ArcOfEllipse to any of ArcOfcircle, circle and Ellipse (using construction elements)
- Perpendicularity constraint
- Bug fix: Show/hide internal geometry not working for external geometry
- Visualization of Internal alignment constraints when selecting in the constraint widget
- Equality for ellipses and arc of ellipses
2014-12-20 12:33:31 +01:00
Abdullah Tahiri
fb0d830560 Sketcher Ellipse and ArcOfEllipse: Major bug fixes
- Change mode so that focus1 is not a point, but two doubles so that visual model and solver model match in number of points.
- Solver fix to deal with reduced constraint partials accuracy (threshold for matrix rank calculation tweak)
- Changes suggested by logari81
2014-12-20 12:33:30 +01:00
DeepSOIC
e423c308af Sketcher Ellipse bug fix: Jump back on mouseup when shrinked 2014-12-20 12:33:29 +01:00
Abdullah Tahiri
a458c3e6d2 Sketcher New Feature: Ellipse support
- Ellipse introduction button via (center,majaxis extreme, a point in edge), ellipse is always CCW so that Z axis goes in the positive direction of the sketch
- Backwards compatibility with files of previous versions of ellipse not defining a phi angle
- Art by Jim (all the icons you see and the XPMs shown on creation of an ellipse)
- Element Widget support for ellipses
- Box selection for ellipses
- Point on Ellipse constraint based on the gardener's method based on Ulrich's function proposal (radcan simplified, i.e. with simplify_radical sage function)
- Tangent: Ellipse to Line based on DeepSOIC's geometric formulation (radcan simplified)

Sketcher New Feature: Internal Alignment Constraint
- The element to which internal alignment is applied has to be selected last.
- All other elements are added in the order of priority, taking into account existing elements
- Art by Jim (beautiful icons).

Sketcher New Feature: Tool to show/hide/restore the internal geometry of an element
- New functionality for show/hide internal geometry:
  toggles between hiding all unused internal geometry elements and showing all internal geometry.
  The restore function is implicit to the showing all internal geometry

Sketcher New Feature: Arc of Ellipse support
- Part::Geometry + Python implementation
- ArcOfEllipse creation method
- Art by Jim (all the icons you see and the XPMs shown on creation of arc of ellipse elements)
- Sketcher Element widget for ArcOfEllipse.

Bug fix: Select elements associated to constraints works now for foci internal alignment constraints
2014-12-20 12:33:29 +01:00
jriegel
d65a4e4ed7 some type clearification 2014-08-21 17:59:33 +02:00
wmayer
409285d53f + optimize creation of hexagonal sketch profile, add icon 2014-06-04 12:05:41 +02:00
wmayer
3b5cdda879 + fix flaws found with code analyzer tool 2014-05-07 13:09:44 +02:00
wmayer
b7cb49c3e3 + issue #0001474: crash selecting constraint 2014-03-15 11:32:03 +01:00
wmayer
847b6b79e0 + Replace math.h with cmath 2014-01-05 11:25:40 +01:00
Yorik van Havre
a81604b9be Updated links to the new bugtracker location 2013-11-04 17:07:35 -02:00
wmayer
9af4f7ee73 + Fix compiler warnings 2013-10-11 12:24:49 +02:00
wmayer
89a5d06926 0001216: Unable to Loft Sketches with Radiused Corners 2013-08-16 12:59:00 +02:00
logari81
afcaa8b980 Sketcher: Implement symmetry with respect to a point constraint, aka midpoint constraint 2012-11-29 22:46:11 +01:00
logari81
714908d3e9 Sketcher: add support for points as construction geometry 2012-07-08 12:01:07 +02:00
logari81
7cbb16f2e8 Sketcher: include coincident constraints in the sketch diagnosis 2012-05-25 18:18:51 +02:00
logari81
ce5d9a332a Sketcher, Issue #0000691: detect redundant constraints and skip them if necessary 2012-05-14 11:28:05 +02:00
logari81
63b2b239b1 Sketcher: use low precision solving during mouse drag and code simplifications 2012-05-14 10:55:44 +02:00
logari81
73d2fa9e61 Sketcher: avoid duplicate code and unnecessary arguments 2012-05-14 10:44:44 +02:00
logari81
126b25e690 Sketcher: basic graph based system partitioning 2012-04-14 12:10:32 +02:00
logari81
17ac6da079 Sketcher: support perpendicularity constraint for arcs and circles 2012-04-01 16:32:51 +02:00
logari81
f0a6d25621 Fix 0000461: Sketcher: tangent constraint between two arcs/circles 2012-03-22 14:14:07 +01:00
logari81
c6de527391 + fix issue with conflicting constraints in fixed arcs
git-svn-id: https://free-cad.svn.sourceforge.net/svnroot/free-cad/trunk@5361 e8eeb9e2-ec13-0410-a4a9-efa5cf37419d
2011-12-29 20:12:57 +00:00
logari81
40ebead233 + modified declaration of external geometry in setUpSketch
git-svn-id: https://free-cad.svn.sourceforge.net/svnroot/free-cad/trunk@5344 e8eeb9e2-ec13-0410-a4a9-efa5cf37419d
2011-12-24 15:37:11 +00:00
logari81
3c9053a599 + preparation for external geometry constraints in the sketcher
+ change value of H_Axis and V_Axis constants
+ external Geometry transferred in reverse order from SketchObject to Sketch
+ replace construction property with external property in GeoDef
+ support negative geometry indices in the Sketch class
+ whitespace and variables naming improvements, typo fixes


git-svn-id: https://free-cad.svn.sourceforge.net/svnroot/free-cad/trunk@5340 e8eeb9e2-ec13-0410-a4a9-efa5cf37419d
2011-12-24 00:25:34 +00:00
logari81
a987522a77 + support fixed geometries in the Sketch class
+ avoid code duplication 


git-svn-id: https://free-cad.svn.sourceforge.net/svnroot/free-cad/trunk@5302 e8eeb9e2-ec13-0410-a4a9-efa5cf37419d
2011-12-14 21:29:24 +00:00
logari81
3b4dde6799 + change warnings to log messages for 0.12 release
git-svn-id: https://free-cad.svn.sourceforge.net/svnroot/free-cad/trunk@5156 e8eeb9e2-ec13-0410-a4a9-efa5cf37419d
2011-11-22 18:33:06 +00:00