discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

inspecting fuctions

DS
Dan Shriver
Sat, Feb 10, 2018 8:39 PM

What do people do for debugging functions given that echo() doesn't work
inside them?

I'd prefer not to stream debugging output into the return value of the
function.

https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=icon
Virus-free.
www.avast.com
https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=link
<#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>

What do people do for debugging functions given that echo() doesn't work inside them? I'd prefer not to stream debugging output into the return value of the function. <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=icon> Virus-free. www.avast.com <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=link> <#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
TP
Torsten Paul
Sat, Feb 10, 2018 9:53 PM

On 02/10/2018 09:39 PM, Dan Shriver wrote:

What do people do for debugging functions given that echo()
doesn't work inside them?

It is available for functions in the nightly builds.

For some info, see:
https://github.com/openscad/openscad/pull/1830

There's still some todo:
https://github.com/openscad/openscad/issues/1859

ciao,
Torsten.

On 02/10/2018 09:39 PM, Dan Shriver wrote: > What do people do for debugging functions given that echo() > doesn't work inside them? > It is available for functions in the nightly builds. For some info, see: https://github.com/openscad/openscad/pull/1830 There's still some todo: https://github.com/openscad/openscad/issues/1859 ciao, Torsten.
T
Troberg
Sun, Feb 11, 2018 12:02 PM

I break up the function into simpler parts and test them individually.
Sometimes, I do this through breaking it up into many smaller function, and
one function which puts it all together, sometimes I do it by commenting out
parts of the function temporarily for testing purposes.

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

I break up the function into simpler parts and test them individually. Sometimes, I do this through breaking it up into many smaller function, and one function which puts it all together, sometimes I do it by commenting out parts of the function temporarily for testing purposes. -- Sent from: http://forum.openscad.org/
NH
nop head
Sun, Feb 11, 2018 12:10 PM

I use this function to echo any part of an expression.

// Echo expression and return it
function echoit(x) = echo(x) x;

Before function echo was added I sometimes had to resort to translating
code into Python to debug it.

On 11 February 2018 at 12:02, Troberg troberg.anders@gmail.com wrote:

I break up the function into simpler parts and test them individually.
Sometimes, I do this through breaking it up into many smaller function, and
one function which puts it all together, sometimes I do it by commenting
out
parts of the function temporarily for testing purposes.

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


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

I use this function to echo any part of an expression. // Echo expression and return it function echoit(x) = echo(x) x; Before function echo was added I sometimes had to resort to translating code into Python to debug it. On 11 February 2018 at 12:02, Troberg <troberg.anders@gmail.com> wrote: > I break up the function into simpler parts and test them individually. > Sometimes, I do this through breaking it up into many smaller function, and > one function which puts it all together, sometimes I do it by commenting > out > parts of the function temporarily for testing purposes. > > > > -- > Sent from: http://forum.openscad.org/ > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org >
RW
Rob Ward
Sun, Feb 11, 2018 12:24 PM

For those who are concerned about "libraries", could a Save option be included in OpenSCAD that has an "archive" feature that simply saves the target file and any referenced library, or subfile into a ZIP file(for example).
With gigabytes so cheap these days, this would not cost much??
No doubt over time, changes to the OpenSCAD IDEmight render any particular example 'broken' but at least anyone else coming along behind would have a complete snapshot of the original working design to begin with.
It would also make sharing OpenSCAD designs easier?
Cheers.
Rob
Cheers, RobW

On 11 February 2018 11:02:04 pm AEDT, Troberg troberg.anders@gmail.com wrote:

I break up the function into simpler parts and test them individually.
Sometimes, I do this through breaking it up into many smaller function,
and
one function which puts it all together, sometimes I do it by
commenting out
parts of the function temporarily for testing purposes.

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


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

For those who are concerned about "libraries", could a Save option be included in OpenSCAD that has an "archive" feature that simply saves the target file and any referenced library, or subfile into a ZIP file(for example). With gigabytes so cheap these days, this would not cost much?? No doubt over time, changes to the OpenSCAD IDEmight render any particular example 'broken' but at least anyone else coming along behind would have a complete snapshot of the original working design to begin with. It would also make sharing OpenSCAD designs easier? Cheers. Rob Cheers, RobW On 11 February 2018 11:02:04 pm AEDT, Troberg <troberg.anders@gmail.com> wrote: >I break up the function into simpler parts and test them individually. >Sometimes, I do this through breaking it up into many smaller function, >and >one function which puts it all together, sometimes I do it by >commenting out >parts of the function temporarily for testing purposes. > > > >-- >Sent from: http://forum.openscad.org/ > >_______________________________________________ >OpenSCAD mailing list >Discuss@lists.openscad.org >http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
FV
Frank van der Hulst
Sun, Feb 11, 2018 5:31 PM

I first write the code as a module to debug it, then translate it into a
function. e.g.

module Arc(centre, radius, angle1, angle2, step = 10, dir=false) {
a1 = dir ? angle1 : angle2;
a2 = dir ? angle2 : angle1;

polygon([for (a = [a1 > a2 ? a1 - 360 : a1:step:a2]) [centre[0] +

radius * cos(a), centre[1] + radius * sin(a)]]);
}

function arc(centre, radius, angle1, angle2, dir = false, step = 10) =
let(a1 = dir ? angle1 : angle2)
let(a2 = dir ? angle2 : angle1)
[for (a = [a1 > a2 ? a1 - 360: a1:step:a2]) [centre[0] + radius *
cos(a), centre[1] + radius * sin(a)]];

On Mon, Feb 12, 2018 at 1:24 AM, Rob Ward rl.ward@bigpond.com wrote:

For those who are concerned about "libraries", could a Save option be
included in OpenSCAD that has an "archive" feature that simply saves the
target file and any referenced library, or subfile into a ZIP file(for
example).
With gigabytes so cheap these days, this would not cost much??
No doubt over time, changes to the OpenSCAD IDEmight render any particular
example 'broken' but at least anyone else coming along behind would have a
complete snapshot of the original working design to begin with.
It would also make sharing OpenSCAD designs easier?
Cheers.
Rob
Cheers, RobW

On 11 February 2018 11:02:04 pm AEDT, Troberg troberg.anders@gmail.com
wrote:

I break up the function into simpler parts and test them individually.
Sometimes, I do this through breaking it up into many smaller function, and
one function which puts it all together, sometimes I do it by commenting out
parts of the function temporarily for testing purposes.

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


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

I first write the code as a module to debug it, then translate it into a function. e.g. module Arc(centre, radius, angle1, angle2, step = 10, dir=false) { a1 = dir ? angle1 : angle2; a2 = dir ? angle2 : angle1; polygon([for (a = [a1 > a2 ? a1 - 360 : a1:step:a2]) [centre[0] + radius * cos(a), centre[1] + radius * sin(a)]]); } function arc(centre, radius, angle1, angle2, dir = false, step = 10) = let(a1 = dir ? angle1 : angle2) let(a2 = dir ? angle2 : angle1) [for (a = [a1 > a2 ? a1 - 360: a1:step:a2]) [centre[0] + radius * cos(a), centre[1] + radius * sin(a)]]; On Mon, Feb 12, 2018 at 1:24 AM, Rob Ward <rl.ward@bigpond.com> wrote: > For those who are concerned about "libraries", could a Save option be > included in OpenSCAD that has an "archive" feature that simply saves the > target file and any referenced library, or subfile into a ZIP file(for > example). > With gigabytes so cheap these days, this would not cost much?? > No doubt over time, changes to the OpenSCAD IDEmight render any particular > example 'broken' but at least anyone else coming along behind would have a > complete snapshot of the original working design to begin with. > It would also make sharing OpenSCAD designs easier? > Cheers. > Rob > Cheers, RobW > > On 11 February 2018 11:02:04 pm AEDT, Troberg <troberg.anders@gmail.com> > wrote: >> >> I break up the function into simpler parts and test them individually. >> Sometimes, I do this through breaking it up into many smaller function, and >> one function which puts it all together, sometimes I do it by commenting out >> parts of the function temporarily for testing purposes. >> >> >> >> -- >> Sent from: http://forum.openscad.org/ >> >> ------------------------------ >> >> OpenSCAD mailing list >> Discuss@lists.openscad.org >> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org >> >> > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org > >
DS
Dan Shriver
Sun, Feb 11, 2018 8:28 PM

Torsten

on the downloads (http://www.openscad.org/downloads.html) I see a
2018.01.06 build, and I installed that on top of what I had.  But it does
not seem to have echo() for functions.

Where do I go to grab a nightly build?  The OS is 64 bit windows 7

https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=icon
Virus-free.
www.avast.com
https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=link
<#m_-2160566236724823863_m_-7176511858633565756_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>

On Sat, Feb 10, 2018 at 4:53 PM, Torsten Paul Torsten.Paul@gmx.de wrote:

On 02/10/2018 09:39 PM, Dan Shriver wrote:

What do people do for debugging functions given that echo()
doesn't work inside them?

It is available for functions in the nightly builds.

Torsten on the downloads (http://www.openscad.org/downloads.html) I see a 2018.01.06 build, and I installed that on top of what I had. But it does not seem to have echo() for functions. Where do I go to grab a nightly build? The OS is 64 bit windows 7 <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=icon> Virus-free. www.avast.com <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=link> <#m_-2160566236724823863_m_-7176511858633565756_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2> On Sat, Feb 10, 2018 at 4:53 PM, Torsten Paul <Torsten.Paul@gmx.de> wrote: > On 02/10/2018 09:39 PM, Dan Shriver wrote: > >> What do people do for debugging functions given that echo() >> doesn't work inside them? >> >> It is available for functions in the nightly builds. > > For some info, see: > https://github.com/openscad/openscad/pull/1830 > > There's still some todo: > https://github.com/openscad/openscad/issues/1859 > > ciao, > Torsten. > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org >
DM
doug moen
Sun, Feb 11, 2018 8:34 PM

You need to go into Preferences >> Features and enable the "echo
expression" feature.

On 11 February 2018 at 15:28, Dan Shriver tabbydan@gmail.com wrote:

Torsten

on the downloads (http://www.openscad.org/downloads.html) I see a
2018.01.06 build, and I installed that on top of what I had.  But it does
not seem to have echo() for functions.

Where do I go to grab a nightly build?  The OS is 64 bit windows 7

https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=icon Virus-free.
www.avast.com
https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=link
<#m_2324107662973867695_m_-2160566236724823863_m_-7176511858633565756_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>

On Sat, Feb 10, 2018 at 4:53 PM, Torsten Paul Torsten.Paul@gmx.de wrote:

On 02/10/2018 09:39 PM, Dan Shriver wrote:

What do people do for debugging functions given that echo()
doesn't work inside them?

It is available for functions in the nightly builds.

You need to go into Preferences >> Features and enable the "echo expression" feature. On 11 February 2018 at 15:28, Dan Shriver <tabbydan@gmail.com> wrote: > Torsten > > on the downloads (http://www.openscad.org/downloads.html) I see a > 2018.01.06 build, and I installed that on top of what I had. But it does > not seem to have echo() for functions. > > Where do I go to grab a nightly build? The OS is 64 bit windows 7 > > > <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=icon> Virus-free. > www.avast.com > <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=link> > <#m_2324107662973867695_m_-2160566236724823863_m_-7176511858633565756_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2> > > On Sat, Feb 10, 2018 at 4:53 PM, Torsten Paul <Torsten.Paul@gmx.de> wrote: > >> On 02/10/2018 09:39 PM, Dan Shriver wrote: >> >>> What do people do for debugging functions given that echo() >>> doesn't work inside them? >>> >>> It is available for functions in the nightly builds. >> >> For some info, see: >> https://github.com/openscad/openscad/pull/1830 >> >> There's still some todo: >> https://github.com/openscad/openscad/issues/1859 >> >> ciao, >> Torsten. >> >> _______________________________________________ >> OpenSCAD mailing list >> Discuss@lists.openscad.org >> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org >> > > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org > >
TP
Torsten Paul
Sun, Feb 11, 2018 8:36 PM

On 02/11/2018 09:28 PM, Dan Shriver wrote:

on the downloads I see a 2018.01.06 build, and I installed
that on top of what I had.  But it does not seem to have
echo() for functions.

You may need to go into Preferences->Features to enable it.

ciao,
Torsten.

On 02/11/2018 09:28 PM, Dan Shriver wrote: > on the downloads I see a 2018.01.06 build, and I installed > that on top of what I had.  But it does not seem to have > echo() for functions. > You may need to go into Preferences->Features to enable it. ciao, Torsten.
DS
Dan Shriver
Mon, Feb 12, 2018 12:11 AM

On 02/11/2018 09:28 PM, Dan Shriver wrote:

on the downloads I see a 2018.01.06 build, and I installed that on top of
what I had.  But it does not seem to have
echo() for functions.

You may need to go into Preferences->Features to enable it.

After enabling it works, thanks Doug / Torsten <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=icon> Virus-free. www.avast.com <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=link> <#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2> On Sun, Feb 11, 2018 at 3:36 PM, Torsten Paul <Torsten.Paul@gmx.de> wrote: > On 02/11/2018 09:28 PM, Dan Shriver wrote: > >> on the downloads I see a 2018.01.06 build, and I installed that on top of >> what I had. But it does not seem to have >> echo() for functions. >> >> You may need to go into Preferences->Features to enable it. > > > ciao, > Torsten. > > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org >