Commit Graph

152 Commits

Author SHA1 Message Date
wmayer
bf129d3a33 fix memory leak in SketchObject::transferConstraints 2016-10-24 14:35:24 +02:00
wmayer
efff1b7773 fix linking failure with gcc/clang 2016-10-23 14:10:01 +02:00
wmayer
222e9b6b46 replace hard coded numbers with static constants 2016-10-23 13:44:26 +02:00
wmayer
de7978434d fix Coverity issues 2016-08-19 22:51:33 +02:00
wmayer
1e2e24b652 + rename methods in Vector3 class
+ add convenience methods Cross and Dot to Vector3 class
+ fix bug in DistanceToLineSegment in Vector3 class
2016-07-30 15:14:47 +02:00
wmayer
f079b23ada + fix gcc warning of unused variable 2016-05-22 18:45:37 +02:00
DeepSOIC
0f75ad6637 Sketcher: change rules of external linkage
Was:
+ allowed: links to support
+ allowed: free links within one body,
+ Ctrl-protected: links between bodies of ?one? part
- blocked: (everything else) . i.e., if sketch is not in a body, only
links to support are allowed.

New:

* Across Parts, from Part to outside part, from document into part:
blocked
* Within one part (also if directly in document): allowed.
except links from body to outside or to other bodies are screened (hold
Ctrl to allow).
Support (attachment) is totally ignored in this logic.
2016-05-21 01:31:06 +03:00
Alexander Golubev
0cfc0cd424 Fix warnings introduced in new PartDesign
Mostly unused wariables and compare of signed & unsigned
2016-04-12 18:12:21 +02:00
DeepSOIC
81015b3f44 Fix problems with unlimited external geometry
Caused by recent changes by abdullah, which assumes there is external
geometry only if sketch has support.
http://forum.freecadweb.org/viewtopic.php?f=3&t=12746&p=102087#p102087
2016-04-12 18:12:21 +02:00
Stefan Tröger
83eedba043 crossreferences only with ctrl button and fix missing return value 2016-04-12 18:12:20 +02:00
DeepSOIC
e2f70e5e5b Sketcher: when refusing to link external, print why (in statusbar) 2016-04-12 18:12:20 +02:00
DeepSOIC
3df305cc4e Sketcher: allow referencing everything; add testing for circular references 2016-04-12 18:12:20 +02:00
Alexander Golubev
797d6d3a11 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
Alexander Golubev
8b62680fe7 Sketcher: minor enhance in sketch interaction with body 2016-04-12 18:12:16 +02:00
DeepSOIC
42ecc24ec5 Sketcher: new attachment engine 2016-04-12 18:12:12 +02:00
DeepSOIC
061747f367 Sketcher: change Support from PropertyLinkSub to PropertyLinkSubList
Note: may fail to build after this commit...
2016-04-12 18:12:12 +02:00
DeepSOIC
31e4fd8994 Sketcher: fix free-standing sketches
See forum thread, Sketch support == NULL
http://forum.freecadweb.org/viewtopic.php?f=20&t=10942
2016-04-12 18:12:07 +02:00
DeepSOIC
f31aed1c40 Sketcher: Fix duplicate external avoidance false positives
Attempting to link to Edge1 of one object failed when there was already
an Edge1 linked from another object.
2016-04-12 18:12:06 +02:00
Jan Rheinländer
273e0f0b71 Fixed bug that did not allow selecting datum planes as external references in sketches 2016-04-12 18:11:59 +02:00
jrheinlaender
f6958f391c Fix bug where external reference was ignored without an error message 2016-04-12 18:11:55 +02:00
jrheinlaender
37a8c02bc6 Improved SketchObject error reporting 2016-04-12 18:11:55 +02:00
jrheinlaender
22e3aaa2d6 Fix bug in SketchObject::execute() that throws exception instead of returning an error 2016-04-12 18:11:55 +02:00
jrheinlaender
be9365679f Centralize the check for valid external geometry to ensure consistency 2016-04-12 18:11:55 +02:00
jrheinlaender
97fb44ddd5 Detect external geometry that is a circle which becomes a bspline after projection 2016-04-12 18:11:52 +02:00
jrheinlaender
9e7b463113 Allow geometry from other bodies in the same par as external geometry for sketches 2016-04-12 18:11:52 +02:00
jrheinlaender
f954a51430 Pad/Pocket: Allow extrude up to a datum plane 2016-04-12 18:11:50 +02:00
jrheinlaender
5b3d5e6bd8 Moved generic Datum class to Part module to avoid Sketcher dependency on PartDesign 2016-04-12 18:11:49 +02:00
jrheinlaender
bb1a3a532f Miscellaneous fixes 2016-04-12 18:11:49 +02:00
Abdullah Tahiri
81f216f9e3 Sketcher Bug fix: Solver information update on over-constrained situation
==================================================================================

Why?
if lastDoF<0, then an over-constrained situation has ensued and geometry is not to be updated, as geometry can not follow the constraints.
However, solver information needs to be updated.

Solution:
Just trigger a constraint change so that signaling is sent to ViewProviderSketch via boost and the solver information updated, using
Constraints.touch().
2016-01-09 13:42:12 +01:00
wmayer
462ec49297 + fixes #0001956: FreeCAD 0.14.370x hangs when attempting to edit sketch containing ellipse 2015-12-27 11:44:47 +01:00
Abdullah Tahiri
501fa80e4d Sketcher: Fix Sketch Mirror functionality
=========================================

The problem:
Mirror stopped working.

How to reproduce:
Select a sketch, and apply "Mirror Sketch" from the menu.

Why?
With the introduction of expressions, mirror sketch stopped working. The reason is that mirror functionality did use the "clone" function to make copies of constraints
and then modify their values. After expessions introduction, which introduces a unique tag per constraint, this copy was regarded as a "rename" of the original constraint
as they shared the unique tag.

Fix?
New function "copy()" for a constraint, that copies all the content but the tag.
2015-12-09 13:32:12 +01:00
Mateusz Skowroński
f3860faaef Fix file encoding. Go from ISO8859-1 to UTF-8. 2015-11-11 18:54:42 +01:00
Abdullah Tahiri
e1dd86f0a9 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
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
e7a3dc48e8 + support of Python feature classes without an execute() method
+ if execute() method of Python feature is missing or if it returns false call the execute() method of the C++ feature
+ fix SketchObjectPython
2015-10-21 00:22:40 +02:00
Abdullah Tahiri
dc224265fa Sketcher: Bug fix: Constraints dissapear after a sketch loses support
=====================================================================

Issue:
http://freecadweb.org/tracker/view.php?id=2292

Constraints dissapear after a sketch loses support

Steps To Reproduce:
1. Make a sketch on a face.
2. Constrain it
3. Select "reorient sketch"
4. Do you want to lose support? Yes
5. Click cancel on the reorientation dialog.
6. Enter edit mode: No constraints...

Why?
GeoUndef not checked when deleting all external geometry (on dettaching from the support).

Solution:
Check for GeoUndef.
2015-10-13 21:32:55 +02:00
Abdullah Tahiri
94851bc14f Sketcher Bug fix: External geometry shown after reorient
========================================================================

Reported here:
http://forum.freecadweb.org/viewtopic.php?f=10&t=12517&p=100388#p100429

Solution:
When a sketch loses support, all external geometry is deleted right away.
2015-09-28 11:45:06 +02:00
Abdullah Tahiri
56c29e27f7 Sketcher: Bug fix: Building Vertex Index on Restore
===================================================

The bug was introduced by myself here:
47c0859c1b

[code]
void SketchObject::onDocumentRestored()
 {
     try {
-        rebuildExternalGeometry();
+        if(Support.getValue()) {
+            validateExternalLinks();
+            rebuildExternalGeometry();
+        }
         Constraints.acceptGeometry(getCompleteGeometry());
     }
[/code]

The issue is that "rebuildExternalGeometry" calls "rebuildVertexIndex". So for any sketch not having external geometry, if you open it, select everything and hit del, you will have a crash because
I effectively removed the creation of the index in this dossier. You won't have one if you do anything rebuilding the index before hitting del, like creating geometry, though.
2015-09-28 11:42:56 +02:00
Mateusz Skowroński
43a4a5938c Fix files encoding. Go from ISO8859-1 to UTF-8. 2015-09-21 19:50:49 -03:00
Eivind Kvedalen
67800ec8c4 Sketcher: Added support for expressions. 2015-09-21 14:51:10 +02:00
Abdullah Tahiri
47c0859c1b Sketcher: Bug fixes: inability to create links to external geometry
=================================================================

First bug: Inability to create links to external geometry as described here:
http://forum.freecadweb.org/download/file.php?id=16668

Second bug: FC crashes on changing the support after having imported external geometry as described here:
http://forum.freecadweb.org/viewtopic.php?f=10&t=12380

and solving this ticket:
http://www.freecadweb.org/tracker/view.php?id=2225

Solution to first bug:

If for some reason a sketch ends up having a list of external geometries (property) that can not be recreated (rebuilt),
they remain latent, do not show the external elements in the elements widget or in the screen and prevent adding the
elements again.

In cases where the saved file contains invalid external geometry links (which will give raise to a handled exception that would prevent external geometry creation),
this condition gets detected during restore and the invalid links are deleted before external geometry creation, so as to allow the rest of external links to be recreated.

Solution to second bug:

It is also related to invalid external links (the link was existing, but upon change on the support, it is possible that an external edge is no longer valid, reduction of edges in support).
This situation is detected upon entering into edit mode, and the invalid ones are deleted.

Note that there is still the possibility for the user to remap an invalid sketch BEFORE editing, if the remapping is successful, it may not be necessary to delete links (all depends on the
specific case).
2015-09-11 21:25:58 +02:00
Abdullah Tahiri
53320b260e Sketcher: Renaming old get Coincident functions and introducing a extended one
==============================================================================

What is this?

method

getCoincidentPoints

actually only included (as indicated in the documentation comment) those points coincident by a single constraint.

That is not "all the coincident points".

However some methods currently using it are expecting exactly that (coincident points linked by a single constraint).

A new method is introduced:
const std::map<int, Sketcher::PointPos> getAllCoincidentPoints(int GeoId, PointPos PosId);

that provides all the points coincident with the given one, directly (via a single constraint) or indirectly (via multiple coincident constraints).

The old method is renamed to:
getDirectlyCoincidentPoints

So as to have a more meaningful name to differentiate between both methods.
2015-09-09 22:57:49 +02:00
Abdullah Tahiri
82e41125da Sketcher bug/feature request: arePointsCoincident/coincidence creation
======================================================================

1. SketchObject::arePointsCoincident upgraded to check for indirect coincidence.
2. Coincidence constraint creation now checks for indirect coincidences and avoids
creating redundant coincidence constraints (for example during box selection).
2015-09-09 22:56:14 +02:00
Abdullah Tahiri
224b3ec7d7 Sketcher: Improvement: Horizontal/Vertical Autoconstraint creation with External Geometry
=====================================================================================

This fixes a bug related to:
http://www.freecadweb.org/tracker/view.php?id=2093

that during creation of a geometric element if a vertical/horiz autoconstraint is to be enforced, it is not enforced if the endpoints of the geometric element under creation are
coincident with external geometry.

According to the discussion here:
http://forum.freecadweb.org/viewtopic.php?f=10&t=12254&sid=eacf5bdee068cb71cc54dc5a62a6849d&start=20#p99359

this fixes the bug.

It does not fulfil the request on the ticket as it was decided to still allow an explicit addition of a vertical/horizontal constraint, as
it may be needed in some cases and the user expects to be able to add them, even if it will lead to an overconstrained sketch.

How to reproduce?
1. Create a rectange
2. Pad it
3. Create a new sketch on a face
4. link two corners as "external geometry" (but not the ones of a diagonal)
5. Create a line coincident with the first and second corners, so that the line is horizontal or vertical

In master it will force horiz or vert leading to a overconstrained sketch.
With this patch, the horiz/vert will not be enforced in this case.
2015-09-09 22:50:36 +02:00
wmayer
979d1299cc + fix various warnings with gcc 2015-09-01 19:29:39 +02:00
wmayer
3807cbdb23 + improve whitespaces 2015-08-31 13:53:48 +02:00
Abdullah Tahiri
927fca0ece Sketcher: Bug fix addGeometry list creation and construction lines
==================================================================

A recent improvement was to allow to create an object (several geometric elements) as construction lines
by providing an additional parameter as true (that defaults to false).

This introduced a bug, that when a list of geometries mixing construction and normal lines was added (with the parameter as false),
construction lines would be converted to normal lines.

This fixes the bug.
2015-08-30 12:08:45 +02:00
Abdullah Tahiri
97d551b551 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
6a16910ba5 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
ee43612125 Sketcher: AddSymmetric End-to-End point tangency bug fix
========================================================

For a while End-to-endpoint tangency is implemented via AngleViaPoint constraint. The code was not recalculating the "value" of the constraint in this case.

This also forces to set the geometry first and constraints afterwards, as the AutoLockTangencyAndPerpty function requires a valid GeoId to operate (not a big deal anyway).

Correction of the condition to allow the symmetry when a single line is mirrored about a point pertaining to a geometric element.
2015-08-30 12:08:41 +02:00