Nurbs editor

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
microelly2
Posts: 4690
Joined: Tue Nov 12, 2013 4:06 pm
Contact:

Re: Nurbs editor

Postby microelly2 » Mon Aug 01, 2016 8:52 am

this was one of the last mysteries:
segment a nurbs into pieces by selecting an area in the knot grid , modify a detail and recombine all back.
this way local modifications on large nurbs surfaces can be reduced to the the small area where the change happens.
Attachments
bp_081.png
bp_081.png (77.27 KiB) Viewed 2471 times
User avatar
yorik
Site Admin
Posts: 11845
Joined: Tue Feb 17, 2009 9:16 pm
Location: São Paulo, Brazil
Contact:

Re: Nurbs editor

Postby yorik » Mon Aug 01, 2016 1:44 pm

Each new module of you is more impressive than the previous one, microelly2! This could be awesome to recreate terrains...
keithsloan52
Posts: 1233
Joined: Mon Feb 27, 2012 5:31 pm

Re: Nurbs editor & OpenNurbs

Postby keithsloan52 » Mon Aug 01, 2016 5:39 pm

Couple of years ago I started work on using OpenNurbs https://www.rhino3d.com/opennurbs to be able to read Rhino files into FreeCAD. I was able to parse the Rhino files but got stuck adding code to create FreeCAD objects.

A copy of my efforts are available at https://www.dropbox.com/sh/9xtd5pmfkxze ... eqyGa?dl=0

Happy for people to use as long as I get some acknowledgement.

The source is in sub directory Lib which has a Makefile

testRead : Reads a test Rhino file and parses ( Note: test file location is hard coded )
importNurbs.so is a shared module library that should exist in /usr/lib/freecad/libs
i.e. Needs a softlink ( ln -s ) to /usr/lib/freecad/libs/importNurbs.so

Unfortunately I did not backup the FreeCAD module directory /usr/lib/freecad/Mod/Nurbs, but it should be fairly easy to recreate if you look at /usr/lib/freecad/Mod/Import

Note: the version of OpenNurbs will be several years out of date.
I added in places code to print out the relevant data that is needed to add info to FreeCAD

Quite happy to work with microelly2 if he/she could provide details on creating FreeCAD objects and control points

Thanks
User avatar
microelly2
Posts: 4690
Joined: Tue Nov 12, 2013 4:06 pm
Contact:

Re: Nurbs editor

Postby microelly2 » Mon Aug 01, 2016 7:07 pm

@keithsloan52

thank you, I will look at your sources at the end of my holidays.
the occ/freecad support for nurbs is very good, so now I'm on the way to bring all ideas together.
I hope to merge my work with the wonderful ideas of edwardvmills and maybe with a rhino interface from you too. 8-)
https://github.com/edwardvmills/NURBSlib_EVM
I start a separate workbench for nurbs and will shift the examples and methods step by step from the reconstruction wb to this place.
https://github.com/microelly2/freecad-nurbs

@yorik
thank you for the compliment.
Indeed the idea to create terrains was a main force to study nurbs.
with the segmentation we will be able to fill the SRTM data with local data details
viewtopic.php?f=8&t=6973&hilit=geodat&start=100#p129973
and I hope to get something like a zoom in functionality with different LOD models in the same CAD file.
keithsloan52
Posts: 1233
Joined: Mon Feb 27, 2012 5:31 pm

Re: Import OpenNurbs

Postby keithsloan52 » Tue Aug 02, 2016 11:32 am

keithsloan52 wrote:Couple of years ago I started work on using OpenNurbs https://www.rhino3d.com/opennurbs to be able to read Rhino files into FreeCAD. I was able to parse the Rhino files but got stuck adding code to create FreeCAD objects.

A copy of my efforts are available at https://www.dropbox.com/sh/9xtd5pmfkxze ... eqyGa?dl=0

Happy for people to use as long as I get some acknowledgement.

The source is in sub directory Lib which has a Makefile

testRead : Reads a test Rhino file and parses ( Note: test file location is hard coded )
importNurbs.so is a shared module library that should exist in /usr/lib/freecad/libs
i.e. Needs a softlink ( ln -s ) to /usr/lib/freecad/libs/importNurbs.so

Unfortunately I did not backup the FreeCAD module directory /usr/lib/freecad/Mod/Nurbs, but it should be fairly easy to recreate if you look at /usr/lib/freecad/Mod/Import

Note: the version of OpenNurbs will be several years out of date.
I added in places code to print out the relevant data that is needed to add info to FreeCAD

Quite happy to work with microelly2 if he/she could provide details on creating FreeCAD objects and control points

Thanks
Okay I recreated the Mod directory. If you download from Dropbox and then run the commands in the file softLinks having changed the source according to where you downloaded the dropbox directory you should be able to do the following in FreeCAD

Get the option to load Rhino files i.e. *.3dm.

FreeCAD will not currently display anything but the output from parsing the file with opennurbs will be in the file /tmp/opennurbs.out

If somebody can tell me the calls I need to make to create the FreeCAD objects for the sample 3dm files I can then make some more progress.

I do not have access to Rhino but did invest in a Rhino ios app so that I could view what the 3dm looked like, but the sample files supplied with opennurbs need to be first loaded into Rhino and resaved with some option :-( ( I might be able to dig out the email from there support as to details).

Do we have any users with access to Rhino that would be willing to help?
User avatar
microelly2
Posts: 4690
Joined: Tue Nov 12, 2013 4:06 pm
Contact:

Re: Import OpenNurbs

Postby microelly2 » Tue Aug 02, 2016 1:01 pm

keithsloan52 wrote: Do we have any users with access to Rhino that would be willing to help?
My colleague has a CNC machine and uses Rhino, so we can start supported work in september. :)
User avatar
saso
Posts: 1487
Joined: Fri May 16, 2014 1:14 pm
Contact:

Re: Nurbs editor

Postby saso » Tue Aug 02, 2016 1:14 pm

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

Re: Nurbs editor

Postby Chris_G » Tue Aug 02, 2016 1:32 pm

Hi,
Interesting.
Would Rhynamo author, Nathan Miller, be NateM on this forum, who gave a try at a surface WB ?
User avatar
microelly2
Posts: 4690
Joined: Tue Nov 12, 2013 4:06 pm
Contact:

Re: Nurbs editor

Postby microelly2 » Tue Aug 02, 2016 5:40 pm

I still learn what all the parameters of a BSpline can influence.
Moving the poles is intuitive,
now here a video what the pole weights and the knot vector do when the poles remain fixed.
https://youtu.be/H-_XNOpCQb4
bp_088.png
bp_088.png (16.09 KiB) Viewed 2307 times
the script is here: http://freecadbuch.de/doku.php?id=blog: ... i_bsplines
triplus
Posts: 9428
Joined: Mon Dec 12, 2011 4:45 pm

Re: Nurbs editor

Postby triplus » Tue Aug 02, 2016 8:30 pm

Yes now the interface is much more align to the rest of FreeCAD. I guess in the future only individual control point properties could be made visible when selecting control point? As having huge BSpline would expose too many control point properties if all would be listed?

Anyway i like the approach of having such detailed control over control point.