Gyroid
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Be nice to others! Respect the FreeCAD code of conduct!
- microelly2
- Veteran
- Posts: 4688
- Joined: Tue Nov 12, 2013 4:06 pm
- Contact:
Gyroid
https://youtu.be/VIcZdc42F0g
the model is created by 3 sketches to generate a Surface and a lot of Draft arrays.
for gyroid see the model is created by 3 sketches to generate a Surface and a lot of Draft arrays.
Re: Gyroid
Nice, I'm playing with TPMS based structures at work
I'm using trigonometry approximations to find the surfaces. How did you made it ? You solved the plateau's law or find some approximations ?
I'm using trigonometry approximations to find the surfaces. How did you made it ? You solved the plateau's law or find some approximations ?
- microelly2
- Veteran
- Posts: 4688
- Joined: Tue Nov 12, 2013 4:06 pm
- Contact:
Re: Gyroid
I use scipy minimize to find the minimum area surface
Code: Select all
#---------------------------
# finde otimale innenpole
import numpy as np
import scipy
from scipy.optimize import minimize
methods=[
'Nelder-Mead' ,
'Powell' ,
'CG' ,
'BFGS' ,
'L-BFGS-B',
'TNC',
'COBYLA',
'SLSQP',
]
alpha=[App.ActiveDocument.BePlane.Shape.Face1.CenterOfMass]*4
ptsa=np.array(App.ActiveDocument.BePlane.Shape.Face1.Surface.getPoles())
def areaMin(alpha):
'''function to minimize'''
poles=ptsa
alpha=alpha.reshape(2,2,3)
poles[1:3,1:3]=alpha
bs=Part.BSplineSurface()
bs.buildFromPolesMultsKnots(poles,[4,4],[4,4],[0,1],[0,1],False,False,3,3)
return bs.toShape().Area
for method in methods:
tol=10**5
rc=minimize(areaMin,alpha,method=method,tol=tol)
print (rc.success,rc.message)
alpha=np.array(list(rc.x)).reshape(2,2,3)
poles=ptsa
poles[1:3,1:3]=alpha
bs=Part.BSplineSurface()
bs.buildFromPolesMultsKnots(poles,[4,4],[4,4],[0,1],[0,1],False,False,3,3)
Part.show(bs.toShape())
new=bs.toShape().Area
old=App.ActiveDocument.BePlane.Shape.Area
print (method," improvement %",round((old-new)/old*100,2),new)
#----------------------------
Re: Gyroid
… had also my "close encounters of the third kind" with gyroid.
But I only used surface-tool. Is the result of surface minimal?
But I only used surface-tool. Is the result of surface minimal?
- Attachments
-
- Gyroid_n.FCStd
- FC.18.15713
- (217.63 KiB) Downloaded 109 times
-
- Gyroid_n.PNG (86.46 KiB) Viewed 3867 times
- microelly2
- Veteran
- Posts: 4688
- Joined: Tue Nov 12, 2013 4:06 pm
- Contact:
Re: Gyroid
I remember your solution. I don't know whether the surface wb calculates minimal surfaces.
My idea is to optimize a given surface by modifiing the inner poles to get a minimum area.
For small models scipy.optimize.minimize works.
I will have a look at surface wb faces again and try to optimize them.
- microelly2
- Veteran
- Posts: 4688
- Joined: Tue Nov 12, 2013 4:06 pm
- Contact:
Re: Gyroid
I have compared the surface result against the optimized scipy-version
Surface::GeomFillSurface is not a mimimal surface
Here the results for a 4 x 4 testcase
..
('Nelder-Mead', True, 'Optimization terminated successfully.', 16080.548992338268)
('Powell', True, 'Optimization terminated successfully.', 15643.54680362999)
('CG', True, 'Optimization terminated successfully.', 15643.54680362999)
('BFGS', True, 'Optimization terminated successfully.', 15643.54680362999)
('L-BFGS-B', True, 'CONVERGENCE: NORM_OF_PROJECTED_GRADIENT_<=_PGTOL', 15643.54680362999)
('TNC', True, 'Local minima reach (|pg| ~= 0)', 15643.54680362999)
('COBYLA', True, 'Optimization terminated successfully.', 15708.577614427331)
('SLSQP', True, 'Optimization terminated successfully.', 15708.577614427331)
>>>
>>>
>>> suf=App.ActiveDocument.addObject("Surface::GeomFillSurface","Surface")
>>> suf.BoundaryList=[App.ActiveDocument.Shape003,('Edge4','Edge3','Edge2','Edge1')]
>>> _=App.activeDocument().recompute()
>>> suf.Shape.Area
15773.11692233747
There is no big difference but it is a difference 15773 and 15643
yellow:Surface WB, pink optimized Surface WB - nice structure minimum surface - not so nice
Surface::GeomFillSurface is not a mimimal surface
Here the results for a 4 x 4 testcase
..
('Nelder-Mead', True, 'Optimization terminated successfully.', 16080.548992338268)
('Powell', True, 'Optimization terminated successfully.', 15643.54680362999)
('CG', True, 'Optimization terminated successfully.', 15643.54680362999)
('BFGS', True, 'Optimization terminated successfully.', 15643.54680362999)
('L-BFGS-B', True, 'CONVERGENCE: NORM_OF_PROJECTED_GRADIENT_<=_PGTOL', 15643.54680362999)
('TNC', True, 'Local minima reach (|pg| ~= 0)', 15643.54680362999)
('COBYLA', True, 'Optimization terminated successfully.', 15708.577614427331)
('SLSQP', True, 'Optimization terminated successfully.', 15708.577614427331)
>>>
>>>
>>> suf=App.ActiveDocument.addObject("Surface::GeomFillSurface","Surface")
>>> suf.BoundaryList=[App.ActiveDocument.Shape003,('Edge4','Edge3','Edge2','Edge1')]
>>> _=App.activeDocument().recompute()
>>> suf.Shape.Area
15773.11692233747
There is no big difference but it is a difference 15773 and 15643
yellow:Surface WB, pink optimized Surface WB - nice structure minimum surface - not so nice
Re: Gyroid
… to get minimal surfaces, the soap bubble should be the physical method.
I only used arcs for the border lines in the elemental gyroid-cube.
Applying a curvature comb, there is a discontinuity at the cubes corners for arcs.
Should there be a better solution when using sinus curves? (But which amplitude???)
I only used arcs for the border lines in the elemental gyroid-cube.
Applying a curvature comb, there is a discontinuity at the cubes corners for arcs.
Should there be a better solution when using sinus curves? (But which amplitude???)
- microelly2
- Veteran
- Posts: 4688
- Joined: Tue Nov 12, 2013 4:06 pm
- Contact:
Re: Gyroid
I do experiments with a 4 x 9 nurbs where I start with arcs (Bezier approx.) as borders too.hammax wrote: ↑Thu Jan 31, 2019 8:28 am … to get minimal surfaces, the soap bubble should be the physical method.
I only used arcs for the border lines in the elemental gyroid-cube.
Applying a curvature comb, there is a discontinuity at the cubes corners for arcs.
Should there be a better solution when using sinus curves? (But which amplitude???)
Gyroid_n_2.PNG
in a next step I will modify the border segment to other Bezier curves and compare the results.
this all can be reduced parametric to one sketch with 4 points, so experiments will become simple.
Re: Gyroid
… I tried to draw such a gyroid basic edge by sketching some sinus like curve with BSpline.
To control the amplitude only one value must be changed in the master sketch.
The clones are following the master. => primary cube cell
8 primaries (4 placements, 4 mirrored placements) => secondary cube cell.
To control the amplitude only one value must be changed in the master sketch.
The clones are following the master. => primary cube cell
8 primaries (4 placements, 4 mirrored placements) => secondary cube cell.
- Attachments
-
- Gyroid_sin_0.FCStd
- FC.18.15713
- (237.38 KiB) Downloaded 135 times