discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

Shoe : openSCAD + Python

SP
Sanjeev Prabhakar
Mon, Jan 26, 2026 9:13 AM

Just modelled a shoe, while trying to create various surfaces and it worked
well. May not be perfect but the concept looks ok

python code:


from openscad4 import *

c1=circle(30,[-40,0])
c2=circle(40,[10,10])
c3=circle(40,[0,0])
c4=circle(35,[105,0])
a1=two_cir_tarc(c2,c1,200)
a2=two_cir_tarc(c1,c3,200)
a3=two_cir_tarc(c3,c4,85)
a4=two_cir_tarc(c4,c2,85)
sec1=a1[1:-1]+arc_2p(a1[-1],a2[0],30,-1)+a2[1:-1]+arc_2p(a2[-1],a3[0],40,-1)+a3[1:-1]+

arc_long_2p(a3[-1],a4[0],35,-1)+a4[1:-1]+arc_2p(a4[-1],a1[0],40,-1)
sec1=c23(equidistant_pathc(sec1,302))
l10=rot('x90',cr2dt([[-70,0],[50,-10,200],[60,15,100],[40,-5,50],[100,0]],20))
sec1=wrap_sec2path(sec1,l10,[1,0,0],1)

sec1=mirror_line(sec1,[0,1,0],[0,0,0])

sec2=translate([0,0,0],surround([[0,0],[60,0]],25,s=50))
sec2=equidistant_pathc(sec2,100)
l9=equidistant_path(rot('x90',cr2dt([[0,0],[7,3,10],[7,-5,15],[15,0,15],[3,5]],20)),50)
l9=translate([0,0,0],fit_pline2line(l9,[[30,0,47],[140,0,60]]))
sec2=flip(wrap_sec2path(sec2,l9,[1,0,0]))
l1=equidistant_path(cr2dt([[0,0],[-1,5,4],[20,3,20],[5,5]],20),50)
l1=rot('x90',l1)
l2=rot('x90z90',arc_2p([0,0],[0,40],30,s=50))
l3=rot('x90z180',arc_2p([0,0],[0,40],50,s=50))
l4=rot('x90z270',arc_2p([0,0],[0,40],50,s=50))
a,b,c,d,e,g=sec1[54:143],sec2[35:55],sec1[143:205],sec2[55:86],sec1[205:267],sec2[86:]+sec2[:19]
h,i=sec1[267:]+sec1[:55],sec2[19:35]
l5=fit_pline2line(l1,[a[0],b[0]])
l6=fit_pline2line(l2,[a[-1],b[-1]])
l7=fit_pline2line(l3,[c[-1],d[-1]])
l8=fit_pline2line(l4,[e[-1],g[-1]])

s1=surface_from_4_lines(l5,l6,a,b)
s2=surface_from_4_lines(l6,l7,c,d)
s3=surface_from_4_lines(l7,l8,e,g)
s4=surface_from_4_lines(l8,l5,h,i)
surf1=s1+s2+s3+s4
surf1a=surface_offset(surf1,-2)
sol1=solid_from_2surfaces(surf1,surf1a)
sol1=sol1+[sol1[0]]
s5=sec2surface(sec1[54:]+sec1[:54])
s6=translate([0,0,-5],axis_rot_1(s5,[0,1,0],[-70,0,0],5))
surf2=solid_from_2surfaces(s6,s5)
sol1=axis_rot_1(sol1,[0,1,0],[-70,0,0],-3.25)
surf2=axis_rot_1(surf2,[0,1,0],[-70,0,0],-3.25)
l1=equidistant_pathc(sec1[54:]+sec1[:54],300)
l2=translate([0,0,-5],axis_rot_1(l1,[0,1,0],[-70,0,0],5))
l3=translate([0,0,2],l2)
l4=offset_3d_sec(l2,-2)
f1=axis_rot_1(solid_from_fillet_closed(convert_3lines2fillet(l4,l3,l2),-2),[0,1,0],[-70,0,0],-3.25)

fo(f'''
//color("blue") for(p={[l10]}) p_line3d(p,2);
//%color("blue",.1) for(p={[sec2]}) p_line3d(p,2);
//%color("magenta",.1) p_line3d({sec1},2);
//%color("cyan",.1) for(p={[l5,l6,l7,l8]}) p_line3d(p,2);
//{track_points(sec1,0.5)}{track_points(sec2,0.5)}
translate([0,0,11.5]){{
color("#795C34"){swp_c(sol1)}
difference(){{
color("grey"){swp(surf2)}
color("grey"){swp_c(f1)}
}}
}}
''')


[image: Screenshot 2026-01-26 at 2.32.43 PM.png]
[image: Screenshot 2026-01-26 at 2.34.34 PM.png]

[image: Screenshot 2026-01-26 at 2.33.27 PM.png]

scad file can be downloaded from here:
https://github.com/sprabhakar2006/openSCAD/blob/main/shoe.scad

Just modelled a shoe, while trying to create various surfaces and it worked well. May not be perfect but the concept looks ok python code: ______________________________________________________ from openscad4 import * c1=circle(30,[-40,0]) c2=circle(40,[10,10]) c3=circle(40,[0,0]) c4=circle(35,[105,0]) a1=two_cir_tarc(c2,c1,200) a2=two_cir_tarc(c1,c3,200) a3=two_cir_tarc(c3,c4,85) a4=two_cir_tarc(c4,c2,85) sec1=a1[1:-1]+arc_2p(a1[-1],a2[0],30,-1)+a2[1:-1]+arc_2p(a2[-1],a3[0],40,-1)+a3[1:-1]+ \ arc_long_2p(a3[-1],a4[0],35,-1)+a4[1:-1]+arc_2p(a4[-1],a1[0],40,-1) sec1=c23(equidistant_pathc(sec1,302)) l10=rot('x90',cr2dt([[-70,0],[50,-10,200],[60,15,100],[40,-5,50],[100,0]],20)) sec1=wrap_sec2path(sec1,l10,[1,0,0],1) # sec1=mirror_line(sec1,[0,1,0],[0,0,0]) sec2=translate([0,0,0],surround([[0,0],[60,0]],25,s=50)) sec2=equidistant_pathc(sec2,100) l9=equidistant_path(rot('x90',cr2dt([[0,0],[7,3,10],[7,-5,15],[15,0,15],[3,5]],20)),50) l9=translate([0,0,0],fit_pline2line(l9,[[30,0,47],[140,0,60]])) sec2=flip(wrap_sec2path(sec2,l9,[1,0,0])) l1=equidistant_path(cr2dt([[0,0],[-1,5,4],[20,3,20],[5,5]],20),50) l1=rot('x90',l1) l2=rot('x90z90',arc_2p([0,0],[0,40],30,s=50)) l3=rot('x90z180',arc_2p([0,0],[0,40],50,s=50)) l4=rot('x90z270',arc_2p([0,0],[0,40],50,s=50)) a,b,c,d,e,g=sec1[54:143],sec2[35:55],sec1[143:205],sec2[55:86],sec1[205:267],sec2[86:]+sec2[:19] h,i=sec1[267:]+sec1[:55],sec2[19:35] l5=fit_pline2line(l1,[a[0],b[0]]) l6=fit_pline2line(l2,[a[-1],b[-1]]) l7=fit_pline2line(l3,[c[-1],d[-1]]) l8=fit_pline2line(l4,[e[-1],g[-1]]) s1=surface_from_4_lines(l5,l6,a,b) s2=surface_from_4_lines(l6,l7,c,d) s3=surface_from_4_lines(l7,l8,e,g) s4=surface_from_4_lines(l8,l5,h,i) surf1=s1+s2+s3+s4 surf1a=surface_offset(surf1,-2) sol1=solid_from_2surfaces(surf1,surf1a) sol1=sol1+[sol1[0]] s5=sec2surface(sec1[54:]+sec1[:54]) s6=translate([0,0,-5],axis_rot_1(s5,[0,1,0],[-70,0,0],5)) surf2=solid_from_2surfaces(s6,s5) sol1=axis_rot_1(sol1,[0,1,0],[-70,0,0],-3.25) surf2=axis_rot_1(surf2,[0,1,0],[-70,0,0],-3.25) l1=equidistant_pathc(sec1[54:]+sec1[:54],300) l2=translate([0,0,-5],axis_rot_1(l1,[0,1,0],[-70,0,0],5)) l3=translate([0,0,2],l2) l4=offset_3d_sec(l2,-2) f1=axis_rot_1(solid_from_fillet_closed(convert_3lines2fillet(l4,l3,l2),-2),[0,1,0],[-70,0,0],-3.25) fo(f''' //color("blue") for(p={[l10]}) p_line3d(p,2); //%color("blue",.1) for(p={[sec2]}) p_line3d(p,2); //%color("magenta",.1) p_line3d({sec1},2); //%color("cyan",.1) for(p={[l5,l6,l7,l8]}) p_line3d(p,2); //{track_points(sec1,0.5)}{track_points(sec2,0.5)} translate([0,0,11.5]){{ color("#795C34"){swp_c(sol1)} difference(){{ color("grey"){swp(surf2)} color("grey"){swp_c(f1)} }} }} ''') _____________________________________________________ [image: Screenshot 2026-01-26 at 2.32.43 PM.png] [image: Screenshot 2026-01-26 at 2.34.34 PM.png] [image: Screenshot 2026-01-26 at 2.33.27 PM.png] scad file can be downloaded from here: https://github.com/sprabhakar2006/openSCAD/blob/main/shoe.scad