[Issue #6189] Surface to surface tangency

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!
chrisb
Veteran
Posts: 53920
Joined: Tue Mar 17, 2015 9:14 am

Re: Surface to surface tangency

Post by chrisb »

jmaustpc wrote: Sun Sep 27, 2020 11:26 pm Would one of these be adequate?
May I suggest the upper with a different color in the middle? I would do it, if you agree.

Edit: Oops, far too slow to keep pace with Werner - Thanks!
wmayer wrote: Mon Sep 28, 2020 5:49 am git commit a4176fa15
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
User avatar
Pauvres_honteux
Posts: 728
Joined: Sun Feb 16, 2014 12:05 am
Location: Far side of the moon

Re: Surface to surface tangency

Post by Pauvres_honteux »

wmayer wrote: Sun Sep 27, 2020 10:02 pm Only edges can be used. The actual algorithm is GeomFill_NSections that requires a list of curves. The curves are obtained from the selected edges.
Tested your "Sections" (Multi section surface creator) on:
.
OS: openSUSE Leap 15.1 (KDE//usr/share/xsessions/default)
Display server protocol: Wayland
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.22522 (Git) AppImage
Build type: Release
Branch: master
Hash: d8e476ef428017900dfe0f9359ba448503c216f9
Python version: 3.8.5
Qt version: 5.12.9
Coin version: 4.0.0
OCC version: 7.4.0
.
And I could make a surface by selecting surface edges as well as lines/curves. (Do we have a distinct definition of lines/curves/edges somewhere? In my world an edge/intersect is a child of a surface/solid, a line/curve is the parent of a surface/solid.)
Sweep_end_tangency_Part_new_Sections_tool.FCStd
(13.39 KiB) Downloaded 61 times
.
However, I could not see how to set any surface tangency conditions?
Multi_section_tool_v001_No_tangency.png
Multi_section_tool_v001_No_tangency.png (48.48 KiB) Viewed 1943 times
.
Further, I can not distinguish between a "Sweep" and your "Multi section tool", can you? ("Sweep" = green and "Multi section tool" = yellow)
Multi_section_tool_v001_Identical_to_Sweep.png
Multi_section_tool_v001_Identical_to_Sweep.png (98.89 KiB) Viewed 1943 times
.
I'd suggest you add a column to the right, in Multi_section_tool_v001_No_tangency.png with the headline "[sovereign]surface" and means to select them via point-click in 3D and/or in the tree.
An extra column for "Tangency/curvature" to choose between plain tangency (C1) or curvature correct (C2/C3) transitions.
And a slider to adjust the acceleration (0-1 / 0-100% in steps of at a minumum 1/100) per Tangency/curvature. Preferably an auto update of the surface in question, but not any update of the whole document.
By this suggestion you easily see what rules what and how.
wmayer
Founder
Posts: 20243
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Surface to surface tangency

Post by wmayer »

And I could make a surface by selecting surface edges as well as lines/curves. (Do we have a distinct definition of lines/curves/edges somewhere?
Yes, we follow the convention how OCC defines it. It distinguishes between geometry and topology. Geometric entities are points, curves and surfaces. A curve can be a line, circle, ellipse, ... and a surface can be a plane, a cylindrical surface, spherical surface, ...

Topological entities are a vertex, edge, wire, face, shell, solid, compound or compound solid. Vertex, edge and face are special topological entities because they directly correspond to the geometries point, curve and surface. The other topological entities (wire, shell, ...) are higher-order entities because they can be built from several edges or faces.

As said above the class used to create a surface from sections is GeomFill_NSections and according to its name it works with geometries, i.e. curves in this context. So, there is no direct way to support wires. The best way to achieve this is using a function to select several adjacent curves and approximate them with a B-spline curve and then use the B-spline as a section.
User avatar
Pauvres_honteux
Posts: 728
Joined: Sun Feb 16, 2014 12:05 am
Location: Far side of the moon

Re: Surface to surface tangency

Post by Pauvres_honteux »

wmayer wrote: Mon Sep 28, 2020 9:53 am Yes, we follow the convention how OCC defines it. It distinguishes between geometry and topology.
Good to know.
.
wmayer wrote: Mon Sep 28, 2020 9:53 am Geometric entities are points, curves and surfaces.

A curve can be a line, circle, ellipse,
... a surface can be a plane, a cylindrical surface, spherical surface, ...

Topological entities are a vertex, edge, wire, face, shell, solid, compound or compound solid.
Vertex, edge and face are special topological entities because they directly correspond to the geometries point, curve and surface.

The other topological entities (wire, shell, ...) are higher-order entities because they can be built from several edges or faces.
Brilliant explanation! With a question: you state wire = topological entity AND "other topological entity", can it be both? If so, how?
.
wmayer wrote: Mon Sep 28, 2020 9:53 am As said above the class used to create a surface from sections is GeomFill_NSections and according to its name it works with geometries, i.e. curves in this context. So, there is no direct way to support wires. The best way to achieve this is using a function to select several adjacent curves and approximate them with a B-spline curve and then use the B-spline as a section.
Then the algorithm must tweaked to take "wires" as an argument. Or develop a new algorithm, or work around it without resorting to approximation, or try to find some other algorithm in OCCT which do take wires as an argument.
If the user first make a "join" (maybe it's called compound?) of the involved wires, would that move us forward?
wmayer
Founder
Posts: 20243
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Surface to surface tangency

Post by wmayer »

With a question: you state wire = topological entity AND "other topological entity", can it be both? If so, how?
Sorry, I don't understand your question. Can you explain what you want to know?
Then the algorithm must tweaked to take "wires" as an argument. Or develop a new algorithm, or work around it without resorting to approximation, or try to find some other algorithm in OCCT which do take wires as an argument.
In the Curves add-on there is such a function. Just select several adjacent edges and it will approximate a B-spline curve out of them.
or try to find some other algorithm in OCCT which do take wires as an argument.
For many algorithms in OCC there is a Geom version that accepts only geometries and a Brep variant that accepts shapes as arguments. This is also the case here with the class BRepFill_NSections.
If the user first make a "join" (maybe it's called compound?) of the involved wires, would that move us forward?
Joining the non-adjacent sections to a compound makes no sense and very likely won't work. Joining adjacent sections to a wire possibly works when using the class BRepFill_NSections. But this must be tested.
User avatar
Pauvres_honteux
Posts: 728
Joined: Sun Feb 16, 2014 12:05 am
Location: Far side of the moon

Re: Surface to surface tangency

Post by Pauvres_honteux »

wmayer wrote: Mon Sep 28, 2020 3:20 pm
Pauvres_honteux wrote:With a question: you state wire = topological entity AND "other topological entity", can it be both? If so, how?
Sorry, I don't understand your question. Can you explain what you want to know?
I reread your statement a few times and now the coin dropped. You type almost as good as I do... :lol:
.
wmayer wrote: Mon Sep 28, 2020 3:20 pm
Pauvres_honteux wrote:Then the algorithm must tweaked to take "wires" as an argument. Or develop a new algorithm, or work around it without resorting to approximation, or try to find some other algorithm in OCCT which do take wires as an argument.
In the Curves add-on there is such a function. Just select several adjacent edges and it will approximate a B-spline curve out of them.
This is exactly what FreeCAD shall not do. Not at all ! We shall have exact curves in each and every operation there is.
A surface shall not start with/be created from an approximated curve or line! Never ever!!!
Approximation will be a separate function/operation(with a separate icon in the tree) used to make jagged intersect and jagged reflect lines smooth, but not for creating these simple surfaces. The only time one uses approximated curves is when the program creates jagged curves/reflect lines.
.
wmayer wrote: Mon Sep 28, 2020 3:20 pm
Pauvres_honteux wrote:or try to find some other algorithm in OCCT which do take wires as an argument.
For many algorithms in OCC there is a Geom version that accepts only geometries and a Brep variant that accepts shapes as arguments. This is also the case here with the class BRepFill_NSections.
Now that's what I'm talking about!
.
wmayer wrote: Mon Sep 28, 2020 3:20 pm
Pauvres_honteux wrote:If the user first make a "join" (maybe it's called compound?) of the involved wires, would that move us forward?
Joining the non-adjacent sections to a compound makes no sense and very likely won't work. Joining adjacent sections to a wire possibly works when using the class BRepFill_NSections. But this must be tested.
I think I must make a picture of how I imagined it, but that will not be done in the next few days.
.
So, how to proceed with the surface tangency?
Please try with my previously attached files, "Arbitrary_four_sided_surface" and "Sweep_end_tangency". I didn't succeed in making anything tangent anyway, maybe you've got more luck than me?
.
User avatar
Chris_G
Veteran
Posts: 2579
Joined: Tue Dec 31, 2013 4:10 pm
Location: France
Contact:

Re: Surface to surface tangency

Post by Chris_G »

Pauvres_honteux wrote: Mon Sep 28, 2020 6:32 pm This is exactly what FreeCAD shall not do. Not at all ! We shall have exact curves in each and every operation there is.
A surface shall not start with/be created from an approximated curve or line! Never ever!!!
In an perfect world, maybe everything would be that simple.
In real life, this means that you have to match curves by degree elevation / knot insertion.
If you stack a couple of operations like that, you might end up with overly heavy curves / surfaces.
Some algorithms need to use approximation. It is not wrong by itself.
Usually approximation takes a tolerance as input, and will return a result within specified tolerance.
There is often more cleverness into approximation algorithms, than into interpolation ones, for example.
Approximation is not evil. It just needs to be used cleverly (this is where I exclude CurvesWB :lol: )
wmayer
Founder
Posts: 20243
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Surface to surface tangency

Post by wmayer »

Pauvres_honteux wrote: Wed May 27, 2020 1:46 pm Hi, anyone working on surface to surface tangency with the intent of up-streaming it to master?
The surfaces shall have a common curve ruling them both.
Attached is a small project with two B-spline surfaces (extruded from sketches) and filled with a G1-continuoues surface. The only limitation is that for this function you need a closed curve network. So, the way how microelly2 does it in his video is not directly possible. These two missing curves can be created with the Curves wb.

But for the sake of simplicity I connected two straight lines. You switch to the Surface wb and start the first function (it's the blue surface with 4 boundary curves). There select the four curves and for the two curves from the extruded sketches double-click the item in the list view. It opens a sub-panel where you can choose G1 continuity.

In the example project I created two surfaces: one with C0 and the other with G1 continuity. If you toggle visibility of them you should see the difference.
Attachments
surface_tangency.FCStd
(57.68 KiB) Downloaded 49 times
wmayer
Founder
Posts: 20243
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Surface to surface tangency

Post by wmayer »

mnesarco wrote: Thu Sep 24, 2020 4:56 pm I have tried BRepFill_Filling without success, i have read surface modeling part 6 many times, many times it leads to invalid shapes, segfaults, in general I never got a desired result. Maybe I am doing something batantly wrong, but again the documentation does not help.

OCCT formun is rarely useful, questions get never answered or partially answered or answered with "contact our paid support services"

It looks like you have knowledge about this topic, it would be great if you can share it.
Attached is a model as shown in Roman's blog. When using the Surface wb you can fill the gap with a surface (behind the scene it uses BRepFill_Filling). If you zoom at the created surface you will see that it's only C0 continuous but by double-clicking the list items you can set G1 continuity and when observing the surface you see that it fits better and better for each G1 continuous edge.

Btw, over the weekend I have implemented some Python wrappers for the GeomPlate_BuildPlateSurface API: git commit 00e0e7745c97a
Here is a short example how to create a surface by setting point and curve constraints:

Code: Select all

v1=App.Vector(0,0,0)
v2=App.Vector(10,0,0)
v3=App.Vector(10,10,3)
v4=App.Vector(0,10,0)
v5=App.Vector(5,5,5)

l1=Part.LineSegment(v1, v2)
l2=Part.LineSegment(v2, v3)
l3=Part.LineSegment(v3, v4)
l4=Part.LineSegment(v4, v1)

c1=Part.GeomPlate.CurveConstraint(l1)
c2=Part.GeomPlate.CurveConstraint(l2)
c3=Part.GeomPlate.CurveConstraint(l3)
c4=Part.GeomPlate.CurveConstraint(l4)
c5=Part.GeomPlate.PointConstraint(v5)

bp=Part.GeomPlate.BuildPlateSurface()
bp.add(c1)
bp.add(c2)
bp.add(c3)
bp.add(c4)
bp.add(c5)
bp.perform()
s=bp.surface()
bs=s.makeApprox()
Part.show(bs.toShape())
Part.show(l1.toShape())
Part.show(l2.toShape())
Part.show(l3.toShape())
Part.show(l4.toShape())
Attachments
plate_surface.FCStd
(26.32 KiB) Downloaded 55 times
User avatar
Chris_G
Veteran
Posts: 2579
Joined: Tue Dec 31, 2013 4:10 pm
Location: France
Contact:

Re: Surface to surface tangency

Post by Chris_G »

A new toy to play with :D
Thanks a lot.
Post Reply