Skip to content
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
wants to merge 34 commits into
base: main
Choose a base branch
from

Conversation

AjinkyaDahale
Copy link
Contributor

(draft until stage 2 is merged)

@github-actions github-actions bot added the Mod: Sketcher Related to the Sketcher Workbench label Jan 7, 2025
[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.
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.
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Mod: Sketcher Related to the Sketcher Workbench
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant