discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

Re: Debugging OpenSCAD code

SP
Sanjeev Prabhakar
Tue, Oct 18, 2022 12:39 AM

I am writing openscad codes in python (jupyter notebook) although I am not
very proficient in python but I find it quite useful.

Stopping the code whenever a certain condition is met is very easy and a
lot of things which would be very difficult in openscad can be done in
python like reshaping the data etc.

Also if openscad crashes the code is not lost as it is written in jupyter
notebook which till date has never crashed and you have an option to stop
the code execution if it is taking too long.

Till now there is no issues whatsoever and I have written a lot of
functions in python.

Since I have started learning python only few months ago, I don't know the
debugging option and will give it a try.

The way it works is:
Write a code to manipulate points in 2d or 3d space.
This code then can be written to a scad file and you have the model.

On Tue, 18 Oct, 2022, 4:28 am William Lugg via Discuss, <
discuss@lists.openscad.org> wrote:

---------- Forwarded message ----------
From: William Lugg luggw1@protonmail.com
To: "Jan Öhman via Discuss" discuss@lists.openscad.org
Cc:
Bcc:
Date: Mon, 17 Oct 2022 22:57:11 +0000
Subject: [OpenSCAD] Re: Debugging OpenSCAD code
I understand what you're saying re the model displaying, but multiple
times I've been attempting to troubleshoot looping and navigating
through a complex if structure in a module.  I know what the model was
going to look like when it finished; how it was getting there was what I
was interested in.  Adding echos was becoming quite troublesome.  As it
turned out in my case, I was able to color the different components and
discover the errant if clause that was causing me trouble...this time.

So I guess the question is what evidence do I need to provide to support
the need for debugging tools to be added to the code editor?
Alternatively, isn't there a way to integrate a pre-developed open
source IDE into OpenSCAD that would provide all those tools?  I know I
make it sound trivial, but it just seems like an effort to reinvent the
wheel here.

Just a thought...don't shoot the newbie.  ;o)
Bill Lugg

On 10/17/22 16:28, Jordan Brown wrote:

I don't see any issues on the subject at
https://github.com/openscad/openscad/issues , suggesting that nobody
has been really interested.  You should file an issue if it's
important to you, but of course that wouldn't guarantee that anybody
else is interested and willing to do the work.

Some notes:

  • A debugger would likely not be nearly as useful as you might
    think, because OpenSCAD doesn't put the model on the screen until
    after the program has executed - and can't, because there's no
    telling what will happen to any particular piece of geometry until
    it gets all the way to the top-level implied union.
  • The * and ! modifiers are also quite helpful.  So is #, but in a
    different way.
  • Note that echo() can be used in expressions, and that assert() can
    be used both as a statement and in an expression.

---------- Forwarded message ----------
From: William Lugg via Discuss discuss@lists.openscad.org
To: "Jan Öhman via Discuss" discuss@lists.openscad.org
Cc: William Lugg luggw1@protonmail.com
Bcc:
Date: Mon, 17 Oct 2022 22:57:11 +0000
Subject: [OpenSCAD] Re: Debugging OpenSCAD code


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

I am writing openscad codes in python (jupyter notebook) although I am not very proficient in python but I find it quite useful. Stopping the code whenever a certain condition is met is very easy and a lot of things which would be very difficult in openscad can be done in python like reshaping the data etc. Also if openscad crashes the code is not lost as it is written in jupyter notebook which till date has never crashed and you have an option to stop the code execution if it is taking too long. Till now there is no issues whatsoever and I have written a lot of functions in python. Since I have started learning python only few months ago, I don't know the debugging option and will give it a try. The way it works is: Write a code to manipulate points in 2d or 3d space. This code then can be written to a scad file and you have the model. On Tue, 18 Oct, 2022, 4:28 am William Lugg via Discuss, < discuss@lists.openscad.org> wrote: > > > > ---------- Forwarded message ---------- > From: William Lugg <luggw1@protonmail.com> > To: "Jan Öhman via Discuss" <discuss@lists.openscad.org> > Cc: > Bcc: > Date: Mon, 17 Oct 2022 22:57:11 +0000 > Subject: [OpenSCAD] Re: Debugging OpenSCAD code > I understand what you're saying re the model displaying, but multiple > times I've been attempting to troubleshoot looping and navigating > through a complex if structure in a module. I know what the model was > going to look like when it finished; how it was getting there was what I > was interested in. Adding echos was becoming quite troublesome. As it > turned out in my case, I was able to color the different components and > discover the errant if clause that was causing me trouble...this time. > > So I guess the question is what evidence do I need to provide to support > the need for debugging tools to be added to the code editor? > Alternatively, isn't there a way to integrate a pre-developed open > source IDE into OpenSCAD that would provide all those tools? I know I > make it sound trivial, but it just seems like an effort to reinvent the > wheel here. > > Just a thought...don't shoot the newbie. ;o) > Bill Lugg > > On 10/17/22 16:28, Jordan Brown wrote: > > I don't see any issues on the subject at > > https://github.com/openscad/openscad/issues , suggesting that nobody > > has been really interested. You should file an issue if it's > > important to you, but of course that wouldn't guarantee that anybody > > *else* is interested and willing to do the work. > > > > Some notes: > > > > * A debugger would likely not be nearly as useful as you might > > think, because OpenSCAD doesn't put the model on the screen until > > after the program has executed - and can't, because there's no > > telling what will happen to any particular piece of geometry until > > it gets all the way to the top-level implied union. > > * The * and ! modifiers are also quite helpful. So is #, but in a > > different way. > > * Note that echo() can be used in expressions, and that assert() can > > be used both as a statement and in an expression. > > > > > > > > > ---------- Forwarded message ---------- > From: William Lugg via Discuss <discuss@lists.openscad.org> > To: "Jan Öhman via Discuss" <discuss@lists.openscad.org> > Cc: William Lugg <luggw1@protonmail.com> > Bcc: > Date: Mon, 17 Oct 2022 22:57:11 +0000 > Subject: [OpenSCAD] Re: Debugging OpenSCAD code > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org >
FH
Father Horton
Tue, Oct 18, 2022 12:44 AM

OpenSCAD can do anything. That doesn't mean it's always the right too.
Sometimes it's just easier to do it in Python (or something else) and
import to OpenSCAD as needed.

On Mon, Oct 17, 2022 at 7:40 PM Sanjeev Prabhakar sprabhakar2006@gmail.com
wrote:

I am writing openscad codes in python (jupyter notebook) although I am not
very proficient in python but I find it quite useful.

Stopping the code whenever a certain condition is met is very easy and a
lot of things which would be very difficult in openscad can be done in
python like reshaping the data etc.

Also if openscad crashes the code is not lost as it is written in jupyter
notebook which till date has never crashed and you have an option to stop
the code execution if it is taking too long.

Till now there is no issues whatsoever and I have written a lot of
functions in python.

Since I have started learning python only few months ago, I don't know the
debugging option and will give it a try.

The way it works is:
Write a code to manipulate points in 2d or 3d space.
This code then can be written to a scad file and you have the model.

On Tue, 18 Oct, 2022, 4:28 am William Lugg via Discuss, <
discuss@lists.openscad.org> wrote:

---------- Forwarded message ----------
From: William Lugg luggw1@protonmail.com
To: "Jan Öhman via Discuss" discuss@lists.openscad.org
Cc:
Bcc:
Date: Mon, 17 Oct 2022 22:57:11 +0000
Subject: [OpenSCAD] Re: Debugging OpenSCAD code
I understand what you're saying re the model displaying, but multiple
times I've been attempting to troubleshoot looping and navigating
through a complex if structure in a module.  I know what the model was
going to look like when it finished; how it was getting there was what I
was interested in.  Adding echos was becoming quite troublesome.  As it
turned out in my case, I was able to color the different components and
discover the errant if clause that was causing me trouble...this time.

So I guess the question is what evidence do I need to provide to support
the need for debugging tools to be added to the code editor?
Alternatively, isn't there a way to integrate a pre-developed open
source IDE into OpenSCAD that would provide all those tools?  I know I
make it sound trivial, but it just seems like an effort to reinvent the
wheel here.

Just a thought...don't shoot the newbie.  ;o)
Bill Lugg

On 10/17/22 16:28, Jordan Brown wrote:

I don't see any issues on the subject at
https://github.com/openscad/openscad/issues , suggesting that nobody
has been really interested.  You should file an issue if it's
important to you, but of course that wouldn't guarantee that anybody
else is interested and willing to do the work.

Some notes:

  • A debugger would likely not be nearly as useful as you might
    think, because OpenSCAD doesn't put the model on the screen until
    after the program has executed - and can't, because there's no
    telling what will happen to any particular piece of geometry until
    it gets all the way to the top-level implied union.
  • The * and ! modifiers are also quite helpful.  So is #, but in a
    different way.
  • Note that echo() can be used in expressions, and that assert() can
    be used both as a statement and in an expression.

---------- Forwarded message ----------
From: William Lugg via Discuss discuss@lists.openscad.org
To: "Jan Öhman via Discuss" discuss@lists.openscad.org
Cc: William Lugg luggw1@protonmail.com
Bcc:
Date: Mon, 17 Oct 2022 22:57:11 +0000
Subject: [OpenSCAD] Re: Debugging OpenSCAD code


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 *can* do anything. That doesn't mean it's always the right too. Sometimes it's just easier to do it in Python (or something else) and import to OpenSCAD as needed. On Mon, Oct 17, 2022 at 7:40 PM Sanjeev Prabhakar <sprabhakar2006@gmail.com> wrote: > I am writing openscad codes in python (jupyter notebook) although I am not > very proficient in python but I find it quite useful. > > Stopping the code whenever a certain condition is met is very easy and a > lot of things which would be very difficult in openscad can be done in > python like reshaping the data etc. > > Also if openscad crashes the code is not lost as it is written in jupyter > notebook which till date has never crashed and you have an option to stop > the code execution if it is taking too long. > > Till now there is no issues whatsoever and I have written a lot of > functions in python. > > Since I have started learning python only few months ago, I don't know the > debugging option and will give it a try. > > The way it works is: > Write a code to manipulate points in 2d or 3d space. > This code then can be written to a scad file and you have the model. > > > On Tue, 18 Oct, 2022, 4:28 am William Lugg via Discuss, < > discuss@lists.openscad.org> wrote: > >> >> >> >> ---------- Forwarded message ---------- >> From: William Lugg <luggw1@protonmail.com> >> To: "Jan Öhman via Discuss" <discuss@lists.openscad.org> >> Cc: >> Bcc: >> Date: Mon, 17 Oct 2022 22:57:11 +0000 >> Subject: [OpenSCAD] Re: Debugging OpenSCAD code >> I understand what you're saying re the model displaying, but multiple >> times I've been attempting to troubleshoot looping and navigating >> through a complex if structure in a module. I know what the model was >> going to look like when it finished; how it was getting there was what I >> was interested in. Adding echos was becoming quite troublesome. As it >> turned out in my case, I was able to color the different components and >> discover the errant if clause that was causing me trouble...this time. >> >> So I guess the question is what evidence do I need to provide to support >> the need for debugging tools to be added to the code editor? >> Alternatively, isn't there a way to integrate a pre-developed open >> source IDE into OpenSCAD that would provide all those tools? I know I >> make it sound trivial, but it just seems like an effort to reinvent the >> wheel here. >> >> Just a thought...don't shoot the newbie. ;o) >> Bill Lugg >> >> On 10/17/22 16:28, Jordan Brown wrote: >> > I don't see any issues on the subject at >> > https://github.com/openscad/openscad/issues , suggesting that nobody >> > has been really interested. You should file an issue if it's >> > important to you, but of course that wouldn't guarantee that anybody >> > *else* is interested and willing to do the work. >> > >> > Some notes: >> > >> > * A debugger would likely not be nearly as useful as you might >> > think, because OpenSCAD doesn't put the model on the screen until >> > after the program has executed - and can't, because there's no >> > telling what will happen to any particular piece of geometry until >> > it gets all the way to the top-level implied union. >> > * The * and ! modifiers are also quite helpful. So is #, but in a >> > different way. >> > * Note that echo() can be used in expressions, and that assert() can >> > be used both as a statement and in an expression. >> > >> > >> >> >> >> >> ---------- Forwarded message ---------- >> From: William Lugg via Discuss <discuss@lists.openscad.org> >> To: "Jan Öhman via Discuss" <discuss@lists.openscad.org> >> Cc: William Lugg <luggw1@protonmail.com> >> Bcc: >> Date: Mon, 17 Oct 2022 22:57:11 +0000 >> Subject: [OpenSCAD] Re: Debugging OpenSCAD code >> _______________________________________________ >> 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 >
FH
Father Horton
Tue, Oct 18, 2022 12:47 AM
  • right tool.

On Mon, Oct 17, 2022 at 7:44 PM Father Horton fatherhorton@gmail.com
wrote:

OpenSCAD can do anything. That doesn't mean it's always the right too.
Sometimes it's just easier to do it in Python (or something else) and
import to OpenSCAD as needed.

On Mon, Oct 17, 2022 at 7:40 PM Sanjeev Prabhakar <
sprabhakar2006@gmail.com> wrote:

I am writing openscad codes in python (jupyter notebook) although I am
not very proficient in python but I find it quite useful.

Stopping the code whenever a certain condition is met is very easy and a
lot of things which would be very difficult in openscad can be done in
python like reshaping the data etc.

Also if openscad crashes the code is not lost as it is written in jupyter
notebook which till date has never crashed and you have an option to stop
the code execution if it is taking too long.

Till now there is no issues whatsoever and I have written a lot of
functions in python.

Since I have started learning python only few months ago, I don't know
the debugging option and will give it a try.

The way it works is:
Write a code to manipulate points in 2d or 3d space.
This code then can be written to a scad file and you have the model.

On Tue, 18 Oct, 2022, 4:28 am William Lugg via Discuss, <
discuss@lists.openscad.org> wrote:

---------- Forwarded message ----------
From: William Lugg luggw1@protonmail.com
To: "Jan Öhman via Discuss" discuss@lists.openscad.org
Cc:
Bcc:
Date: Mon, 17 Oct 2022 22:57:11 +0000
Subject: [OpenSCAD] Re: Debugging OpenSCAD code
I understand what you're saying re the model displaying, but multiple
times I've been attempting to troubleshoot looping and navigating
through a complex if structure in a module.  I know what the model was
going to look like when it finished; how it was getting there was what I
was interested in.  Adding echos was becoming quite troublesome.  As it
turned out in my case, I was able to color the different components and
discover the errant if clause that was causing me trouble...this time.

So I guess the question is what evidence do I need to provide to support
the need for debugging tools to be added to the code editor?
Alternatively, isn't there a way to integrate a pre-developed open
source IDE into OpenSCAD that would provide all those tools?  I know I
make it sound trivial, but it just seems like an effort to reinvent the
wheel here.

Just a thought...don't shoot the newbie.  ;o)
Bill Lugg

On 10/17/22 16:28, Jordan Brown wrote:

I don't see any issues on the subject at
https://github.com/openscad/openscad/issues , suggesting that nobody
has been really interested.  You should file an issue if it's
important to you, but of course that wouldn't guarantee that anybody
else is interested and willing to do the work.

Some notes:

  • A debugger would likely not be nearly as useful as you might
    think, because OpenSCAD doesn't put the model on the screen until
    after the program has executed - and can't, because there's no
    telling what will happen to any particular piece of geometry until
    it gets all the way to the top-level implied union.
  • The * and ! modifiers are also quite helpful.  So is #, but in a
    different way.
  • Note that echo() can be used in expressions, and that assert() can
    be used both as a statement and in an expression.

---------- Forwarded message ----------
From: William Lugg via Discuss discuss@lists.openscad.org
To: "Jan Öhman via Discuss" discuss@lists.openscad.org
Cc: William Lugg luggw1@protonmail.com
Bcc:
Date: Mon, 17 Oct 2022 22:57:11 +0000
Subject: [OpenSCAD] Re: Debugging OpenSCAD code


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

* right tool. On Mon, Oct 17, 2022 at 7:44 PM Father Horton <fatherhorton@gmail.com> wrote: > OpenSCAD *can* do anything. That doesn't mean it's always the right too. > Sometimes it's just easier to do it in Python (or something else) and > import to OpenSCAD as needed. > > On Mon, Oct 17, 2022 at 7:40 PM Sanjeev Prabhakar < > sprabhakar2006@gmail.com> wrote: > >> I am writing openscad codes in python (jupyter notebook) although I am >> not very proficient in python but I find it quite useful. >> >> Stopping the code whenever a certain condition is met is very easy and a >> lot of things which would be very difficult in openscad can be done in >> python like reshaping the data etc. >> >> Also if openscad crashes the code is not lost as it is written in jupyter >> notebook which till date has never crashed and you have an option to stop >> the code execution if it is taking too long. >> >> Till now there is no issues whatsoever and I have written a lot of >> functions in python. >> >> Since I have started learning python only few months ago, I don't know >> the debugging option and will give it a try. >> >> The way it works is: >> Write a code to manipulate points in 2d or 3d space. >> This code then can be written to a scad file and you have the model. >> >> >> On Tue, 18 Oct, 2022, 4:28 am William Lugg via Discuss, < >> discuss@lists.openscad.org> wrote: >> >>> >>> >>> >>> ---------- Forwarded message ---------- >>> From: William Lugg <luggw1@protonmail.com> >>> To: "Jan Öhman via Discuss" <discuss@lists.openscad.org> >>> Cc: >>> Bcc: >>> Date: Mon, 17 Oct 2022 22:57:11 +0000 >>> Subject: [OpenSCAD] Re: Debugging OpenSCAD code >>> I understand what you're saying re the model displaying, but multiple >>> times I've been attempting to troubleshoot looping and navigating >>> through a complex if structure in a module. I know what the model was >>> going to look like when it finished; how it was getting there was what I >>> was interested in. Adding echos was becoming quite troublesome. As it >>> turned out in my case, I was able to color the different components and >>> discover the errant if clause that was causing me trouble...this time. >>> >>> So I guess the question is what evidence do I need to provide to support >>> the need for debugging tools to be added to the code editor? >>> Alternatively, isn't there a way to integrate a pre-developed open >>> source IDE into OpenSCAD that would provide all those tools? I know I >>> make it sound trivial, but it just seems like an effort to reinvent the >>> wheel here. >>> >>> Just a thought...don't shoot the newbie. ;o) >>> Bill Lugg >>> >>> On 10/17/22 16:28, Jordan Brown wrote: >>> > I don't see any issues on the subject at >>> > https://github.com/openscad/openscad/issues , suggesting that nobody >>> > has been really interested. You should file an issue if it's >>> > important to you, but of course that wouldn't guarantee that anybody >>> > *else* is interested and willing to do the work. >>> > >>> > Some notes: >>> > >>> > * A debugger would likely not be nearly as useful as you might >>> > think, because OpenSCAD doesn't put the model on the screen until >>> > after the program has executed - and can't, because there's no >>> > telling what will happen to any particular piece of geometry until >>> > it gets all the way to the top-level implied union. >>> > * The * and ! modifiers are also quite helpful. So is #, but in a >>> > different way. >>> > * Note that echo() can be used in expressions, and that assert() can >>> > be used both as a statement and in an expression. >>> > >>> > >>> >>> >>> >>> >>> ---------- Forwarded message ---------- >>> From: William Lugg via Discuss <discuss@lists.openscad.org> >>> To: "Jan Öhman via Discuss" <discuss@lists.openscad.org> >>> Cc: William Lugg <luggw1@protonmail.com> >>> Bcc: >>> Date: Mon, 17 Oct 2022 22:57:11 +0000 >>> Subject: [OpenSCAD] Re: Debugging OpenSCAD code >>> _______________________________________________ >>> 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 >> >