discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

Complex rounding issue

RV
Roel Vanhout
Sat, Aug 24, 2024 6:05 PM

On Sat, Aug 24, 2024 at 7:07 PM Adrian Mariano avm4@cornell.edu wrote:

I believe that the approach Sanjeev uses is not to use python to generate
openscad code but to use python to generate the entire object as a
polyhedron and then just pass that to openscad to be rendered.  You can of
course produce any object this way if you work hard enough on your python
code.

Ah I thought there was some sort of higher level interface that generated /
interfaced with OpenSCAD. I'm still wondering how to generate the posted
example though.

I don't see a way that you can fill the little gap with join_prism().  If
you allow self-intersection you won't be able to create an STL.  Does that
matter to you?

Oh I didn't realize that, didn't get that far yet - yes it matters to me,
the end goal is to 3d print this.

A lot of the limitations in the join_prism() implementation result from
the need to have an interface to the module.  I made it as general as I
could figure out how to make it, but it can't do everything.  And as noted
by others, it's already not the most accessible interface.

I understand how this is a very complex problem, I haven't even really
visualized in my head what exactly the result should look like, I was
mostly hoping I could find a way that did the thinking for me and I could
just poke the code until it looked like it would work :) I think that
join_prism() is an amazing piece of work for which I have thought up
several applications already, just not this one then I'm afraid.

regards

Roel

On Sat, Aug 24, 2024 at 7:07 PM Adrian Mariano <avm4@cornell.edu> wrote: > I believe that the approach Sanjeev uses is not to use python to generate > openscad code but to use python to generate the entire object as a > polyhedron and then just pass that to openscad to be rendered. You can of > course produce any object this way if you work hard enough on your python > code. > Ah I thought there was some sort of higher level interface that generated / interfaced with OpenSCAD. I'm still wondering how to generate the posted example though. > I don't see a way that you can fill the little gap with join_prism(). If > you allow self-intersection you won't be able to create an STL. Does that > matter to you? > Oh I didn't realize that, didn't get that far yet - yes it matters to me, the end goal is to 3d print this. > A lot of the limitations in the join_prism() implementation result from > the need to have an interface to the module. I made it as general as I > could figure out how to make it, but it can't do everything. And as noted > by others, it's already not the most accessible interface. > I understand how this is a very complex problem, I haven't even really visualized in my head what exactly the result should look like, I was mostly hoping I could find a way that did the thinking for me and I could just poke the code until it looked like it would work :) I think that join_prism() is an amazing piece of work for which I have thought up several applications already, just not this one then I'm afraid. regards Roel
SP
Sanjeev Prabhakar
Sat, Aug 24, 2024 6:36 PM

code is below:

first need to import the library openscad1.py to create objects

https://github.com/sprabhakar2006/openSCAD/blob/main/openscad1.py

also need to download library dependencies2.scad

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

from openscad1 import *

create center pillar

c1=circle(10) # circlular section

p1 is path to create an object, it is similar to the rounding library in

openscad
p1=corner_radius(pts1([[100,0],[-100,0,5],[0,70,3],[-3,0]]),30)
sol1=prism(c1,p1) # prism is a function which offsets the section c1 in

create another surface for supports

l1=corner_radius(pts1([[-2.5,0],[0,50,2],[5,0,2],[0,-50]]),10)
l1=equidistant_path(l1,500)
l1=q_rot(['x90','z45'],l1)
v1=q_rot(['y45','z-45'],[100,0,0])
s1=surface_line_vector(l1,v1)

l1=ip_surf2sol(sol1,s1) # first intersection points
l2=ip_surf2sol(sol1,s1,n=-1)
l1=l1+flip(l2)
l2=o_3d(l1,sol1,-3)

sol2=prism(c1,path_offset(p1,3))
l3=ip_surf2sol(sol2,s1) # first intersection points
l4=ip_surf2sol(sol2,s1,n=-1)
l3=l3+flip(l4)
l3=path2path1(l1,l3) # function to make both lines points same

now make a fillet with these 3 lines

fillet1=convert_3lines2fillet_closed(l2,l3,l1)

sol3=translate([0,0,-5],linear_extrude(corner_radius(pts1([[-50,-50,5],[100,0,5],[0,100,5],[-100,0,5]]),10),5))

with open('trial.scad','w+') as f:
f.write(f'''
include<dependencies2.scad>

for(i=[0,90,180,270])
rotate([0,0,i]){{
hull()
color("blue")p_line3dc({l1},.01,1);
{swp(sol1[1:])}
{swp_c(fillet1)}
}}
{swp(sol3)}
''')

[image: Screenshot 2024-08-25 at 12.05.55 AM.png]

On Sat, 24 Aug 2024 at 21:08, Roel Vanhout roel.vanhout@gmail.com wrote:

This is amazing, would you mind sharing the code that created this? I
write Python every day and I'm much more comfortable with it than with
straight OpenSCAD, but I always thought that using Python to generate
OpenSCAD code was mostly syntactic sugar like having 'real' for loops with
updating variables and such, I didn't know (and still don't quite see how
tbh) that it also allowed for such complex shapes.

cheers

On Sat, Aug 24, 2024 at 5:49 AM Sanjeev Prabhakar <
sprabhakar2006@gmail.com> wrote:

I gave it a try
[image: Screenshot 2024-08-24 at 9.16.07 AM.png]

On Fri, 23 Aug 2024 at 16:19, Roel Vanhout via Discuss <
discuss@lists.openscad.org> wrote:

Hello all,

I have a complex shape to round for which I'd like to ask if anyone has
suggestions on how to approach this. I've always found rounding and
chamfering to be very tedious using plain OpenSCAD until I found how to do
it with BOSL2, which has been a godsend for the cases I've encountered so
far. But today I have the shape in the picture below, for which the code is
at the bottom. I'm looking to round out all surfaces of the 'fins' that
radiate out from the center 'stem' come in contact with other surfaces.
(this is a presser tool for stuffing food into a mold, the 'fins' are to
distribute the pressure that is manually exerted on the ring to the bottom
platelet).

I've marked the various lines that need to be rounded out in different
colors. Out of these, the turquoise one I could do with a BOSL2
rounding_edge_mask(), and the green one too if I use an appropriate 'ang'
parameter (which I can calculate fairly easily). However I have no idea how
to do the red one or the orange one, nor how to let e.g. the orange one
blend smoothly into the green one for example; and the same for all the
other places where roundovers meet.

Any ideas on how I can do this? Thank you.

regards

Roel

[image: presser_foot_rounding.png]

include <BOSL2-master/std.scad>
include <BOSL2-master/screws.scad>
include <BOSL2-master/threading.scad>

ZFE = 0.01;    // Z fighting epsilon, a constant to prevent planes from
overlapping.
// It has a separate name so that you know where it's
used what it's for.
ZFE_2 = ZFE * 2;
ZFE_3 = ZFE * 3;
$fn = $preview ? 64 : 128;

// Global
g_corner_rounding = 2;

// Ring
g_wall_thickness = 3;
g_inside_size = 90;
g_height = 70;

// Lid
g_lid_play = 1;
g_presser_height = 30;
g_presser_width = 20;
g_lid_rounding = 5;
g_presser_size = 10;

module ring() {
outside_size = g_inside_size + (2 * g_wall_thickness);
//cuboid([g_wall_thickness, depth, clip_height], chamfer=1,
edges="X", anchor=LEFT+BOTTOM+FRONT);
difference() {
cuboid([outside_size, outside_size, g_height],
rounding=g_corner_rounding, edges="Z");
cuboid([g_inside_size, g_inside_size, g_height + ZFE_2],
rounding=g_corner_rounding, edges="Z");
}
}

module presser() {
cuboid([g_inside_size - g_lid_play, g_inside_size - g_lid_play,
g_wall_thickness * 2], rounding=g_corner_rounding, edges="Z");

 difference() {
     union() {
         // The outer cylinder that will make the presser handle ring
         up(g_wall_thickness + g_presser_height * 1.5)
             ycyl(l = g_presser_width, d=g_presser_size * 4, rounding

= g_corner_rounding);
// The 'stem' of the presser handle
up(g_wall_thickness + g_presser_height / 2)
zcyl(l = g_presser_height, r=g_presser_size,
rounding1=-g_lid_rounding);
}
// Cut away the inside of the presser handle ring. It will also
cut into the top of the stem a bit, hence why
// it's here.
up(g_wall_thickness + g_presser_height * 1.5)
ycyl(l = g_presser_width + ZFE_2, d=g_presser_size * 3,
rounding = -g_corner_rounding);
}
//up(g_wall_thickness)
for (r = [45 : 90 : 360]) {
zrot(r) up(g_wall_thickness)
wedge([g_presser_size, g_presser_size * 5, g_presser_size *
2], anchor=CENTER+BOTTOM+FRONT);
}
}

ring();
right(150) presser();


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

code is below: # first need to import the library openscad1.py to create objects # https://github.com/sprabhakar2006/openSCAD/blob/main/openscad1.py # also need to download library dependencies2.scad # https://github.com/sprabhakar2006/openSCAD/blob/main/dependencies2.scad from openscad1 import * # create center pillar c1=circle(10) # circlular section # p1 is path to create an object, it is similar to the rounding library in openscad p1=corner_radius(pts1([[100,0],[-100,0,5],[0,70,3],[-3,0]]),30) sol1=prism(c1,p1) # prism is a function which offsets the section c1 in # create another surface for supports l1=corner_radius(pts1([[-2.5,0],[0,50,2],[5,0,2],[0,-50]]),10) l1=equidistant_path(l1,500) l1=q_rot(['x90','z45'],l1) v1=q_rot(['y45','z-45'],[100,0,0]) s1=surface_line_vector(l1,v1) l1=ip_surf2sol(sol1,s1) # first intersection points l2=ip_surf2sol(sol1,s1,n=-1) l1=l1+flip(l2) l2=o_3d(l1,sol1,-3) sol2=prism(c1,path_offset(p1,3)) l3=ip_surf2sol(sol2,s1) # first intersection points l4=ip_surf2sol(sol2,s1,n=-1) l3=l3+flip(l4) l3=path2path1(l1,l3) # function to make both lines points same # now make a fillet with these 3 lines fillet1=convert_3lines2fillet_closed(l2,l3,l1) sol3=translate([0,0,-5],linear_extrude(corner_radius(pts1([[-50,-50,5],[100,0,5],[0,100,5],[-100,0,5]]),10),5)) with open('trial.scad','w+') as f: f.write(f''' include<dependencies2.scad> for(i=[0,90,180,270]) rotate([0,0,i]){{ hull() color("blue")p_line3dc({l1},.01,1); {swp(sol1[1:])} {swp_c(fillet1)} }} {swp(sol3)} ''') [image: Screenshot 2024-08-25 at 12.05.55 AM.png] On Sat, 24 Aug 2024 at 21:08, Roel Vanhout <roel.vanhout@gmail.com> wrote: > This is amazing, would you mind sharing the code that created this? I > write Python every day and I'm much more comfortable with it than with > straight OpenSCAD, but I always thought that using Python to generate > OpenSCAD code was mostly syntactic sugar like having 'real' for loops with > updating variables and such, I didn't know (and still don't quite see how > tbh) that it also allowed for such complex shapes. > > cheers > > > On Sat, Aug 24, 2024 at 5:49 AM Sanjeev Prabhakar < > sprabhakar2006@gmail.com> wrote: > >> I gave it a try >> [image: Screenshot 2024-08-24 at 9.16.07 AM.png] >> >> On Fri, 23 Aug 2024 at 16:19, Roel Vanhout via Discuss < >> discuss@lists.openscad.org> wrote: >> >>> Hello all, >>> >>> I have a complex shape to round for which I'd like to ask if anyone has >>> suggestions on how to approach this. I've always found rounding and >>> chamfering to be very tedious using plain OpenSCAD until I found how to do >>> it with BOSL2, which has been a godsend for the cases I've encountered so >>> far. But today I have the shape in the picture below, for which the code is >>> at the bottom. I'm looking to round out all surfaces of the 'fins' that >>> radiate out from the center 'stem' come in contact with other surfaces. >>> (this is a presser tool for stuffing food into a mold, the 'fins' are to >>> distribute the pressure that is manually exerted on the ring to the bottom >>> platelet). >>> >>> I've marked the various lines that need to be rounded out in different >>> colors. Out of these, the turquoise one I could do with a BOSL2 >>> rounding_edge_mask(), and the green one too if I use an appropriate 'ang' >>> parameter (which I can calculate fairly easily). However I have no idea how >>> to do the red one or the orange one, nor how to let e.g. the orange one >>> blend smoothly into the green one for example; and the same for all the >>> other places where roundovers meet. >>> >>> Any ideas on how I can do this? Thank you. >>> >>> regards >>> >>> Roel >>> >>> >>> [image: presser_foot_rounding.png] >>> >>> >>> >>> >>> >>> >>> include <BOSL2-master/std.scad> >>> include <BOSL2-master/screws.scad> >>> include <BOSL2-master/threading.scad> >>> >>> ZFE = 0.01; // Z fighting epsilon, a constant to prevent planes from >>> overlapping. >>> // It has a separate name so that you know where it's >>> used what it's for. >>> ZFE_2 = ZFE * 2; >>> ZFE_3 = ZFE * 3; >>> $fn = $preview ? 64 : 128; >>> >>> // Global >>> g_corner_rounding = 2; >>> >>> // Ring >>> g_wall_thickness = 3; >>> g_inside_size = 90; >>> g_height = 70; >>> >>> // Lid >>> g_lid_play = 1; >>> g_presser_height = 30; >>> g_presser_width = 20; >>> g_lid_rounding = 5; >>> g_presser_size = 10; >>> >>> module ring() { >>> outside_size = g_inside_size + (2 * g_wall_thickness); >>> //cuboid([g_wall_thickness, depth, clip_height], chamfer=1, >>> edges="X", anchor=LEFT+BOTTOM+FRONT); >>> difference() { >>> cuboid([outside_size, outside_size, g_height], >>> rounding=g_corner_rounding, edges="Z"); >>> cuboid([g_inside_size, g_inside_size, g_height + ZFE_2], >>> rounding=g_corner_rounding, edges="Z"); >>> } >>> } >>> >>> module presser() { >>> cuboid([g_inside_size - g_lid_play, g_inside_size - g_lid_play, >>> g_wall_thickness * 2], rounding=g_corner_rounding, edges="Z"); >>> >>> difference() { >>> union() { >>> // The outer cylinder that will make the presser handle ring >>> up(g_wall_thickness + g_presser_height * 1.5) >>> ycyl(l = g_presser_width, d=g_presser_size * 4, rounding >>> = g_corner_rounding); >>> // The 'stem' of the presser handle >>> up(g_wall_thickness + g_presser_height / 2) >>> zcyl(l = g_presser_height, r=g_presser_size, >>> rounding1=-g_lid_rounding); >>> } >>> // Cut away the inside of the presser handle ring. It will also >>> cut into the top of the stem a bit, hence why >>> // it's here. >>> up(g_wall_thickness + g_presser_height * 1.5) >>> ycyl(l = g_presser_width + ZFE_2, d=g_presser_size * 3, >>> rounding = -g_corner_rounding); >>> } >>> //up(g_wall_thickness) >>> for (r = [45 : 90 : 360]) { >>> zrot(r) up(g_wall_thickness) >>> wedge([g_presser_size, g_presser_size * 5, g_presser_size * >>> 2], anchor=CENTER+BOTTOM+FRONT); >>> } >>> } >>> >>> ring(); >>> right(150) presser(); >>> _______________________________________________ >>> OpenSCAD mailing list >>> To unsubscribe send an email to discuss-leave@lists.openscad.org >>> >>
SP
Sanjeev Prabhakar
Sun, Aug 25, 2024 2:05 AM

posted a video on this
https://youtu.be/_Mx4bCU7OPw

On Sun, 25 Aug 2024 at 00:06, Sanjeev Prabhakar sprabhakar2006@gmail.com
wrote:

code is below:

first need to import the library openscad1.py to create objects

https://github.com/sprabhakar2006/openSCAD/blob/main/openscad1.py

also need to download library dependencies2.scad

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

from openscad1 import *

create center pillar

c1=circle(10) # circlular section

p1 is path to create an object, it is similar to the rounding library in

openscad
p1=corner_radius(pts1([[100,0],[-100,0,5],[0,70,3],[-3,0]]),30)
sol1=prism(c1,p1) # prism is a function which offsets the section c1 in

create another surface for supports

l1=corner_radius(pts1([[-2.5,0],[0,50,2],[5,0,2],[0,-50]]),10)
l1=equidistant_path(l1,500)
l1=q_rot(['x90','z45'],l1)
v1=q_rot(['y45','z-45'],[100,0,0])
s1=surface_line_vector(l1,v1)

l1=ip_surf2sol(sol1,s1) # first intersection points
l2=ip_surf2sol(sol1,s1,n=-1)
l1=l1+flip(l2)
l2=o_3d(l1,sol1,-3)

sol2=prism(c1,path_offset(p1,3))
l3=ip_surf2sol(sol2,s1) # first intersection points
l4=ip_surf2sol(sol2,s1,n=-1)
l3=l3+flip(l4)
l3=path2path1(l1,l3) # function to make both lines points same

now make a fillet with these 3 lines

fillet1=convert_3lines2fillet_closed(l2,l3,l1)

sol3=translate([0,0,-5],linear_extrude(corner_radius(pts1([[-50,-50,5],[100,0,5],[0,100,5],[-100,0,5]]),10),5))

with open('trial.scad','w+') as f:
f.write(f'''
include<dependencies2.scad>

for(i=[0,90,180,270])
rotate([0,0,i]){{
hull()
color("blue")p_line3dc({l1},.01,1);
{swp(sol1[1:])}
{swp_c(fillet1)}
}}
{swp(sol3)}
''')

[image: Screenshot 2024-08-25 at 12.05.55 AM.png]

On Sat, 24 Aug 2024 at 21:08, Roel Vanhout roel.vanhout@gmail.com wrote:

This is amazing, would you mind sharing the code that created this? I
write Python every day and I'm much more comfortable with it than with
straight OpenSCAD, but I always thought that using Python to generate
OpenSCAD code was mostly syntactic sugar like having 'real' for loops with
updating variables and such, I didn't know (and still don't quite see how
tbh) that it also allowed for such complex shapes.

cheers

On Sat, Aug 24, 2024 at 5:49 AM Sanjeev Prabhakar <
sprabhakar2006@gmail.com> wrote:

I gave it a try
[image: Screenshot 2024-08-24 at 9.16.07 AM.png]

On Fri, 23 Aug 2024 at 16:19, Roel Vanhout via Discuss <
discuss@lists.openscad.org> wrote:

Hello all,

I have a complex shape to round for which I'd like to ask if anyone has
suggestions on how to approach this. I've always found rounding and
chamfering to be very tedious using plain OpenSCAD until I found how to do
it with BOSL2, which has been a godsend for the cases I've encountered so
far. But today I have the shape in the picture below, for which the code is
at the bottom. I'm looking to round out all surfaces of the 'fins' that
radiate out from the center 'stem' come in contact with other surfaces.
(this is a presser tool for stuffing food into a mold, the 'fins' are to
distribute the pressure that is manually exerted on the ring to the bottom
platelet).

I've marked the various lines that need to be rounded out in different
colors. Out of these, the turquoise one I could do with a BOSL2
rounding_edge_mask(), and the green one too if I use an appropriate 'ang'
parameter (which I can calculate fairly easily). However I have no idea how
to do the red one or the orange one, nor how to let e.g. the orange one
blend smoothly into the green one for example; and the same for all the
other places where roundovers meet.

Any ideas on how I can do this? Thank you.

regards

Roel

[image: presser_foot_rounding.png]

include <BOSL2-master/std.scad>
include <BOSL2-master/screws.scad>
include <BOSL2-master/threading.scad>

ZFE = 0.01;    // Z fighting epsilon, a constant to prevent planes from
overlapping.
// It has a separate name so that you know where it's
used what it's for.
ZFE_2 = ZFE * 2;
ZFE_3 = ZFE * 3;
$fn = $preview ? 64 : 128;

// Global
g_corner_rounding = 2;

// Ring
g_wall_thickness = 3;
g_inside_size = 90;
g_height = 70;

// Lid
g_lid_play = 1;
g_presser_height = 30;
g_presser_width = 20;
g_lid_rounding = 5;
g_presser_size = 10;

module ring() {
outside_size = g_inside_size + (2 * g_wall_thickness);
//cuboid([g_wall_thickness, depth, clip_height], chamfer=1,
edges="X", anchor=LEFT+BOTTOM+FRONT);
difference() {
cuboid([outside_size, outside_size, g_height],
rounding=g_corner_rounding, edges="Z");
cuboid([g_inside_size, g_inside_size, g_height + ZFE_2],
rounding=g_corner_rounding, edges="Z");
}
}

module presser() {
cuboid([g_inside_size - g_lid_play, g_inside_size - g_lid_play,
g_wall_thickness * 2], rounding=g_corner_rounding, edges="Z");

 difference() {
     union() {
         // The outer cylinder that will make the presser handle ring
         up(g_wall_thickness + g_presser_height * 1.5)
             ycyl(l = g_presser_width, d=g_presser_size * 4,

rounding = g_corner_rounding);
// The 'stem' of the presser handle
up(g_wall_thickness + g_presser_height / 2)
zcyl(l = g_presser_height, r=g_presser_size,
rounding1=-g_lid_rounding);
}
// Cut away the inside of the presser handle ring. It will also
cut into the top of the stem a bit, hence why
// it's here.
up(g_wall_thickness + g_presser_height * 1.5)
ycyl(l = g_presser_width + ZFE_2, d=g_presser_size * 3,
rounding = -g_corner_rounding);
}
//up(g_wall_thickness)
for (r = [45 : 90 : 360]) {
zrot(r) up(g_wall_thickness)
wedge([g_presser_size, g_presser_size * 5, g_presser_size *
2], anchor=CENTER+BOTTOM+FRONT);
}
}

ring();
right(150) presser();


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

posted a video on this https://youtu.be/_Mx4bCU7OPw On Sun, 25 Aug 2024 at 00:06, Sanjeev Prabhakar <sprabhakar2006@gmail.com> wrote: > code is below: > > # first need to import the library openscad1.py to create objects > # https://github.com/sprabhakar2006/openSCAD/blob/main/openscad1.py > # also need to download library dependencies2.scad > # https://github.com/sprabhakar2006/openSCAD/blob/main/dependencies2.scad > > from openscad1 import * > > # create center pillar > c1=circle(10) # circlular section > > # p1 is path to create an object, it is similar to the rounding library in > openscad > p1=corner_radius(pts1([[100,0],[-100,0,5],[0,70,3],[-3,0]]),30) > sol1=prism(c1,p1) # prism is a function which offsets the section c1 in > > # create another surface for supports > > l1=corner_radius(pts1([[-2.5,0],[0,50,2],[5,0,2],[0,-50]]),10) > l1=equidistant_path(l1,500) > l1=q_rot(['x90','z45'],l1) > v1=q_rot(['y45','z-45'],[100,0,0]) > s1=surface_line_vector(l1,v1) > > > l1=ip_surf2sol(sol1,s1) # first intersection points > l2=ip_surf2sol(sol1,s1,n=-1) > l1=l1+flip(l2) > l2=o_3d(l1,sol1,-3) > > sol2=prism(c1,path_offset(p1,3)) > l3=ip_surf2sol(sol2,s1) # first intersection points > l4=ip_surf2sol(sol2,s1,n=-1) > l3=l3+flip(l4) > l3=path2path1(l1,l3) # function to make both lines points same > # now make a fillet with these 3 lines > fillet1=convert_3lines2fillet_closed(l2,l3,l1) > > > sol3=translate([0,0,-5],linear_extrude(corner_radius(pts1([[-50,-50,5],[100,0,5],[0,100,5],[-100,0,5]]),10),5)) > > with open('trial.scad','w+') as f: > f.write(f''' > include<dependencies2.scad> > > for(i=[0,90,180,270]) > rotate([0,0,i]){{ > hull() > color("blue")p_line3dc({l1},.01,1); > {swp(sol1[1:])} > {swp_c(fillet1)} > }} > {swp(sol3)} > ''') > > [image: Screenshot 2024-08-25 at 12.05.55 AM.png] > > On Sat, 24 Aug 2024 at 21:08, Roel Vanhout <roel.vanhout@gmail.com> wrote: > >> This is amazing, would you mind sharing the code that created this? I >> write Python every day and I'm much more comfortable with it than with >> straight OpenSCAD, but I always thought that using Python to generate >> OpenSCAD code was mostly syntactic sugar like having 'real' for loops with >> updating variables and such, I didn't know (and still don't quite see how >> tbh) that it also allowed for such complex shapes. >> >> cheers >> >> >> On Sat, Aug 24, 2024 at 5:49 AM Sanjeev Prabhakar < >> sprabhakar2006@gmail.com> wrote: >> >>> I gave it a try >>> [image: Screenshot 2024-08-24 at 9.16.07 AM.png] >>> >>> On Fri, 23 Aug 2024 at 16:19, Roel Vanhout via Discuss < >>> discuss@lists.openscad.org> wrote: >>> >>>> Hello all, >>>> >>>> I have a complex shape to round for which I'd like to ask if anyone has >>>> suggestions on how to approach this. I've always found rounding and >>>> chamfering to be very tedious using plain OpenSCAD until I found how to do >>>> it with BOSL2, which has been a godsend for the cases I've encountered so >>>> far. But today I have the shape in the picture below, for which the code is >>>> at the bottom. I'm looking to round out all surfaces of the 'fins' that >>>> radiate out from the center 'stem' come in contact with other surfaces. >>>> (this is a presser tool for stuffing food into a mold, the 'fins' are to >>>> distribute the pressure that is manually exerted on the ring to the bottom >>>> platelet). >>>> >>>> I've marked the various lines that need to be rounded out in different >>>> colors. Out of these, the turquoise one I could do with a BOSL2 >>>> rounding_edge_mask(), and the green one too if I use an appropriate 'ang' >>>> parameter (which I can calculate fairly easily). However I have no idea how >>>> to do the red one or the orange one, nor how to let e.g. the orange one >>>> blend smoothly into the green one for example; and the same for all the >>>> other places where roundovers meet. >>>> >>>> Any ideas on how I can do this? Thank you. >>>> >>>> regards >>>> >>>> Roel >>>> >>>> >>>> [image: presser_foot_rounding.png] >>>> >>>> >>>> >>>> >>>> >>>> >>>> include <BOSL2-master/std.scad> >>>> include <BOSL2-master/screws.scad> >>>> include <BOSL2-master/threading.scad> >>>> >>>> ZFE = 0.01; // Z fighting epsilon, a constant to prevent planes from >>>> overlapping. >>>> // It has a separate name so that you know where it's >>>> used what it's for. >>>> ZFE_2 = ZFE * 2; >>>> ZFE_3 = ZFE * 3; >>>> $fn = $preview ? 64 : 128; >>>> >>>> // Global >>>> g_corner_rounding = 2; >>>> >>>> // Ring >>>> g_wall_thickness = 3; >>>> g_inside_size = 90; >>>> g_height = 70; >>>> >>>> // Lid >>>> g_lid_play = 1; >>>> g_presser_height = 30; >>>> g_presser_width = 20; >>>> g_lid_rounding = 5; >>>> g_presser_size = 10; >>>> >>>> module ring() { >>>> outside_size = g_inside_size + (2 * g_wall_thickness); >>>> //cuboid([g_wall_thickness, depth, clip_height], chamfer=1, >>>> edges="X", anchor=LEFT+BOTTOM+FRONT); >>>> difference() { >>>> cuboid([outside_size, outside_size, g_height], >>>> rounding=g_corner_rounding, edges="Z"); >>>> cuboid([g_inside_size, g_inside_size, g_height + ZFE_2], >>>> rounding=g_corner_rounding, edges="Z"); >>>> } >>>> } >>>> >>>> module presser() { >>>> cuboid([g_inside_size - g_lid_play, g_inside_size - g_lid_play, >>>> g_wall_thickness * 2], rounding=g_corner_rounding, edges="Z"); >>>> >>>> difference() { >>>> union() { >>>> // The outer cylinder that will make the presser handle ring >>>> up(g_wall_thickness + g_presser_height * 1.5) >>>> ycyl(l = g_presser_width, d=g_presser_size * 4, >>>> rounding = g_corner_rounding); >>>> // The 'stem' of the presser handle >>>> up(g_wall_thickness + g_presser_height / 2) >>>> zcyl(l = g_presser_height, r=g_presser_size, >>>> rounding1=-g_lid_rounding); >>>> } >>>> // Cut away the inside of the presser handle ring. It will also >>>> cut into the top of the stem a bit, hence why >>>> // it's here. >>>> up(g_wall_thickness + g_presser_height * 1.5) >>>> ycyl(l = g_presser_width + ZFE_2, d=g_presser_size * 3, >>>> rounding = -g_corner_rounding); >>>> } >>>> //up(g_wall_thickness) >>>> for (r = [45 : 90 : 360]) { >>>> zrot(r) up(g_wall_thickness) >>>> wedge([g_presser_size, g_presser_size * 5, g_presser_size * >>>> 2], anchor=CENTER+BOTTOM+FRONT); >>>> } >>>> } >>>> >>>> ring(); >>>> right(150) presser(); >>>> _______________________________________________ >>>> OpenSCAD mailing list >>>> To unsubscribe send an email to discuss-leave@lists.openscad.org >>>> >>>