-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sk refactor stage 3 #18916
Draft
AjinkyaDahale
wants to merge
34
commits into
FreeCAD:main
Choose a base branch
from
AjinkyaDahale:sk-refactor-stage-3
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Sk refactor stage 3 #18916
+2,858
−2,211
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AjinkyaDahale
force-pushed
the
sk-refactor-stage-3
branch
from
January 7, 2025 09:25
22e33e6
to
398fda4
Compare
2 tasks
[Sketcher] Add null case to constraint change on deletion checks
No tests added since this should be no more different than existing code.
No tests are added since this commit only adjusts if-then statements.
Some tests probably needed
Remove the type-checks in `free(std::vector<Constraint*>& constrvec)` as well as checks for `nullptr` before deleting.
* Use range-for and rearrange for understandability. * Break down into individual functions by geomtype. * Also refactor `exposeInternalGeometryForType<Part::GeomBSplineCurve>` * Use `Constraint::involves...()` in delete internal
1. Use `Part::GeomCurve::createArc()` 2. Refactor constraint logic in `trim`
Cognitive complexity down to 57.
Fixes fails at cases where one (or both) of the remaining segments is (are) degenerate. This existed pre-refactor. Fixes cases where there are some constraints on internal geometry that do not get deleted cleanly. Also fixes a memory leak.
...by hyarion on December 29.
1. Now uses `Part::Geometry::createArc`. 2. Removed type-specific codes. It can be generalized now.
1. Replace `find_if` with `any_of` when the iterator is not used. 2. Use PascalCase for templated class.
...when some are "used"
This should be a `protected` or `private` operation since it doesn't handle constraints. However, this is intended to be used by external classes that modify a `SketchObject` (instead of these modifications like `split`, `trim`, `join` etc. being methods of `SketchObject`). In that case, it may be best to use the `friend` keyword.
For some reason this is not caught in the tests.
Towards making it a function class or similar.
Not working completely. 1. Internal geometries are not transferred/deleted.
1. Don't bother deleting internal geometry first. 2. Don't assume all new constraints are well formed.
Should be just the same old loop and conditional rearrangement. However, not confident that this behaves exactly the same as previously.
Note that for distance constraints we remove even if the constraint is not on the point.
AjinkyaDahale
force-pushed
the
sk-refactor-stage-3
branch
from
January 8, 2025 04:19
398fda4
to
07b481f
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
(draft until stage 2 is merged)