Silk: a NURBS workbench

Need help, or want to share a macro? Post here!
User avatar
sliptonic
Posts: 1987
Joined: Tue Oct 25, 2011 10:46 pm
Location: Columbia, Missouri
Contact:

Re: Silk: a NURBS workbench

Postby sliptonic » Tue Mar 17, 2020 2:34 pm

@Russ4262 has been doing some great work on the Path workbench to improve the 3D surfacing capabilities. One thing we need are some test models.

Would someone here be willing to build some shapes that are suitable to include in cnctorture?

Ideal shapes would be relatively simple solids incorporating 1 or more nurbs surfaces. More shapes are better than one shape with lots of surfaces but shapes with increasing complexity are great.

I won't pollute this thread any more than necessary so please reply to the CNCTorture thread linked above.

Thank you.
keithsloan52
Posts: 1450
Joined: Mon Feb 27, 2012 5:31 pm

Re: Silk: a NURBS workbench

Postby keithsloan52 » Wed Mar 25, 2020 6:18 am

A while back I became aware of OpenNURBS and started a workbench https://github.com/KeithSloan/FreeCAD_ImportNurbs But the library at the time was just C++ so it was hard going, so never really got anywhere. Recently @zohozer pointed out that there was now python bindings see this thread https://forum.freecadweb.org/viewtopic.php?f=8&t=11970 @Chris_G put together some code. I started a new workbench https://github.com/KeithSloan/ImportNURBS and added Chris's code.

But if you look at the screen shot
ImportNURBS.png
ImportNURBS.png (490.35 KiB) Viewed 275 times
What are BRep_Faces which are BSpline_Surfaces end up as FreeCAD Faces but with no editable Properties.
To my mind we/I should be converting to something that one of the various workbench's that deal with NURBS, Bezier, can then edit.

Question: Does Silk just deal with NURB Surfaces? or can it do other types of surface, like Bezier etc?
What about the other Surface related workbenches.

i.e. Which workbench should I be taking a fork of and trying to add an importer using OpenNURBS?
User avatar
microelly2
Posts: 4690
Joined: Tue Nov 12, 2013 4:06 pm
Contact:

Re: Silk: a NURBS workbench

Postby microelly2 » Mon Mar 30, 2020 6:26 am

keithsloan52 wrote:
Wed Mar 25, 2020 6:18 am
Question: Does Silk just deal with NURB Surfaces? or can it do other types of surface, like Bezier etc?
What about the other Surface related workbenches.

i.e. Which workbench should I be taking a fork of and trying to add an importer using OpenNURBS?
At the end you always have BSpline surfaces and BSplines curves as border for patches.

For both datatypes there are classes in FreeCAD.Part: BSplineSurface and BSpline Curve

These object are full featured Nurbs and they are full parametric.

Beziers are a special case of BSplines, So IMO there is no need to have Beziers as background data model.
You can write your importer in a separate workbench or modul, so we can in stall it and use it in other workbenches.
keithsloan52
Posts: 1450
Joined: Mon Feb 27, 2012 5:31 pm

Re: Silk: a NURBS workbench

Postby keithsloan52 » Mon Mar 30, 2020 7:24 am

microelly2 wrote:
Mon Mar 30, 2020 6:26 am
keithsloan52 wrote:
Wed Mar 25, 2020 6:18 am
Question: Does Silk just deal with NURB Surfaces? or can it do other types of surface, like Bezier etc?
What about the other Surface related workbenches.

i.e. Which workbench should I be taking a fork of and trying to add an importer using OpenNURBS?
At the end you always have BSpline surfaces and BSplines curves as border for patches.

For both datatypes there are classes in FreeCAD.Part: BSplineSurface and BSpline Curve

These object are full featured Nurbs and they are full parametric.

Beziers are a special case of BSplines, So IMO there is no need to have Beziers as background data model.
You can write your importer in a separate workbench or modul, so we can in stall it and use it in other workbenches.
Well Chris_G has written the code for a NurbsSurface and I adjusted his attempt for a NurbsCurve, When I import a file with these components they display, but if I select them I don't see any relevant properties in FreeCAD's property window, so not convinced we are doing things correctly.

github repro is at https://github.com/KeithSloan/ImportNURBS

Sample 3DM files are available at https://www.rhino3d.com/download/openn ... bs6samples

Test file for surfaces is V6 - mysurfaces.3dm

Test Curve is V6 - mycurves.3dm
emills2
Posts: 631
Joined: Tue Apr 28, 2015 11:23 pm

Re: Silk: a NURBS workbench

Postby emills2 » Mon Mar 30, 2020 7:34 am

keithsloan52 wrote:
Mon Mar 30, 2020 7:24 am
microelly2 wrote:
Mon Mar 30, 2020 6:26 am
keithsloan52 wrote:
Wed Mar 25, 2020 6:18 am
Question: Does Silk just deal with NURB Surfaces? or can it do other types of surface, like Bezier etc?
What about the other Surface related workbenches.

i.e. Which workbench should I be taking a fork of and trying to add an importer using OpenNURBS?
At the end you always have BSpline surfaces and BSplines curves as border for patches.

For both datatypes there are classes in FreeCAD.Part: BSplineSurface and BSpline Curve

These object are full featured Nurbs and they are full parametric.

Beziers are a special case of BSplines, So IMO there is no need to have Beziers as background data model.
You can write your importer in a separate workbench or modul, so we can in stall it and use it in other workbenches.
Well Chris_G has written the code for a NurbsSurface and I adjusted his attempt for a NurbsCurve, When I import a file with these components they display, but if I select them I don't see any relevant properties in FreeCAD's property window, so not convinced we are doing things correctly.

github repro is at https://github.com/KeithSloan/ImportNURBS

Sample 3DM files are available at https://www.rhino3d.com/download/openn ... bs6samples

Test file for surfaces is V6 - mysurfaces.3dm

Test Curve is V6 - mycurves.3dm
basically all surfaces in freecad have full nurbs functionality. it's the core. what ChrisG, Microelly, and myself have done is based off of the existing objects. we just go about it different ways. if you have an external nurbs object you want to import, you need to figure out how to read its knot vectors and pole/weight tables. then feed them into the freecad objects. it gets trickier with trimmed surfaces, but it's all there.

the reason we have all these different tools is because the core nurbs object doesn't tell you how to go about creating the knot vectors, poles, etc.

but if you're importing, it's just a translation exercise (at a first glance, i'm sure there'll be some puzzles)

edit: as far as editing the imported objects....you can already use the python console to read the existing pole tables, edit them and create new modified objects....but that feels more like trying to model with chewing gum than it feels like modeling with clay.

if you don't have access to the underlying curves and the tools that were used to generate the surfaces, you end up with a challenge similar to, for example, editing a step object without the modeling history.
emills2
Posts: 631
Joined: Tue Apr 28, 2015 11:23 pm

Re: Silk: a NURBS workbench

Postby emills2 » Mon Mar 30, 2020 7:52 am

sliptonic wrote:
Tue Mar 17, 2020 2:34 pm
@Russ4262 has been doing some great work on the Path workbench to improve the 3D surfacing capabilities. One thing we need are some test models.

Would someone here be willing to build some shapes that are suitable to include in cnctorture?

Ideal shapes would be relatively simple solids incorporating 1 or more nurbs surfaces. More shapes are better than one shape with lots of surfaces but shapes with increasing complexity are great.

I won't pollute this thread any more than necessary so please reply to the CNCTorture thread linked above.

Thank you.
i'll try to make something, but i can't say when. unfortunately very little time for FreeCAD these days.
keithsloan52
Posts: 1450
Joined: Mon Feb 27, 2012 5:31 pm

Re: Silk: a NURBS workbench

Postby keithsloan52 » Mon Mar 30, 2020 10:36 am

emills2 wrote:
Mon Mar 30, 2020 7:34 am

Well I just tried installing @Microelly nurbs workbench via the AddonManager to see if I could select and change one the imported curves and edit it, but it seems the workbench has not been updated for Python3 :-(
yes, it runs only with py2,
I started the work with python3 with the pyflow node editor project