Commit Graph

2779 Commits

Author SHA1 Message Date
howie-j
acbf135b78 [Sketcher] Fix angle constraint expression regression (#10743)
* fix 10742

* moved expression string modifier to helper function

* Tests: Add example tests for SketchObject

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* made expr modifier func static, pass by value and added unit tests

---------

Co-authored-by: Chris Hennes <chennes@gmail.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2023-09-25 10:44:31 -05:00
wmayer
5a81fcd7a5 MSVC: fix warnings and build failure 2023-09-23 19:10:32 +02:00
Chris Hennes
730d471fb1 Update translations 2023-09-19 22:25:14 -05:00
wmayer
ab4abab53d Sketch: fix a few minor issues:
* fix compiler warning about unused variable
* fix const correctness
* fix access type of setExpression()
* removed duplicated method
2023-09-19 22:01:19 +02:00
Chris Hennes
0bbb10864b Merge pull request #10656 from Ondsel-Development/dim_arc_angle
Sketcher_Dimension: Adds arc angle mode.
2023-09-19 12:42:56 -05:00
Paddle
e3445388a2 Sketcher_Dimension : adds arc-angle mode for arcs. 2023-09-19 08:25:45 +02:00
Paddle
55420d96af Sketcher: Angle constraint: when moving it with mouse, it enables user to switch of supplementary angle. 2023-09-19 07:22:50 +02:00
Paddle
a8f11f12fb Implement a function in sketchObject that swap an angle constraint to its supplementary. 2023-09-19 07:22:50 +02:00
Paddle
e58b52ea12 Add setter/getter for constraint expression. 2023-09-19 07:22:50 +02:00
Paddle
1c8f49ee67 Adds a small convenience function to get arc of circle angle. 2023-09-18 21:33:24 +02:00
Jonas Bähr
efc7fd09e4 Sketcher: update SketchObject's pydocs, first batch
Style like in e.g. `Part.makeLine(...)`, which seems to loosely follow
Google's recommendations [1]. Note that the signature *is* repeated in
the docstrings, as it's not "inspectable" (see notes for non-python
implementations in `inspect.signature` [2]).

[1]: https://github.com/google/styleguide/blob/gh-pages/pyguide.md#38-comments-and-docstrings
[2]: https://docs.python.org/3/library/inspect.html#inspect.signature
2023-09-18 10:57:12 -05:00
howie-j
12913daef5 fixes #10651 2023-09-18 10:56:13 -05:00
Florian Foinant-Willig
f393a90467 Sketcher: refactor CommandConstraint.cpp (#10692)
* Sketcher: refactor CommandConstraint.cpp with TypeId helpers

* Sketcher: cosmetic empty lines

* fix pointer misusage
2023-09-18 10:37:03 -05:00
Paddle
594b1aec11 Sketcher_Dimension : enable user to deselect geos by clicking on them again. 2023-09-14 20:57:39 -05:00
wmayer
e9b61bdbe2 Sketcher: fix several inconsistencies in Sketcher_CompDimensionTools
* The menu text and tooltip of the Sketcher_ConstrainRadius command shouldn't be different if part of the group command or not.
  The explicit mentioning to change the weight of a B-Spline is pointless and confusing.
* The order of Sketcher_ConstrainRadius and Sketcher_ConstrainDiameter has flippend when used in Sketcher_CompDimensionTools
* The command Sketcher_ConstrainRadiam is completely missing
* The command Sketcher_ConstrainSnellsLaw was wrongly re-added
* CmdSketcherCompConstrainRadDia uses a wrong context
2023-09-14 20:56:14 -05:00
luzpaz
760fac5d82 Fix typos 2023-09-14 20:53:04 -05:00
Florian Foinant-Willig
602819478c Sketcher: add TypeId checking helpers 2023-09-14 20:52:03 -05:00
wmayer
89bb28239e MSVC: fix several compiler warnings 2023-09-12 22:57:26 +02:00
pre-commit-ci[bot]
e8ab02b26b [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2023-09-12 21:19:33 +02:00
pre-commit-ci[bot]
222a2520b1 [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2023-09-12 13:02:35 -04:00
sliptonic
ea2919765e Merge pull request #10597 from howie-j/sketcher_dim_key
[Sketcher] Change Sketcher_Dimension modifier key from SHIFT to M
2023-09-11 10:38:07 -05:00
Chris Hennes
857ddacb6e Update translations (#10613)
* Update translations
* Start: Remove Start.ts
2023-09-10 13:06:26 -05:00
howie-j
3d7e01bb7a Fixes #10596 2023-09-07 21:14:56 +02:00
luzpaz
4dbbe85c2b Fix various typos 2023-09-07 20:34:49 +02:00
Jonas Bähr
880461593f Sketcher: Fix check in carbonCopy's python interface
Presumably due to an copy/paste error, carbonCopy used to verify the
referenced object via `isExternalAllowed` (just like addExternal).
Now using `isCarbonCopyAllowed`, the resulting error message is the
expected one for wrong objects, not a generic one after the operation
failed.
2023-09-05 08:49:31 +02:00
Jonas Bähr
7e84c3f42f Sketcher: Fix wrong format string in PyArg_ParseTuple
The part behind the column represents the function name itself, not an
error message. So previously, an argument error looked like this:
("Give an object" is not the method name)
```
>>> obj.carbonCopy()
Traceback (most recent call last):
  File "<input>", line 1, in <module>
TypeError: Give an object() takes at least 1 argument (0 given)
>>> obj.carbonCopy(123)
Traceback (most recent call last):
  File "<input>", line 1, in <module>
TypeError: Give an object() argument 1 must be str, not int
```

While the format string also supports a text for the complete error message
(using a semicolon instead), I decided against this: Pythons standard text
is more precise than this:
(the type error here is not "Give an object")
```
>>> obj.carbonCopy()
Traceback (most recent call last):
  File "<input>", line 1, in <module>
TypeError: Give an object
>>> obj.carbonCopy(123)
Traceback (most recent call last):
  File "<input>", line 1, in <module>
TypeError: Give an object
```
2023-09-05 00:38:30 +02:00
Jonas Bähr
4db4aeb91a Sketcher: fix docs for solve(..)
Since the docstring was initially written, an additional error code was added.
2023-09-05 00:32:54 +02:00
Chris Hennes
791fe02934 Sketcher: Reformat to current clang-format standard 2023-09-04 07:17:28 -05:00
Paddle
3a9135fd30 Sketcher_Dimension Replace SubNames by std::move(SubNames) 2023-09-02 11:35:31 +02:00
Paddle
4f34ef1a97 Sketcher_Dimension fix crash. 2023-09-01 18:50:46 +02:00
wmayer
c7116599ce Sketcher: fix several warnings:
* fix -Wunused-parameter
* fix -Wsign-compare
2023-09-01 17:34:29 +02:00
Paddle
fb32c0a6d7 Sketcher_Dimension: Disable arc-circle and arc-line distances as they are not implemented yet. 2023-09-01 08:00:21 -05:00
Paddle
e7b0ffffc4 Sketcher_Dimension: Implement Point-to-Circle distance. 2023-09-01 08:00:21 -05:00
Paddle
a121f8710f Sketcher_Dimension Fix the transaction auto-closing issue 2023-09-01 07:58:45 -05:00
Paddle
c72c9eaaa3 Sketcher_Dimension : Implement selection->tool workflow 2023-09-01 07:58:45 -05:00
Paddle
d74e67336e Sketcher_Dimension : Turn the command into a group-command to have at hand individual commands. 2023-09-01 07:57:44 -05:00
luzpaz
9ed299a57a Fix typos 2023-08-31 22:29:17 -05:00
bdieterm
7013ce0cbc Sketcher: fix segfault on distance constraints without SecondPos 2023-08-29 16:24:15 -05:00
kaktus Jacek
0445b88d55 Cleaning code from unnecessary strings generated to Crowdin 4 (#10426)
Cleaning Crowdin of "garbage". Second approach.
https://github.com/FreeCAD/FreeCAD-translations/issues/270
2023-08-29 12:57:26 -05:00
Chris Hennes
6bfafc62dc Update translations 2023-08-29 07:38:09 -05:00
kaktus Jacek
c0060277c8 Cleaning code from unnecessary strings generated to Crowdin 3 (#10420)
Cleaning Crowdin of "garbage". Second approach.
https://github.com/FreeCAD/FreeCAD-translations/issues/270
2023-08-29 07:35:04 -05:00
Florian Foinant-Willig
ae60811fba Sketcher: Point to Circle Distance Constraints (#9559) 2023-08-28 10:58:09 -05:00
Chris Hennes
874b0ff1a8 Merge pull request #9810 from Ondsel-Development/v2_constrain_contextually
Sketcher: Constrain Contextual implementation V2
2023-08-28 10:52:05 -05:00
Florian Foinant-Willig
d3af7e1e8d Sketcher: Fix Visual toolbox visibility 2023-08-28 10:46:48 -05:00
Paddle
11fd7f3a32 Implement GeomSelectionSizes to further refactor Dimension::makeAppropriateConstraint 2023-08-27 18:48:33 +02:00
Paddle
4d3b27f9a8 Dimension: Fix 2 circles concentric and length mode. 2023-08-27 18:48:00 +02:00
kaktus Jacek
06284ede05 Cleaning code from unnecessary strings generated to Crowdin. (#10385)
Cleaning Crowdin of "garbage". Second approach.
https://github.com/FreeCAD/FreeCAD-translations/issues/270
2023-08-27 10:08:11 -05:00
Paddle
212c0a75af Fix crash when user click 'Close' button while Dimension is active.
TaskDlgEditSketch didn't purge the handler first as is doing CmdSketcherLeaveSketch.
2023-08-27 09:26:44 +02:00
Paddle
178257c544 Refactor makeAppropriateConstraint 2023-08-27 08:25:20 +02:00
Paddle
4c161a544d Replace multiple occurence of selVec.size() by s_vec to clean the makeAppropriateConstraint function 2023-08-27 07:26:53 +02:00