discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

Fusion360 and OpenSCAD

J
jon
Thu, Oct 6, 2016 5:30 PM

Thank you, Torsten, but this "tool" is not documented sufficiently for
me to even understand where to start.

Jon

On 10/6/2016 1:05 PM, Torsten Paul wrote:

On 10/06/2016 01:49 PM, jon wrote:

Or a tool that allows you to position Bezier handles
which are then converted to smoothed lines and then
imported into OpenSCAD

Not integrated, but still nice way to just draw polygon:

http://daid.eu/~daid/3d/

source: https://github.com/daid/OpenSCAD-polygon-editor

ciao,
Torsten.

Thank you, Torsten, but this "tool" is not documented sufficiently for me to even understand where to start. Jon On 10/6/2016 1:05 PM, Torsten Paul wrote: > On 10/06/2016 01:49 PM, jon wrote: >> Or a tool that allows you to position Bezier handles >> which are then converted to smoothed lines and then >> imported into OpenSCAD >> > Not integrated, but still nice way to just draw polygon: > > http://daid.eu/~daid/3d/ > > source: https://github.com/daid/OpenSCAD-polygon-editor > > ciao, > Torsten. > >
FV
Frank van der Hulst
Thu, Oct 6, 2016 6:09 PM

Interesting idea, Richard.

A couple of thoughts....

OpenSCAD would need to monitor the "precompiler" source code, not the
OpenSCAD source file generated by the precompiler, for your idea of
automatically running a script beforehand. Or would the script generate a
temp file to be read by OpenSCAD itself?

It's already common for people to write Python scripts to generate OpenSCAD
source. What's the benefit of yet another super-OpenSCAD language? Or were
you thinking of something like the way PHP embeds chunks of HTML?

This can be done now by using an IDE or something like NotePad++ to manage
the source editing, and on command run the precompiler script to generate
the .scad file which in turn would trigger OpenSCAD to reload it. There's
no need to see the ugly generated code... you can tell OpenSCAD to hide its
editor window.

Frank

On Fri, Oct 7, 2016 at 6:30 AM, jon jon@jonbondy.com wrote:

Thank you, Torsten, but this "tool" is not documented sufficiently for me
to even understand where to start.

Jon

On 10/6/2016 1:05 PM, Torsten Paul wrote:

On 10/06/2016 01:49 PM, jon wrote:

Or a tool that allows you to position Bezier handles
which are then converted to smoothed lines and then
imported into OpenSCAD

Not integrated, but still nice way to just draw polygon:

Interesting idea, Richard. A couple of thoughts.... OpenSCAD would need to monitor the "precompiler" source code, not the OpenSCAD source file generated by the precompiler, for your idea of automatically running a script beforehand. Or would the script generate a temp file to be read by OpenSCAD itself? It's already common for people to write Python scripts to generate OpenSCAD source. What's the benefit of yet another super-OpenSCAD language? Or were you thinking of something like the way PHP embeds chunks of HTML? This can be done now by using an IDE or something like NotePad++ to manage the source editing, and on command run the precompiler script to generate the .scad file which in turn would trigger OpenSCAD to reload it. There's no need to see the ugly generated code... you can tell OpenSCAD to hide its editor window. Frank On Fri, Oct 7, 2016 at 6:30 AM, jon <jon@jonbondy.com> wrote: > Thank you, Torsten, but this "tool" is not documented sufficiently for me > to even understand where to start. > > Jon > > > > On 10/6/2016 1:05 PM, Torsten Paul wrote: > >> On 10/06/2016 01:49 PM, jon wrote: >> >>> Or a tool that allows you to position Bezier handles >>> which are then converted to smoothed lines and then >>> imported into OpenSCAD >>> >>> Not integrated, but still nice way to just draw polygon: >> >> http://daid.eu/~daid/3d/ >> >> source: https://github.com/daid/OpenSCAD-polygon-editor >> >> ciao, >> Torsten. >> >> >> > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org >
CA
Carsten Arnholm
Thu, Oct 6, 2016 7:17 PM

On 06. okt. 2016 18:58, Torsten Paul wrote:

On 10/06/2016 01:33 PM, arnholm@arnholm.org wrote:

I have been experimenting with extracting 2d profiles from
hand drawings, so they can be used to obtain 3d-printable
models.
See for example http://www.printrbottalk.com/forum/download/file.php?id=11168

Nice, what was used for the image->vector conversion?
The "some experimental code" sounds like it's not using
any existing tool or library?

No, it is a new library + application I have been playing with lately to
do this. It is experimental as noted but solves some difficult examples
already. It does not use any pre-existing tool or library (just
wxWidgets for the application GUI).

Another example, this time a famous logo:

The starting point, a B/W image
https://gyazo.com/5a256235cf21905c5946a4971c50e2ed

The white areas are triangulated into a mesh (home-grown triangulator).
Rather dense triangles in this case:
https://gyazo.com/79195935193fa14ff73e725e0807f4e8

The contours are identified from the mesh, note the colours of the inner
and outer contours, it is automatic
https://gyazo.com/c048ff34f3a1599ddc9234f9775ec3ac

The contours are exported as Angelscript source code and extruded in my
CSG application (using carve for 3d booleans). Below is OpenSCAD used as
a viewer of the resulting polyhedron:

Linear extrude
https://gyazo.com/bae667e63d29c7526d59b99693f7f7af

Rotate extrude (20 degrees)
https://gyazo.com/52a0cef818160c151b9b9b4c86762ef5

It would no doubt be possible to use the exact same approach to export
to .scad format and let OpenSCAD do the extrusions, but I have not done it.

I had a quick look at the potrace algorithm now, since you mentioned it.
http://potrace.sourceforge.net/potrace.pdf
Nice paper, the approach is quite different from mine, but some very
good ideas there.

Originally, I had a similar idea as your trace(...) command of
integrating image->vector conversion into my CSG application, but now I
think it really is impractical because the conversion needs to be
inspected and possibly redone with other parameters before it can be
accepted and used in a 3d model. So I found it easier to handle it
separately as shown above. The result is easy to integrate with other
modeling code since the profiles become source code functions returning
2d shapes (equivalent to an OpenSCAD module), you just copy/paste the
generated functions.

The potrace integration idea is nice but I suspect it might be subject
to difficult user issues if integrated too tightly.

I have briefly used potrace with OpenSCAD in the past
http://arnholm.org/a-reverse-3d-printing-experiment/, but I didn't know
the algorithm used by potrace.

Just my thoughts.

Carsten Arnholm

On 06. okt. 2016 18:58, Torsten Paul wrote: > On 10/06/2016 01:33 PM, arnholm@arnholm.org wrote: >> I have been experimenting with extracting 2d profiles from >> hand drawings, so they can be used to obtain 3d-printable >> models. >> See for example http://www.printrbottalk.com/forum/download/file.php?id=11168 >> > Nice, what was used for the image->vector conversion? > The "some experimental code" sounds like it's not using > any existing tool or library? No, it is a new library + application I have been playing with lately to do this. It is experimental as noted but solves some difficult examples already. It does not use any pre-existing tool or library (just wxWidgets for the application GUI). Another example, this time a famous logo: The starting point, a B/W image https://gyazo.com/5a256235cf21905c5946a4971c50e2ed The white areas are triangulated into a mesh (home-grown triangulator). Rather dense triangles in this case: https://gyazo.com/79195935193fa14ff73e725e0807f4e8 The contours are identified from the mesh, note the colours of the inner and outer contours, it is automatic https://gyazo.com/c048ff34f3a1599ddc9234f9775ec3ac The contours are exported as Angelscript source code and extruded in my CSG application (using carve for 3d booleans). Below is OpenSCAD used as a viewer of the resulting polyhedron: Linear extrude https://gyazo.com/bae667e63d29c7526d59b99693f7f7af Rotate extrude (20 degrees) https://gyazo.com/52a0cef818160c151b9b9b4c86762ef5 It would no doubt be possible to use the exact same approach to export to .scad format and let OpenSCAD do the extrusions, but I have not done it. I had a quick look at the potrace algorithm now, since you mentioned it. http://potrace.sourceforge.net/potrace.pdf Nice paper, the approach is quite different from mine, but some very good ideas there. Originally, I had a similar idea as your trace(...) command of integrating image->vector conversion into my CSG application, but now I think it really is impractical because the conversion needs to be inspected and possibly redone with other parameters before it can be accepted and used in a 3d model. So I found it easier to handle it separately as shown above. The result is easy to integrate with other modeling code since the profiles become source code functions returning 2d shapes (equivalent to an OpenSCAD module), you just copy/paste the generated functions. The potrace integration idea is nice but I suspect it might be subject to difficult user issues if integrated too tightly. I have briefly used potrace with OpenSCAD in the past http://arnholm.org/a-reverse-3d-printing-experiment/, but I didn't know the algorithm used by potrace. Just my thoughts. Carsten Arnholm
TP
Torsten Paul
Thu, Oct 6, 2016 7:46 PM

On 10/06/2016 09:17 PM, Carsten Arnholm wrote:

I had a quick look at the potrace algorithm now, since you
mentioned it. http://potrace.sourceforge.net/potrace.pdf
Nice paper, the approach is quite different from mine, but
some very good ideas there.

Yeah, looks like both approaches give quite good results.

The potrace integration idea is nice but I suspect it might
be subject to difficult user issues if integrated too tightly.

I think it's more a matter of scope. It's not intended to
cover all possible cases giving thousands of parameters. It's
supposed to "just work" for the simple/normal case. For
everything more advanced, I agree that a separate, specialized
application is a better choice.
I do expect it to work well for simple scanned sketches and
could reduce the effort to base a design on that quite a bit.

ciao,
Torsten.

On 10/06/2016 09:17 PM, Carsten Arnholm wrote: > I had a quick look at the potrace algorithm now, since you > mentioned it. http://potrace.sourceforge.net/potrace.pdf > Nice paper, the approach is quite different from mine, but > some very good ideas there. > Yeah, looks like both approaches give quite good results. > The potrace integration idea is nice but I suspect it might > be subject to difficult user issues if integrated too tightly. > I think it's more a matter of scope. It's not intended to cover all possible cases giving thousands of parameters. It's supposed to "just work" for the simple/normal case. For everything more advanced, I agree that a separate, specialized application is a better choice. I do expect it to work well for simple scanned sketches and could reduce the effort to base a design on that quite a bit. ciao, Torsten.
RU
Richard Urwin
Thu, Oct 6, 2016 8:04 PM

frankv wrote

OpenSCAD would need to monitor the "precompiler" source code, not the
OpenSCAD source file generated by the precompiler, for your idea of
automatically running a script beforehand. Or would the script generate a
temp file to be read by OpenSCAD itself?

Yes.

It's already common for people to write Python scripts to generate
OpenSCAD
source. What's the benefit of yet another super-OpenSCAD language? Or were
you thinking of something like the way PHP embeds chunks of HTML?

In this case, no; this would be a complete compiler, at least initially, for
my own delictation. Although I do have an application already written that
would do exactly that.

This can be done now by using an IDE or something like NotePad++ to manage
the source editing, and on command run the precompiler script to generate
the .scad file which in turn would trigger OpenSCAD to reload it.

And I do elsewhere; save-make-run is a normal part of programming. It would
just be nice not to have to do it.

There's no need to see the ugly generated code... you can tell OpenSCAD
to hide its
editor window.

Doesn't everyone? ;) I was just pointing out how transparent it would be for
very little effort.

tp3 wrote

The other option is to help making OpenSCAD itself better
which will then can benefit everyone who uses it.
Yes, it's more complicated to work together and find
solutions that don't break existing stuff, and yes that
can be frustrating at times, but there's also lots of
things to gain.

Granted, and I might. But there are other gains in working alone on a
private project, such as not having to convince everyone you have a good
idea before you try it out and find it is rubbish.

--
View this message in context: http://forum.openscad.org/Fusion360-and-OpenSCAD-tp18493p18581.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

frankv wrote > OpenSCAD would need to monitor the "precompiler" source code, not the > OpenSCAD source file generated by the precompiler, for your idea of > automatically running a script beforehand. Or would the script generate a > temp file to be read by OpenSCAD itself? Yes. > It's already common for people to write Python scripts to generate > OpenSCAD > source. What's the benefit of yet another super-OpenSCAD language? Or were > you thinking of something like the way PHP embeds chunks of HTML? In this case, no; this would be a complete compiler, at least initially, for my own delictation. Although I do have an application already written that would do exactly that. > This can be done now by using an IDE or something like NotePad++ to manage > the source editing, and on command run the precompiler script to generate > the .scad file which in turn would trigger OpenSCAD to reload it. And I do elsewhere; save-make-run is a normal part of programming. It would just be nice not to have to do it. > There's no need to see the ugly generated code... you can tell OpenSCAD > to hide its > editor window. Doesn't everyone? ;) I was just pointing out how transparent it would be for very little effort. tp3 wrote > The other option is to help making OpenSCAD itself better > which will then can benefit everyone who uses it. > Yes, it's more complicated to work together and find > solutions that don't break existing stuff, and yes that > can be frustrating at times, but there's also lots of > things to gain. Granted, and I might. But there are other gains in working alone on a private project, such as not having to convince everyone you have a good idea before you try it out and find it is rubbish. -- View this message in context: http://forum.openscad.org/Fusion360-and-OpenSCAD-tp18493p18581.html Sent from the OpenSCAD mailing list archive at Nabble.com.
TP
Torsten Paul
Thu, Oct 6, 2016 8:51 PM

On 10/06/2016 10:04 PM, Richard Urwin wrote:

tp3 wrote

The other option is to help making OpenSCAD itself better
which will then can benefit everyone who uses it.
Yes, it's more complicated to work together and find
solutions that don't break existing stuff, and yes that
can be frustrating at times, but there's also lots of
things to gain.

Granted, and I might. But there are other gains in working
alone on a private project, such as not having to convince
everyone you have a good idea before you try it out and
find it is rubbish.

Just trying something is actually very simple when using
OpenSCAD as base. Creating a new node that does something
new is quite easy, e.g. I had a python() node that could
generate geometry working in a couple of hours and I mostly
had to fight with the actual python interpreter calls.
The neat thing is that it's possible to reuse all the
existing parser and viewer code without even having to
look at it.
It's only getting a bit more complicated when integrating
new modules as it's hard to change language syntax once
it's out in the wild.
(e.g. https://github.com/openscad/openscad/pull/1380)
But it pretty much all the cases the result of the
discussions is a better solution, even if it takes some
time.

Anyway, I'm just asking because it's a bit sad seeing
all those dead pyscad projects (just an example, but I
feel there are at least 10 different ones with that name)
with description "Make better OpenSCAD and work around
limitations" with maybe 100 commits from some years ago.
Yep, there's lots of things that need improvement, and
at least some of those don't need a separate project.

As said before, it's not wrong to start a project like
that, it's very likely there's lots of things to learn
and that a good thing. But it's also very likely the
project is dead a couple of month later.

ciao,
Torsten.

On 10/06/2016 10:04 PM, Richard Urwin wrote: > tp3 wrote >> The other option is to help making OpenSCAD itself better >> which will then can benefit everyone who uses it. >> Yes, it's more complicated to work together and find >> solutions that don't break existing stuff, and yes that >> can be frustrating at times, but there's also lots of >> things to gain. > > Granted, and I might. But there are other gains in working > alone on a private project, such as not having to convince > everyone you have a good idea before you try it out and > find it is rubbish. > Just trying something is actually very simple when using OpenSCAD as base. Creating a new node that does something new is quite easy, e.g. I had a python() node that could generate geometry working in a couple of hours and I mostly had to fight with the actual python interpreter calls. The neat thing is that it's possible to reuse all the existing parser and viewer code without even having to look at it. It's only getting a bit more complicated when integrating new modules as it's hard to change language syntax once it's out in the wild. (e.g. https://github.com/openscad/openscad/pull/1380) But it pretty much all the cases the result of the discussions is a better solution, even if it takes some time. Anyway, I'm just asking because it's a bit sad seeing all those dead pyscad projects (just an example, but I feel there are at least 10 different ones with that name) with description "Make better OpenSCAD and work around limitations" with maybe 100 commits from some years ago. Yep, there's lots of things that need improvement, and at least some of those don't need a separate project. As said before, it's not wrong to start a project like that, it's very likely there's lots of things to learn and that a good thing. But it's also very likely the project is dead a couple of month later. ciao, Torsten.
MS
Mark Schafer
Thu, Oct 6, 2016 11:54 PM

potrace is an excellent tool for this and you can see a good example of
its integration into inkscape code.

Which is where I use it to generate openscad files direct for export
from vector linework. Of which inkscape is an excellent tool

On 10/7/2016 8:46 AM, Torsten Paul wrote:

On 10/06/2016 09:17 PM, Carsten Arnholm wrote:

I had a quick look at the potrace algorithm now, since you
mentioned it. http://potrace.sourceforge.net/potrace.pdf
Nice paper, the approach is quite different from mine, but
some very good ideas there.

Yeah, looks like both approaches give quite good results.

The potrace integration idea is nice but I suspect it might
be subject to difficult user issues if integrated too tightly.

I think it's more a matter of scope. It's not intended to
cover all possible cases giving thousands of parameters. It's
supposed to "just work" for the simple/normal case. For
everything more advanced, I agree that a separate, specialized
application is a better choice.
I do expect it to work well for simple scanned sketches and
could reduce the effort to base a design on that quite a bit.

ciao,
Torsten.


potrace is an excellent tool for this and you can see a good example of its integration into inkscape code. Which is where I use it to generate openscad files direct for export from vector linework. Of which inkscape is an excellent tool On 10/7/2016 8:46 AM, Torsten Paul wrote: > On 10/06/2016 09:17 PM, Carsten Arnholm wrote: >> I had a quick look at the potrace algorithm now, since you >> mentioned it. http://potrace.sourceforge.net/potrace.pdf >> Nice paper, the approach is quite different from mine, but >> some very good ideas there. >> > Yeah, looks like both approaches give quite good results. > >> The potrace integration idea is nice but I suspect it might >> be subject to difficult user issues if integrated too tightly. >> > I think it's more a matter of scope. It's not intended to > cover all possible cases giving thousands of parameters. It's > supposed to "just work" for the simple/normal case. For > everything more advanced, I agree that a separate, specialized > application is a better choice. > I do expect it to work well for simple scanned sketches and > could reduce the effort to base a design on that quite a bit. > > ciao, > Torsten. > > ____
AC
Alan Cox
Fri, Oct 7, 2016 10:58 AM

There's no need to see the ugly generated code... you can tell OpenSCAD
to hide its
editor window.

Doesn't everyone? ;) I was just pointing out how transparent it would be for
very little effort.

Or you allow it to run as a command line in a pipe (which for some of the
other tools is the only way to do it)

I actually go to the trouble of generating nice code with proper
indentation from my tools. In the longer term I've found it pays off
repeatedly when you need to take tool output and debug it, or when you
want to take tool output and hand tweak it for a special case.

It would also not be hard to write an "indent" for openscad 8)

Alan

> > There's no need to see the ugly generated code... you can tell OpenSCAD > > to hide its > > editor window. > > Doesn't everyone? ;) I was just pointing out how transparent it would be for > very little effort. Or you allow it to run as a command line in a pipe (which for some of the other tools is the only way to do it) I actually go to the trouble of generating nice code with proper indentation from my tools. In the longer term I've found it pays off repeatedly when you need to take tool output and debug it, or when you want to take tool output and hand tweak it for a special case. It would also not be hard to write an "indent" for openscad 8) Alan
MK
Marius Kintel
Fri, Oct 7, 2016 11:56 AM

On Oct 7, 2016, at 01:54, Mark Schafer mschafer@wireframe.biz wrote:

Which is where I use it to generate openscad files direct for export from vector linework. Of which inkscape is an excellent tool

FYI: The OpenSCAD development snapshot has experimental support for direct SVG import. It’s still experimental - we need more people testing this and commenting on how it fits their use-cases.

-Marius

> On Oct 7, 2016, at 01:54, Mark Schafer <mschafer@wireframe.biz> wrote: > > Which is where I use it to generate openscad files direct for export from vector linework. Of which inkscape is an excellent tool > FYI: The OpenSCAD development snapshot has experimental support for direct SVG import. It’s still experimental - we need more people testing this and commenting on how it fits their use-cases. -Marius
DM
doug moen
Fri, Oct 7, 2016 12:52 PM

So how would it be if OpenSCAD had an ability to watch the source file and
then run a configurable script on it before loading the result of that
script. There's various levels of doing that, from a script that is blindly
run on all files, to something that can treat files differently based on
their extensions with macros for the filenames involved. A modular first
hack should be simple to produce and then others with more interest could
extend it as required and send pull requests.

You could solve your problem by running a separate tool that watches your
source file, and invokes your language->OpenSCAD compiler when the source
file changes.

There are lots of tools like this available on the internet. Here's one
option:  http://entrproject.org/

There's no need to build this tool into OpenSCAD.

> > So how would it be if OpenSCAD had an ability to watch the source file and > then run a configurable script on it before loading the result of that > script. There's various levels of doing that, from a script that is blindly > run on all files, to something that can treat files differently based on > their extensions with macros for the filenames involved. A modular first > hack should be simple to produce and then others with more interest could > extend it as required and send pull requests. > You could solve your problem by running a separate tool that watches your source file, and invokes your language->OpenSCAD compiler when the source file changes. There are lots of tools like this available on the internet. Here's one option: http://entrproject.org/ There's no need to build this tool into OpenSCAD.