0001304: Allow Sketcher to Fillet Arcs, Not Only Lines

Post here for help on using FreeCAD's graphical user interface (GUI).
Forum rules
and Helpful information
IMPORTANT: Please click here and read this first, before asking for help

Also, be nice to others! Read the FreeCAD code of conduct!
User avatar
NormandC
Veteran
Posts: 18587
Joined: Sat Feb 06, 2010 9:52 pm
Location: Québec, Canada

Re: 0001304: Allow Sketcher to Fillet Arcs, Not Only Lines

Post by NormandC »

Hi abdullah,

The first animated Gif shows exactly what I would expect of the tool. Are you concerned because the arc of ellipse rotates a little bit? Sure it would be nice if its placement didn't change at all, but I wouldn't worry too much about it - after all it's just a matter of adding the appropriate constraints.

As for the unexpected result in the 3rd Gif, well, we already get wonky behaviour with the trimming tool, when trying to trim circles... I prefer a tool that acts wonky sometimes to a tool that is not available at all :D
abdullah
Veteran
Posts: 4935
Joined: Sun May 04, 2014 3:16 pm
Contact:

Re: 0001304: Allow Sketcher to Fillet Arcs, Not Only Lines

Post by abdullah »

chrisb wrote: Tue Oct 16, 2018 5:43 pm Does it work as well with just clicking the corner?
Not, ATM. But I think it could work by guessing an arc radius (like with line segments).
Joel_graff wrote: Tue Oct 16, 2018 8:09 pm That's really awesome. Nice that it's integrated into the existing tool, too - eliminates the need for geometry checking.

I wrote a monstrous amount of python code to achieve this same effect, but my results were exact. Still, this is a lot easier than anything I'd imagined.
This is just aimed as filleting it. Constraints are needed to keep everything in place.
bejant wrote: Tue Oct 16, 2018 10:47 pm To me it looks like the size of the Fillet is determined by where the user clicks on the two existing arcs (maybe you alluded to that in your next post) - is that right?
Yes it is right. As Chris mentions it is also how it is determined with straight lines. I was important to me to understand that this is a filleting tool, not a connecting tool. It is possible to connect two curves using an arc tangential to both, but if curves (or the underlying untrimmed curves, ellipse in the case of arc of ellipse) do not intersect, then it is not filleting, but connecting.
bejant wrote: Tue Oct 16, 2018 10:47 pm I wonder, do the directions in which the Arc and Arc Of Ellipse were originally created (clockwise or anti-clockwise) come into play there?
Indeed, I think this is my problem. Maybe a curve that is CW having a basis curve that is CCW. I know exactly where it happens, so I need some extra debugging.
NormandC wrote: Wed Oct 17, 2018 3:29 am Are you concerned because the arc of ellipse rotates a little bit? Sure it would be nice if its placement didn't change at all, but I wouldn't worry too much about it - after all it's just a matter of adding the appropriate constraints.
I am not worried about the rotation. I am more worried about the user getting overwhelmed by the tool. With line segments it is quite easy to see how the tool will make the fillet. With connected curves, due to the curvature, sometimes it comes to me as a surprise (admittedly it may be my limitation, that I am just not used). With curves that are not connected at all, the surprise effect is even higher.
NormandC wrote: Wed Oct 17, 2018 3:29 am As for the unexpected result in the 3rd Gif, well, we already get wonky behaviour with the trimming tool, when trying to trim circles... I prefer a tool that acts wonky sometimes to a tool that is not available at all :D
I think I can fix the wonky behaviour. Afterwards, I will see if I make an Appimage so that you CAD profs can get a hands-on feeling of the tool and come back with comments.
User avatar
Joel_graff
Veteran
Posts: 1949
Joined: Fri Apr 28, 2017 4:23 pm
Contact:

Re: 0001304: Allow Sketcher to Fillet Arcs, Not Only Lines

Post by Joel_graff »

abdullah wrote: Wed Oct 17, 2018 4:33 pm This is just aimed as filleting it. Constraints are needed to keep everything in place.
Right. I think between fixing the geometry in place with the block constraint and this new fillet tool, I'll be able to do "organically" in Sketcher what required a lot of ugly Python-scripted math on my part...

Great work!
FreeCAD Trails workbench for transportation engineering: https://www.github.com/joelgraff/freecad.trails

pivy_trackers 2D coin3D library: https://www.github.com/joelgraff/pivy_trackers
RogerK
Posts: 28
Joined: Thu Oct 04, 2018 6:25 pm
Location: Elsau

Re: 0001304: Allow Sketcher to Fillet Arcs, Not Only Lines

Post by RogerK »

Hi abdullah

Do I understand you right? When you fillet two arcs, you will cut the arc at the point where the user clicked on the arc, then connect these two points with a new arc and set the tangent constraint a both connection points? Depending on the location of the click, the arc's have to be more or less adjusted.

One approach could be not using the clicking points directly for the cut, but for a starting point to search for a suitable new filletarc which fit tangential to both selected arc. The target would be to fit the tangential intersection point from the filletarc as near as possible to the clickpoint from the first selected arc. With this approach it should be possible to fit the fillet to both arcs without an adjustment of the radius of the original arcs. But this is quit challenging and I have no idea how such an implementation will look like.


Kind regards

Roger
abdullah
Veteran
Posts: 4935
Joined: Sun May 04, 2014 3:16 pm
Contact:

Re: 0001304: Allow Sketcher to Fillet Arcs, Not Only Lines

Post by abdullah »

RogerK wrote: Wed Oct 17, 2018 6:40 pm Hi abdullah

Do I understand you right? When you fillet two arcs, you will cut the arc at the point where the user clicked on the arc, then connect these two points with a new arc and set the tangent constraint a both connection points? Depending on the location of the click, the arc's have to be more or less adjusted.
The current algorithm expects a correction. It is basically what you have described, but assuming the center of the arc is in the intersection of the normals at the clicked points. This cannot be true for an arc, as the radius towards each curve would be different.

It may be possible to improve the algorithm. The fact that the direction of the normal changes with position makes it a little bit more complicated. But if an exact math solution exists, then it shall be possible.

I am currently stuck with an issue that may be an OCC bug. Hopefully it is not.
abdullah
Veteran
Posts: 4935
Joined: Sun May 04, 2014 3:16 pm
Contact:

Re: 0001304: Allow Sketcher to Fillet Arcs, Not Only Lines

Post by abdullah »

Well, the bug was not an OCC bug, but a FC bug. This was nice to solve.

In the meantime I have rewritten the code using offset curves. So basically, uses the radius magnitude given to the command (or estimates it as the distance between the given reference points). With this radius generates two offset curves (one for each curve to fillet) by the radius magnitude. It calculates the intersection of those offset curves. This is the center of the arc. Then it projects the intersection on the curves (calculates the closest point of each curve to the intersection). Then creates an arc between those points.

My expectation was that it won't move, not even a bit. Well, it does move a little bit:
FilletArcOfConics3.gif
FilletArcOfConics3.gif (135.78 KiB) Viewed 1194 times
chrisb
Veteran
Posts: 53919
Joined: Tue Mar 17, 2015 9:14 am

Re: 0001304: Allow Sketcher to Fillet Arcs, Not Only Lines

Post by chrisb »

This looks very good!
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
User avatar
NormandC
Veteran
Posts: 18587
Joined: Sat Feb 06, 2010 9:52 pm
Location: Québec, Canada

Re: 0001304: Allow Sketcher to Fillet Arcs, Not Only Lines

Post by NormandC »

abdullah wrote: Sat Oct 20, 2018 1:25 pm My expectation was that it won't move, not even a bit. Well, it does move a little bit:
I see absolutely no movement, at all. But you are the programmer so I will take your word for it. :D

PR it already!!! :mrgreen:
RogerK
Posts: 28
Joined: Thu Oct 04, 2018 6:25 pm
Location: Elsau

Re: 0001304: Allow Sketcher to Fillet Arcs, Not Only Lines

Post by RogerK »

Hi abdullah

This is awesome. Great job. I can't see any jumping either :D . But maybe I need new glasses.


Kind regards

Roger
abdullah
Veteran
Posts: 4935
Joined: Sun May 04, 2014 3:16 pm
Contact:

Re: 0001304: Allow Sketcher to Fillet Arcs, Not Only Lines

Post by abdullah »

Thanks guys!!
NormandC wrote: Sat Oct 20, 2018 6:57 pm I see absolutely no movement, at all. But you are the programmer so I will take your word for it. :D
RogerK wrote: Sun Oct 21, 2018 6:10 am I can't see any jumping either :D . But maybe I need new glasses.
Look at the endpoint of the major axis of the left ellipse. It does move slightly when applying the tangency.

I am finding many tiny bugs, the kind you find when you do fillets between arcs of hyperbola and line segments and things like those.

It is for sure not PR ready yet (there are cases where it fails). I am not sure if it would be wise to include it in v0.18, as I am changing some decent amount of code and it would not have a long enough debug period... plus I get to tease you to start using v0.19 straight away. Who could live with an outdated version? :lol:
Post Reply