discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

bending a shape that's only slightly complex

RW
Rob Ward
Fri, Dec 11, 2020 12:33 PM

My problem I very much like the OpenSCAD paradigm, ie cube(10), and I do not want to jump ship. I just wonder how much easier these problems could be solved if the OpenSCAD language was structured differently, preferably modified? This question could be posed countless times to threads in this forum, and I apologize for the  vagueness of the response to this particular thread. However solving some of these problems in OpenSCAD with even more OpenSCAD seems like going down the proverbial Rabbit Hole.
Cheers, RobW

On 11 December 2020 10:36:33 pm AEDT, nop head nop.head@gmail.com wrote:

If you don't like OpenSCAD for solving problems why not use a language
you
do like? I don't think OpenSCAD will suddenly morph into Python
anytime soon.

On Fri, 11 Dec 2020 at 11:29, jon jon@jonbondy.com wrote:

Rob:

If you want to talk about better programming languages, that is fine.
Just put it under its own topic/thread, not under a "bending" topic

where

no one will be able to find it later.

Jon
On 12/11/2020 6:01 AM, Rob Ward wrote:

But shouldn't we always consider how a better programming language

would

help solve these problems? Or is that OpenSCAD taboo?
Cheers, RobW

On 11 December 2020 9:02:48 pm AEDT, MichaelAtOz

RobWLakes wrote

I chose to disregard the answer...I think the argument for OpenSCAD

in a

Python environment...

Thanks Rob. This is not just aimed at you.

EVERYONE, yes there are some cultural discussion in other threads,

but,

PLEASE REPLY TO THE TOPIC UNDER DISCUSSION.

This is: bending a shape that's only slightly complex

And follows discussion of sweep libraries, all OpenSCAD, not python.

NO, do not reply to this thread if you have an issue, don't be lazy,
start a new one, easy on the forum (click 'New Topic'),
or for Mailing-list users - send a NEW email,with a NEW Subject,

My problem I very much like the OpenSCAD paradigm, ie cube(10), and I do not want to jump ship. I just wonder how much easier these problems could be solved if the OpenSCAD language was structured differently, preferably modified? This question could be posed countless times to threads in this forum, and I apologize for the vagueness of the response to this particular thread. However solving some of these problems in OpenSCAD with even more OpenSCAD seems like going down the proverbial Rabbit Hole. Cheers, RobW On 11 December 2020 10:36:33 pm AEDT, nop head <nop.head@gmail.com> wrote: >If you don't like OpenSCAD for solving problems why not use a language >you >do like? I don't think OpenSCAD will suddenly morph into Python >anytime soon. > >On Fri, 11 Dec 2020 at 11:29, jon <jon@jonbondy.com> wrote: > >> Rob: >> >> If you want to talk about better programming languages, that is fine. >> Just put it under its own topic/thread, not under a "bending" topic >where >> no one will be able to find it later. >> >> Jon >> On 12/11/2020 6:01 AM, Rob Ward wrote: >> >> But shouldn't we always consider how a better programming language >would >> help solve these problems? Or is that OpenSCAD taboo? >> Cheers, RobW >> >> On 11 December 2020 9:02:48 pm AEDT, MichaelAtOz ><oz.at.michael@gmail.com> >> <oz.at.michael@gmail.com> wrote: >>> >>> RobWLakes wrote >>>> >>>> I chose to disregard the answer...I think the argument for OpenSCAD >in a >>>> Python environment... >>> >>> >>> Thanks Rob. This is not just aimed at you. >>> >>> EVERYONE, yes there are some cultural discussion in other threads, >but, >>> PLEASE REPLY TO THE TOPIC UNDER DISCUSSION. >>> >>> This is: bending a shape that's only slightly complex >>> >>> And follows discussion of sweep libraries, all OpenSCAD, not python. >>> >>> NO, do not reply to this thread if you have an issue, don't be lazy, >>> start a new one, easy on the forum (click 'New Topic'), >>> or for Mailing-list users - send a NEW email,with a NEW Subject, >todiscuss@lists.openscad.org >>> ------------------------------ >>> >>> _______________________________________________ >> OpenSCAD mailing list >> Discuss@lists.openscad.org >> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org >>
NH
nop head
Fri, Dec 11, 2020 12:37 PM

I personally don't have any problem implementing what I need in OpenSCAD,
which is why I stick with it as I find it the simplest way to make 3D
printable models. There are lots of other languages I could use if I needed
something more complicated but I don't.

On Fri, 11 Dec 2020 at 12:34, Rob Ward rl.ward@bigpond.com wrote:

My problem I very much like the OpenSCAD paradigm, ie cube(10), and I do
not want to jump ship. I just wonder how much easier these problems could
be solved if the OpenSCAD language was structured differently, preferably
modified? This question could be posed countless times to threads in this
forum, and I apologize for the vagueness of the response to this particular
thread. However solving some of these problems in OpenSCAD with even more
OpenSCAD seems like going down the proverbial Rabbit Hole.
Cheers, RobW

On 11 December 2020 10:36:33 pm AEDT, nop head nop.head@gmail.com wrote:

If you don't like OpenSCAD for solving problems why not use a language
you do like? I don't think OpenSCAD will suddenly morph into Python
anytime soon.

On Fri, 11 Dec 2020 at 11:29, jon jon@jonbondy.com wrote:

Rob:

If you want to talk about better programming languages, that is fine.
Just put it under its own topic/thread, not under a "bending" topic where
no one will be able to find it later.

Jon
On 12/11/2020 6:01 AM, Rob Ward wrote:

But shouldn't we always consider how a better programming language would
help solve these problems? Or is that OpenSCAD taboo?
Cheers, RobW

On 11 December 2020 9:02:48 pm AEDT, MichaelAtOz
oz.at.michael@gmail.com oz.at.michael@gmail.com wrote:

RobWLakes wrote

I chose to disregard the answer...I think the argument for OpenSCAD in a
Python environment...

Thanks Rob. This is not just aimed at you.

EVERYONE, yes there are some cultural discussion in other threads, but,
PLEASE REPLY TO THE TOPIC UNDER DISCUSSION.

This is: bending a shape that's only slightly complex

And follows discussion of sweep libraries, all OpenSCAD, not python.

NO, do not reply to this thread if you have an issue, don't be lazy,
start a new one, easy on the forum (click 'New Topic'),
or for Mailing-list users - send a NEW email,with a NEW Subject, todiscuss@lists.openscad.org



I personally don't have any problem implementing what I need in OpenSCAD, which is why I stick with it as I find it the simplest way to make 3D printable models. There are lots of other languages I could use if I needed something more complicated but I don't. On Fri, 11 Dec 2020 at 12:34, Rob Ward <rl.ward@bigpond.com> wrote: > My problem I very much like the OpenSCAD paradigm, ie cube(10), and I do > not want to jump ship. I just wonder how much easier these problems could > be solved if the OpenSCAD language was structured differently, preferably > modified? This question could be posed countless times to threads in this > forum, and I apologize for the vagueness of the response to this particular > thread. However solving some of these problems in OpenSCAD with even more > OpenSCAD seems like going down the proverbial Rabbit Hole. > Cheers, RobW > > On 11 December 2020 10:36:33 pm AEDT, nop head <nop.head@gmail.com> wrote: >> >> If you don't like OpenSCAD for solving problems why not use a language >> you do like? I don't think OpenSCAD will suddenly morph into Python >> anytime soon. >> >> On Fri, 11 Dec 2020 at 11:29, jon <jon@jonbondy.com> wrote: >> >>> Rob: >>> >>> If you want to talk about better programming languages, that is fine. >>> Just put it under its own topic/thread, not under a "bending" topic where >>> no one will be able to find it later. >>> >>> Jon >>> On 12/11/2020 6:01 AM, Rob Ward wrote: >>> >>> But shouldn't we always consider how a better programming language would >>> help solve these problems? Or is that OpenSCAD taboo? >>> Cheers, RobW >>> >>> On 11 December 2020 9:02:48 pm AEDT, MichaelAtOz >>> <oz.at.michael@gmail.com> <oz.at.michael@gmail.com> wrote: >>>> >>>> RobWLakes wrote >>>>> >>>>> I chose to disregard the answer...I think the argument for OpenSCAD in a >>>>> Python environment... >>>> >>>> >>>> Thanks Rob. This is not just aimed at you. >>>> >>>> EVERYONE, yes there are some cultural discussion in other threads, but, >>>> PLEASE REPLY TO THE TOPIC UNDER DISCUSSION. >>>> >>>> This is: bending a shape that's only slightly complex >>>> >>>> And follows discussion of sweep libraries, all OpenSCAD, not python. >>>> >>>> NO, do not reply to this thread if you have an issue, don't be lazy, >>>> start a new one, easy on the forum (click 'New Topic'), >>>> or for Mailing-list users - send a NEW email,with a NEW Subject, todiscuss@lists.openscad.org >>>> ------------------------------ >>>> >>>> _______________________________________________ >>> OpenSCAD mailing list >>> Discuss@lists.openscad.org >>> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org >>> >> _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org >
MM
Michael Marx
Fri, Dec 11, 2020 1:30 PM

Rob,

I SAID:

EVERYONE, yes there are some cultural discussion in other threads, but,
PLEASE REPLY TO THE TOPIC UNDER DISCUSSION.

This is: bending a shape that's only slightly complex

And follows discussion of sweep libraries, all OpenSCAD, not python.

NO, do not reply to this thread if you have an issue, don't be lazy,
start a new one, easy on the forum (click 'New Topic'),
or for Mailing-list users - send a NEW email,with a NEW Subject, to
mailto:discuss@lists.openscad.org discuss@lists.openscad.org

ATM I'm considering action. But here it is 00:12 hours.

So I will tamper my moderator action 'till morning.

NO, do not reply to this thread if you have an issue

EVERYONE please reply to the thread which is the topic that is relevant.

It would also help if you'all ignored off-topic posts, if you must please quote the 'responder' in
a NEW topic.

I resist debating the 'paradigm' here, but I may elsewhere tomorrow...

MichaelAtOz

Forum ADMIN.

No do not reply to this....I believe then 'bending' topic is complete...


From: Discuss [mailto:discuss-bounces@lists.openscad.org] On Behalf Of Rob Ward
Sent: Fri, 11 Dec 2020 23:33
To: OpenSCAD general discussion
Subject: Re: [OpenSCAD] FW: bending a shape that's only slightly complex

My problem I very much like the OpenSCAD paradigm, ie cube(10), and I do not want to jump ship. I
just wonder how much easier these problems could be solved if the OpenSCAD language was structured
differently, preferably modified? This question could be posed countless times to threads in this
forum, and I apologize for the vagueness of the response to this particular thread. However solving
some of these problems in OpenSCAD with even more OpenSCAD seems like going down the proverbial
Rabbit Hole.
Cheers, RobW

On 11 December 2020 10:36:33 pm AEDT, nop head nop.head@gmail.com wrote:

If you don't like OpenSCAD for solving problems why not use a language you do like? I don't think
OpenSCAD will suddenly morph into Python anytime soon.

On Fri, 11 Dec 2020 at 11:29, jon jon@jonbondy.com wrote:

Rob:

If you want to talk about better programming languages, that is fine.  Just put it under its own
topic/thread, not under a "bending" topic where no one will be able to find it later.

Jon

On 12/11/2020 6:01 AM, Rob Ward wrote:

But shouldn't we always consider how a better programming language would help solve these problems?
Or is that OpenSCAD taboo?
Cheers, RobW

On 11 December 2020 9:02:48 pm AEDT, MichaelAtOz  mailto:oz.at.michael@gmail.com
oz.at.michael@gmail.com wrote:

RobWLakes wrote

I chose to disregard the answer...I think the argument for OpenSCAD in a
Python environment...

Thanks Rob. This is not just aimed at you.

EVERYONE, yes there are some cultural discussion in other threads, but,
PLEASE REPLY TO THE TOPIC UNDER DISCUSSION.

This is: bending a shape that's only slightly complex

And follows discussion of sweep libraries, all OpenSCAD, not python.

NO, do not reply to this thread if you have an issue, don't be lazy,
start a new one, easy on the forum (click 'New Topic'),
or for Mailing-list users - send a NEW email,with a NEW Subject, to
discuss@lists.openscad.org



OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

--
This email has been checked for viruses by AVG.
https://www.avg.com

Rob, I SAID: EVERYONE, yes there are some cultural discussion in other threads, but, PLEASE REPLY TO THE TOPIC UNDER DISCUSSION. This is: bending a shape that's only slightly complex And follows discussion of sweep libraries, all OpenSCAD, not python. NO, do not reply to this thread if you have an issue, don't be lazy, start a new one, easy on the forum (click 'New Topic'), or for Mailing-list users - send a NEW email,with a NEW Subject, to <mailto:discuss@lists.openscad.org> discuss@lists.openscad.org ATM I'm considering action. But here it is 00:12 hours. So I will tamper my moderator action 'till morning. NO, do not reply to this thread if you have an issue EVERYONE please reply to the thread which is the topic that is relevant. It would also help if you'all ignored off-topic posts, if you must please quote the 'responder' in a NEW topic. I resist debating the 'paradigm' here, but I may elsewhere tomorrow... MichaelAtOz Forum ADMIN. No do not reply to this....I believe then 'bending' topic is complete... _____ From: Discuss [mailto:discuss-bounces@lists.openscad.org] On Behalf Of Rob Ward Sent: Fri, 11 Dec 2020 23:33 To: OpenSCAD general discussion Subject: Re: [OpenSCAD] FW: bending a shape that's only slightly complex My problem I very much like the OpenSCAD paradigm, ie cube(10), and I do not want to jump ship. I just wonder how much easier these problems could be solved if the OpenSCAD language was structured differently, preferably modified? This question could be posed countless times to threads in this forum, and I apologize for the vagueness of the response to this particular thread. However solving some of these problems in OpenSCAD with even more OpenSCAD seems like going down the proverbial Rabbit Hole. Cheers, RobW On 11 December 2020 10:36:33 pm AEDT, nop head <nop.head@gmail.com> wrote: If you don't like OpenSCAD for solving problems why not use a language you do like? I don't think OpenSCAD will suddenly morph into Python anytime soon. On Fri, 11 Dec 2020 at 11:29, jon <jon@jonbondy.com> wrote: Rob: If you want to talk about better programming languages, that is fine. Just put it under its own topic/thread, not under a "bending" topic where no one will be able to find it later. Jon On 12/11/2020 6:01 AM, Rob Ward wrote: But shouldn't we always consider how a better programming language would help solve these problems? Or is that OpenSCAD taboo? Cheers, RobW On 11 December 2020 9:02:48 pm AEDT, MichaelAtOz <mailto:oz.at.michael@gmail.com> <oz.at.michael@gmail.com> wrote: RobWLakes wrote I chose to disregard the answer...I think the argument for OpenSCAD in a Python environment... Thanks Rob. This is not just aimed at you. EVERYONE, yes there are some cultural discussion in other threads, but, PLEASE REPLY TO THE TOPIC UNDER DISCUSSION. This is: bending a shape that's only slightly complex And follows discussion of sweep libraries, all OpenSCAD, not python. NO, do not reply to this thread if you have an issue, don't be lazy, start a new one, easy on the forum (click 'New Topic'), or for Mailing-list users - send a NEW email,with a NEW Subject, to discuss@lists.openscad.org _____ _______________________________________________ OpenSCAD mailing list Discuss@lists.openscad.org http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org -- This email has been checked for viruses by AVG. https://www.avg.com
HL
Hans L
Sat, Dec 12, 2020 6:41 AM

I worked out the exact geometry of a path of circular arcs, and combined
with sweep from BOSL2 in adrianv's example.

The arc function was copied from my FunctionalOpenSCAD library:
https://github.com/thehans/FunctionalOpenSCAD (and renamed from "arc" to
"my_arc" so it doesn't conflict with BOSL2 )

Self-intersections shouldn't be an issue for most cases as long as "r2" is
somewhat larger than "radius".

oh and i decided to name your shape a "squiggy"

include<BOSL2/std.scad>
include<BOSL2/skin.scad>

radius=4;
sections = 6;
r2 = radius*2;

$fs=0.5;
$fa=1;

arcs = 2*sections;
a_ext = 180+360/arcs;
a_int = 360 - a_ext;
R_c = r2/sin(180/arcs); // radius of circle which squiggy centers lie on

squiggy_points = [
for(i=[0:1:arcs-1]) let(a_c=360i/arcs)
if (i%2) each my_arc(r=r2, angle=a_ext, offsetAngle=0+a_c,
c=R_c
[cos(a_c),sin(a_c)], center=true, endpoint=false)
else each my_arc(r=r2, angle=-a_int, offsetAngle=180+a_c,
c=R_c*[cos(a_c),sin(a_c)], center=true, endpoint=false)
];

path_sweep(circle(r=radius), squiggy_points, closed=true);

// Generate a list of points for a circular arc with center c, radius r,
etc.
// "center" parameter centers the sweep of the arc about the offsetAngle
(half to each side of it)
// "internal" parameter enables polyhole radius correction
// optional "d" parameter overrides r
// optional "fragments" parameter overrides calculations from $fn,$fs,$fa
with a direct input
// optional "endpoint" parameter specifies whether or not to include the
last point in the arc,
//    by default the endpoint is included as long as the angle is not 360
//    setting endpoint=false can be useful to avoid duplicating points if
you are concatenating arc paths together
function my_arc(r=1, angle=360, offsetAngle=0, c=[0,0], center=false,
internal=false, d, fragments, endpoint) =
let (
r1 = d==undef ? r : d/2,
fragments = fragments==undef ? ceil((abs(angle) / 360) * fragments(r1))
: fragments,
step = angle / fragments,
a = offsetAngle-(center ? angle/2 : 0),
R = internal ? to_internal(r1) : r1,
last = endpoint==undef ? (abs(angle) == 360 ? 1 : 0) : (endpoint ? 0 :
1)
)
[ for (i = [0:1:fragments-last] ) let(a2=istep+a) c+R[cos(a2), sin(a2)]
];

function fragments(r=1) = ($fn > 0) ? ($fn >= 3 ? $fn : 3) :
ceil(max(min(360.0 / $fa, r2PI / $fs), 5));

On Thu, Dec 10, 2020 at 9:43 PM adrianv avm4@cornell.edu wrote:

Nobody posted an example of what I thought was desired:

include<BOSL2/std.scad>
include<BOSL2/skin.scad>

$fn=16;
ofs = 1;
r=4;
number=5;
radius=.4;    // If this is much bigger you need path_sweep2d

path = [for(i=[0:2:359]) (r+ofssin(numberi))*[cos(i),sin(i)]];
path_sweep(circle(r=radius), path, closed=true);
// path_sweep2d(circle(r=radius), path, closed=true);

Note that if you fiddle with the parameters you can get self-intersections
to occur at the peaks of the sin wave (creases in the model) and that makes
the model invalid.  (Curiously the RC version doesn't flag this as invalid,
even though the render is wrong!)  You can  handle the self-intersections
with path_sweep2d, but it's much slower, at least to preview, than the
regular path_sweep.

BOSL2 is the Belfry OpenSCAD Library:

https://github.com/revarbat/BOSL2/wiki

I believe the dotSCAD library also includes a path_sweep module (not sure
what it's called).  And of course list-comprehension-demos has the
original
sweep().

skypuppy wrote

I'd like to know what it is before I jump down that rabbit hole.

David

On 12/10/20 8:18 PM, crunchysteve wrote:

Answered "What is BOSL2?" for myself, disregard that question :D

Cheers


Make things, travel and tell stories.

Sent from: http://forum.openscad.org/


OpenSCAD mailing list

Discuss@.openscad

Discuss@.openscad

I worked out the exact geometry of a path of circular arcs, and combined with sweep from BOSL2 in adrianv's example. The arc function was copied from my FunctionalOpenSCAD library: https://github.com/thehans/FunctionalOpenSCAD (and renamed from "arc" to "my_arc" so it doesn't conflict with BOSL2 ) Self-intersections shouldn't be an issue for most cases as long as "r2" is somewhat larger than "radius". oh and i decided to name your shape a "squiggy" include<BOSL2/std.scad> include<BOSL2/skin.scad> radius=4; sections = 6; r2 = radius*2; $fs=0.5; $fa=1; arcs = 2*sections; a_ext = 180+360/arcs; a_int = 360 - a_ext; R_c = r2/sin(180/arcs); // radius of circle which squiggy centers lie on squiggy_points = [ for(i=[0:1:arcs-1]) let(a_c=360*i/arcs) if (i%2) each my_arc(r=r2, angle=a_ext, offsetAngle=0+a_c, c=R_c*[cos(a_c),sin(a_c)], center=true, endpoint=false) else each my_arc(r=r2, angle=-a_int, offsetAngle=180+a_c, c=R_c*[cos(a_c),sin(a_c)], center=true, endpoint=false) ]; path_sweep(circle(r=radius), squiggy_points, closed=true); // Generate a list of points for a circular arc with center c, radius r, etc. // "center" parameter centers the sweep of the arc about the offsetAngle (half to each side of it) // "internal" parameter enables polyhole radius correction // optional "d" parameter overrides r // optional "fragments" parameter overrides calculations from $fn,$fs,$fa with a direct input // optional "endpoint" parameter specifies whether or not to include the last point in the arc, // by default the endpoint is included as long as the angle is not 360 // setting endpoint=false can be useful to avoid duplicating points if you are concatenating arc paths together function my_arc(r=1, angle=360, offsetAngle=0, c=[0,0], center=false, internal=false, d, fragments, endpoint) = let ( r1 = d==undef ? r : d/2, fragments = fragments==undef ? ceil((abs(angle) / 360) * fragments(r1)) : fragments, step = angle / fragments, a = offsetAngle-(center ? angle/2 : 0), R = internal ? to_internal(r1) : r1, last = endpoint==undef ? (abs(angle) == 360 ? 1 : 0) : (endpoint ? 0 : 1) ) [ for (i = [0:1:fragments-last] ) let(a2=i*step+a) c+R*[cos(a2), sin(a2)] ]; function fragments(r=1) = ($fn > 0) ? ($fn >= 3 ? $fn : 3) : ceil(max(min(360.0 / $fa, r*2*PI / $fs), 5)); On Thu, Dec 10, 2020 at 9:43 PM adrianv <avm4@cornell.edu> wrote: > Nobody posted an example of what I thought was desired: > > include<BOSL2/std.scad> > include<BOSL2/skin.scad> > > $fn=16; > ofs = 1; > r=4; > number=5; > radius=.4; // If this is much bigger you need path_sweep2d > > path = [for(i=[0:2:359]) (r+ofs*sin(number*i))*[cos(i),sin(i)]]; > path_sweep(circle(r=radius), path, closed=true); > // path_sweep2d(circle(r=radius), path, closed=true); > > Note that if you fiddle with the parameters you can get self-intersections > to occur at the peaks of the sin wave (creases in the model) and that makes > the model invalid. (Curiously the RC version doesn't flag this as invalid, > even though the render is wrong!) You can handle the self-intersections > with path_sweep2d, but it's much slower, at least to preview, than the > regular path_sweep. > > BOSL2 is the Belfry OpenSCAD Library: > > https://github.com/revarbat/BOSL2/wiki > > I believe the dotSCAD library also includes a path_sweep module (not sure > what it's called). And of course list-comprehension-demos has the > original > sweep(). > > > skypuppy wrote > > I'd like to know what it is before I jump down that rabbit hole. > > > > David > > > > > > On 12/10/20 8:18 PM, crunchysteve wrote: > >> Answered "What is BOSL2?" for myself, disregard that question :D > >> > >> Cheers > >> > >> > >> > >> ----- > >> Make things, travel and tell stories. > >> -- > >> Sent from: http://forum.openscad.org/ > >> > >> _______________________________________________ > >> OpenSCAD mailing list > >> > > > Discuss@.openscad > > >> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org > > > > _______________________________________________ > > OpenSCAD mailing list > > > Discuss@.openscad > > > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org > > > > > > -- > Sent from: http://forum.openscad.org/ > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org >