Commit Graph

6081 Commits

Author SHA1 Message Date
DeepSOIC
8660d9a914 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
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
68ec9e44f8 OpticConstraints: SnellsLaw: icon 2015-01-02 11:48:30 +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
ec03fb541f 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
Sebastian Hoogen
a8dd528c1a Build python Qt resource files at compile time
fixes #1888
2015-01-02 11:14:07 +01:00
Yorik van Havre
f3af41e4cc Merge branch 'master' of ssh://git.code.sf.net/p/free-cad/code 2015-01-01 19:06:26 -02:00
Yorik van Havre
051b38b1c1 Arch: temporarily disabled custom subvolume in windows 2015-01-01 19:06:11 -02:00
Yorik van Havre
60b648b053 Arch: Equipments now take the diffuse color of their base object on creation 2015-01-01 19:06:00 -02:00
wmayer
f545455466 + fixes #0001889: Crash when undoing move of base object of a part fillet 2015-01-01 21:05:19 +01:00
Yorik van Havre
2680395ede Draft: adapt icon sizes from preferences settings - fixes #1783 2014-12-31 21:23:24 -02:00
Yorik van Havre
845849fa91 Arch: implemented reading & writing of Ifc properties in IFC files 2014-12-31 18:35:39 -02:00
Yorik van Havre
244373779d Arch: Fixed IFC import bug - fixes #1887 2014-12-31 15:21:41 -02:00
Yorik van Havre
3f607d73a4 Arch: Fixed Arch example - fixes #1789 2014-12-31 14:42:22 -02:00
Yorik van Havre
cb5a807990 Arch: Added a MoveWithHost property to all Arch objects which specifies if they must be moved/rotated together with their parent - fixes #1820 2014-12-31 14:04:23 -02:00
Yorik van Havre
1f9ecfa509 Draft: Better error messages when trying to convert a bspline to a sketch 2014-12-31 13:17:25 -02:00
wmayer
ca5062cbfe + fixes #0001885: Unhandled exception when trying to enter edit-mode for objects while drawing view is active 2014-12-31 14:08:03 +01:00
wmayer
4d618955b3 + fixes #0001884: Crash when double-clicking on Clip element with drawing page closed 2014-12-31 13:15:33 +01:00
wmayer
b2f8a4ed2a + fixes #0001723: Display errormessage in tree in tooltip 2014-12-30 22:44:29 +01:00
wmayer
2c53bd1e9a + fixes #0001670: Orthographic projection: scale/position is empty when unchecking 'Auto scale/position' 2014-12-30 19:14:07 +01:00
wmayer
c231866b8d + fixes #0001746: Part Fillet and Chamfer do not show correct length/radius when editing old items 2014-12-30 17:20:32 +01:00
wmayer
ff09f0524d + fixes #0001656: Vertical/horizontal distance constraint confuses for a line or two points 2014-12-30 15:20:29 +01:00
wmayer
fba0ef0671 + fixes #0001657: Sketcher: First digit can not be deleted when editing grid size 2014-12-30 14:18:02 +01:00
wmayer
7aa91ecee3 + fixes #0001760: FC fails to load a *.FCStd file if the filename lacks the *.FCStd file extension 2014-12-30 00:31:39 +01:00
wmayer
72f947433c Merge branch 'master' of ssh://git.code.sf.net/p/free-cad/code 2014-12-29 22:28:52 +01:00
wmayer
f51daa88e0 + fixes #0001819: Getter Methods for Data inside a sketch 2014-12-29 22:28:12 +01:00
Yorik van Havre
2f78c021db Arch: Fixed encodings in Survey - fixes #1825 2014-12-29 18:54:33 -02:00
Yorik van Havre
638fa8ba75 Draft: Changed working plane button text to Auto - fixes #1879 2014-12-29 17:54:04 -02:00
wmayer
84aad261fc + fixes #0001876: replace helpful text in task tab with an info button 2014-12-29 18:49:17 +01:00
wmayer
d83c02387c + fix constraint evaluation function 2014-12-29 15:17:04 +01:00
Peter Lama
32dd867a30 Fix duplicate 'optimized' when using new libpack
When using a CLbundler libpack, PYTHON_LIBRARY has both optimized and debug
libs, but it doesn't when using an old libpack, which was the reason for
commit f5a4e680
2014-12-28 19:04:31 -08:00
wmayer
6a1cb47e30 + fixes #0001616: crash when selecting 'Edit Sketch' 2014-12-29 01:13:03 +01:00
wmayer
51c017ae24 + fixes #0001877: associate a grayed out icon with Freecad's backup files (fcstd1) 2014-12-28 23:54:08 +01:00
wmayer
e329cb5c3a + fixes #0001878: model refine exception 2014-12-28 18:10:02 +01:00
wmayer
7d8b1f30c3 + fixes #0001720: Freecad crash when handling invalid sketches 2014-12-28 17:10:54 +01:00
wmayer
6a211b9dbe + fixes #0001060: Editing sketch crashes FreeCAD 2014-12-27 22:47:21 +01:00
wmayer
16a8965038 + do not long apply changes in mesh settings on existing mesh objects 2014-12-27 18:32:18 +01:00
wmayer
7149cce90f + fixes #0000957: Sketch view problem when go to edit 2014-12-27 17:50:37 +01:00
wmayer
b172e069a1 + fix conversion from Qi image to Inventor when image uses a color table 2014-12-27 13:51:36 +01:00
wmayer
6a9252744d + fixes #0000976: Usability: default Material drop-down is not the active material type 2014-12-27 00:56:46 +01:00
wmayer
93e5668967 + make undo/redo accessible from drawing view 2014-12-26 22:46:02 +01:00
wmayer
9290274e1c + fixes #0000711: fileted borders not projected on 2D drawing + deleted views still showing 2014-12-26 22:24:45 +01:00
wmayer
d060cdf400 + revert changes for issue 1873 2014-12-26 00:08:26 +01:00
wmayer
272cb566e9 + fix minor issue in toggle construction command 2014-12-25 23:13:01 +01:00
wmayer
29d50dbc01 + improve whitespace 2014-12-25 23:10:42 +01:00
wmayer
e8802adcbe + fixes #0001838: When In Sketcher Make It Difficult To Mistakenly Delete A Feature 2014-12-25 22:43:09 +01:00
wmayer
a6b8bd6815 + improve whitespace, fix warnings 2014-12-25 09:48:23 +01:00
wmayer
33bc596fd8 + fixes #0001873: Error working with getSelectionEx()[0].SubObjects 2014-12-23 22:04:34 +01:00