## Gyroid

microelly2
Posts: 4239
Joined: Tue Nov 12, 2013 4:06 pm
Contact:

### Gyroid

bp_955.png (147.6 KiB) Viewed 1408 times
for gyroid see https://youtu.be/VIcZdc42F0g
the model is created by 3 sketches to generate a Surface and a lot of Draft arrays.
schupin
Posts: 262
Joined: Sun Jan 21, 2018 1:43 pm

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

### Re: Gyroid

schupin wrote:
Tue Jan 29, 2019 6:15 pm
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 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=[
'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)

#----------------------------

``````
For the gyroid I use 4 x 7 poles nurbs, it's a little bit more complex but the same idea.
hammax
Posts: 774
Joined: Thu Jan 19, 2017 5:03 pm
Location: Ammersee

### 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?
Attachments
Gyroid_n.FCStd
FC.18.15713
Gyroid_n.PNG (86.46 KiB) Viewed 1317 times
microelly2
Posts: 4239
Joined: Tue Nov 12, 2013 4:06 pm
Contact:

### Re: Gyroid

hammax wrote:
Wed Jan 30, 2019 6:45 am
… had also my "close encounters of the third kind" with gyroid.
But I only used surface-tool. Is the result of surface minimal?
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
Posts: 4239
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)
('TNC', True, 'Local minima reach (|pg| ~= 0)', 15643.54680362999)
('COBYLA', True, 'Optimization terminated successfully.', 15708.577614427331)
('SLSQP', True, 'Optimization terminated successfully.', 15708.577614427331)
>>>
>>>

>>> 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
bp_956.png (105.92 KiB) Viewed 1257 times
Surface WB - nice structure
bp_957.png (26.48 KiB) Viewed 1257 times
minimum surface - not so nice
bp_958.png (20.58 KiB) Viewed 1257 times
hammax
Posts: 774
Joined: Thu Jan 19, 2017 5:03 pm
Location: Ammersee

### 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???)

Gyroid_n_2.PNG (91.09 KiB) Viewed 1167 times
microelly2
Posts: 4239
Joined: Tue Nov 12, 2013 4:06 pm
Contact:

### Re: Gyroid

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
I do experiments with a 4 x 9 nurbs where I start with arcs (Bezier approx.) as borders too.
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.
hammax
Posts: 774
Joined: Thu Jan 19, 2017 5:03 pm
Location: Ammersee

### 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.

+stereo
Gyroid_n_5.PNG (155.96 KiB) Viewed 997 times
Attachments
Gyroid_sin_0.FCStd
FC.18.15713