[Sketcher] snapping discussion

Have some feature requests, feedback, cool stuff to share, or want to know where FreeCAD is going? This is the place.
Forum rules
Be nice to others! Read the FreeCAD code of conduct!
User avatar
paddle
Veteran
Posts: 1391
Joined: Mon Feb 03, 2020 4:47 pm

Re: [Sketcher] snapping discussion

Post by paddle »

openBrain wrote: Wed Feb 08, 2023 6:06 am Your PR doesn't even compile on the CI. This is kind of things I wish is checked before announcing it works.
Since I released the new CI, it has been allowed to run on fork repos, so I'm encouraging you to update the master branch of your fork so CI will run on every push to your repo and you'll get the result (first run will be quite long, time to create cache).

Also please take care of your commits. Things are more easily reviewed and merged if they come as a sequence of well thought commits that each introduces a limited but consistent set of things. Your PR may well be 3 to 4 commits. You may read a bit of documentation about 'git commit --fixup' and 'git rebase --autosquash' so you can envisage it in a sustainable way.

I seen the CI message this morning. Hmm this is again a situation where VS let me build without issues and where it doesn't build on linux. Probably a missing include?

Regarding the new CI, when did you released it? Yesterday when I pushed to my remote branch, I did not get any notification that CI ran there.

For the commits, I didn't really found any meaningfull way of splitting them. I guess the implementation of angle snapping in the DSH can be separated. I will have a look if I can find a meaningful split to be done.
Hologram
Posts: 201
Joined: Thu Nov 03, 2022 3:05 pm

Re: [Sketcher] snapping discussion

Post by Hologram »

Good news @paddle this is an interesting development to me, looking forward to the results. Good luck! :)
cadcam
Posts: 273
Joined: Thu Apr 02, 2020 10:39 am

Re: [Sketcher] snapping discussion

Post by cadcam »

Very good to se you attacking this issue and that yopu haven't abandoned developing for FC.

I don't know if it is something you would consider, but many years ago I was involved with testing a
new 2D cad package. One of the features I found very useful was the ability to adjust the range of the
snap. e.g you are drawing a line and you want to snap to using the horizontal constraint. By default
the system would snap within a radius as you describe. However using a hotkey or <CTRL>
the search area could temporarily be extended. I haven't thought how best it would be implemented in FC, but
perhaps with extended cross-hairs which can be seen to snap to distant geometry and change colour and/or
display the constraint at the detected geometry

Best Wishes
openBrain
Veteran
Posts: 9034
Joined: Fri Nov 09, 2018 5:38 pm
Contact:

Re: [Sketcher] snapping discussion

Post by openBrain »

paddle wrote: Wed Feb 08, 2023 8:22 am Regarding the new CI, when did you released it? Yesterday when I pushed to my remote branch, I did not get any notification that CI ran there.
I would say 2 weeks ago or so. I checked and your master have it (and so it ran and failed when you pushed to your branch on your fork repo).
Maybe check our notification settings.
Here the failing run : https://github.com/PaddleStroke/FreeCAD ... 4118049383
For the commits, I didn't really found any meaningfull way of splitting them. I guess the implementation of angle snapping in the DSH can be separated. I will have a look if I can find a meaningful split to be done.
I didn't checked thoroughly. But for example, 'SnapManager' introduction could be a separate commit (not changing anything to the code behavior, just adding it). ;)
User avatar
paddle
Veteran
Posts: 1391
Joined: Mon Feb 03, 2020 4:47 pm

Re: [Sketcher] snapping discussion

Post by paddle »

The build error is fixed, it was a missing header.
I split the commits and added some more features (snap to line/arc centers, ellipse/arc of ellipse).

I will try to add for hyperbola and parabola now.

@cadcam sorry I can't understand what you mean. Do you have a video perhaps?

@Hologram thanks ! :)
GeneFC
Veteran
Posts: 5373
Joined: Sat Mar 19, 2016 3:36 pm
Location: Punta Gorda, FL

Re: [Sketcher] snapping discussion

Post by GeneFC »

paddle wrote: Wed Feb 08, 2023 11:28 am @cadcam sorry I can't understand what you mean. Do you have a video perhaps?
Beware creeping elegance! You will never finish with the first pass.

Gene
Hologram
Posts: 201
Joined: Thu Nov 03, 2022 3:05 pm

Re: [Sketcher] snapping discussion

Post by Hologram »

Come on, no snarky comments.
User avatar
paddle
Veteran
Posts: 1391
Joined: Mon Feb 03, 2020 4:47 pm

Re: [Sketcher] snapping discussion

Post by paddle »

Hmm I'm having mathematic trouble for hyperbola to find the point on the hyperbola close to mouse pointer.
If the following inspire someone with hyperbola knowledge :)

Code: Select all

                const Part::GeomArcOfHyperbola* hyperbola = static_cast<const Part::GeomArcOfHyperbola*>(geo);
                Base::Vector2d centerPoint = Base::Vector2d(hyperbola->getCenter().x, hyperbola->getCenter().y);
                Base::Vector2d majorAxis = Base::Vector2d(hyperbola->getMajorAxisDir().x, hyperbola->getMajorAxisDir().y) * hyperbola->getMajorRadius();
                Base::Vector2d minorAxis = Base::Vector2d(- hyperbola->getMajorAxisDir().y, hyperbola->getMajorAxisDir().x) * hyperbola->getMinorRadius();

		//This is appantly wrong : 
                Base::Vector2d vec = pointToOverride - centerPoint;
                double U = atanh(vec.y / minorAxis.Length()) + acosh(vec.x / majorAxis.Length());

		//This seems to be OK as it create points on the hyperbola :
                pointToOverride = centerPoint + majorAxis * cosh(U) + minorAxis * sinh(U);
Last edited by paddle on Wed Feb 08, 2023 9:06 pm, edited 1 time in total.
GeneFC
Veteran
Posts: 5373
Joined: Sat Mar 19, 2016 3:36 pm
Location: Punta Gorda, FL

Re: [Sketcher] snapping discussion

Post by GeneFC »

Hologram wrote: Wed Feb 08, 2023 2:55 pm Come on, no snarky comments.
That was not snarky at all. I have been there many times. Pure truth.

Gene
chrisb
Veteran
Posts: 53919
Joined: Tue Mar 17, 2015 9:14 am

Re: [Sketcher] snapping discussion

Post by chrisb »

Hologram wrote: Wed Feb 08, 2023 2:55 pm Come on, no snarky comments.
You seem to be pretty new here and I'm a bit surprised that you are calling Gene to order. He is for good reasons a moderator because he always stays calm and fair.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
Post Reply