Curves workbench

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!
balrobs
Posts: 449
Joined: Fri Apr 24, 2020 8:58 pm

Re: Curves workbench

Post by balrobs »

Chris_G wrote: Thu Jan 27, 2022 11:14 am A possible solution is to discretize the ellipse, and approximate it with a uniform parametrization.
This may not be totally accurate, but much better anyway.
Thank you @Chris_G for showing me this solution. Indeed it's a way to do things.
It also works for splines, so with this approach the step distribution can now fairly accurately be controled for general curved stairs.
Thanks again! :D
pafurijaz
Posts: 66
Joined: Sun Dec 18, 2016 6:04 pm

Re: Curves workbench

Post by pafurijaz »

Hi Chris_G, I have a problem with the blending between surfaces, it doesn't work as I expected with this object, at Y, I attack the file hoping you can get an answer.

For each side there is an anomalous blending on one while the other is correct.
I have noticed that this also happens in other circumstances.
Image
Y-blend.FCStd
Y Surface Blend
(196.81 KiB) Downloaded 29 times
User avatar
Chris_G
Veteran
Posts: 2579
Joined: Tue Dec 31, 2013 4:10 pm
Location: France
Contact:

Re: Curves workbench

Post by Chris_G »

Hi,
I have seen this bug already.
For an unknown reason, the derivatives of the surface are not correctly computed at one corner of the faces.
I need to investigate further.
bad_derivatives.png
bad_derivatives.png (32.06 KiB) Viewed 1818 times
paullee
Veteran
Posts: 5098
Joined: Wed May 04, 2016 3:58 pm

Re: Curves workbench

Post by paullee »

Chris_G wrote: Thu Jan 27, 2022 11:14 am Sketch_On_Surface depends on how the target surface is parametrized.
An ellipse is not parametrized by arc-length, so the mapped object is deformed / stretched.
Could you slightly elaborate the logic behind how Sketch is Mapped / Stretched ? Can't imagine after studying a few examples how the stairs were mapped on different surface :D

Thanks.
User avatar
hammax
Veteran
Posts: 1985
Joined: Thu Jan 19, 2017 5:03 pm
Location: Ammersee DE

Re: Curves workbench

Post by hammax »

... yes, would be very interesting
and how one can get / visualize these "Derivatives"?

After looking into the pafurijaz example, I tried it in another way => no problems.

BCurve.PNG
BCurve.PNG (24.66 KiB) Viewed 1709 times
Attachments
BCurve_2.FCStd
another job => not so optimal
(162.77 KiB) Downloaded 25 times
BCurve.FCStd
FC.19.3
(190.18 KiB) Downloaded 32 times
pafurijaz
Posts: 66
Joined: Sun Dec 18, 2016 6:04 pm

Re: Curves workbench

Post by pafurijaz »

hammax wrote: Fri Jan 28, 2022 5:50 am ....
After looking into the pafurijaz example, I tried it in another way => no problems.
Hi @hammax, and thanks for the alternative version, this could help me in other contexts, however, in this case there is an anomaly in the generation of the surfaces, which has some areas with crossed CVs and consequently generates a wavy surface.

Here below your version with wavy surface CVs
Image
Image

And on the other hand,what I've done with bend and a better continuity, I have kept the correct ones and mirrored them.
Image
Image

Anyway I wanted to ask how you created the flat top, it is something that I cannot understand and that I have tried to do often but I did not understand how to make it
Image
Thank you
User avatar
Chris_G
Veteran
Posts: 2579
Joined: Tue Dec 31, 2013 4:10 pm
Location: France
Contact:

Re: Curves workbench

Post by Chris_G »

paullee wrote: Thu Jan 27, 2022 11:26 pm Could you slightly elaborate the logic behind how Sketch is Mapped / Stretched ? Can't imagine after studying a few examples how the stairs were mapped on different surface :D
The main tool is a Quad face (a simple flat BSpline surface) that acts as a flat map of the target face.
The special thing about this quad BSpline surface, compared to all other geometries, is that it is stretchable, because its geometry (set by the poles) is independent from its parametric space (set by the knots).
So this quad is used as an intermediate transfer face between the target face, and the shapes we want to map on it.
In the Sketch_on_surface tool, this quad surface is not shown, but it is set to the dimensions of the blue construction rectangle of the Mapped Sketch.

Here is a little walkthrough that you can run, part by part, in the python console :

First, we create the target face (a cone) and save its parametric bounds

Code: Select all

from FreeCAD import Vector

cone  = Part.makeCone(5, 2, 10).Face1
Part.show(cone, "Cone")
u0, u1, v0, v1 = cone.ParameterRange

Now, we create our quad BSpline surface:

Code: Select all

quad = Part.BSplineSurface()
quad.setUKnots([u0, u1])
quad.setVKnots([v0, v1])

quad.setPole(1, 2, Vector(0, 10, 0))
quad.setPole(2, 1, Vector(20, 0, 0))
quad.setPole(2, 2, Vector(20, 10, 0))

map = quad.toShape()
Part.show(map, "Quad")

The knots are set to the parametric bounds of the cone, so the cone face and the quad have the same parametric space.
Then we can stretch the geometry of the quad to whatever we want, like a 20 x 10 rectangle, for example.

Now, we create a shape to project and map on the cone, for example a box :

Code: Select all

box = Part.makeBox(3, 3, 3)
box.Placement = FreeCAD.Placement(Vector(12, 3, 3), Vector(0.7, -0.7, -0.2), 35)
Part.show(box, "Box")

And finally, here is the transfer part.
The box is first projected on the quad.
Then, in the for loop, each edge of the projection generates a 2D geometry (curveOnSurface) that is then mapped on the cone (toShape(cone, ...))

Code: Select all

proj = map.project([box])
Part.show(proj, "Box projection")
edges = []
for e in proj.Edges:
	cos, fp, lp = map.curveOnSurface(e)
	edges.append(cos.toShape(cone, fp, lp))

box_on_cone = Part.Compound(edges)
Part.show(box_on_cone, "box_on_cone")
pafurijaz
Posts: 66
Joined: Sun Dec 18, 2016 6:04 pm

Re: Curves workbench

Post by pafurijaz »

Chris_G wrote: Thu Jan 27, 2022 6:20 pm ..........
........
..
Hi Chris_G, I saw that the B-Spline curve icon is misleading, it represents a B-Spline from the control points, but actually a B-Spline is created through the points,

Actual Icon
Image

Image

I think I miss this possibility to create a B-Spline through the Points, because this would allow to do a manual continuity by constraining the points on construction lines and tangents, and I wanted to ask if you can implement this kind of curve like in Silk.

Image

Thanks
User avatar
hammax
Veteran
Posts: 1985
Joined: Thu Jan 19, 2017 5:03 pm
Location: Ammersee DE

Re: Curves workbench

Post by hammax »

... the flat face is from a PartWB tool:

There is still more learning effort to get "smooth / waveless" Blend_Surfaces.
That's why I am trying and trying...


BCurve_3.PNG
BCurve_3.PNG (41.74 KiB) Viewed 1638 times
pafurijaz
Posts: 66
Joined: Sun Dec 18, 2016 6:04 pm

Re: Curves workbench

Post by pafurijaz »

hammax wrote: Fri Jan 28, 2022 11:00 am ... the flat face is from a PartWB tool:
Thanks, this new path opens up a lot of new opportunities for me, I have to explore the various workbenches well, these functions are indispensable for working with surfaces.
Post Reply