discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

bottle with wrapped sinewave surface

SP
Sanjeev Prabhakar
Fri, Dec 12, 2025 3:10 PM

An interesting bottle after wrapping a sinewave surface around a plain
bottle.

scad file with points list can be downloaded from here:
https://github.com/sprabhakar2006/openSCAD/blob/main/bottle_with_sinewaves_wrapping.scad

[image: Screenshot 2025-12-12 at 8.25.27 PM.png]

python code is here:
from openscad4 import *
p1=cr2dt([[-3,0],[3,0,2],[3,7,10],[-5,20,40],[7,30,40],[-10,20,7],[0,10]],20)
p1=equidistant_path(p1,99)
c1=circle(10,s=200)
h1=[ 2pi(10+x-.3) for (x,y) in p1 ]
l1=l_(a_(p1)[:,1])
c2=cpo([l1,h1])
w1=rot('x90',sinewave(100,5,2,100))
w2=rot('x90z90',sinewave(100,5,2,100))
s1=surface_from_2_waves(w1,w2,1)
s2=[[s1[i][j] for j in range(len(s1[0])) if l_lenv_o(s1[i][:j])<h1[i]]for i
in range(len(s1)) ]
sol=rot('y90',prism(c1,p1))
sol1=[ bspline_closed(wrap_around(s2[i],sol[i]),3,100) for i in
range(len(sol))]
sol1=[ translate(a_(sol[i][0])-a_(sol1[i][0]),sol1[i]) for i in
range(len(sol1))]
sol2=surface_offset(sol1,-.5)
sol3=rot('y-90',sol1+flip(sol2))
sol4=cpo([ bspline_open(p,3,200) for p in cpo(sol3) ])
fo(f'''
difference(){{
{swp(flip(sol4))}
//{swp(cut_plane([0,-1,0],[200,200],50))}
}}

''')

python libraries to install
numpy, scipy, sympy, scikit-image

openscad4 from my github page above

An interesting bottle after wrapping a sinewave surface around a plain bottle. scad file with points list can be downloaded from here: https://github.com/sprabhakar2006/openSCAD/blob/main/bottle_with_sinewaves_wrapping.scad [image: Screenshot 2025-12-12 at 8.25.27 PM.png] python code is here: from openscad4 import * p1=cr2dt([[-3,0],[3,0,2],[3,7,10],[-5,20,40],[7,30,40],[-10,20,7],[0,10]],20) p1=equidistant_path(p1,99) c1=circle(10,s=200) h1=[ 2*pi*(10+x-.3) for (x,y) in p1 ] l1=l_(a_(p1)[:,1]) c2=cpo([l1,h1]) w1=rot('x90',sinewave(100,5,2,100)) w2=rot('x90z90',sinewave(100,5,2,100)) s1=surface_from_2_waves(w1,w2,1) s2=[[s1[i][j] for j in range(len(s1[0])) if l_lenv_o(s1[i][:j])<h1[i]]for i in range(len(s1)) ] sol=rot('y90',prism(c1,p1)) sol1=[ bspline_closed(wrap_around(s2[i],sol[i]),3,100) for i in range(len(sol))] sol1=[ translate(a_(sol[i][0])-a_(sol1[i][0]),sol1[i]) for i in range(len(sol1))] sol2=surface_offset(sol1,-.5) sol3=rot('y-90',sol1+flip(sol2)) sol4=cpo([ bspline_open(p,3,200) for p in cpo(sol3) ]) fo(f''' difference(){{ {swp(flip(sol4))} //{swp(cut_plane([0,-1,0],[200,200],50))} }} ''') python libraries to install numpy, scipy, sympy, scikit-image openscad4 from my github page above
SP
Sanjeev Prabhakar
Mon, Dec 15, 2025 4:50 PM

I made a mistake in the last code, this one is the correct one:
can be downloaded from here:
https://github.com/sprabhakar2006/openSCAD/blob/main/bottle_with_sinewaves_wrapping.scad

[image: Screenshot 2025-12-15 at 10.16.26 PM.png]

python code:

from openscad4 import *

p1=cr2dt([[-3,0],[3,0,2],[3,7,10],[-5,20,40],[7,30,40],[-10,20,7],[0,10]],20)
p1=equidistant_path(p1,99)
c1=circle(10,s=200)
h1=[ 2pi(10+x) for (x,y) in p1 ]
l1=l_(a_(p1)[:,1])
c2=cpo([l1,h1])
c3=c32(xzc(c23(c2)))
l1=translate([.1,0,0],c23(cpo([c3,c2])))
w1=rot('x90',sinewave(100,5,2,100))
w2=rot('x90z90',sinewave(100,5,2,100))
s1=rot('z.0001',surface_from_2_waves(w1,w2,1))
s2=[ fit_pline2line(s1[i],l1[i]) for i in range(len(s1)) ]
s3=rot('y90', prism(offset(c1,.01),p1))
s4=[translate(-a_(s2[i][0]), wrap_around(s2[i],s3[i]+[s3[i][0]])) for i in
range(len(s3)) ]
s5=surface_offset(s4,0.5)
bottle=rot('y-90',s4+flip(s5))
fo(f'''
difference(){{
{swp(bottle)}
//{swp(cut_plane([0,-1,0],[200,200],50))}
}}
''')

On Fri, 12 Dec 2025 at 20:40, Sanjeev Prabhakar sprabhakar2006@gmail.com
wrote:

An interesting bottle after wrapping a sinewave surface around a plain
bottle.

scad file with points list can be downloaded from here:

https://github.com/sprabhakar2006/openSCAD/blob/main/bottle_with_sinewaves_wrapping.scad

[image: Screenshot 2025-12-12 at 8.25.27 PM.png]

python code is here:
from openscad4 import *

p1=cr2dt([[-3,0],[3,0,2],[3,7,10],[-5,20,40],[7,30,40],[-10,20,7],[0,10]],20)
p1=equidistant_path(p1,99)
c1=circle(10,s=200)
h1=[ 2pi(10+x-.3) for (x,y) in p1 ]
l1=l_(a_(p1)[:,1])
c2=cpo([l1,h1])
w1=rot('x90',sinewave(100,5,2,100))
w2=rot('x90z90',sinewave(100,5,2,100))
s1=surface_from_2_waves(w1,w2,1)
s2=[[s1[i][j] for j in range(len(s1[0])) if l_lenv_o(s1[i][:j])<h1[i]]for
i in range(len(s1)) ]
sol=rot('y90',prism(c1,p1))
sol1=[ bspline_closed(wrap_around(s2[i],sol[i]),3,100) for i in
range(len(sol))]
sol1=[ translate(a_(sol[i][0])-a_(sol1[i][0]),sol1[i]) for i in
range(len(sol1))]
sol2=surface_offset(sol1,-.5)
sol3=rot('y-90',sol1+flip(sol2))
sol4=cpo([ bspline_open(p,3,200) for p in cpo(sol3) ])
fo(f'''
difference(){{
{swp(flip(sol4))}
//{swp(cut_plane([0,-1,0],[200,200],50))}
}}

''')

python libraries to install
numpy, scipy, sympy, scikit-image

openscad4 from my github page above

I made a mistake in the last code, this one is the correct one: can be downloaded from here: https://github.com/sprabhakar2006/openSCAD/blob/main/bottle_with_sinewaves_wrapping.scad [image: Screenshot 2025-12-15 at 10.16.26 PM.png] python code: from openscad4 import * p1=cr2dt([[-3,0],[3,0,2],[3,7,10],[-5,20,40],[7,30,40],[-10,20,7],[0,10]],20) p1=equidistant_path(p1,99) c1=circle(10,s=200) h1=[ 2*pi*(10+x) for (x,y) in p1 ] l1=l_(a_(p1)[:,1]) c2=cpo([l1,h1]) c3=c32(xzc(c23(c2))) l1=translate([.1,0,0],c23(cpo([c3,c2]))) w1=rot('x90',sinewave(100,5,2,100)) w2=rot('x90z90',sinewave(100,5,2,100)) s1=rot('z.0001',surface_from_2_waves(w1,w2,1)) s2=[ fit_pline2line(s1[i],l1[i]) for i in range(len(s1)) ] s3=rot('y90', prism(offset(c1,.01),p1)) s4=[translate(-a_(s2[i][0]), wrap_around(s2[i],s3[i]+[s3[i][0]])) for i in range(len(s3)) ] s5=surface_offset(s4,0.5) bottle=rot('y-90',s4+flip(s5)) fo(f''' difference(){{ {swp(bottle)} //{swp(cut_plane([0,-1,0],[200,200],50))} }} ''') On Fri, 12 Dec 2025 at 20:40, Sanjeev Prabhakar <sprabhakar2006@gmail.com> wrote: > An interesting bottle after wrapping a sinewave surface around a plain > bottle. > > scad file with points list can be downloaded from here: > > https://github.com/sprabhakar2006/openSCAD/blob/main/bottle_with_sinewaves_wrapping.scad > > [image: Screenshot 2025-12-12 at 8.25.27 PM.png] > > python code is here: > from openscad4 import * > > p1=cr2dt([[-3,0],[3,0,2],[3,7,10],[-5,20,40],[7,30,40],[-10,20,7],[0,10]],20) > p1=equidistant_path(p1,99) > c1=circle(10,s=200) > h1=[ 2*pi*(10+x-.3) for (x,y) in p1 ] > l1=l_(a_(p1)[:,1]) > c2=cpo([l1,h1]) > w1=rot('x90',sinewave(100,5,2,100)) > w2=rot('x90z90',sinewave(100,5,2,100)) > s1=surface_from_2_waves(w1,w2,1) > s2=[[s1[i][j] for j in range(len(s1[0])) if l_lenv_o(s1[i][:j])<h1[i]]for > i in range(len(s1)) ] > sol=rot('y90',prism(c1,p1)) > sol1=[ bspline_closed(wrap_around(s2[i],sol[i]),3,100) for i in > range(len(sol))] > sol1=[ translate(a_(sol[i][0])-a_(sol1[i][0]),sol1[i]) for i in > range(len(sol1))] > sol2=surface_offset(sol1,-.5) > sol3=rot('y-90',sol1+flip(sol2)) > sol4=cpo([ bspline_open(p,3,200) for p in cpo(sol3) ]) > fo(f''' > difference(){{ > {swp(flip(sol4))} > //{swp(cut_plane([0,-1,0],[200,200],50))} > }} > > ''') > > python libraries to install > numpy, scipy, sympy, scikit-image > > openscad4 from my github page above >