An example of Gordon Surface based upon OCC

Have some feature requests, feedback, cool stuff to share, or want to know where FreeCAD is going? This is the place.
User avatar
GlouGlou
Posts: 1016
Joined: Sun Apr 05, 2015 9:02 am
Location: La Rochelle, France

Re: An example of Gordon Surface based upon OCC

Postby GlouGlou » Fri Dec 28, 2018 5:23 pm

oh, you're right, the gordon make it. :shock: thanks
Attachments
Capture.PNG
Capture.PNG (63.91 KiB) Viewed 289 times
montagdude
Posts: 2
Joined: Tue Jan 08, 2019 9:04 pm

Re: An example of Gordon Surface based upon OCC

Postby montagdude » Tue Jan 08, 2019 9:20 pm

I have been looking for something just like this. Thank you so much for your work! Just a few notes:
  1. Using the FreeCAD 0.17 64-bit Linux AppImage, I get an error like this: 'module' object has no attribute 'matmul.' Apparently, the numpy version packaged with FreeCAD doesn't have matmul. I implemented my own version of matmul instead, and then it worked.
  2. Is there any way to control the tolerance of the edge curve interpolation? For my use, I need to be able to create closed solids from surfaces using the Part shape builder. I tried changing the Tol2 D and Tol3 D properties of the Gordon surface, which did cause it to be recomputed, but no matter what I was not able to create a valid closed solid (and it didn't seem like the process was taking any longer either), so I'm not sure if those controls actually do anything.
  3. I have a lot of experience with numerical methods and Python and C++ programming, but very little experience with FreeCAD scripting (I'm just getting started). Is there anything I can do to help improve these tools?
User avatar
Chris_G
Posts: 909
Joined: Tue Dec 31, 2013 4:10 pm
Location: France
Contact:

Re: An example of Gordon Surface based upon OCC

Postby Chris_G » Wed Jan 09, 2019 10:48 am

montagdude wrote:
Tue Jan 08, 2019 9:20 pm
Using the FreeCAD 0.17 64-bit Linux AppImage, I get an error like this: 'module' object has no attribute 'matmul.' Apparently, the numpy version packaged with FreeCAD doesn't have matmul. I implemented my own version of matmul instead, and then it worked.
Hi,
Since this workbench is experimental, I must admit that I don't pay much attention about compatibility with the various FC versions.
I only work with current master.
montagdude wrote:
Tue Jan 08, 2019 9:20 pm
Is there any way to control the tolerance of the edge curve interpolation? For my use, I need to be able to create closed solids from surfaces using the Part shape builder. I tried changing the Tol2 D and Tol3 D properties of the Gordon surface, which did cause it to be recomputed, but no matter what I was not able to create a valid closed solid (and it didn't seem like the process was taking any longer either), so I'm not sure if those controls actually do anything.
The Gordon surface tool is a python port of a C++ tool. There were several hardcoded tolerances in the C++ source code. I was hoping I could reduce these to the 2 properties of the FC object. I am not sure anymore it is a good idea. And I am not sure Tol2D is really used anywhere.
Tol3D however, is used at the beginning of the computation, to detect the curve intersections.
In my personal experiment, I was able to build valid solids with these surfaces. Would you have some example files to test, please.
montagdude wrote:
Tue Jan 08, 2019 9:20 pm
I have a lot of experience with numerical methods and Python and C++ programming, but very little experience with FreeCAD scripting (I'm just getting started). Is there anything I can do to help improve these tools?
I am not a skilled coder, and this python port has been a real challenge for me. The resulting source code is quite a mess. I am lacking time, but I have several things on my TODO list concerning this tool :
- remove all the commented C++ source code
- remove or comment most of the debug commands (it way too much verbose currently)
- think about the various tolerance values, and expose the needed ones to the user

The Curves Workbench repo : https://github.com/tomate44/CurvesWB
The files are :
- BSplineAlgorithms.py
- BSplineApproxInterp.py
- curve_network_sorter.py
- gordon.py
- gordonFP.py (the FreeCAD FeaturePython object)

Be aware that working on my code is probably not a pleasing experience :oops:
montagdude
Posts: 2
Joined: Tue Jan 08, 2019 9:04 pm

Re: An example of Gordon Surface based upon OCC

Postby montagdude » Wed Jan 09, 2019 1:14 pm

Chris_G wrote:
Wed Jan 09, 2019 10:48 am
Hi,
Since this workbench is experimental, I must admit that I don't pay much attention about compatibility with the various FC versions.
I only work with current master.
No problem, that's what I figured. Anyway, this seems to be the only compatibility issue.
Chris_G wrote:
Wed Jan 09, 2019 10:48 am
The Gordon surface tool is a python port of a C++ tool. There were several hardcoded tolerances in the C++ source code. I was hoping I could reduce these to the 2 properties of the FC object. I am not sure anymore it is a good idea. And I am not sure Tol2D is really used anywhere.
Tol3D however, is used at the beginning of the computation, to detect the curve intersections.
In my personal experiment, I was able to build valid solids with these surfaces. Would you have some example files to test, please.
Thanks for the info. I will play with that some more and post an example if I can't get it to work.
Chris_G wrote:
Wed Jan 09, 2019 10:48 am
I am not a skilled coder, and this python port has been a real challenge for me. The resulting source code is quite a mess. I am lacking time, but I have several things on my TODO list concerning this tool :
- remove all the commented C++ source code
- remove or comment most of the debug commands (it way too much verbose currently)
- think about the various tolerance values, and expose the needed ones to the user

The Curves Workbench repo : https://github.com/tomate44/CurvesWB
The files are :
- BSplineAlgorithms.py
- BSplineApproxInterp.py
- curve_network_sorter.py
- gordon.py
- gordonFP.py (the FreeCAD FeaturePython object)
Thanks for the info. I will take a look through there when I get a chance.
Chris_G wrote:
Wed Jan 09, 2019 10:48 am
Be aware that working on my code is probably not a pleasing experience :oops:
I'm sure you are too humble.
User avatar
GlouGlou
Posts: 1016
Joined: Sun Apr 05, 2015 9:02 am
Location: La Rochelle, France

Re: An example of Gordon Surface based upon OCC

Postby GlouGlou » Mon Jan 14, 2019 9:07 pm

Can't make the gordon.
The green group doesn't touch themselves. Every red curve touches the greens.
Any idea?
What about told 3D do actually?
Attachments
Capture.PNG
Capture.PNG (21.42 KiB) Viewed 101 times
User avatar
Chris_G
Posts: 909
Joined: Tue Dec 31, 2013 4:10 pm
Location: France
Contact:

Re: An example of Gordon Surface based upon OCC

Postby Chris_G » Mon Jan 14, 2019 9:42 pm

Your curves won't work for Gordon surfaces.
You need some curves that have a grid pattern.
Each curve of a group (guides or profiles) must intersect ALL the curves of the other group.
Each red curve must intersect all the green curves.
Each green curve must intersect all the red curves.
Grid_pattern_2.jpeg
Grid_pattern_2.jpeg (55.35 KiB) Viewed 95 times
User avatar
hammax
Posts: 676
Joined: Thu Jan 19, 2017 5:03 pm
Location: Ammersee

Re: An example of Gordon Surface based upon OCC

Postby hammax » Tue Jan 15, 2019 5:10 pm

… until now I didn't believe, that this would be possible.
But there is a way to form a complex hull out of gordon surface with a minimum of frames and stringers.
Maybe more frames could deliver a "smoother" or better controllable shape????

GlouHull.png
GlouHull.png (59.5 KiB) Viewed 39 times
Attachments
GlouHull.FCStd
FC.18.15639
(340.26 KiB) Downloaded 3 times