NH
nop head
Sat, Nov 27, 2021 10:22 AM
You do ask OpenSCAD to calculate it for you when you write the correct
expression using high school trig. And if that measurement is important it
should be specified as a constraint in the design so that you don't need to
measure it. For example, I have a tilted blower in my 3D primer design that
needs to be oriented to aim at the nozzle, so it has atan2() and several
sin() and cos() expressions in the design of its bracket, so it adapts to
the hot end and extruder design. I don't even know what angle it is or how
big the bracket is. I just know it will fit and can see that it fits in the
F5 preview.
NetFabb can measure it but it is quite a complex GUI problem to be able to
select arbitrary lines and vertices and calculate the distance between
them. NetFabb has 5 ways of selecting points and 9 different measurements
it can make, and that can only work in the F6 view. I only draw assembly
views in F5, so it would never work for me, other than I could measure my
STLs, which I can do in Netfabb anyway.
On Sat, 27 Nov 2021 at 09:37, Rogier Wolff R.E.Wolff@bitwizard.nl wrote:
On Fri, Nov 26, 2021 at 07:05:35PM +0000, nop head wrote:
I never need to do that because if a dimension is important I specify it
my source code and make it so in the code. Do you want to measure other
people's designs?
Recent project: I had a central "box", some margin, and then a frame
around that. And then a box to fit that frame. So my total size is:
inner_box_x + 2margin + 2framesize.
Sure I can write down the formula for that.
But what if say right side frame-size is determined by a square tilted
at an angle. Sure, I can do the trig to calculate the right side of
that tilted square, but wouldn't it be nice to ask openscad to
calculate that for me?
Roger.
I do have something difficult I need to do: somehow find a way to
marker on the rendered object interactively and locate that point. Or
compute a distance between two markers. If I can figure out a way to do
that in openscad I don't care whether it is functional or imperative or
declarative, I like it just fine - and if I can't do that then I'll
move to some other system which I would find unfortunate because so far
after a few months openSCAD has always got the job done for me.
Edmund
On Fri, Nov 26, 2021 at 4:05 PM Adrian Mariano avm4@cornell.edu
I think if you want OpenSCAD programming to "click" the answer is to
write a bunch of programs where you try to do something difficult. If
you're trying to do something and you care about efficiency then you
should try to do that thing with OpenSCAD native matrix operations
first. For example, using the fold() function above to sum up a
simple vector of numbers is 40 times slower than using a vector
product, something like:
sum_of_test = test*[for(i=test) 1]];
The second choice for efficiency (and probably the first for
readability) is to use a list comprehension. Neither of these two
methods is "functional programming". List comprehensions can do a lot
of things---anything where the value at one output point is
independent of the value at other output points. There's the business
of not being able to redefine variables, which can be an occasional
nuisance, but it's not a big issue. The main consequence is that you
have to handle all cases all at once with the ternary operator, or you
have to introduce more variables. But if you can't use a list
comprehension because the answer depends on previous answers, then you
need to use recursion. That's when things look "functional". If
you're lucky you can do this with tail recursion, and get more
efficiency. If not you'll be in a less efficient situation. The last
option is the C-style for loop, which in my testing I have found to be
the slowest option, slower than recursion. It's hard to use (usually
harder than recursion).
So is OpenSCAD a "functional language"? I'm not sure. A lot of
OpenSCAD programming doesn't really seem functional. If you want to
code in OpenSCAD then you need to learn OpenSCAD and its quirks and
not get hung up on terminology. At the end of the day, if your
program works does it matter if it was "functional" or "procedural"?
On Fri, Nov 26, 2021 at 9:19 AM Patrick Callahan
pat.callahan1@gmail.com wrote:
Sorry, It was an attempt at humor in a programming language. Never
On 26.11.21 13:38, Patrick Callahan wrote:
Sure, but why?
array = [ for (msg = [ for ([0:9]) "blah" ]) echo(msg) msg ];
ciao,
Torsten.
OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org
You do ask OpenSCAD to calculate it for you when you write the correct
expression using high school trig. And if that measurement is important it
should be specified as a constraint in the design so that you don't need to
measure it. For example, I have a tilted blower in my 3D primer design that
needs to be oriented to aim at the nozzle, so it has atan2() and several
sin() and cos() expressions in the design of its bracket, so it adapts to
the hot end and extruder design. I don't even know what angle it is or how
big the bracket is. I just know it will fit and can see that it fits in the
F5 preview.
NetFabb can measure it but it is quite a complex GUI problem to be able to
select arbitrary lines and vertices and calculate the distance between
them. NetFabb has 5 ways of selecting points and 9 different measurements
it can make, and that can only work in the F6 view. I only draw assembly
views in F5, so it would never work for me, other than I could measure my
STLs, which I can do in Netfabb anyway.
On Sat, 27 Nov 2021 at 09:37, Rogier Wolff <R.E.Wolff@bitwizard.nl> wrote:
> On Fri, Nov 26, 2021 at 07:05:35PM +0000, nop head wrote:
> > I never need to do that because if a dimension is important I specify it
> in
> > my source code and make it so in the code. Do you want to measure other
> > people's designs?
>
> Recent project: I had a central "box", some margin, and then a frame
> around that. And then a box to fit that frame. So my total size is:
> inner_box_x + 2*margin + 2*framesize.
>
> Sure I can write down the formula for that.
>
> But what if say right side frame-size is determined by a square tilted
> at an angle. Sure, I can do the trig to calculate the right side of
> that tilted square, but wouldn't it be nice to ask openscad to
> calculate that for me?
>
> Roger.
>
> >
> > On Fri, 26 Nov 2021 at 18:52, edmund ronald <edmundronald@gmail.com>
> wrote:
> >
> > > I do have something difficult I need to do: somehow find a way to
> place a
> > > marker on the rendered object interactively and locate that point. Or
> even
> > > compute a distance between two markers. If I can figure out a way to do
> > > that in openscad I don't care whether it is functional or imperative or
> > > declarative, I like it just fine - and if I can't do that then I'll
> have to
> > > move to some other system which I would find unfortunate because so far
> > > after a few months openSCAD has always got the job done for me.
> > >
> > > Edmund
> > >
> > > On Fri, Nov 26, 2021 at 4:05 PM Adrian Mariano <avm4@cornell.edu>
> wrote:
> > >
> > >> I think if you want OpenSCAD programming to "click" the answer is to
> > >> write a bunch of programs where you try to do something difficult. If
> > >> you're trying to do something and you care about efficiency then you
> > >> should try to do that thing with OpenSCAD native matrix operations
> > >> first. For example, using the fold() function above to sum up a
> > >> simple vector of numbers is 40 times slower than using a vector
> > >> product, something like:
> > >>
> > >> sum_of_test = test*[for(i=test) 1]];
> > >>
> > >> The second choice for efficiency (and probably the first for
> > >> readability) is to use a list comprehension. Neither of these two
> > >> methods is "functional programming". List comprehensions can do a lot
> > >> of things---anything where the value at one output point is
> > >> independent of the value at other output points. There's the business
> > >> of not being able to redefine variables, which can be an occasional
> > >> nuisance, but it's not a big issue. The main consequence is that you
> > >> have to handle all cases all at once with the ternary operator, or you
> > >> have to introduce more variables. But if you can't use a list
> > >> comprehension because the answer depends on previous answers, then you
> > >> need to use recursion. That's when things look "functional". If
> > >> you're lucky you can do this with tail recursion, and get more
> > >> efficiency. If not you'll be in a less efficient situation. The last
> > >> option is the C-style for loop, which in my testing I have found to be
> > >> the slowest option, slower than recursion. It's hard to use (usually
> > >> harder than recursion).
> > >>
> > >> So is OpenSCAD a "functional language"? I'm not sure. A lot of
> > >> OpenSCAD programming doesn't really seem functional. If you want to
> > >> code in OpenSCAD then you need to learn OpenSCAD and its quirks and
> > >> not get hung up on terminology. At the end of the day, if your
> > >> program works does it matter if it was "functional" or "procedural"?
> > >>
> > >> On Fri, Nov 26, 2021 at 9:19 AM Patrick Callahan
> > >> <pat.callahan1@gmail.com> wrote:
> > >> >
> > >> > Sorry, It was an attempt at humor in a programming language. Never
> a
> > >> good idea.
> > >> >
> > >> > -Pat
> > >> >
> > >> > On Fri, Nov 26, 2021 at 8:33 AM Torsten Paul <Torsten.Paul@gmx.de>
> > >> wrote:
> > >> >>
> > >> >> On 26.11.21 13:38, Patrick Callahan wrote:
> > >> >> > Can you do this?
> > >> >>
> > >> >> Sure, but why?
> > >> >>
> > >> >> array = [ for (msg = [ for ([0:9]) "blah" ]) echo(msg) msg ];
> > >> >>
> > >> >> ciao,
> > >> >> Torsten.
> > >> >> _______________________________________________
> > >> >> 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
> > >> _______________________________________________
> > >> 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
> > >
>
> > _______________________________________________
> > OpenSCAD mailing list
> > To unsubscribe send an email to discuss-leave@lists.openscad.org
>
>
> --
> ** 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
>
RW
Raymond West
Sat, Nov 27, 2021 11:01 AM
On 27/11/2021 09:36, Rogier Wolff wrote:
On Fri, Nov 26, 2021 at 07:05:35PM +0000, nop head wrote:
I never need to do that because if a dimension is important I specify it in
my source code and make it so in the code. Do you want to measure other
people's designs?
Recent project: I had a central "box", some margin, and then a frame
around that. And then a box to fit that frame. So my total size is:
inner_box_x + 2margin + 2framesize.
Sure I can write down the formula for that.
But what if say right side frame-size is determined by a square tilted
at an angle. Sure, I can do the trig to calculate the right side of
that tilted square, but wouldn't it be nice to ask openscad to
calculate that for me?
Roger.
Hi Roger,
How do you define the points you are interested in? I think the only
general way is to 'eyeball' it, in which case then a 'norm' between the
points will measure it for you. Without manually locating a point, how
could you mathematically define 'Anie's ear lobes' in my previous post?
It is not too difficult, flitting between plan and side view, gradually
translating it to where you want it to be, to whatever tolerance you want.
On Fri, 26 Nov 2021 at 18:52, edmund ronald edmundronald@gmail.com wrote:
I do have something difficult I need to do: somehow find a way to place a
marker on the rendered object interactively and locate that point. Or even
compute a distance between two markers. If I can figure out a way to do
that in openscad I don't care whether it is functional or imperative or
declarative, I like it just fine - and if I can't do that then I'll have to
move to some other system which I would find unfortunate because so far
after a few months openSCAD has always got the job done for me.
Edmund
On Fri, Nov 26, 2021 at 4:05 PM Adrian Mariano avm4@cornell.edu wrote:
I think if you want OpenSCAD programming to "click" the answer is to
write a bunch of programs where you try to do something difficult. If
you're trying to do something and you care about efficiency then you
should try to do that thing with OpenSCAD native matrix operations
first. For example, using the fold() function above to sum up a
simple vector of numbers is 40 times slower than using a vector
product, something like:
sum_of_test = test*[for(i=test) 1]];
The second choice for efficiency (and probably the first for
readability) is to use a list comprehension. Neither of these two
methods is "functional programming". List comprehensions can do a lot
of things---anything where the value at one output point is
independent of the value at other output points. There's the business
of not being able to redefine variables, which can be an occasional
nuisance, but it's not a big issue. The main consequence is that you
have to handle all cases all at once with the ternary operator, or you
have to introduce more variables. But if you can't use a list
comprehension because the answer depends on previous answers, then you
need to use recursion. That's when things look "functional". If
you're lucky you can do this with tail recursion, and get more
efficiency. If not you'll be in a less efficient situation. The last
option is the C-style for loop, which in my testing I have found to be
the slowest option, slower than recursion. It's hard to use (usually
harder than recursion).
So is OpenSCAD a "functional language"? I'm not sure. A lot of
OpenSCAD programming doesn't really seem functional. If you want to
code in OpenSCAD then you need to learn OpenSCAD and its quirks and
not get hung up on terminology. At the end of the day, if your
program works does it matter if it was "functional" or "procedural"?
On Fri, Nov 26, 2021 at 9:19 AM Patrick Callahan
pat.callahan1@gmail.com wrote:
Sorry, It was an attempt at humor in a programming language. Never a
good idea.
-Pat
On Fri, Nov 26, 2021 at 8:33 AM Torsten Paul Torsten.Paul@gmx.de
wrote:
On 26.11.21 13:38, Patrick Callahan wrote:
Can you do this?
Sure, but why?
array = [ for (msg = [ for ([0:9]) "blah" ]) echo(msg) msg ];
ciao,
Torsten.
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
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
OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org
On 27/11/2021 09:36, Rogier Wolff wrote:
> On Fri, Nov 26, 2021 at 07:05:35PM +0000, nop head wrote:
>> I never need to do that because if a dimension is important I specify it in
>> my source code and make it so in the code. Do you want to measure other
>> people's designs?
> Recent project: I had a central "box", some margin, and then a frame
> around that. And then a box to fit that frame. So my total size is:
> inner_box_x + 2*margin + 2*framesize.
>
> Sure I can write down the formula for that.
>
> But what if say right side frame-size is determined by a square tilted
> at an angle. Sure, I can do the trig to calculate the right side of
> that tilted square, but wouldn't it be nice to ask openscad to
> calculate that for me?
>
> Roger.
Hi Roger,
How do you define the points you are interested in? I think the only
general way is to 'eyeball' it, in which case then a 'norm' between the
points will measure it for you. Without manually locating a point, how
could you mathematically define 'Anie's ear lobes' in my previous post?
It is not too difficult, flitting between plan and side view, gradually
translating it to where you want it to be, to whatever tolerance you want.
>> On Fri, 26 Nov 2021 at 18:52, edmund ronald <edmundronald@gmail.com> wrote:
>>
>>> I do have something difficult I need to do: somehow find a way to place a
>>> marker on the rendered object interactively and locate that point. Or even
>>> compute a distance between two markers. If I can figure out a way to do
>>> that in openscad I don't care whether it is functional or imperative or
>>> declarative, I like it just fine - and if I can't do that then I'll have to
>>> move to some other system which I would find unfortunate because so far
>>> after a few months openSCAD has always got the job done for me.
>>>
>>> Edmund
>>>
>>> On Fri, Nov 26, 2021 at 4:05 PM Adrian Mariano <avm4@cornell.edu> wrote:
>>>
>>>> I think if you want OpenSCAD programming to "click" the answer is to
>>>> write a bunch of programs where you try to do something difficult. If
>>>> you're trying to do something and you care about efficiency then you
>>>> should try to do that thing with OpenSCAD native matrix operations
>>>> first. For example, using the fold() function above to sum up a
>>>> simple vector of numbers is 40 times slower than using a vector
>>>> product, something like:
>>>>
>>>> sum_of_test = test*[for(i=test) 1]];
>>>>
>>>> The second choice for efficiency (and probably the first for
>>>> readability) is to use a list comprehension. Neither of these two
>>>> methods is "functional programming". List comprehensions can do a lot
>>>> of things---anything where the value at one output point is
>>>> independent of the value at other output points. There's the business
>>>> of not being able to redefine variables, which can be an occasional
>>>> nuisance, but it's not a big issue. The main consequence is that you
>>>> have to handle all cases all at once with the ternary operator, or you
>>>> have to introduce more variables. But if you can't use a list
>>>> comprehension because the answer depends on previous answers, then you
>>>> need to use recursion. That's when things look "functional". If
>>>> you're lucky you can do this with tail recursion, and get more
>>>> efficiency. If not you'll be in a less efficient situation. The last
>>>> option is the C-style for loop, which in my testing I have found to be
>>>> the slowest option, slower than recursion. It's hard to use (usually
>>>> harder than recursion).
>>>>
>>>> So is OpenSCAD a "functional language"? I'm not sure. A lot of
>>>> OpenSCAD programming doesn't really seem functional. If you want to
>>>> code in OpenSCAD then you need to learn OpenSCAD and its quirks and
>>>> not get hung up on terminology. At the end of the day, if your
>>>> program works does it matter if it was "functional" or "procedural"?
>>>>
>>>> On Fri, Nov 26, 2021 at 9:19 AM Patrick Callahan
>>>> <pat.callahan1@gmail.com> wrote:
>>>>> Sorry, It was an attempt at humor in a programming language. Never a
>>>> good idea.
>>>>> -Pat
>>>>>
>>>>> On Fri, Nov 26, 2021 at 8:33 AM Torsten Paul <Torsten.Paul@gmx.de>
>>>> wrote:
>>>>>> On 26.11.21 13:38, Patrick Callahan wrote:
>>>>>>> Can you do this?
>>>>>> Sure, but why?
>>>>>>
>>>>>> array = [ for (msg = [ for ([0:9]) "blah" ]) echo(msg) msg ];
>>>>>>
>>>>>> ciao,
>>>>>> Torsten.
>>>>>> _______________________________________________
>>>>>> 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
>>>> _______________________________________________
>>>> 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
>>>
>> _______________________________________________
>> OpenSCAD mailing list
>> To unsubscribe send an email to discuss-leave@lists.openscad.org
>
ER
edmund ronald
Sat, Nov 27, 2021 1:49 PM
Raymond,
I think you make an interesting point: Some design work is done entirely by
eye. When placing a decoration, I I guess I look at the thing, choose a
spot, and then I say "I want the decoration there". Which leaves me with
the problem of placing a marker on the rendering and doing a couple of
measurements.
This isn't about the OpenSCAD language at all, it is about a functionality
embedded in the visualiser. Just as parenthesis matching can be embedded in
a code editor. The code editor blinks the caret to show where you are
typing, and then puts a character there if you hit a key, the visualiser
shows a cursor to show where your virtual hand is, and then if you choose a
certain click to occur it will choose to move the view as of now, or to
drop a marker in a possible mod, or some other ideas which the developers
might find useful themselves.
I think somebody posted code at one point to create a second axis set, and
that could possibly work as a point of departure for such a function.
Edmund
On Sat, Nov 27, 2021 at 12:02 PM Raymond West raywest@raywest.com wrote:
On 27/11/2021 09:36, Rogier Wolff wrote:
On Fri, Nov 26, 2021 at 07:05:35PM +0000, nop head wrote:
I never need to do that because if a dimension is important I specify
my source code and make it so in the code. Do you want to measure other
people's designs?
Recent project: I had a central "box", some margin, and then a frame
around that. And then a box to fit that frame. So my total size is:
inner_box_x + 2margin + 2framesize.
Sure I can write down the formula for that.
But what if say right side frame-size is determined by a square tilted
at an angle. Sure, I can do the trig to calculate the right side of
that tilted square, but wouldn't it be nice to ask openscad to
calculate that for me?
Roger.
Hi Roger,
How do you define the points you are interested in? I think the only
general way is to 'eyeball' it, in which case then a 'norm' between the
points will measure it for you. Without manually locating a point, how
could you mathematically define 'Anie's ear lobes' in my previous post?
It is not too difficult, flitting between plan and side view, gradually
translating it to where you want it to be, to whatever tolerance you want.
I do have something difficult I need to do: somehow find a way to
marker on the rendered object interactively and locate that point. Or
compute a distance between two markers. If I can figure out a way to do
that in openscad I don't care whether it is functional or imperative or
declarative, I like it just fine - and if I can't do that then I'll
move to some other system which I would find unfortunate because so far
after a few months openSCAD has always got the job done for me.
Edmund
On Fri, Nov 26, 2021 at 4:05 PM Adrian Mariano avm4@cornell.edu
I think if you want OpenSCAD programming to "click" the answer is to
write a bunch of programs where you try to do something difficult. If
you're trying to do something and you care about efficiency then you
should try to do that thing with OpenSCAD native matrix operations
first. For example, using the fold() function above to sum up a
simple vector of numbers is 40 times slower than using a vector
product, something like:
sum_of_test = test*[for(i=test) 1]];
The second choice for efficiency (and probably the first for
readability) is to use a list comprehension. Neither of these two
methods is "functional programming". List comprehensions can do a lot
of things---anything where the value at one output point is
independent of the value at other output points. There's the business
of not being able to redefine variables, which can be an occasional
nuisance, but it's not a big issue. The main consequence is that you
have to handle all cases all at once with the ternary operator, or you
have to introduce more variables. But if you can't use a list
comprehension because the answer depends on previous answers, then you
need to use recursion. That's when things look "functional". If
you're lucky you can do this with tail recursion, and get more
efficiency. If not you'll be in a less efficient situation. The last
option is the C-style for loop, which in my testing I have found to be
the slowest option, slower than recursion. It's hard to use (usually
harder than recursion).
So is OpenSCAD a "functional language"? I'm not sure. A lot of
OpenSCAD programming doesn't really seem functional. If you want to
code in OpenSCAD then you need to learn OpenSCAD and its quirks and
not get hung up on terminology. At the end of the day, if your
program works does it matter if it was "functional" or "procedural"?
On Fri, Nov 26, 2021 at 9:19 AM Patrick Callahan
pat.callahan1@gmail.com wrote:
Sorry, It was an attempt at humor in a programming language. Never a
On 26.11.21 13:38, Patrick Callahan wrote:
Sure, but why?
array = [ for (msg = [ for ([0:9]) "blah" ]) echo(msg) msg ];
ciao,
Torsten.
OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org
Raymond,
I think you make an interesting point: Some design work is done entirely by
eye. When placing a decoration, I I guess I look at the thing, choose a
spot, and then I say "I want the decoration there". Which leaves me with
the problem of placing a marker on the rendering and doing a couple of
measurements.
This isn't about the OpenSCAD language at all, it is about a functionality
embedded in the visualiser. Just as parenthesis matching can be embedded in
a code editor. The code editor blinks the caret to show where you are
typing, and then puts a character there if you hit a key, the visualiser
shows a cursor to show where your virtual hand is, and then if you choose a
certain click to occur it will choose to move the view as of now, or to
drop a marker in a possible mod, or some other ideas which the developers
might find useful themselves.
I think somebody posted code at one point to create a second axis set, and
that could possibly work as a point of departure for such a function.
Edmund
On Sat, Nov 27, 2021 at 12:02 PM Raymond West <raywest@raywest.com> wrote:
>
> On 27/11/2021 09:36, Rogier Wolff wrote:
> > On Fri, Nov 26, 2021 at 07:05:35PM +0000, nop head wrote:
> >> I never need to do that because if a dimension is important I specify
> it in
> >> my source code and make it so in the code. Do you want to measure other
> >> people's designs?
> > Recent project: I had a central "box", some margin, and then a frame
> > around that. And then a box to fit that frame. So my total size is:
> > inner_box_x + 2*margin + 2*framesize.
> >
> > Sure I can write down the formula for that.
> >
> > But what if say right side frame-size is determined by a square tilted
> > at an angle. Sure, I can do the trig to calculate the right side of
> > that tilted square, but wouldn't it be nice to ask openscad to
> > calculate that for me?
> >
> > Roger.
>
> Hi Roger,
>
> How do you define the points you are interested in? I think the only
> general way is to 'eyeball' it, in which case then a 'norm' between the
> points will measure it for you. Without manually locating a point, how
> could you mathematically define 'Anie's ear lobes' in my previous post?
> It is not too difficult, flitting between plan and side view, gradually
> translating it to where you want it to be, to whatever tolerance you want.
>
>
> >> On Fri, 26 Nov 2021 at 18:52, edmund ronald <edmundronald@gmail.com>
> wrote:
> >>
> >>> I do have something difficult I need to do: somehow find a way to
> place a
> >>> marker on the rendered object interactively and locate that point. Or
> even
> >>> compute a distance between two markers. If I can figure out a way to do
> >>> that in openscad I don't care whether it is functional or imperative or
> >>> declarative, I like it just fine - and if I can't do that then I'll
> have to
> >>> move to some other system which I would find unfortunate because so far
> >>> after a few months openSCAD has always got the job done for me.
> >>>
> >>> Edmund
> >>>
> >>> On Fri, Nov 26, 2021 at 4:05 PM Adrian Mariano <avm4@cornell.edu>
> wrote:
> >>>
> >>>> I think if you want OpenSCAD programming to "click" the answer is to
> >>>> write a bunch of programs where you try to do something difficult. If
> >>>> you're trying to do something and you care about efficiency then you
> >>>> should try to do that thing with OpenSCAD native matrix operations
> >>>> first. For example, using the fold() function above to sum up a
> >>>> simple vector of numbers is 40 times slower than using a vector
> >>>> product, something like:
> >>>>
> >>>> sum_of_test = test*[for(i=test) 1]];
> >>>>
> >>>> The second choice for efficiency (and probably the first for
> >>>> readability) is to use a list comprehension. Neither of these two
> >>>> methods is "functional programming". List comprehensions can do a lot
> >>>> of things---anything where the value at one output point is
> >>>> independent of the value at other output points. There's the business
> >>>> of not being able to redefine variables, which can be an occasional
> >>>> nuisance, but it's not a big issue. The main consequence is that you
> >>>> have to handle all cases all at once with the ternary operator, or you
> >>>> have to introduce more variables. But if you can't use a list
> >>>> comprehension because the answer depends on previous answers, then you
> >>>> need to use recursion. That's when things look "functional". If
> >>>> you're lucky you can do this with tail recursion, and get more
> >>>> efficiency. If not you'll be in a less efficient situation. The last
> >>>> option is the C-style for loop, which in my testing I have found to be
> >>>> the slowest option, slower than recursion. It's hard to use (usually
> >>>> harder than recursion).
> >>>>
> >>>> So is OpenSCAD a "functional language"? I'm not sure. A lot of
> >>>> OpenSCAD programming doesn't really seem functional. If you want to
> >>>> code in OpenSCAD then you need to learn OpenSCAD and its quirks and
> >>>> not get hung up on terminology. At the end of the day, if your
> >>>> program works does it matter if it was "functional" or "procedural"?
> >>>>
> >>>> On Fri, Nov 26, 2021 at 9:19 AM Patrick Callahan
> >>>> <pat.callahan1@gmail.com> wrote:
> >>>>> Sorry, It was an attempt at humor in a programming language. Never a
> >>>> good idea.
> >>>>> -Pat
> >>>>>
> >>>>> On Fri, Nov 26, 2021 at 8:33 AM Torsten Paul <Torsten.Paul@gmx.de>
> >>>> wrote:
> >>>>>> On 26.11.21 13:38, Patrick Callahan wrote:
> >>>>>>> Can you do this?
> >>>>>> Sure, but why?
> >>>>>>
> >>>>>> array = [ for (msg = [ for ([0:9]) "blah" ]) echo(msg) msg ];
> >>>>>>
> >>>>>> ciao,
> >>>>>> Torsten.
> >>>>>> _______________________________________________
> >>>>>> 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
> >>>> _______________________________________________
> >>>> 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
> >>>
> >> _______________________________________________
> >> 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
>
AM
Adrian Mariano
Sat, Nov 27, 2021 2:22 PM
It seems to me that edmund wants to be able to look at the model,
click the mouse and get the point---and Openscad gives
[3.43434,5.643543,-4.564353]---and then he copies that number into his
program to position some decoration. To me this seems like it's just
not the right way to use OpenSCAD. If you want to do this sort of
thing you should be using some other program. The value of OpenSCAD
is that you can define your parameters and build the model from them
and then if you need to change the parameters, it is easy to do so.
But with the above approach, you cannot change the model parameters
because you have hard coded a value. OpenSCAD is not the tool for all
design problems.
The other thing that was mentioned was verifying that constraints are
met. I think if you want to do that you should embody the constraints
into your model. Then you can visually observe if they are met or
not. Analogous to this is creating a ruler into your model to measure
something.
The example was given to create a square that surrounds another square
tilted at an arbitrary angle. I know there are folks here who love to
get up close and personal with the trigonometry, but despite my
mastery of that subject, I prefer to have the computer do it for me.
I think it's easier to write and debug the code and easier to read it
tomorrow. A solution shown below will also generalize to any
transformation of the square you please. The idea that one should do
this in OpenSCAD by drawing a rotated square, clicking the mouse to
find a point, and then writing code based on that value seems like a
great misunderstanding of how OpenSCAD should be used.
include<BOSL2/std.scad>
angle = 17;
rotsquare = zrot(angle, square(10));
bounds = pointlist_bounds(rotsquare);
translate(bounds[0])
square(bounds[1]-bounds[0]);
color("green")polygon(rotsquare);
On Sat, Nov 27, 2021 at 6:02 AM Raymond West raywest@raywest.com wrote:
On 27/11/2021 09:36, Rogier Wolff wrote:
On Fri, Nov 26, 2021 at 07:05:35PM +0000, nop head wrote:
I never need to do that because if a dimension is important I specify it in
my source code and make it so in the code. Do you want to measure other
people's designs?
Recent project: I had a central "box", some margin, and then a frame
around that. And then a box to fit that frame. So my total size is:
inner_box_x + 2margin + 2framesize.
Sure I can write down the formula for that.
But what if say right side frame-size is determined by a square tilted
at an angle. Sure, I can do the trig to calculate the right side of
that tilted square, but wouldn't it be nice to ask openscad to
calculate that for me?
Roger.
Hi Roger,
How do you define the points you are interested in? I think the only
general way is to 'eyeball' it, in which case then a 'norm' between the
points will measure it for you. Without manually locating a point, how
could you mathematically define 'Anie's ear lobes' in my previous post?
It is not too difficult, flitting between plan and side view, gradually
translating it to where you want it to be, to whatever tolerance you want.
I do have something difficult I need to do: somehow find a way to place a
marker on the rendered object interactively and locate that point. Or even
compute a distance between two markers. If I can figure out a way to do
that in openscad I don't care whether it is functional or imperative or
declarative, I like it just fine - and if I can't do that then I'll have to
move to some other system which I would find unfortunate because so far
after a few months openSCAD has always got the job done for me.
Edmund
On Fri, Nov 26, 2021 at 4:05 PM Adrian Mariano avm4@cornell.edu wrote:
I think if you want OpenSCAD programming to "click" the answer is to
write a bunch of programs where you try to do something difficult. If
you're trying to do something and you care about efficiency then you
should try to do that thing with OpenSCAD native matrix operations
first. For example, using the fold() function above to sum up a
simple vector of numbers is 40 times slower than using a vector
product, something like:
sum_of_test = test*[for(i=test) 1]];
The second choice for efficiency (and probably the first for
readability) is to use a list comprehension. Neither of these two
methods is "functional programming". List comprehensions can do a lot
of things---anything where the value at one output point is
independent of the value at other output points. There's the business
of not being able to redefine variables, which can be an occasional
nuisance, but it's not a big issue. The main consequence is that you
have to handle all cases all at once with the ternary operator, or you
have to introduce more variables. But if you can't use a list
comprehension because the answer depends on previous answers, then you
need to use recursion. That's when things look "functional". If
you're lucky you can do this with tail recursion, and get more
efficiency. If not you'll be in a less efficient situation. The last
option is the C-style for loop, which in my testing I have found to be
the slowest option, slower than recursion. It's hard to use (usually
harder than recursion).
So is OpenSCAD a "functional language"? I'm not sure. A lot of
OpenSCAD programming doesn't really seem functional. If you want to
code in OpenSCAD then you need to learn OpenSCAD and its quirks and
not get hung up on terminology. At the end of the day, if your
program works does it matter if it was "functional" or "procedural"?
On Fri, Nov 26, 2021 at 9:19 AM Patrick Callahan
pat.callahan1@gmail.com wrote:
Sorry, It was an attempt at humor in a programming language. Never a
On 26.11.21 13:38, Patrick Callahan wrote:
Sure, but why?
array = [ for (msg = [ for ([0:9]) "blah" ]) echo(msg) msg ];
ciao,
Torsten.
OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org
It seems to me that edmund wants to be able to look at the model,
click the mouse and get the point---and Openscad gives
[3.43434,5.643543,-4.564353]---and then he copies that number into his
program to position some decoration. To me this seems like it's just
not the right way to use OpenSCAD. If you want to do this sort of
thing you should be using some other program. The value of OpenSCAD
is that you can define your parameters and build the model from them
and then if you need to change the parameters, it is easy to do so.
But with the above approach, you cannot change the model parameters
because you have hard coded a value. OpenSCAD is not the tool for all
design problems.
The other thing that was mentioned was verifying that constraints are
met. I think if you want to do that you should embody the constraints
into your model. Then you can visually observe if they are met or
not. Analogous to this is creating a ruler into your model to measure
something.
The example was given to create a square that surrounds another square
tilted at an arbitrary angle. I know there are folks here who love to
get up close and personal with the trigonometry, but despite my
mastery of that subject, I prefer to have the computer do it for me.
I think it's easier to write and debug the code and easier to read it
tomorrow. A solution shown below will also generalize to any
transformation of the square you please. The idea that one should do
this in OpenSCAD by drawing a rotated square, clicking the mouse to
find a point, and then writing code based on that value seems like a
great misunderstanding of how OpenSCAD should be used.
include<BOSL2/std.scad>
angle = 17;
rotsquare = zrot(angle, square(10));
bounds = pointlist_bounds(rotsquare);
translate(bounds[0])
square(bounds[1]-bounds[0]);
color("green")polygon(rotsquare);
On Sat, Nov 27, 2021 at 6:02 AM Raymond West <raywest@raywest.com> wrote:
>
>
> On 27/11/2021 09:36, Rogier Wolff wrote:
> > On Fri, Nov 26, 2021 at 07:05:35PM +0000, nop head wrote:
> >> I never need to do that because if a dimension is important I specify it in
> >> my source code and make it so in the code. Do you want to measure other
> >> people's designs?
> > Recent project: I had a central "box", some margin, and then a frame
> > around that. And then a box to fit that frame. So my total size is:
> > inner_box_x + 2*margin + 2*framesize.
> >
> > Sure I can write down the formula for that.
> >
> > But what if say right side frame-size is determined by a square tilted
> > at an angle. Sure, I can do the trig to calculate the right side of
> > that tilted square, but wouldn't it be nice to ask openscad to
> > calculate that for me?
> >
> > Roger.
>
> Hi Roger,
>
> How do you define the points you are interested in? I think the only
> general way is to 'eyeball' it, in which case then a 'norm' between the
> points will measure it for you. Without manually locating a point, how
> could you mathematically define 'Anie's ear lobes' in my previous post?
> It is not too difficult, flitting between plan and side view, gradually
> translating it to where you want it to be, to whatever tolerance you want.
>
>
> >> On Fri, 26 Nov 2021 at 18:52, edmund ronald <edmundronald@gmail.com> wrote:
> >>
> >>> I do have something difficult I need to do: somehow find a way to place a
> >>> marker on the rendered object interactively and locate that point. Or even
> >>> compute a distance between two markers. If I can figure out a way to do
> >>> that in openscad I don't care whether it is functional or imperative or
> >>> declarative, I like it just fine - and if I can't do that then I'll have to
> >>> move to some other system which I would find unfortunate because so far
> >>> after a few months openSCAD has always got the job done for me.
> >>>
> >>> Edmund
> >>>
> >>> On Fri, Nov 26, 2021 at 4:05 PM Adrian Mariano <avm4@cornell.edu> wrote:
> >>>
> >>>> I think if you want OpenSCAD programming to "click" the answer is to
> >>>> write a bunch of programs where you try to do something difficult. If
> >>>> you're trying to do something and you care about efficiency then you
> >>>> should try to do that thing with OpenSCAD native matrix operations
> >>>> first. For example, using the fold() function above to sum up a
> >>>> simple vector of numbers is 40 times slower than using a vector
> >>>> product, something like:
> >>>>
> >>>> sum_of_test = test*[for(i=test) 1]];
> >>>>
> >>>> The second choice for efficiency (and probably the first for
> >>>> readability) is to use a list comprehension. Neither of these two
> >>>> methods is "functional programming". List comprehensions can do a lot
> >>>> of things---anything where the value at one output point is
> >>>> independent of the value at other output points. There's the business
> >>>> of not being able to redefine variables, which can be an occasional
> >>>> nuisance, but it's not a big issue. The main consequence is that you
> >>>> have to handle all cases all at once with the ternary operator, or you
> >>>> have to introduce more variables. But if you can't use a list
> >>>> comprehension because the answer depends on previous answers, then you
> >>>> need to use recursion. That's when things look "functional". If
> >>>> you're lucky you can do this with tail recursion, and get more
> >>>> efficiency. If not you'll be in a less efficient situation. The last
> >>>> option is the C-style for loop, which in my testing I have found to be
> >>>> the slowest option, slower than recursion. It's hard to use (usually
> >>>> harder than recursion).
> >>>>
> >>>> So is OpenSCAD a "functional language"? I'm not sure. A lot of
> >>>> OpenSCAD programming doesn't really seem functional. If you want to
> >>>> code in OpenSCAD then you need to learn OpenSCAD and its quirks and
> >>>> not get hung up on terminology. At the end of the day, if your
> >>>> program works does it matter if it was "functional" or "procedural"?
> >>>>
> >>>> On Fri, Nov 26, 2021 at 9:19 AM Patrick Callahan
> >>>> <pat.callahan1@gmail.com> wrote:
> >>>>> Sorry, It was an attempt at humor in a programming language. Never a
> >>>> good idea.
> >>>>> -Pat
> >>>>>
> >>>>> On Fri, Nov 26, 2021 at 8:33 AM Torsten Paul <Torsten.Paul@gmx.de>
> >>>> wrote:
> >>>>>> On 26.11.21 13:38, Patrick Callahan wrote:
> >>>>>>> Can you do this?
> >>>>>> Sure, but why?
> >>>>>>
> >>>>>> array = [ for (msg = [ for ([0:9]) "blah" ]) echo(msg) msg ];
> >>>>>>
> >>>>>> ciao,
> >>>>>> Torsten.
> >>>>>> _______________________________________________
> >>>>>> 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
> >>>> _______________________________________________
> >>>> 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
> >>>
> >> _______________________________________________
> >> 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
Sat, Nov 27, 2021 2:23 PM
On 26.11.21 21:30, edmund ronald wrote:
I have looked in the archives and people keep asking for
this and the answer given to them seems to be repeatedly
that "real men know their dimensions" :)
Not relevant. Some people may not need that, that's fine.
That has nothing to do with a feature request.
I think someone has even tried to put a bounty on such a
measuring feature, which shows how desperate people are.
Yes, the bounty exists (at $370 currently) and this would
be a very welcome addition.
ciao,
Torsten.
On 26.11.21 21:30, edmund ronald wrote:
> I have looked in the archives and people keep asking for
> this and the answer given to them seems to be repeatedly
> that "real men know their dimensions" :)
Not relevant. Some people may not need that, that's fine.
That has nothing to do with a feature request.
> I think someone has even tried to put a bounty on such a
> measuring feature, which shows how desperate people are.
Yes, the bounty exists (at $370 currently) and this would
be a very welcome addition.
ciao,
Torsten.
ER
edmund ronald
Sat, Nov 27, 2021 3:00 PM
Adrian,
You understand perfectly well that a constructive solution does not solve
an inverse problem.
Telling people they should agically be able to invert the equations for
something is a cute way to say "go away you idiot".
Edmund
On Sat, Nov 27, 2021 at 3:24 PM Adrian Mariano avm4@cornell.edu wrote:
It seems to me that edmund wants to be able to look at the model,
click the mouse and get the point---and Openscad gives
[3.43434,5.643543,-4.564353]---and then he copies that number into his
program to position some decoration. To me this seems like it's just
not the right way to use OpenSCAD. If you want to do this sort of
thing you should be using some other program. The value of OpenSCAD
is that you can define your parameters and build the model from them
and then if you need to change the parameters, it is easy to do so.
But with the above approach, you cannot change the model parameters
because you have hard coded a value. OpenSCAD is not the tool for all
design problems.
The other thing that was mentioned was verifying that constraints are
met. I think if you want to do that you should embody the constraints
into your model. Then you can visually observe if they are met or
not. Analogous to this is creating a ruler into your model to measure
something.
The example was given to create a square that surrounds another square
tilted at an arbitrary angle. I know there are folks here who love to
get up close and personal with the trigonometry, but despite my
mastery of that subject, I prefer to have the computer do it for me.
I think it's easier to write and debug the code and easier to read it
tomorrow. A solution shown below will also generalize to any
transformation of the square you please. The idea that one should do
this in OpenSCAD by drawing a rotated square, clicking the mouse to
find a point, and then writing code based on that value seems like a
great misunderstanding of how OpenSCAD should be used.
include<BOSL2/std.scad>
angle = 17;
rotsquare = zrot(angle, square(10));
bounds = pointlist_bounds(rotsquare);
translate(bounds[0])
square(bounds[1]-bounds[0]);
color("green")polygon(rotsquare);
On Sat, Nov 27, 2021 at 6:02 AM Raymond West raywest@raywest.com wrote:
On 27/11/2021 09:36, Rogier Wolff wrote:
On Fri, Nov 26, 2021 at 07:05:35PM +0000, nop head wrote:
I never need to do that because if a dimension is important I specify
my source code and make it so in the code. Do you want to measure
Recent project: I had a central "box", some margin, and then a frame
around that. And then a box to fit that frame. So my total size is:
inner_box_x + 2margin + 2framesize.
Sure I can write down the formula for that.
But what if say right side frame-size is determined by a square tilted
at an angle. Sure, I can do the trig to calculate the right side of
that tilted square, but wouldn't it be nice to ask openscad to
calculate that for me?
Roger.
Hi Roger,
How do you define the points you are interested in? I think the only
general way is to 'eyeball' it, in which case then a 'norm' between the
points will measure it for you. Without manually locating a point, how
could you mathematically define 'Anie's ear lobes' in my previous post?
It is not too difficult, flitting between plan and side view, gradually
translating it to where you want it to be, to whatever tolerance you
I do have something difficult I need to do: somehow find a way to
marker on the rendered object interactively and locate that point.
compute a distance between two markers. If I can figure out a way to
that in openscad I don't care whether it is functional or imperative
declarative, I like it just fine - and if I can't do that then I'll
move to some other system which I would find unfortunate because so
after a few months openSCAD has always got the job done for me.
Edmund
On Fri, Nov 26, 2021 at 4:05 PM Adrian Mariano avm4@cornell.edu
I think if you want OpenSCAD programming to "click" the answer is to
write a bunch of programs where you try to do something difficult.
you're trying to do something and you care about efficiency then you
should try to do that thing with OpenSCAD native matrix operations
first. For example, using the fold() function above to sum up a
simple vector of numbers is 40 times slower than using a vector
product, something like:
sum_of_test = test*[for(i=test) 1]];
The second choice for efficiency (and probably the first for
readability) is to use a list comprehension. Neither of these two
methods is "functional programming". List comprehensions can do a
of things---anything where the value at one output point is
independent of the value at other output points. There's the
of not being able to redefine variables, which can be an occasional
nuisance, but it's not a big issue. The main consequence is that
have to handle all cases all at once with the ternary operator, or
have to introduce more variables. But if you can't use a list
comprehension because the answer depends on previous answers, then
need to use recursion. That's when things look "functional". If
you're lucky you can do this with tail recursion, and get more
efficiency. If not you'll be in a less efficient situation. The
option is the C-style for loop, which in my testing I have found to
the slowest option, slower than recursion. It's hard to use
harder than recursion).
So is OpenSCAD a "functional language"? I'm not sure. A lot of
OpenSCAD programming doesn't really seem functional. If you want to
code in OpenSCAD then you need to learn OpenSCAD and its quirks and
not get hung up on terminology. At the end of the day, if your
program works does it matter if it was "functional" or "procedural"?
On Fri, Nov 26, 2021 at 9:19 AM Patrick Callahan
pat.callahan1@gmail.com wrote:
Sorry, It was an attempt at humor in a programming language.
On 26.11.21 13:38, Patrick Callahan wrote:
Sure, but why?
array = [ for (msg = [ for ([0:9]) "blah" ]) echo(msg) msg ];
ciao,
Torsten.
OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org
Adrian,
You understand perfectly well that a constructive solution does not solve
an inverse problem.
Telling people they should agically be able to invert the equations for
something is a cute way to say "go away you idiot".
Edmund
On Sat, Nov 27, 2021 at 3:24 PM Adrian Mariano <avm4@cornell.edu> wrote:
> It seems to me that edmund wants to be able to look at the model,
> click the mouse and get the point---and Openscad gives
> [3.43434,5.643543,-4.564353]---and then he copies that number into his
> program to position some decoration. To me this seems like it's just
> not the right way to use OpenSCAD. If you want to do this sort of
> thing you should be using some other program. The value of OpenSCAD
> is that you can define your parameters and build the model from them
> and then if you need to change the parameters, it is easy to do so.
> But with the above approach, you cannot change the model parameters
> because you have hard coded a value. OpenSCAD is not the tool for all
> design problems.
>
> The other thing that was mentioned was verifying that constraints are
> met. I think if you want to do that you should embody the constraints
> into your model. Then you can visually observe if they are met or
> not. Analogous to this is creating a ruler into your model to measure
> something.
>
> The example was given to create a square that surrounds another square
> tilted at an arbitrary angle. I know there are folks here who love to
> get up close and personal with the trigonometry, but despite my
> mastery of that subject, I prefer to have the computer do it for me.
> I think it's easier to write and debug the code and easier to read it
> tomorrow. A solution shown below will also generalize to any
> transformation of the square you please. The idea that one should do
> this in OpenSCAD by drawing a rotated square, clicking the mouse to
> find a point, and then writing code based on that value seems like a
> great misunderstanding of how OpenSCAD should be used.
>
> include<BOSL2/std.scad>
>
> angle = 17;
> rotsquare = zrot(angle, square(10));
> bounds = pointlist_bounds(rotsquare);
> translate(bounds[0])
> square(bounds[1]-bounds[0]);
> color("green")polygon(rotsquare);
>
>
>
> On Sat, Nov 27, 2021 at 6:02 AM Raymond West <raywest@raywest.com> wrote:
> >
> >
> > On 27/11/2021 09:36, Rogier Wolff wrote:
> > > On Fri, Nov 26, 2021 at 07:05:35PM +0000, nop head wrote:
> > >> I never need to do that because if a dimension is important I specify
> it in
> > >> my source code and make it so in the code. Do you want to measure
> other
> > >> people's designs?
> > > Recent project: I had a central "box", some margin, and then a frame
> > > around that. And then a box to fit that frame. So my total size is:
> > > inner_box_x + 2*margin + 2*framesize.
> > >
> > > Sure I can write down the formula for that.
> > >
> > > But what if say right side frame-size is determined by a square tilted
> > > at an angle. Sure, I can do the trig to calculate the right side of
> > > that tilted square, but wouldn't it be nice to ask openscad to
> > > calculate that for me?
> > >
> > > Roger.
> >
> > Hi Roger,
> >
> > How do you define the points you are interested in? I think the only
> > general way is to 'eyeball' it, in which case then a 'norm' between the
> > points will measure it for you. Without manually locating a point, how
> > could you mathematically define 'Anie's ear lobes' in my previous post?
> > It is not too difficult, flitting between plan and side view, gradually
> > translating it to where you want it to be, to whatever tolerance you
> want.
> >
> >
> > >> On Fri, 26 Nov 2021 at 18:52, edmund ronald <edmundronald@gmail.com>
> wrote:
> > >>
> > >>> I do have something difficult I need to do: somehow find a way to
> place a
> > >>> marker on the rendered object interactively and locate that point.
> Or even
> > >>> compute a distance between two markers. If I can figure out a way to
> do
> > >>> that in openscad I don't care whether it is functional or imperative
> or
> > >>> declarative, I like it just fine - and if I can't do that then I'll
> have to
> > >>> move to some other system which I would find unfortunate because so
> far
> > >>> after a few months openSCAD has always got the job done for me.
> > >>>
> > >>> Edmund
> > >>>
> > >>> On Fri, Nov 26, 2021 at 4:05 PM Adrian Mariano <avm4@cornell.edu>
> wrote:
> > >>>
> > >>>> I think if you want OpenSCAD programming to "click" the answer is to
> > >>>> write a bunch of programs where you try to do something difficult.
> If
> > >>>> you're trying to do something and you care about efficiency then you
> > >>>> should try to do that thing with OpenSCAD native matrix operations
> > >>>> first. For example, using the fold() function above to sum up a
> > >>>> simple vector of numbers is 40 times slower than using a vector
> > >>>> product, something like:
> > >>>>
> > >>>> sum_of_test = test*[for(i=test) 1]];
> > >>>>
> > >>>> The second choice for efficiency (and probably the first for
> > >>>> readability) is to use a list comprehension. Neither of these two
> > >>>> methods is "functional programming". List comprehensions can do a
> lot
> > >>>> of things---anything where the value at one output point is
> > >>>> independent of the value at other output points. There's the
> business
> > >>>> of not being able to redefine variables, which can be an occasional
> > >>>> nuisance, but it's not a big issue. The main consequence is that
> you
> > >>>> have to handle all cases all at once with the ternary operator, or
> you
> > >>>> have to introduce more variables. But if you can't use a list
> > >>>> comprehension because the answer depends on previous answers, then
> you
> > >>>> need to use recursion. That's when things look "functional". If
> > >>>> you're lucky you can do this with tail recursion, and get more
> > >>>> efficiency. If not you'll be in a less efficient situation. The
> last
> > >>>> option is the C-style for loop, which in my testing I have found to
> be
> > >>>> the slowest option, slower than recursion. It's hard to use
> (usually
> > >>>> harder than recursion).
> > >>>>
> > >>>> So is OpenSCAD a "functional language"? I'm not sure. A lot of
> > >>>> OpenSCAD programming doesn't really seem functional. If you want to
> > >>>> code in OpenSCAD then you need to learn OpenSCAD and its quirks and
> > >>>> not get hung up on terminology. At the end of the day, if your
> > >>>> program works does it matter if it was "functional" or "procedural"?
> > >>>>
> > >>>> On Fri, Nov 26, 2021 at 9:19 AM Patrick Callahan
> > >>>> <pat.callahan1@gmail.com> wrote:
> > >>>>> Sorry, It was an attempt at humor in a programming language.
> Never a
> > >>>> good idea.
> > >>>>> -Pat
> > >>>>>
> > >>>>> On Fri, Nov 26, 2021 at 8:33 AM Torsten Paul <Torsten.Paul@gmx.de>
> > >>>> wrote:
> > >>>>>> On 26.11.21 13:38, Patrick Callahan wrote:
> > >>>>>>> Can you do this?
> > >>>>>> Sure, but why?
> > >>>>>>
> > >>>>>> array = [ for (msg = [ for ([0:9]) "blah" ]) echo(msg) msg ];
> > >>>>>>
> > >>>>>> ciao,
> > >>>>>> Torsten.
> > >>>>>> _______________________________________________
> > >>>>>> 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
> > >>>> _______________________________________________
> > >>>> 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
> > >>>
> > >> _______________________________________________
> > >> 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
> _______________________________________________
> OpenSCAD mailing list
> To unsubscribe send an email to discuss-leave@lists.openscad.org
>
ER
edmund ronald
Sat, Nov 27, 2021 3:24 PM
I was a bit rough here, and I apologize.
What I was trying to say that the designer's job is to create an object
which fits into a set of constraints, some unknown, and that the design
environment should provide tools to aid the design task, while the design
language provides the tools for constructing the object.
I love the OpenSCAD approach because it allows me to create a family of
parametric designs; however when I actually need an object from such a
family, I need to make measurements - or else I would need to solve an
inverse problem for the space a curve occupies etc taking into account all
the parameters.
Edmund
On Sat, Nov 27, 2021 at 4:00 PM edmund ronald edmundronald@gmail.com
wrote:
Adrian,
You understand perfectly well that a constructive solution does not solve
an inverse problem.
Telling people they should agically be able to invert the equations for
something is a cute way to say "go away you idiot".
Edmund
On Sat, Nov 27, 2021 at 3:24 PM Adrian Mariano avm4@cornell.edu wrote:
It seems to me that edmund wants to be able to look at the model,
click the mouse and get the point---and Openscad gives
[3.43434,5.643543,-4.564353]---and then he copies that number into his
program to position some decoration. To me this seems like it's just
not the right way to use OpenSCAD. If you want to do this sort of
thing you should be using some other program. The value of OpenSCAD
is that you can define your parameters and build the model from them
and then if you need to change the parameters, it is easy to do so.
But with the above approach, you cannot change the model parameters
because you have hard coded a value. OpenSCAD is not the tool for all
design problems.
The other thing that was mentioned was verifying that constraints are
met. I think if you want to do that you should embody the constraints
into your model. Then you can visually observe if they are met or
not. Analogous to this is creating a ruler into your model to measure
something.
The example was given to create a square that surrounds another square
tilted at an arbitrary angle. I know there are folks here who love to
get up close and personal with the trigonometry, but despite my
mastery of that subject, I prefer to have the computer do it for me.
I think it's easier to write and debug the code and easier to read it
tomorrow. A solution shown below will also generalize to any
transformation of the square you please. The idea that one should do
this in OpenSCAD by drawing a rotated square, clicking the mouse to
find a point, and then writing code based on that value seems like a
great misunderstanding of how OpenSCAD should be used.
include<BOSL2/std.scad>
angle = 17;
rotsquare = zrot(angle, square(10));
bounds = pointlist_bounds(rotsquare);
translate(bounds[0])
square(bounds[1]-bounds[0]);
color("green")polygon(rotsquare);
On Sat, Nov 27, 2021 at 6:02 AM Raymond West raywest@raywest.com wrote:
On 27/11/2021 09:36, Rogier Wolff wrote:
On Fri, Nov 26, 2021 at 07:05:35PM +0000, nop head wrote:
I never need to do that because if a dimension is important I
my source code and make it so in the code. Do you want to measure
Recent project: I had a central "box", some margin, and then a frame
around that. And then a box to fit that frame. So my total size is:
inner_box_x + 2margin + 2framesize.
Sure I can write down the formula for that.
But what if say right side frame-size is determined by a square tilted
at an angle. Sure, I can do the trig to calculate the right side of
that tilted square, but wouldn't it be nice to ask openscad to
calculate that for me?
Roger.
Hi Roger,
How do you define the points you are interested in? I think the only
general way is to 'eyeball' it, in which case then a 'norm' between the
points will measure it for you. Without manually locating a point, how
could you mathematically define 'Anie's ear lobes' in my previous post?
It is not too difficult, flitting between plan and side view, gradually
translating it to where you want it to be, to whatever tolerance you
I do have something difficult I need to do: somehow find a way to
marker on the rendered object interactively and locate that point.
compute a distance between two markers. If I can figure out a way
that in openscad I don't care whether it is functional or
declarative, I like it just fine - and if I can't do that then I'll
move to some other system which I would find unfortunate because so
after a few months openSCAD has always got the job done for me.
Edmund
On Fri, Nov 26, 2021 at 4:05 PM Adrian Mariano avm4@cornell.edu
I think if you want OpenSCAD programming to "click" the answer is
write a bunch of programs where you try to do something
you're trying to do something and you care about efficiency then
should try to do that thing with OpenSCAD native matrix operations
first. For example, using the fold() function above to sum up a
simple vector of numbers is 40 times slower than using a vector
product, something like:
sum_of_test = test*[for(i=test) 1]];
The second choice for efficiency (and probably the first for
readability) is to use a list comprehension. Neither of these two
methods is "functional programming". List comprehensions can do a
of things---anything where the value at one output point is
independent of the value at other output points. There's the
of not being able to redefine variables, which can be an occasional
nuisance, but it's not a big issue. The main consequence is that
have to handle all cases all at once with the ternary operator, or
have to introduce more variables. But if you can't use a list
comprehension because the answer depends on previous answers, then
need to use recursion. That's when things look "functional". If
you're lucky you can do this with tail recursion, and get more
efficiency. If not you'll be in a less efficient situation. The
option is the C-style for loop, which in my testing I have found
the slowest option, slower than recursion. It's hard to use
harder than recursion).
So is OpenSCAD a "functional language"? I'm not sure. A lot of
OpenSCAD programming doesn't really seem functional. If you want
code in OpenSCAD then you need to learn OpenSCAD and its quirks and
not get hung up on terminology. At the end of the day, if your
program works does it matter if it was "functional" or
Sorry, It was an attempt at humor in a programming language.
On 26.11.21 13:38, Patrick Callahan wrote:
Sure, but why?
array = [ for (msg = [ for ([0:9]) "blah" ]) echo(msg) msg ];
ciao,
Torsten.
OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org
I was a bit rough here, and I apologize.
What I was trying to say that the designer's job is to create an object
which fits into a set of constraints, some unknown, and that the design
environment should provide tools to aid the design task, while the design
language provides the tools for constructing the object.
I love the OpenSCAD approach because it allows me to create a family of
parametric designs; however when I actually need an object from such a
family, I need to make measurements - or else I would need to solve an
inverse problem for the space a curve occupies etc taking into account all
the parameters.
Edmund
On Sat, Nov 27, 2021 at 4:00 PM edmund ronald <edmundronald@gmail.com>
wrote:
> Adrian,
> You understand perfectly well that a constructive solution does not solve
> an inverse problem.
> Telling people they should agically be able to invert the equations for
> something is a cute way to say "go away you idiot".
>
> Edmund
>
>
> On Sat, Nov 27, 2021 at 3:24 PM Adrian Mariano <avm4@cornell.edu> wrote:
>
>> It seems to me that edmund wants to be able to look at the model,
>> click the mouse and get the point---and Openscad gives
>> [3.43434,5.643543,-4.564353]---and then he copies that number into his
>> program to position some decoration. To me this seems like it's just
>> not the right way to use OpenSCAD. If you want to do this sort of
>> thing you should be using some other program. The value of OpenSCAD
>> is that you can define your parameters and build the model from them
>> and then if you need to change the parameters, it is easy to do so.
>> But with the above approach, you cannot change the model parameters
>> because you have hard coded a value. OpenSCAD is not the tool for all
>> design problems.
>>
>> The other thing that was mentioned was verifying that constraints are
>> met. I think if you want to do that you should embody the constraints
>> into your model. Then you can visually observe if they are met or
>> not. Analogous to this is creating a ruler into your model to measure
>> something.
>>
>> The example was given to create a square that surrounds another square
>> tilted at an arbitrary angle. I know there are folks here who love to
>> get up close and personal with the trigonometry, but despite my
>> mastery of that subject, I prefer to have the computer do it for me.
>> I think it's easier to write and debug the code and easier to read it
>> tomorrow. A solution shown below will also generalize to any
>> transformation of the square you please. The idea that one should do
>> this in OpenSCAD by drawing a rotated square, clicking the mouse to
>> find a point, and then writing code based on that value seems like a
>> great misunderstanding of how OpenSCAD should be used.
>>
>> include<BOSL2/std.scad>
>>
>> angle = 17;
>> rotsquare = zrot(angle, square(10));
>> bounds = pointlist_bounds(rotsquare);
>> translate(bounds[0])
>> square(bounds[1]-bounds[0]);
>> color("green")polygon(rotsquare);
>>
>>
>>
>> On Sat, Nov 27, 2021 at 6:02 AM Raymond West <raywest@raywest.com> wrote:
>> >
>> >
>> > On 27/11/2021 09:36, Rogier Wolff wrote:
>> > > On Fri, Nov 26, 2021 at 07:05:35PM +0000, nop head wrote:
>> > >> I never need to do that because if a dimension is important I
>> specify it in
>> > >> my source code and make it so in the code. Do you want to measure
>> other
>> > >> people's designs?
>> > > Recent project: I had a central "box", some margin, and then a frame
>> > > around that. And then a box to fit that frame. So my total size is:
>> > > inner_box_x + 2*margin + 2*framesize.
>> > >
>> > > Sure I can write down the formula for that.
>> > >
>> > > But what if say right side frame-size is determined by a square tilted
>> > > at an angle. Sure, I can do the trig to calculate the right side of
>> > > that tilted square, but wouldn't it be nice to ask openscad to
>> > > calculate that for me?
>> > >
>> > > Roger.
>> >
>> > Hi Roger,
>> >
>> > How do you define the points you are interested in? I think the only
>> > general way is to 'eyeball' it, in which case then a 'norm' between the
>> > points will measure it for you. Without manually locating a point, how
>> > could you mathematically define 'Anie's ear lobes' in my previous post?
>> > It is not too difficult, flitting between plan and side view, gradually
>> > translating it to where you want it to be, to whatever tolerance you
>> want.
>> >
>> >
>> > >> On Fri, 26 Nov 2021 at 18:52, edmund ronald <edmundronald@gmail.com>
>> wrote:
>> > >>
>> > >>> I do have something difficult I need to do: somehow find a way to
>> place a
>> > >>> marker on the rendered object interactively and locate that point.
>> Or even
>> > >>> compute a distance between two markers. If I can figure out a way
>> to do
>> > >>> that in openscad I don't care whether it is functional or
>> imperative or
>> > >>> declarative, I like it just fine - and if I can't do that then I'll
>> have to
>> > >>> move to some other system which I would find unfortunate because so
>> far
>> > >>> after a few months openSCAD has always got the job done for me.
>> > >>>
>> > >>> Edmund
>> > >>>
>> > >>> On Fri, Nov 26, 2021 at 4:05 PM Adrian Mariano <avm4@cornell.edu>
>> wrote:
>> > >>>
>> > >>>> I think if you want OpenSCAD programming to "click" the answer is
>> to
>> > >>>> write a bunch of programs where you try to do something
>> difficult. If
>> > >>>> you're trying to do something and you care about efficiency then
>> you
>> > >>>> should try to do that thing with OpenSCAD native matrix operations
>> > >>>> first. For example, using the fold() function above to sum up a
>> > >>>> simple vector of numbers is 40 times slower than using a vector
>> > >>>> product, something like:
>> > >>>>
>> > >>>> sum_of_test = test*[for(i=test) 1]];
>> > >>>>
>> > >>>> The second choice for efficiency (and probably the first for
>> > >>>> readability) is to use a list comprehension. Neither of these two
>> > >>>> methods is "functional programming". List comprehensions can do a
>> lot
>> > >>>> of things---anything where the value at one output point is
>> > >>>> independent of the value at other output points. There's the
>> business
>> > >>>> of not being able to redefine variables, which can be an occasional
>> > >>>> nuisance, but it's not a big issue. The main consequence is that
>> you
>> > >>>> have to handle all cases all at once with the ternary operator, or
>> you
>> > >>>> have to introduce more variables. But if you can't use a list
>> > >>>> comprehension because the answer depends on previous answers, then
>> you
>> > >>>> need to use recursion. That's when things look "functional". If
>> > >>>> you're lucky you can do this with tail recursion, and get more
>> > >>>> efficiency. If not you'll be in a less efficient situation. The
>> last
>> > >>>> option is the C-style for loop, which in my testing I have found
>> to be
>> > >>>> the slowest option, slower than recursion. It's hard to use
>> (usually
>> > >>>> harder than recursion).
>> > >>>>
>> > >>>> So is OpenSCAD a "functional language"? I'm not sure. A lot of
>> > >>>> OpenSCAD programming doesn't really seem functional. If you want
>> to
>> > >>>> code in OpenSCAD then you need to learn OpenSCAD and its quirks and
>> > >>>> not get hung up on terminology. At the end of the day, if your
>> > >>>> program works does it matter if it was "functional" or
>> "procedural"?
>> > >>>>
>> > >>>> On Fri, Nov 26, 2021 at 9:19 AM Patrick Callahan
>> > >>>> <pat.callahan1@gmail.com> wrote:
>> > >>>>> Sorry, It was an attempt at humor in a programming language.
>> Never a
>> > >>>> good idea.
>> > >>>>> -Pat
>> > >>>>>
>> > >>>>> On Fri, Nov 26, 2021 at 8:33 AM Torsten Paul <Torsten.Paul@gmx.de
>> >
>> > >>>> wrote:
>> > >>>>>> On 26.11.21 13:38, Patrick Callahan wrote:
>> > >>>>>>> Can you do this?
>> > >>>>>> Sure, but why?
>> > >>>>>>
>> > >>>>>> array = [ for (msg = [ for ([0:9]) "blah" ]) echo(msg) msg ];
>> > >>>>>>
>> > >>>>>> ciao,
>> > >>>>>> Torsten.
>> > >>>>>> _______________________________________________
>> > >>>>>> 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
>> > >>>> _______________________________________________
>> > >>>> 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
>> > >>>
>> > >> _______________________________________________
>> > >> 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
>> _______________________________________________
>> OpenSCAD mailing list
>> To unsubscribe send an email to discuss-leave@lists.openscad.org
>>
>
LH
Lenore Horner
Sat, Nov 27, 2021 3:29 PM
I do have something difficult I need to do: somehow find a way to place a
marker on the rendered object interactively and locate that point. Or even
compute a distance between two markers. If I can figure out a way to do
that in openscad I don't care whether it is functional or imperative or
declarative, I like it just fine - and if I can't do that then I'll have to
move to some other system which I would find unfortunate because so far
after a few months openSCAD has always got the job done for me.
I think you are really looking for an experience more like Onshape or perhaps GeoGebra (which will export .stl, but I’m not sure text can be treated as an object to extrude).
Lenore Horner
>>>>
>>>>> I do have something difficult I need to do: somehow find a way to place a
>>>>> marker on the rendered object interactively and locate that point. Or even
>>>>> compute a distance between two markers. If I can figure out a way to do
>>>>> that in openscad I don't care whether it is functional or imperative or
>>>>> declarative, I like it just fine - and if I can't do that then I'll have to
>>>>> move to some other system which I would find unfortunate because so far
>>>>> after a few months openSCAD has always got the job done for me.
I think you are really looking for an experience more like Onshape or perhaps GeoGebra (which will export .stl, but I’m not sure text can be treated as an object to extrude).
Lenore Horner
AM
Adrian Mariano
Sat, Nov 27, 2021 5:03 PM
Speaking broadly and abstractly makes it difficult to really
understand what you're trying to do. To me it seems like the task of
"put a design element where it looks good" is not a well posed
problem. Since the problem is not well posed, the "click here"
solution can probably work for this problem (because you don't
actually care what point is produced by the click). But you can't
call it an inverse problem because you have no way to identify
mathematically the point you are looking for. To solve this problem
mathematically you need to make it into an optimization problem that
defines what looks better or worse. A simple example would be to
center text in a region vs hand placing it. Centering the text is a
way of optimizing its placement. Of course, this gets hard if you
can't find the points on the surface of your model.
If you are after points whose location you can actually define, then
to me it seems like the feature that really enables approaching
problems like this would be OpenSCAD letting us get access to the
geometry it computes. In my example posted earlier with the rotated
square I can't rely on native OpenSCAD to rotate the square for me
because it won't tell me the geometry afterwards. So if you want to
be able to find points on the surface of a shape you made using
primitives, the solution is to have access to the geometry and then
you can get points on the surface of your object. I agree that this
problem is difficult to solve generically---though in native OpenSCAD
it's difficult to make a curve which is not a conic section and they
have a simple functional form. But to me the solution of being able
to click on the model seems pretty much uselessly weak as a method for
addressing this class of problems. There was some talk about using
the new function literals to provide access to the geometry. I'm not
sure if that was just talk, or likely to happen someday. (The idea,
as I recall, was that OpenSCAD would provide some kind of map function
that would take a function literal and it would pass the geometry of
its children to the function.) In BOSL2 if you generate a shape as a
polyhedron then you can place objects on that shape's surface.
Again, the easiest way to tell if a model meets a set of constraints
is not to try to invert the model but to place the constraints into
the model space. That is, if you want to know whether f(x)<g(x) then
looking at the graphs of f and g is the easiest way to figure this out
(in well behaved cases). No inverse operation is needed. I do admit,
though, that if I were designing a model under constraints I'd really
focus on building the constraints into the model so that they are
simply guaranteed to be satisfied. The alternative strategy of design
something, look at it, and push points around on the model until it
meets some condition is not the strength of OpenSCAD, and personally
that kind of ad hoc design is something I don't like.
On Sat, Nov 27, 2021 at 10:24 AM edmund ronald edmundronald@gmail.com wrote:
I was a bit rough here, and I apologize.
What I was trying to say that the designer's job is to create an object which fits into a set of constraints, some unknown, and that the design environment should provide tools to aid the design task, while the design language provides the tools for constructing the object.
I love the OpenSCAD approach because it allows me to create a family of parametric designs; however when I actually need an object from such a family, I need to make measurements - or else I would need to solve an inverse problem for the space a curve occupies etc taking into account all the parameters.
Edmund
On Sat, Nov 27, 2021 at 4:00 PM edmund ronald edmundronald@gmail.com wrote:
Adrian,
You understand perfectly well that a constructive solution does not solve an inverse problem.
Telling people they should agically be able to invert the equations for something is a cute way to say "go away you idiot".
Edmund
On Sat, Nov 27, 2021 at 3:24 PM Adrian Mariano avm4@cornell.edu wrote:
It seems to me that edmund wants to be able to look at the model,
click the mouse and get the point---and Openscad gives
[3.43434,5.643543,-4.564353]---and then he copies that number into his
program to position some decoration. To me this seems like it's just
not the right way to use OpenSCAD. If you want to do this sort of
thing you should be using some other program. The value of OpenSCAD
is that you can define your parameters and build the model from them
and then if you need to change the parameters, it is easy to do so.
But with the above approach, you cannot change the model parameters
because you have hard coded a value. OpenSCAD is not the tool for all
design problems.
The other thing that was mentioned was verifying that constraints are
met. I think if you want to do that you should embody the constraints
into your model. Then you can visually observe if they are met or
not. Analogous to this is creating a ruler into your model to measure
something.
The example was given to create a square that surrounds another square
tilted at an arbitrary angle. I know there are folks here who love to
get up close and personal with the trigonometry, but despite my
mastery of that subject, I prefer to have the computer do it for me.
I think it's easier to write and debug the code and easier to read it
tomorrow. A solution shown below will also generalize to any
transformation of the square you please. The idea that one should do
this in OpenSCAD by drawing a rotated square, clicking the mouse to
find a point, and then writing code based on that value seems like a
great misunderstanding of how OpenSCAD should be used.
include<BOSL2/std.scad>
angle = 17;
rotsquare = zrot(angle, square(10));
bounds = pointlist_bounds(rotsquare);
translate(bounds[0])
square(bounds[1]-bounds[0]);
color("green")polygon(rotsquare);
On Sat, Nov 27, 2021 at 6:02 AM Raymond West raywest@raywest.com wrote:
On 27/11/2021 09:36, Rogier Wolff wrote:
On Fri, Nov 26, 2021 at 07:05:35PM +0000, nop head wrote:
I never need to do that because if a dimension is important I specify it in
my source code and make it so in the code. Do you want to measure other
people's designs?
Recent project: I had a central "box", some margin, and then a frame
around that. And then a box to fit that frame. So my total size is:
inner_box_x + 2margin + 2framesize.
Sure I can write down the formula for that.
But what if say right side frame-size is determined by a square tilted
at an angle. Sure, I can do the trig to calculate the right side of
that tilted square, but wouldn't it be nice to ask openscad to
calculate that for me?
Roger.
Hi Roger,
How do you define the points you are interested in? I think the only
general way is to 'eyeball' it, in which case then a 'norm' between the
points will measure it for you. Without manually locating a point, how
could you mathematically define 'Anie's ear lobes' in my previous post?
It is not too difficult, flitting between plan and side view, gradually
translating it to where you want it to be, to whatever tolerance you want.
On Fri, 26 Nov 2021 at 18:52, edmund ronald edmundronald@gmail.com wrote:
I do have something difficult I need to do: somehow find a way to place a
marker on the rendered object interactively and locate that point. Or even
compute a distance between two markers. If I can figure out a way to do
that in openscad I don't care whether it is functional or imperative or
declarative, I like it just fine - and if I can't do that then I'll have to
move to some other system which I would find unfortunate because so far
after a few months openSCAD has always got the job done for me.
Edmund
On Fri, Nov 26, 2021 at 4:05 PM Adrian Mariano avm4@cornell.edu wrote:
I think if you want OpenSCAD programming to "click" the answer is to
write a bunch of programs where you try to do something difficult. If
you're trying to do something and you care about efficiency then you
should try to do that thing with OpenSCAD native matrix operations
first. For example, using the fold() function above to sum up a
simple vector of numbers is 40 times slower than using a vector
product, something like:
sum_of_test = test*[for(i=test) 1]];
The second choice for efficiency (and probably the first for
readability) is to use a list comprehension. Neither of these two
methods is "functional programming". List comprehensions can do a lot
of things---anything where the value at one output point is
independent of the value at other output points. There's the business
of not being able to redefine variables, which can be an occasional
nuisance, but it's not a big issue. The main consequence is that you
have to handle all cases all at once with the ternary operator, or you
have to introduce more variables. But if you can't use a list
comprehension because the answer depends on previous answers, then you
need to use recursion. That's when things look "functional". If
you're lucky you can do this with tail recursion, and get more
efficiency. If not you'll be in a less efficient situation. The last
option is the C-style for loop, which in my testing I have found to be
the slowest option, slower than recursion. It's hard to use (usually
harder than recursion).
So is OpenSCAD a "functional language"? I'm not sure. A lot of
OpenSCAD programming doesn't really seem functional. If you want to
code in OpenSCAD then you need to learn OpenSCAD and its quirks and
not get hung up on terminology. At the end of the day, if your
program works does it matter if it was "functional" or "procedural"?
On Fri, Nov 26, 2021 at 9:19 AM Patrick Callahan
pat.callahan1@gmail.com wrote:
Sorry, It was an attempt at humor in a programming language. Never a
good idea.
-Pat
On Fri, Nov 26, 2021 at 8:33 AM Torsten Paul Torsten.Paul@gmx.de
wrote:
On 26.11.21 13:38, Patrick Callahan wrote:
Can you do this?
Sure, but why?
array = [ for (msg = [ for ([0:9]) "blah" ]) echo(msg) msg ];
ciao,
Torsten.
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
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
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
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
Speaking broadly and abstractly makes it difficult to really
understand what you're trying to do. To me it seems like the task of
"put a design element where it looks good" is not a well posed
problem. Since the problem is not well posed, the "click here"
solution can probably work for this problem (because you don't
actually care what point is produced by the click). But you can't
call it an inverse problem because you have no way to identify
mathematically the point you are looking for. To solve this problem
mathematically you need to make it into an optimization problem that
defines what looks better or worse. A simple example would be to
center text in a region vs hand placing it. Centering the text is a
way of optimizing its placement. Of course, this gets hard if you
can't find the points on the surface of your model.
If you are after points whose location you can actually define, then
to me it seems like the feature that really enables approaching
problems like this would be OpenSCAD letting us get access to the
geometry it computes. In my example posted earlier with the rotated
square I can't rely on native OpenSCAD to rotate the square for me
because it won't tell me the geometry afterwards. So if you want to
be able to find points on the surface of a shape you made using
primitives, the solution is to have access to the geometry and then
you can get points on the surface of your object. I agree that this
problem is difficult to solve generically---though in native OpenSCAD
it's difficult to make a curve which is not a conic section and they
have a simple functional form. But to me the solution of being able
to click on the model seems pretty much uselessly weak as a method for
addressing this class of problems. There was some talk about using
the new function literals to provide access to the geometry. I'm not
sure if that was just talk, or likely to happen someday. (The idea,
as I recall, was that OpenSCAD would provide some kind of map function
that would take a function literal and it would pass the geometry of
its children to the function.) In BOSL2 if you generate a shape as a
polyhedron then you can place objects on that shape's surface.
Again, the easiest way to tell if a model meets a set of constraints
is not to try to invert the model but to place the constraints into
the model space. That is, if you want to know whether f(x)<g(x) then
looking at the graphs of f and g is the easiest way to figure this out
(in well behaved cases). No inverse operation is needed. I do admit,
though, that if I were designing a model under constraints I'd really
focus on building the constraints into the model so that they are
simply guaranteed to be satisfied. The alternative strategy of design
something, look at it, and push points around on the model until it
meets some condition is not the strength of OpenSCAD, and personally
that kind of ad hoc design is something I don't like.
On Sat, Nov 27, 2021 at 10:24 AM edmund ronald <edmundronald@gmail.com> wrote:
>
> I was a bit rough here, and I apologize.
>
> What I was trying to say that the designer's job is to create an object which fits into a set of constraints, some unknown, and that the design environment should provide tools to aid the design task, while the design language provides the tools for constructing the object.
>
> I love the OpenSCAD approach because it allows me to create a family of parametric designs; however when I actually need an object from such a family, I need to make measurements - or else I would need to solve an inverse problem for the space a curve occupies etc taking into account all the parameters.
>
> Edmund
>
> On Sat, Nov 27, 2021 at 4:00 PM edmund ronald <edmundronald@gmail.com> wrote:
>>
>> Adrian,
>> You understand perfectly well that a constructive solution does not solve an inverse problem.
>> Telling people they should agically be able to invert the equations for something is a cute way to say "go away you idiot".
>>
>> Edmund
>>
>>
>> On Sat, Nov 27, 2021 at 3:24 PM Adrian Mariano <avm4@cornell.edu> wrote:
>>>
>>> It seems to me that edmund wants to be able to look at the model,
>>> click the mouse and get the point---and Openscad gives
>>> [3.43434,5.643543,-4.564353]---and then he copies that number into his
>>> program to position some decoration. To me this seems like it's just
>>> not the right way to use OpenSCAD. If you want to do this sort of
>>> thing you should be using some other program. The value of OpenSCAD
>>> is that you can define your parameters and build the model from them
>>> and then if you need to change the parameters, it is easy to do so.
>>> But with the above approach, you cannot change the model parameters
>>> because you have hard coded a value. OpenSCAD is not the tool for all
>>> design problems.
>>>
>>> The other thing that was mentioned was verifying that constraints are
>>> met. I think if you want to do that you should embody the constraints
>>> into your model. Then you can visually observe if they are met or
>>> not. Analogous to this is creating a ruler into your model to measure
>>> something.
>>>
>>> The example was given to create a square that surrounds another square
>>> tilted at an arbitrary angle. I know there are folks here who love to
>>> get up close and personal with the trigonometry, but despite my
>>> mastery of that subject, I prefer to have the computer do it for me.
>>> I think it's easier to write and debug the code and easier to read it
>>> tomorrow. A solution shown below will also generalize to any
>>> transformation of the square you please. The idea that one should do
>>> this in OpenSCAD by drawing a rotated square, clicking the mouse to
>>> find a point, and then writing code based on that value seems like a
>>> great misunderstanding of how OpenSCAD should be used.
>>>
>>> include<BOSL2/std.scad>
>>>
>>> angle = 17;
>>> rotsquare = zrot(angle, square(10));
>>> bounds = pointlist_bounds(rotsquare);
>>> translate(bounds[0])
>>> square(bounds[1]-bounds[0]);
>>> color("green")polygon(rotsquare);
>>>
>>>
>>>
>>> On Sat, Nov 27, 2021 at 6:02 AM Raymond West <raywest@raywest.com> wrote:
>>> >
>>> >
>>> > On 27/11/2021 09:36, Rogier Wolff wrote:
>>> > > On Fri, Nov 26, 2021 at 07:05:35PM +0000, nop head wrote:
>>> > >> I never need to do that because if a dimension is important I specify it in
>>> > >> my source code and make it so in the code. Do you want to measure other
>>> > >> people's designs?
>>> > > Recent project: I had a central "box", some margin, and then a frame
>>> > > around that. And then a box to fit that frame. So my total size is:
>>> > > inner_box_x + 2*margin + 2*framesize.
>>> > >
>>> > > Sure I can write down the formula for that.
>>> > >
>>> > > But what if say right side frame-size is determined by a square tilted
>>> > > at an angle. Sure, I can do the trig to calculate the right side of
>>> > > that tilted square, but wouldn't it be nice to ask openscad to
>>> > > calculate that for me?
>>> > >
>>> > > Roger.
>>> >
>>> > Hi Roger,
>>> >
>>> > How do you define the points you are interested in? I think the only
>>> > general way is to 'eyeball' it, in which case then a 'norm' between the
>>> > points will measure it for you. Without manually locating a point, how
>>> > could you mathematically define 'Anie's ear lobes' in my previous post?
>>> > It is not too difficult, flitting between plan and side view, gradually
>>> > translating it to where you want it to be, to whatever tolerance you want.
>>> >
>>> >
>>> > >> On Fri, 26 Nov 2021 at 18:52, edmund ronald <edmundronald@gmail.com> wrote:
>>> > >>
>>> > >>> I do have something difficult I need to do: somehow find a way to place a
>>> > >>> marker on the rendered object interactively and locate that point. Or even
>>> > >>> compute a distance between two markers. If I can figure out a way to do
>>> > >>> that in openscad I don't care whether it is functional or imperative or
>>> > >>> declarative, I like it just fine - and if I can't do that then I'll have to
>>> > >>> move to some other system which I would find unfortunate because so far
>>> > >>> after a few months openSCAD has always got the job done for me.
>>> > >>>
>>> > >>> Edmund
>>> > >>>
>>> > >>> On Fri, Nov 26, 2021 at 4:05 PM Adrian Mariano <avm4@cornell.edu> wrote:
>>> > >>>
>>> > >>>> I think if you want OpenSCAD programming to "click" the answer is to
>>> > >>>> write a bunch of programs where you try to do something difficult. If
>>> > >>>> you're trying to do something and you care about efficiency then you
>>> > >>>> should try to do that thing with OpenSCAD native matrix operations
>>> > >>>> first. For example, using the fold() function above to sum up a
>>> > >>>> simple vector of numbers is 40 times slower than using a vector
>>> > >>>> product, something like:
>>> > >>>>
>>> > >>>> sum_of_test = test*[for(i=test) 1]];
>>> > >>>>
>>> > >>>> The second choice for efficiency (and probably the first for
>>> > >>>> readability) is to use a list comprehension. Neither of these two
>>> > >>>> methods is "functional programming". List comprehensions can do a lot
>>> > >>>> of things---anything where the value at one output point is
>>> > >>>> independent of the value at other output points. There's the business
>>> > >>>> of not being able to redefine variables, which can be an occasional
>>> > >>>> nuisance, but it's not a big issue. The main consequence is that you
>>> > >>>> have to handle all cases all at once with the ternary operator, or you
>>> > >>>> have to introduce more variables. But if you can't use a list
>>> > >>>> comprehension because the answer depends on previous answers, then you
>>> > >>>> need to use recursion. That's when things look "functional". If
>>> > >>>> you're lucky you can do this with tail recursion, and get more
>>> > >>>> efficiency. If not you'll be in a less efficient situation. The last
>>> > >>>> option is the C-style for loop, which in my testing I have found to be
>>> > >>>> the slowest option, slower than recursion. It's hard to use (usually
>>> > >>>> harder than recursion).
>>> > >>>>
>>> > >>>> So is OpenSCAD a "functional language"? I'm not sure. A lot of
>>> > >>>> OpenSCAD programming doesn't really seem functional. If you want to
>>> > >>>> code in OpenSCAD then you need to learn OpenSCAD and its quirks and
>>> > >>>> not get hung up on terminology. At the end of the day, if your
>>> > >>>> program works does it matter if it was "functional" or "procedural"?
>>> > >>>>
>>> > >>>> On Fri, Nov 26, 2021 at 9:19 AM Patrick Callahan
>>> > >>>> <pat.callahan1@gmail.com> wrote:
>>> > >>>>> Sorry, It was an attempt at humor in a programming language. Never a
>>> > >>>> good idea.
>>> > >>>>> -Pat
>>> > >>>>>
>>> > >>>>> On Fri, Nov 26, 2021 at 8:33 AM Torsten Paul <Torsten.Paul@gmx.de>
>>> > >>>> wrote:
>>> > >>>>>> On 26.11.21 13:38, Patrick Callahan wrote:
>>> > >>>>>>> Can you do this?
>>> > >>>>>> Sure, but why?
>>> > >>>>>>
>>> > >>>>>> array = [ for (msg = [ for ([0:9]) "blah" ]) echo(msg) msg ];
>>> > >>>>>>
>>> > >>>>>> ciao,
>>> > >>>>>> Torsten.
>>> > >>>>>> _______________________________________________
>>> > >>>>>> 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
>>> > >>>> _______________________________________________
>>> > >>>> 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
>>> > >>>
>>> > >> _______________________________________________
>>> > >> 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
>>> _______________________________________________
>>> 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
ER
edmund ronald
Sat, Nov 27, 2021 5:24 PM
The alternative strategy of design
something, look at it, and push points around on the model until it
meets some condition is not the strength of OpenSCAD, and personally
that kind of ad hoc design is something I don't like.
I am the first to agree that pushing points around the space surrounding a
model and looking at the values is not necessarily the best way to solve a
problem, but it is often the the fastest. As it just serves to inform the
process of coding the model, I don't see why it is bad? If people are
starting to post bounties on this issue, that probably means a lot of
people feel strongly about it, and to the extent that a solution just
impinges on the visualisation environment, why not just provide it, benefit
from the fact that the user community is growing -and cash in the bounty
maybe - rather than give people theological lectures on programming style?
Unfortunately, this seems similar to the user forum story. When it existed
it was good, and now people tell those of us who like forums, with great
moral superiority that mailing lists are superior to forums, rather than
just figure out a way to restore functionality by making a gateway to
Google groups which would probably see us through another 10 years.
Edmund
On Sat, Nov 27, 2021 at 6:04 PM Adrian Mariano <avm4@cornell.edu> wrote:
> The alternative strategy of design
> something, look at it, and push points around on the model until it
> meets some condition is not the strength of OpenSCAD, and personally
> that kind of ad hoc design is something I don't like.
>
>
I am the first to agree that pushing points around the space surrounding a
model and looking at the values is not necessarily the best way to solve a
problem, but it is often the the fastest. As it just serves to inform the
process of coding the model, I don't see why it is bad? If people are
starting to post bounties on this issue, that probably means a lot of
people feel strongly about it, and to the extent that a solution just
impinges on the visualisation environment, why not just provide it, benefit
from the fact that the user community is growing -and cash in the bounty
maybe - rather than give people theological lectures on programming style?
Unfortunately, this seems similar to the user forum story. When it existed
it was good, and now people tell those of us who like forums, with great
moral superiority that mailing lists are superior to forums, rather than
just figure out a way to restore functionality by making a gateway to
Google groups which would probably see us through another 10 years.
Edmund