discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

Re: python support for openscad

SP
Sanjeev Prabhakar
Tue, Jul 25, 2023 3:09 AM

Hi Gene,
You don't need to know the maths involved here,  there are functions
written to do all the maths and you need to just know how to use them.
Regards

On Tue, 25 Jul, 2023, 7:42 am gene heskett, gheskett@shentel.net wrote:

On 7/24/23 20:49, Sanjeev Prabhakar wrote:

Haha, thanks
retirement is nearby also

While I as I look to my 89th in a couple months will be retired for 23
years. I am a C.E.T. with an 8th grade education, and don't have the
math skills to do what you are doing. Rather precocious electronically
before I was a teenager, my 8th grade algebra teacher thought he was a
George Carlin and far more interested in what was in the girls panties
than he was in actually teaching the algebra class he was being paid to
do. So I quit school and went to work fixing what was then a brand new
tech, TV's at 14 yo. You would not be far wrong to say I grew up with a
hot soldering iron in one hand and a scope probe in the other by the
time I hit 17.  But real math? Nope...  What little I can do was taught
to me by a TI SR51 or a log-log-duplex Pickett slipstick. What you are
doing might as well be black magic to me.

But if you have an electronics problem, I can probably help.

[...]

Cheers, Gene Heskett.

"There are four boxes to be used in defense of liberty:
soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author, 1940)
If we desire respect for the law, we must first make the law respectable.


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

Hi Gene, You don't need to know the maths involved here, there are functions written to do all the maths and you need to just know how to use them. Regards On Tue, 25 Jul, 2023, 7:42 am gene heskett, <gheskett@shentel.net> wrote: > On 7/24/23 20:49, Sanjeev Prabhakar wrote: > > Haha, thanks > > retirement is nearby also > > > While I as I look to my 89th in a couple months will be retired for 23 > years. I am a C.E.T. with an 8th grade education, and don't have the > math skills to do what you are doing. Rather precocious electronically > before I was a teenager, my 8th grade algebra teacher thought he was a > George Carlin and far more interested in what was in the girls panties > than he was in actually teaching the algebra class he was being paid to > do. So I quit school and went to work fixing what was then a brand new > tech, TV's at 14 yo. You would not be far wrong to say I grew up with a > hot soldering iron in one hand and a scope probe in the other by the > time I hit 17. But real math? Nope... What little I can do was taught > to me by a TI SR51 or a log-log-duplex Pickett slipstick. What you are > doing might as well be black magic to me. > > But if you have an electronics problem, I can probably help. > > [...] > > Cheers, Gene Heskett. > -- > "There are four boxes to be used in defense of liberty: > soap, ballot, jury, and ammo. Please use in that order." > -Ed Howdershelt (Author, 1940) > If we desire respect for the law, we must first make the law respectable. > - Louis D. Brandeis > Genes Web page <http://geneslinuxbox.net:6309/> > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org >
RW
Rogier Wolff
Tue, Jul 25, 2023 9:04 AM

On Mon, Jul 24, 2023 at 11:36:35PM +0530, Sanjeev Prabhakar wrote:

The approach explained in my earlier message will not work in such cases.

Isn't fillet about the same as:

minkovski with a sphere of the fillet radius, Then invert, again
minkovski with that sphere and then invert again.

That would at least give a defined result for my "difficult case".

Roger. 

--
** R.E.Wolff@BitWizard.nl ** https://www.BitWizard.nl/ ** +31-15-2049110 **
**    Delftechpark 11 2628 XJ  Delft, The Netherlands.  KVK: 27239233    **
f equals m times a. When your f is steady, and your m is going down
your a is going up.  -- Chris Hadfield about flying up the space shuttle.

On Mon, Jul 24, 2023 at 11:36:35PM +0530, Sanjeev Prabhakar wrote: > The approach explained in my earlier message will not work in such cases. Isn't fillet about the same as: minkovski with a sphere of the fillet radius, Then invert, again minkovski with that sphere and then invert again. That would at least give a defined result for my "difficult case". Roger. -- ** R.E.Wolff@BitWizard.nl ** https://www.BitWizard.nl/ ** +31-15-2049110 ** ** Delftechpark 11 2628 XJ Delft, The Netherlands. KVK: 27239233 ** f equals m times a. When your f is steady, and your m is going down your a is going up. -- Chris Hadfield about flying up the space shuttle.
SP
Sanjeev Prabhakar
Tue, Jul 25, 2023 2:55 PM

I have not used minkowski method in openscad, maybe someone else can comment

On Tue, 25 Jul 2023 at 14:34, Rogier Wolff R.E.Wolff@bitwizard.nl wrote:

On Mon, Jul 24, 2023 at 11:36:35PM +0530, Sanjeev Prabhakar wrote:

The approach explained in my earlier message will not work in such cases.

Isn't fillet about the same as:

minkovski with a sphere of the fillet radius, Then invert, again
minkovski with that sphere and then invert again.

That would at least give a defined result for my "difficult case".

     Roger.

--
** R.E.Wolff@BitWizard.nl ** https://www.BitWizard.nl/ ** +31-15-2049110
**
**    Delftechpark 11 2628 XJ  Delft, The Netherlands.  KVK: 27239233    **
f equals m times a. When your f is steady, and your m is going down
your a is going up.  -- Chris Hadfield about flying up the space shuttle.


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

I have not used minkowski method in openscad, maybe someone else can comment On Tue, 25 Jul 2023 at 14:34, Rogier Wolff <R.E.Wolff@bitwizard.nl> wrote: > On Mon, Jul 24, 2023 at 11:36:35PM +0530, Sanjeev Prabhakar wrote: > > The approach explained in my earlier message will not work in such cases. > > Isn't fillet about the same as: > > minkovski with a sphere of the fillet radius, Then invert, again > minkovski with that sphere and then invert again. > > That would at least give a defined result for my "difficult case". > > Roger. > > -- > ** R.E.Wolff@BitWizard.nl ** https://www.BitWizard.nl/ ** +31-15-2049110 > ** > ** Delftechpark 11 2628 XJ Delft, The Netherlands. KVK: 27239233 ** > f equals m times a. When your f is steady, and your m is going down > your a is going up. -- Chris Hadfield about flying up the space shuttle. > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org >
NH
nop head
Tue, Jul 25, 2023 3:18 PM

Three minkowskis of any non-trivial shape takes forever. This example takes
more than 5 minutes:

[image: round.png]

On Tue, 25 Jul 2023 at 15:56, Sanjeev Prabhakar sprabhakar2006@gmail.com
wrote:

I have not used minkowski method in openscad, maybe someone else can
comment

On Tue, 25 Jul 2023 at 14:34, Rogier Wolff R.E.Wolff@bitwizard.nl wrote:

On Mon, Jul 24, 2023 at 11:36:35PM +0530, Sanjeev Prabhakar wrote:

The approach explained in my earlier message will not work in such

cases.

Isn't fillet about the same as:

minkovski with a sphere of the fillet radius, Then invert, again
minkovski with that sphere and then invert again.

That would at least give a defined result for my "difficult case".

     Roger.

--
** R.E.Wolff@BitWizard.nl ** https://www.BitWizard.nl/ ** +31-15-2049110
**
**    Delftechpark 11 2628 XJ  Delft, The Netherlands.  KVK: 27239233
**
f equals m times a. When your f is steady, and your m is going down
your a is going up.  -- Chris Hadfield about flying up the space shuttle.


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


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

Three minkowskis of any non-trivial shape takes forever. This example takes more than 5 minutes: [image: round.png] On Tue, 25 Jul 2023 at 15:56, Sanjeev Prabhakar <sprabhakar2006@gmail.com> wrote: > I have not used minkowski method in openscad, maybe someone else can > comment > > On Tue, 25 Jul 2023 at 14:34, Rogier Wolff <R.E.Wolff@bitwizard.nl> wrote: > >> On Mon, Jul 24, 2023 at 11:36:35PM +0530, Sanjeev Prabhakar wrote: >> > The approach explained in my earlier message will not work in such >> cases. >> >> Isn't fillet about the same as: >> >> minkovski with a sphere of the fillet radius, Then invert, again >> minkovski with that sphere and then invert again. >> >> That would at least give a defined result for my "difficult case". >> >> Roger. >> >> -- >> ** R.E.Wolff@BitWizard.nl ** https://www.BitWizard.nl/ ** +31-15-2049110 >> ** >> ** Delftechpark 11 2628 XJ Delft, The Netherlands. KVK: 27239233 >> ** >> f equals m times a. When your f is steady, and your m is going down >> your a is going up. -- Chris Hadfield about flying up the space shuttle. >> _______________________________________________ >> OpenSCAD mailing list >> To unsubscribe send an email to discuss-leave@lists.openscad.org >> > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org >
TP
Torsten Paul
Tue, Jul 25, 2023 3:36 PM

On 25.07.23 17:18, nop head wrote:

Three minkowskis of any non-trivial shape takes forever. This example takes more than 5 minutes.

What's the code for this example?

ciao,
Torsten.

On 25.07.23 17:18, nop head wrote: > Three minkowskis of any non-trivial shape takes forever. This example takes more than 5 minutes. What's the code for this example? ciao, Torsten.
NH
nop head
Tue, Jul 25, 2023 4:55 PM

It is the round_3D test from NopSCADLib. I have distilled it out to this:

$fa = 6;
$fs = 0.25;
inf = 1e10;      // very big
eps = 1/128;    // small fudge factor to stop CSG barfing on coincident
faces.
layer_height    = 0.25;
teardrop_angle  = 45;

function r2sides(r) = $fn ? $fn : ceil(max(min(360/ $fa, r * 2 * PI / $fs),
5));    //! Replicates the OpenSCAD logic to calculate the number of sides
from the radius
function r2sides4n(r) = floor((r2sides(r) + 3) / 4) * 4;
//! Round up the number of sides to a multiple of 4 to ensure
points land on all axes

module circle4n(r, d = undef) {                    //! Circle with
multiple of 4 vertices
R = is_undef(d) ? r : d / 2;
circle(R, $fn = r2sides4n(R));
}

module extrude_if(h, center = true)                //! Extrudes 2D object
to 3D when h is nonzero, otherwise leaves it 2D
if(h)
linear_extrude(h, center = center, convexity = 5) // 3D
children();
else
children();                                // 2D

module teardrop(h, r, center = true, truncate = true, chamfer = 0,
chamfer_both_ends = true, plus = false) { //! For making horizontal holes
that don't need support material, set truncate = false to make
traditional RepRap teardrops that don't even need bridging
module teardrop_2d(r, truncate) {
er = layer_height / 2 - eps;    // Extrusion edge radius
R = plus ? r + er : r;          // Corrected radius
offset = plus ? -er : 0;        // Offset inwards
hull()
for(side = [0 : 1])
mirror([side, 0, 0])
intersection() {
hull()
translate([offset, 0]) {
circle4n(R);

                            if (teardrop_angle > 0) {
                                x = R * tan(teardrop_angle / 2);
                                if(truncate)
                                    translate([0, R / 2])
                                        square([2 * x, R], center =

true);
else
polygon([[0, 0], [eps, 0], [0, R +
x * tan(min(teardrop_angle, 90 - eps))]]);
}
}
translate([0, -2 * R])
square([R, 4 * R]);
}
}

render(convexity = 5)
    extrude_if(h, center)
        teardrop_2d(r, truncate);

}

module offset_3D(r, chamfer_base = false) { //! Offset 3D shape by
specified radius r, positive or negative.
module ball(r)
if(chamfer_base)
rotate_extrude()
intersection() {
rotate(180)
teardrop(0, r);

                translate([0, -r])
                    square([r, 2 * r]);
            }
    else
        sphere(r);

if(r > 0)
    minkowski() {
        children();

        ball(r);
    }
else
    if(r < 0)
        render() difference() {
            cube(inf / 2, center = true);

            minkowski() {
                difference() {
                    cube(inf, center = true);

                    children();
                }
                ball(-r);
            }
        }
    else
        children();

}

module round_3D(r, ir = undef, or = undef, chamfer_base = false) { //!
Round a 3D child single radius or separate inside and outside radii
IR = is_undef(ir) ? r : ir;
OR = is_undef(or) ? r : or;
offset_3D(OR, chamfer_base)
offset_3D(-OR -IR, chamfer_base)
offset_3D(IR, chamfer_base)
children();
}

module shape()
difference() {
square(40, center = true);

    square([20, 20], center = true);
}

module rounds() {
translate([50, 0])
round_3D(or = 4, ir = 2, chamfer_base = true, $fn = 16)
linear_extrude(40, center = true)
shape();
}

rounds();

On Tue, 25 Jul 2023 at 16:37, Torsten Paul Torsten.Paul@gmx.de wrote:

On 25.07.23 17:18, nop head wrote:

Three minkowskis of any non-trivial shape takes forever. This example

takes more than 5 minutes.

What's the code for this example?

ciao,
Torsten.


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

It is the round_3D test from NopSCADLib. I have distilled it out to this: $fa = 6; $fs = 0.25; inf = 1e10; // very big eps = 1/128; // small fudge factor to stop CSG barfing on coincident faces. layer_height = 0.25; teardrop_angle = 45; function r2sides(r) = $fn ? $fn : ceil(max(min(360/ $fa, r * 2 * PI / $fs), 5)); //! Replicates the OpenSCAD logic to calculate the number of sides from the radius function r2sides4n(r) = floor((r2sides(r) + 3) / 4) * 4; //! Round up the number of sides to a multiple of 4 to ensure points land on all axes module circle4n(r, d = undef) { //! Circle with multiple of 4 vertices R = is_undef(d) ? r : d / 2; circle(R, $fn = r2sides4n(R)); } module extrude_if(h, center = true) //! Extrudes 2D object to 3D when `h` is nonzero, otherwise leaves it 2D if(h) linear_extrude(h, center = center, convexity = 5) // 3D children(); else children(); // 2D module teardrop(h, r, center = true, truncate = true, chamfer = 0, chamfer_both_ends = true, plus = false) { //! For making horizontal holes that don't need support material, set `truncate = false` to make traditional RepRap teardrops that don't even need bridging module teardrop_2d(r, truncate) { er = layer_height / 2 - eps; // Extrusion edge radius R = plus ? r + er : r; // Corrected radius offset = plus ? -er : 0; // Offset inwards hull() for(side = [0 : 1]) mirror([side, 0, 0]) intersection() { hull() translate([offset, 0]) { circle4n(R); if (teardrop_angle > 0) { x = R * tan(teardrop_angle / 2); if(truncate) translate([0, R / 2]) square([2 * x, R], center = true); else polygon([[0, 0], [eps, 0], [0, R + x * tan(min(teardrop_angle, 90 - eps))]]); } } translate([0, -2 * R]) square([R, 4 * R]); } } render(convexity = 5) extrude_if(h, center) teardrop_2d(r, truncate); } module offset_3D(r, chamfer_base = false) { //! Offset 3D shape by specified radius `r`, positive or negative. module ball(r) if(chamfer_base) rotate_extrude() intersection() { rotate(180) teardrop(0, r); translate([0, -r]) square([r, 2 * r]); } else sphere(r); if(r > 0) minkowski() { children(); ball(r); } else if(r < 0) render() difference() { cube(inf / 2, center = true); minkowski() { difference() { cube(inf, center = true); children(); } ball(-r); } } else children(); } module round_3D(r, ir = undef, or = undef, chamfer_base = false) { //! Round a 3D child single radius or separate inside and outside radii IR = is_undef(ir) ? r : ir; OR = is_undef(or) ? r : or; offset_3D(OR, chamfer_base) offset_3D(-OR -IR, chamfer_base) offset_3D(IR, chamfer_base) children(); } module shape() difference() { square(40, center = true); square([20, 20], center = true); } module rounds() { translate([50, 0]) round_3D(or = 4, ir = 2, chamfer_base = true, $fn = 16) linear_extrude(40, center = true) shape(); } rounds(); On Tue, 25 Jul 2023 at 16:37, Torsten Paul <Torsten.Paul@gmx.de> wrote: > On 25.07.23 17:18, nop head wrote: > > Three minkowskis of any non-trivial shape takes forever. This example > takes more than 5 minutes. > > What's the code for this example? > > ciao, > Torsten. > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org >
SP
Sanjeev Prabhakar
Wed, Jul 26, 2023 1:05 AM

here is another approach for filleting such type of intersection, it was
suggested by someone earlier, I did some modification and it is super
efficient.
it took 0.4 sec to render.
But it works only for convex intersections.
fillet here is 5 mm
[image: Screenshot 2023-07-26 at 6.33.44 AM.png]

On Tue, 25 Jul 2023 at 20:25, Sanjeev Prabhakar sprabhakar2006@gmail.com
wrote:

I have not used minkowski method in openscad, maybe someone else can
comment

On Tue, 25 Jul 2023 at 14:34, Rogier Wolff R.E.Wolff@bitwizard.nl wrote:

On Mon, Jul 24, 2023 at 11:36:35PM +0530, Sanjeev Prabhakar wrote:

The approach explained in my earlier message will not work in such

cases.

Isn't fillet about the same as:

minkovski with a sphere of the fillet radius, Then invert, again
minkovski with that sphere and then invert again.

That would at least give a defined result for my "difficult case".

     Roger.

--
** R.E.Wolff@BitWizard.nl ** https://www.BitWizard.nl/ ** +31-15-2049110
**
**    Delftechpark 11 2628 XJ  Delft, The Netherlands.  KVK: 27239233
**
f equals m times a. When your f is steady, and your m is going down
your a is going up.  -- Chris Hadfield about flying up the space shuttle.


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

here is another approach for filleting such type of intersection, it was suggested by someone earlier, I did some modification and it is super efficient. it took 0.4 sec to render. But it works only for convex intersections. fillet here is 5 mm [image: Screenshot 2023-07-26 at 6.33.44 AM.png] On Tue, 25 Jul 2023 at 20:25, Sanjeev Prabhakar <sprabhakar2006@gmail.com> wrote: > I have not used minkowski method in openscad, maybe someone else can > comment > > On Tue, 25 Jul 2023 at 14:34, Rogier Wolff <R.E.Wolff@bitwizard.nl> wrote: > >> On Mon, Jul 24, 2023 at 11:36:35PM +0530, Sanjeev Prabhakar wrote: >> > The approach explained in my earlier message will not work in such >> cases. >> >> Isn't fillet about the same as: >> >> minkovski with a sphere of the fillet radius, Then invert, again >> minkovski with that sphere and then invert again. >> >> That would at least give a defined result for my "difficult case". >> >> Roger. >> >> -- >> ** R.E.Wolff@BitWizard.nl ** https://www.BitWizard.nl/ ** +31-15-2049110 >> ** >> ** Delftechpark 11 2628 XJ Delft, The Netherlands. KVK: 27239233 >> ** >> f equals m times a. When your f is steady, and your m is going down >> your a is going up. -- Chris Hadfield about flying up the space shuttle. >> _______________________________________________ >> OpenSCAD mailing list >> To unsubscribe send an email to discuss-leave@lists.openscad.org >> >
L
larry
Wed, Jul 26, 2023 3:43 AM

On Wed, 2023-07-26 at 06:35 +0530, Sanjeev Prabhakar wrote:

here is another approach for filleting such type of intersection, it
was suggested by someone earlier, I did some modification and it is
super efficient.
it took 0.4 sec to render.

On my machine...

F5: Total rendering time: 0:00:00.789
F6: Total rendering time: 0:00:00.290

Ubuntu MATE,
OpenSCAD version 2023.02.15.ai13654

But it works only for convex intersections.
fillet here is 5 mm
Screenshot 2023-07-26 at 6.33.44 AM.png

On Tue, 25 Jul 2023 at 20:25, Sanjeev Prabhakar
sprabhakar2006@gmail.com wrote:

I have not used minkowski method in openscad, maybe someone else
can comment

On Tue, 25 Jul 2023 at 14:34, Rogier Wolff R.E.Wolff@bitwizard.nl
wrote:

On Mon, Jul 24, 2023 at 11:36:35PM +0530, Sanjeev Prabhakar
wrote:

The approach explained in my earlier message will not work in
such cases.

Isn't fillet about the same as:

minkovski with a sphere of the fillet radius, Then invert, again
minkovski with that sphere and then invert again.

That would at least give a defined result for my "difficult
case".

        Roger.


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

On Wed, 2023-07-26 at 06:35 +0530, Sanjeev Prabhakar wrote: > here is another approach for filleting such type of intersection, it > was suggested by someone earlier, I did some modification and it is > super efficient. > it took 0.4 sec to render. On my machine... F5: Total rendering time: 0:00:00.789 F6: Total rendering time: 0:00:00.290 Ubuntu MATE, OpenSCAD version 2023.02.15.ai13654 > But it works only for convex intersections. > fillet here is 5 mm > Screenshot 2023-07-26 at 6.33.44 AM.png > On Tue, 25 Jul 2023 at 20:25, Sanjeev Prabhakar > <sprabhakar2006@gmail.com> wrote: > > I have not used minkowski method in openscad, maybe someone else > > can comment > > > > On Tue, 25 Jul 2023 at 14:34, Rogier Wolff <R.E.Wolff@bitwizard.nl> > > wrote: > > > On Mon, Jul 24, 2023 at 11:36:35PM +0530, Sanjeev Prabhakar > > > wrote: > > > > The approach explained in my earlier message will not work in > > > > such cases. > > > > > > Isn't fillet about the same as: > > > > > > minkovski with a sphere of the fillet radius, Then invert, again > > > minkovski with that sphere and then invert again. > > > > > > That would at least give a defined result for my "difficult > > > case". > > > > > >         Roger. > > > > > > _______________________________________________ > > > OpenSCAD mailing list > > > To unsubscribe send an email to discuss-leave@lists.openscad.org