I've been working on a aerodynamics project for modelling alternative shapes
for some weeks now using OpenSCAD. The shapes are dynamically generated upon
a list of parameters, sometimes calculating several (sub)shapes depending on
surrounding shapes.
Now that my code is going towards 1000+ lines I must restructure and
refactor it. OpenSCAD uses a scripting language and I'm running into some
problems that others might have experienced too but I cannot find much
information about: Are there any tools that ease the development of (large)
scripts?
What I'm really missing is:
A debugger and breakpoints
I'm now debugging using echo statements, which is in fact back to the 80's.
It seems to be impossible to stop the script at an arbitrary point. Not even
a pause statement.
Code refactoring / renaming
Is a simple text search and replace that doesn't know any context.
Warnings
For example constants that are defined but never used.
Any ideas?
How many separate modules do you have now?
I was able to break a project up into about 10 modules. Each one is
under 80 lines and most are much smaller.
It is probably quite different but the final project consists of over
300 identifiable pieces, each one of which is generated using parameters.
If you can refactor it successfully, you should be able to test each
module separately which helps a lot.
You may have to create some test scaffolding but these might be
worthwhile in reducing the time to test and in reducing the complexity
of debugging individual shapes or sub-assemblies.
I hope that these comments help.
Ron
On 2020-08-05 10:05 a.m., peter_osc@xs4all.nl wrote:
I’ve been working on a aerodynamics project for modelling alternative
shapes for some weeks now using OpenSCAD. The shapes are dynamically
generated upon a list of parameters, sometimes calculating several
(sub)shapes depending on surrounding shapes.
Now that my code is going towards 1000+ lines I must restructure and
refactor it. OpenSCAD uses a scripting language and I’m running into
some problems that others might have experienced too but I cannot find
much information about: Are there any tools that ease the development
of (large) scripts?
What I’m really missing is:
A debugger and breakpoints
I’m now debugging using echo statements, which is in fact back to the
80’s. It seems to be impossible to stop the script at an arbitrary
point. Not even a pause statement.
Code refactoring / renaming
Is a simple text search and replace that doesn’t know any context.
Warnings
For example constants that are defined but never used.
Any ideas?
OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
--
Ron Wheeler
Artifact Software
438-345-3369
rwheeler@artifact-software.com
Using assert() instead of echo with stop on first warning is a bit like a
breakpoint in that you will get a stack trace as well as any info you add
to the assert message.
On Wed, 5 Aug 2020 at 16:26, Ron Wheeler via Discuss <
discuss@lists.openscad.org> wrote:
How many separate modules do you have now?
I was able to break a project up into about 10 modules. Each one is under
80 lines and most are much smaller.
It is probably quite different but the final project consists of over 300
identifiable pieces, each one of which is generated using parameters.
If you can refactor it successfully, you should be able to test each
module separately which helps a lot.
You may have to create some test scaffolding but these might be worthwhile
in reducing the time to test and in reducing the complexity of debugging
individual shapes or sub-assemblies.
I hope that these comments help.
Ron
On 2020-08-05 10:05 a.m., peter_osc@xs4all.nl wrote:
I’ve been working on a aerodynamics project for modelling alternative
shapes for some weeks now using OpenSCAD. The shapes are dynamically
generated upon a list of parameters, sometimes calculating several
(sub)shapes depending on surrounding shapes.
Now that my code is going towards 1000+ lines I must restructure and
refactor it. OpenSCAD uses a scripting language and I’m running into some
problems that others might have experienced too but I cannot find much
information about: Are there any tools that ease the development of (large)
scripts?
What I’m really missing is:
A debugger and breakpoints
I’m now debugging using echo statements, which is in fact back to the
80’s. It seems to be impossible to stop the script at an arbitrary point.
Not even a pause statement.
Code refactoring / renaming
Is a simple text search and replace that doesn’t know any context.
Warnings
For example constants that are defined but never used.
Any ideas?
OpenSCAD mailing listDiscuss@lists.openscad.orghttp://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
--
Ron Wheeler
Artifact Software
438-345-3369rwheeler@artifact-software.com
OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
For search and rename I use UNIX tools (e.g. MinGW for Windoze):
grep, sed, vi/vim
grep could also help to find all instances of the given name.
Just my $0.02
Tim
On 8/5/2020 5:05 PM, peter_osc@xs4all.nl wrote:
I’ve been working on a aerodynamics project for modelling alternative
shapes for some weeks now using OpenSCAD. The shapes are dynamically
generated upon a list of parameters, sometimes calculating several
(sub)shapes depending on surrounding shapes.
Now that my code is going towards 1000+ lines I must restructure and
refactor it. OpenSCAD uses a scripting language and I’m running into
some problems that others might have experienced too but I cannot find
much information about: Are there any tools that ease the development of
(large) scripts?
What I’m really missing is:
A debugger and breakpoints
I’m now debugging using echo statements, which is in fact back to the
80’s. It seems to be impossible to stop the script at an arbitrary
point. Not even a pause statement.
Code refactoring / renaming
Is a simple text search and replace that doesn’t know any context.
Warnings
For example constants that are defined but never used.
Any ideas?
OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
I'd love that functionality - and be willing to pay for it. I've already
donated to OpenSCAD and I hope that others are doing the same.
Maybe the people who develop OpenSCAD will consider developing it. I know
that there are some complexities around order of statement execution that
can make things very complex.
From: peter_osc@xs4all.nl peter_osc@xs4all.nl
Sent: Wednesday, August 5, 2020 8:06 AM
To: discuss@lists.openscad.org
Subject: [OpenSCAD] Maintaining and debugging scripts
I've been working on a aerodynamics project for modelling alternative shapes
for some weeks now using OpenSCAD. The shapes are dynamically generated upon
a list of parameters, sometimes calculating several (sub)shapes depending on
surrounding shapes.
Now that my code is going towards 1000+ lines I must restructure and
refactor it. OpenSCAD uses a scripting language and I'm running into some
problems that others might have experienced too but I cannot find much
information about: Are there any tools that ease the development of (large)
scripts?
What I'm really missing is:
A debugger and breakpoints
I'm now debugging using echo statements, which is in fact back to the 80's.
It seems to be impossible to stop the script at an arbitrary point. Not even
a pause statement.
Code refactoring / renaming
Is a simple text search and replace that doesn't know any context.
Warnings
For example constants that are defined but never used.
Any ideas?
This doesn't help with debugging, but you can get somewhat smarter editing
using Visual Studio Code with the SCAD extension.
On Wed, Aug 5, 2020 at 10:25 AM ken@volksswitch.org wrote:
I’d love that functionality – and be willing to pay for it. I’ve already
donated to OpenSCAD and I hope that others are doing the same.
Maybe the people who develop OpenSCAD will consider developing it. I know
that there are some complexities around order of statement execution that
can make things very complex.
From: peter_osc@xs4all.nl peter_osc@xs4all.nl
Sent: Wednesday, August 5, 2020 8:06 AM
To: discuss@lists.openscad.org
Subject: [OpenSCAD] Maintaining and debugging scripts
I’ve been working on a aerodynamics project for modelling alternative
shapes for some weeks now using OpenSCAD. The shapes are dynamically
generated upon a list of parameters, sometimes calculating several
(sub)shapes depending on surrounding shapes.
Now that my code is going towards 1000+ lines I must restructure and
refactor it. OpenSCAD uses a scripting language and I’m running into some
problems that others might have experienced too but I cannot find much
information about: Are there any tools that ease the development of (large)
scripts?
What I’m really missing is:
A debugger and breakpoints
I’m now debugging using echo statements, which is in fact back to the
80’s. It seems to be impossible to stop the script at an arbitrary point.
Not even a pause statement.
Code refactoring / renaming
Is a simple text search and replace that doesn’t know any context.
Warnings
For example constants that are defined but never used.
Any ideas?
OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
--
Don
On Wed Aug 05 10:56:24 PDT 2020 dgarrett@acm.org said:
This doesn't help with debugging, but you can get somewhat smarter editing
using Visual Studio Code with the SCAD extension.
On Wed, Aug 5, 2020 at 10:25 AM ken@volksswitch.org wrote:
I?d love that functionality ? and be willing to pay for it. I?ve already
donated to OpenSCAD and I hope that others are doing the same.
What I?m really missing is:
Code refactoring / renaming
I keep hoping that somebody will make an SCAD plugin for Eclipse.
--
Bobcats and Cougars, oh my! http://john.casadelgato.com/Pets
On 05.08.20 20:34, John Lussmyer wrote:
I keep hoping that somebody will make an SCAD plugin
for Eclipse.
I'd prefer a Language Server implementation in OpenSCAD as
that would support any editor supporting this interface.
https://github.com/openscad/openscad/issues/2629
ciao,
Torsten.
Yeah suport for Language Server Protocol would be really nice.
I think this could go a long way in terms of helping with refactoring
in other IDEs etc, but would also be quite a large project in itself.
One other small trick I sometimes use (mostly to "prettify" other's
scripts) is the "Design" -> "Display AST..." menu item, which displays the
code formmatted with consistent indentation, and can be copy-pasted back
into the source file. It still has some limitations with includes and
uses, and will re-order assignments, functions, and module definitions...
but it can be nice if original indentation is all over the place.
On Wed, Aug 5, 2020 at 1:44 PM Torsten Paul Torsten.Paul@gmx.de wrote:
On 05.08.20 20:34, John Lussmyer wrote:
I keep hoping that somebody will make an SCAD plugin
for Eclipse.
I'd prefer a Language Server implementation in OpenSCAD as
that would support any editor supporting this interface.
https://github.com/openscad/openscad/issues/2629
ciao,
Torsten.
OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
What would you like in the editor that the OpenSCAD editor lacks?
On 2020-08-05 2:34 p.m., John Lussmyer wrote:
On Wed Aug 05 10:56:24 PDT 2020 dgarrett@acm.org said:
This doesn't help with debugging, but you can get somewhat smarter editing
using Visual Studio Code with the SCAD extension.
On Wed, Aug 5, 2020 at 10:25 AM ken@volksswitch.org wrote:
I?d love that functionality ? and be willing to pay for it. I?ve already
donated to OpenSCAD and I hope that others are doing the same.
What I?m really missing is:
Code refactoring / renaming
I keep hoping that somebody will make an SCAD plugin for Eclipse.
--
Bobcats and Cougars, oh my! http://john.casadelgato.com/Pets
OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
--
Ron Wheeler
Artifact Software
438-345-3369
rwheeler@artifact-software.com