Curves workbench

Have some feature requests, feedback, cool stuff to share, or want to know where FreeCAD is going? This is the place.
User avatar
Chris_G
Posts: 931
Joined: Tue Dec 31, 2013 4:10 pm
Location: France
Contact:

Curves workbench

Postby Chris_G » Sat May 27, 2017 3:27 pm

Hi,
Kunda1 is kindly taking care of the addon manager, and asked addon developers to document their addons and present them here , on the forum.
So, here is a presentation of my "Curves" workbench :
https://github.com/tomate44/CurvesWB

Important foreword :
- I am a very bad coder, and this workbench is probably very badly coded.
- So please don't use it for any serious work

My main interest is about NURBS curves and surfaces ( and I've learned a lot about them since I've been here. Thanks guys ! ).

The first tool is about creating BSpline curves.
Keyboard commands are displayed in the upper-left corner.
Image

Next is a tool that turns an edge into an editable BSpline Curve.
This is a crappy temporary tool, until I make a real freehand curve editor ...
Curve degree can be increased / decreased.
Poles can be moved with the properties of the "Poles" section.
Double-click the "Spline" object to show / hide the control points.
I use it to check the parametric behaviour of the other tools.
Image

Third tool joins a set of connected edges into a BSpline Curve.
There is an option for breaking the curve on sharp corners.
It can be useful on imported SVG, to get a real single curve from a smooth SVG path.

Fourth tool discretizes an edge ( or the first wire it belongs to ).
This tool offers all the parameters of the Part.Edge.discretize() python API.
Image

Fifth tool is the best friend of "Discretize". It approximates a set of points to a BSpline curve (or surface).
This tool offers all the parameters of the Part.BSplineCurve.approximate() python API.
When using this tool on several objects, each one will get approximated by a curve.
Image

But if several objects ( with same number of points) are put in a Group, and the tool is used on the Group, it will create an approximating surface.
Image

"Discretize" and "Approximate" could be useful for example in some cases where a sweep operation fails because of a bad sweep path.

To be continued ...
triplus
Posts: 7955
Joined: Mon Dec 12, 2011 4:45 pm

Re: Curves workbench

Postby triplus » Sat May 27, 2017 9:25 pm

Nice!
User avatar
microelly2
Posts: 4163
Joined: Tue Nov 12, 2013 4:06 pm
Contact:

Re: Curves workbench

Postby microelly2 » Mon May 29, 2017 7:21 am

Good to know there is a GUI for these methods.
User avatar
hammax
Posts: 699
Joined: Thu Jan 19, 2017 5:03 pm
Location: Ammersee

Re: Curves workbench

Postby hammax » Mon May 29, 2017 9:01 am

...sweeping with 2 rails:
If I use "birail-sweep" on two logarithmic spirals, the feature uses automatically a (ruled) connecting edge.
Trying to make a sweep out of a circle or an arc, does not deliver a surface.
I see no possibility, to connect the sketch/facebinderobj to the sweep-paths.
(Trying to build a snailshell, for example).
LogSnail.PNG
LogSnail.PNG (33.7 KiB) Viewed 5495 times
User avatar
Chris_G
Posts: 931
Joined: Tue Dec 31, 2013 4:10 pm
Location: France
Contact:

Re: Curves workbench

Postby Chris_G » Mon May 29, 2017 9:54 am

hammax wrote:
Mon May 29, 2017 9:01 am
...sweeping with 2 rails:
Hi,
The Sweep On 2 Rails requires 3 steps.
Please update the Workbench, since I added a tool yesterday.

Step 1 -> create a Birail object out of 2 edges

sw2r-1.jpg
sw2r-1.jpg (27.42 KiB) Viewed 5486 times

Step 2 -> select the Birail and the profiles and create the Sweep on 2 rails

sw2r-2.jpg
sw2r-2.jpg (30.33 KiB) Viewed 5486 times

Step 3 -> Approximate the point cloud with a surface

sw2r-3.jpg
sw2r-3.jpg (36.95 KiB) Viewed 5486 times
sw2r-4.jpg
sw2r-4.jpg (28.75 KiB) Viewed 5486 times

I don't think it will work on closed profiles.
It also requires at least one profile at each end.
This is highly experimental Work In Progress.
User avatar
hammax
Posts: 699
Joined: Thu Jan 19, 2017 5:03 pm
Location: Ammersee

Re: Curves workbench

Postby hammax » Mon Jul 03, 2017 7:34 am

Hello Chris,
...I tried it again with ships construction - Sailboat-halfhull.
It's my longterm goal in FreeCAD.
Using my plane-grid and fife sketches I did my first try with your curves wb.
Only problem is, I can't get the hull's shape and a mirroring.
CurvesWB_Rumpf.PNG
CurvesWB_Rumpf.PNG (53.26 KiB) Viewed 5322 times
Attachments
SecRumpf.FCStd
(62.36 KiB) Downloaded 58 times
User avatar
Chris_G
Posts: 931
Joined: Tue Dec 31, 2013 4:10 pm
Location: France
Contact:

Re: Curves workbench

Postby Chris_G » Mon Jul 03, 2017 8:03 am

Hi,
You can approximate the Sweep2Rails object with a surface ( 5th tool of my WB ), and you'll be able to mirror this surface :
boat.jpg
boat.jpg (34.78 KiB) Viewed 5315 times
User avatar
hammax
Posts: 699
Joined: Thu Jan 19, 2017 5:03 pm
Location: Ammersee

Re: Curves workbench

Postby hammax » Mon Jul 03, 2017 10:06 am

...Wow, thanks - everything you want to see is on board.
Especially the wireframe .
Will there be a view-control on Wireframe/Points in the future?
I got curious by
https://forum.freecadweb.org/viewtopic. ... 28#p180586
https://github.com/tomate44/CurvesWB

CurvesWB_Rumpf_2.PNG
CurvesWB_Rumpf_2.PNG (74.14 KiB) Viewed 5293 times
User avatar
easyw-fc
Posts: 2212
Joined: Thu Jul 09, 2015 9:34 am

Re: Curves workbench

Postby easyw-fc » Mon Jul 03, 2017 11:19 am

Hi Chris,
very nice WB!
Do you have a main icon for the WB?
In FC 0.17 windows I cannot see the WB icon in the WB selector...

thanks
Maurice
User avatar
Chris_G
Posts: 931
Joined: Tue Dec 31, 2013 4:10 pm
Location: France
Contact:

Re: Curves workbench

Postby Chris_G » Mon Jul 03, 2017 12:43 pm

hammax wrote:
Mon Jul 03, 2017 10:06 am
...Wow, thanks - everything you want to see is on board.
Especially the wireframe .
Will there be a view-control on Wireframe/Points in the future?
I got curious by
https://forum.freecadweb.org/viewtopic. ... 28#p180586
https://github.com/tomate44/CurvesWB
Look at the "DisplayMode" property of the Sweep2Rails object ( as seen in your last screenshot ).

Just to be clear : the output of the Sweep2Rails tool is 2D array of points, with different ways to view it ( the DisplayMode property ). But it is not at all a surface yet. This is why it should then be approximated with a surface, because you'll probably want a real face in the end.
I kept the Sweep2Rails / ApproximateSurface as separate steps, because the approximation tool has a whole set of settings already, and the processing can be long ( or even endless ) on bad point arrays ( that have self-intersection for example ).
This way, I can check that the point cloud is good, keep the "fast to recompute" Sweep2Rails object visible during work, and go for the approximate object later.

easyw-fc wrote:
Mon Jul 03, 2017 11:19 am
Do you have a main icon for the WB?
In FC 0.17 windows I cannot see the WB icon in the WB selector...
Hi,
You're right, no icon, indeed.
I'll look for one. Thanks.
cron