discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

seat

GS
Guenther Sohler
Mon, Jun 3, 2024 11:28 AM

Subdividing a solid to smoothen the edges sounds like a good idea.
However, depending on how a face with many vertices is triangulated the
result after rounding could  look very different.

On Mon, Jun 3, 2024 at 1:20 PM Chun Kit LAM via Discuss <
discuss@lists.openscad.org> wrote:

Just FYI, the manifold backend has subdivision for smoothing shapes. Here
are some recent PRs that may be of interest:

https://github.com/elalish/manifold/pull/793
https://github.com/elalish/manifold/pull/821

It doesn't seem too hard to expose the API to openscad, but not sure if
people are happy with having this manifold specific feature. Perhaps we
should try to find more people to try this.
On 3/6/2024 18:34, Adrian Mariano via Discuss wrote:

Well, a C language .h file basically describes an API.  Here's an example
of a solution that does a lot of interesting things.  I can't find it at
the moment, but it has the ability to make joints with different levels of
continuity, so G0 or G2, but the interface is all about pointing and
clicking.  https://www.xnurbs.com/

On Mon, Jun 3, 2024 at 6:06 AM Jon Bondy jon@jonbondy.com wrote:

Adrian:

My use of the term API was a poor one.  I think William said it better.
We need a way of thinking about such complex shapes as procedures and
functions and data, as in a C .H file, and then find a way to implement
those functions in OpenSCAD, if that is even possible.  Up until now, I
thought the problem lay in OpenSCAD's quirky feature set (no variables,
minimal data structures), but now I can see that the problem is more in
finding a design approach that is practical.  It seems that Sanjeev has
conceived of how to create such complex shapes.  Perhaps we can learn from
what he has done, and explore how and whether these functions can be
implemented in OpenSCAD directly.

Jon
On 6/3/2024 12:37 AM, Adrian Mariano via Discuss wrote:

Jon, I think you're underestimating the severity of the concern here.  We
don't merely need an API to do this kind of design.  At least to me that
suggests that a design approach exists and you just need to write its
interface.  There is a perfectly satisfactory API to beziers in BOSL2, for
example.  In actual fact it seems like what's needed is a design philosophy
or strategy.  And indeed, if anybody has any ideas I'd be interested in
hearing them.  I've implemented various things in BOSL2 that do curves
using beziers, but none are particularly general.  I started with
round_corners to round the corners of a polygon, which can apply beziers to
the corners in 2d.  Later I wrote rounded_prism which does a sort of
analogous thing of rounding edges of an arbitrary prism in 3d by placing
beziers at the various corners.  I also implemented smooth_path which takes
a polygon and converts each edge to a bezier curve so that they meet
smoothly (C1) at the corners with a specified amount of bulge.    And I
implemented join_prism() which joins various kinds of prisms or prism to
sphere or plane with a fillet.  But none of this provides a general
framework for designing some arbitrarily curved 3d object.

One approach to that sort of design is to start with a polyhedron and
then smooth it.  There are ways to do this such as Catmull smoothing and
other more sophisticated ones.  They depend on how the starting shape is
triangulated and are hard to control, though.  In particular, what if you
only want to smooth part of a polyhedron?  About a year ago Martin
Herdieckerhoff posted an intriguing message about a library called Yari
that used some subdivision methods to design rounded shapes, but I don't
think I ever saw any details about how it worked, or a link to the actual
algorithm.

On Sun, Jun 2, 2024 at 8:46 PM Jon Bondy via Discuss <
discuss@lists.openscad.org> wrote:

I agree that what is missing is the API to do this kind of complex
curved design.  As to whether that is implemented directly in OpenSCAD or
in a pre-processor or a library may be moot.  That said, once I skip over
to another language, I may not return to OpenSCAD.

A different question would be "could we enhance OpenSCAD to the point
where relying on other languages is unnecessary?"  I'm sure this has been
pondered in the past.

Jon

On 6/2/2024 12:16 PM, William F. Adams via Discuss wrote:

On Sunday, June 2, 2024 at 07:26:06 AM EDT, Jon Bondy via Discuss
discuss@lists.openscad.org discuss@lists.openscad.org wrote:

The OpenSCAD file is incomprehensible, to the point of being useless.
You are writing in Python, not in OpenSCAD. You are just using OpenSCAD as
rendering engine.

Let's turn this around --- if there was an OpenSCAD module for
representing such a design what would the interface look like?

<snip>

http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient
Virus-free.www.avg.com
http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient
<#m_-5478404025311569297_m_7325925207113937027_m_3168717318659623628_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>


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

Subdividing a solid to smoothen the edges sounds like a good idea. However, depending on how a face with many vertices is triangulated the result after rounding could look very different. On Mon, Jun 3, 2024 at 1:20 PM Chun Kit LAM via Discuss < discuss@lists.openscad.org> wrote: > Just FYI, the manifold backend has subdivision for smoothing shapes. Here > are some recent PRs that may be of interest: > > https://github.com/elalish/manifold/pull/793 > https://github.com/elalish/manifold/pull/821 > > It doesn't seem too hard to expose the API to openscad, but not sure if > people are happy with having this manifold specific feature. Perhaps we > should try to find more people to try this. > On 3/6/2024 18:34, Adrian Mariano via Discuss wrote: > > Well, a C language .h file basically describes an API. Here's an example > of a solution that does a lot of interesting things. I can't find it at > the moment, but it has the ability to make joints with different levels of > continuity, so G0 or G2, but the interface is all about pointing and > clicking. https://www.xnurbs.com/ > > On Mon, Jun 3, 2024 at 6:06 AM Jon Bondy <jon@jonbondy.com> wrote: > >> Adrian: >> >> My use of the term API was a poor one. I think William said it better. >> We need a way of thinking about such complex shapes as procedures and >> functions and data, as in a C .H file, and then find a way to implement >> those functions in OpenSCAD, if that is even possible. Up until now, I >> thought the problem lay in OpenSCAD's quirky feature set (no variables, >> minimal data structures), but now I can see that the problem is more in >> finding a design approach that is practical. It seems that Sanjeev has >> conceived of how to create such complex shapes. Perhaps we can learn from >> what he has done, and explore how and whether these functions can be >> implemented in OpenSCAD directly. >> >> Jon >> On 6/3/2024 12:37 AM, Adrian Mariano via Discuss wrote: >> >> Jon, I think you're underestimating the severity of the concern here. We >> don't merely need an API to do this kind of design. At least to me that >> suggests that a design approach exists and you just need to write its >> interface. There is a perfectly satisfactory API to beziers in BOSL2, for >> example. In actual fact it seems like what's needed is a design philosophy >> or strategy. And indeed, if anybody has any ideas I'd be interested in >> hearing them. I've implemented various things in BOSL2 that do curves >> using beziers, but none are particularly general. I started with >> round_corners to round the corners of a polygon, which can apply beziers to >> the corners in 2d. Later I wrote rounded_prism which does a sort of >> analogous thing of rounding edges of an arbitrary prism in 3d by placing >> beziers at the various corners. I also implemented smooth_path which takes >> a polygon and converts each edge to a bezier curve so that they meet >> smoothly (C1) at the corners with a specified amount of bulge. And I >> implemented join_prism() which joins various kinds of prisms or prism to >> sphere or plane with a fillet. But none of this provides a general >> framework for designing some arbitrarily curved 3d object. >> >> One approach to that sort of design is to start with a polyhedron and >> then smooth it. There are ways to do this such as Catmull smoothing and >> other more sophisticated ones. They depend on how the starting shape is >> triangulated and are hard to control, though. In particular, what if you >> only want to smooth part of a polyhedron? About a year ago Martin >> Herdieckerhoff posted an intriguing message about a library called Yari >> that used some subdivision methods to design rounded shapes, but I don't >> think I ever saw any details about how it worked, or a link to the actual >> algorithm. >> >> >> On Sun, Jun 2, 2024 at 8:46 PM Jon Bondy via Discuss < >> discuss@lists.openscad.org> wrote: >> >>> I agree that what is missing is the API to do this kind of complex >>> curved design. As to whether that is implemented directly in OpenSCAD or >>> in a pre-processor or a library may be moot. That said, once I skip over >>> to another language, I may not return to OpenSCAD. >>> >>> A different question would be "could we enhance OpenSCAD to the point >>> where relying on other languages is unnecessary?" I'm sure this has been >>> pondered in the past. >>> >>> Jon >>> >>> >>> On 6/2/2024 12:16 PM, William F. Adams via Discuss wrote: >>> >>> On Sunday, June 2, 2024 at 07:26:06 AM EDT, Jon Bondy via Discuss >>> <discuss@lists.openscad.org> <discuss@lists.openscad.org> wrote: >>> >>> The OpenSCAD file is incomprehensible, to the point of being useless. >>> You are writing in Python, not in OpenSCAD. You are just using OpenSCAD as >>> rendering engine. >>> >>> Let's turn this around --- if there was an OpenSCAD module for >>> representing such a design what would the interface look like? >>> >>> <snip> >>> >>> >>> >>> <http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient> >>> Virus-free.www.avg.com >>> <http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient> >>> <#m_-5478404025311569297_m_7325925207113937027_m_3168717318659623628_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2> >>> _______________________________________________ >>> 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 >
RW
Raymond West
Mon, Jun 3, 2024 11:36 AM

As  a start, it would be easier to consider 2d. The ancient cad software
that I use, I can trace a line with a mouse/trackball/graphics pen/other
device, dropping points as it moves, if needed. I would think that a
layer could be superimposed over the openscad window, and the
coordinates calculated in that layer for a polygon, then translated into
the openscad system as changes were made (the customiser takes effect
when a value is changed, so the time lag could be acceptable). That 
layer would be able to generate polygons to fit or match existing
shapes, and could solve the distance measuring problems, in 2d, for many
practical purposes. When it comes to altering the shape of a square,
say, then intermediate points would need generating, so that they could
be pushed around by the mouse. I did a hand cranked method some time ago
by saving the openscad 2d drawing as an SVG, reading it in python (or
maybe c++, can't remember), generated additional points, and then moved
them, and imported back into openscad. The SVG conversions could have
been avoided, had I knowledge of the internals of openscad.

For 3d, that would need a bit more mental effort in relating a 3d object
to a 2d plane, and vice-versa. However3d digitisers and 'mice' are
available, at a price, although it is simple enough to create an
imprecise. mechanical arm type device.

On 03/06/2024 05:37, Adrian Mariano via Discuss wrote:

Jon, I think you're underestimating the severity of the concern here. 
We don't merely need an API to do this kind of design.  At least to me
that suggests that a design approach exists and you just need to write
its interface.  There is a perfectly satisfactory API to beziers in
BOSL2, for example. In actual fact it seems like what's needed is a
design philosophy or strategy.  And indeed, if anybody has any ideas
I'd be interested in hearing them.  I've implemented various things in
BOSL2 that do curves using beziers, but none are particularly
general.  I started with round_corners to round the corners of a
polygon, which can apply beziers to the corners in 2d.  Later I wrote
rounded_prism which does a sort of analogous thing of rounding edges
of an arbitrary prism in 3d by placing beziers at the various
corners.  I also implemented smooth_path which takes a polygon and
converts each edge to a bezier curve so that they meet smoothly (C1)
at the corners with a specified amount of bulge.    And I implemented
join_prism() which joins various kinds of prisms or prism to sphere or
plane with a fillet.  But none of this provides a general framework
for designing some arbitrarily curved 3d object.

One approach to that sort of design is to start with a polyhedron and
then smooth it.  There are ways to do this such as Catmull smoothing
and other more sophisticated ones.  They depend on how the starting
shape is triangulated and are hard to control, though.  In particular,
what if you only want to smooth part of a polyhedron?  About a year
ago Martin Herdieckerhoff posted an intriguing message about a library
called Yari that used some subdivision methods to design rounded
shapes, but I don't think I ever saw any details about how it worked,
or a link to the actual algorithm.

On Sun, Jun 2, 2024 at 8:46 PM Jon Bondy via Discuss
discuss@lists.openscad.org wrote:

 I agree that what is missing is the API to do this kind of complex
 curved design.  As to whether that is implemented directly in
 OpenSCAD or in a pre-processor or a library may be moot.  That
 said, once I skip over to another language, I may not return to
 OpenSCAD.

 A different question would be "could we enhance OpenSCAD to the
 point where relying on other languages is unnecessary?"  I'm sure
 this has been pondered in the past.

 Jon


 On 6/2/2024 12:16 PM, William F. Adams via Discuss wrote:
 On Sunday, June 2, 2024 at 07:26:06 AM EDT, Jon Bondy via Discuss
 <discuss@lists.openscad.org> <mailto:discuss@lists.openscad.org>
 wrote:

 The OpenSCAD file is incomprehensible, to the point of being
 useless.  You are writing in Python, not in OpenSCAD. You are
 just using OpenSCAD as rendering engine.

 Let's turn this around --- if there was an OpenSCAD module for
 representing such a design what would the interface look like?
 <snip>

 <http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient>
 	Virus-free.www.avg.com
 <http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient>


 <#m_3168717318659623628_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
 _______________________________________________
 OpenSCAD mailing list
 To unsubscribe send an email to discuss-leave@lists.openscad.org

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

As  a start, it would be easier to consider 2d. The ancient cad software that I use, I can trace a line with a mouse/trackball/graphics pen/other device, dropping points as it moves, if needed. I would think that a layer could be superimposed over the openscad window, and the coordinates calculated in that layer for a polygon, then translated into the openscad system as changes were made (the customiser takes effect when a value is changed, so the time lag could be acceptable). That  layer would be able to generate polygons to fit or match existing shapes, and could solve the distance measuring problems, in 2d, for many practical purposes. When it comes to altering the shape of a square, say, then intermediate points would need generating, so that they could be pushed around by the mouse. I did a hand cranked method some time ago by saving the openscad 2d drawing as an SVG, reading it in python (or maybe c++, can't remember), generated additional points, and then moved them, and imported back into openscad. The SVG conversions could have been avoided, had I knowledge of the internals of openscad. For 3d, that would need a bit more mental effort in relating a 3d object to a 2d plane, and vice-versa. However3d digitisers and 'mice' are available, at a price, although it is simple enough to create an imprecise. mechanical arm type device. On 03/06/2024 05:37, Adrian Mariano via Discuss wrote: > Jon, I think you're underestimating the severity of the concern here.  > We don't merely need an API to do this kind of design.  At least to me > that suggests that a design approach exists and you just need to write > its interface.  There is a perfectly satisfactory API to beziers in > BOSL2, for example. In actual fact it seems like what's needed is a > design philosophy or strategy.  And indeed, if anybody has any ideas > I'd be interested in hearing them.  I've implemented various things in > BOSL2 that do curves using beziers, but none are particularly > general.  I started with round_corners to round the corners of a > polygon, which can apply beziers to the corners in 2d.  Later I wrote > rounded_prism which does a sort of analogous thing of rounding edges > of an arbitrary prism in 3d by placing beziers at the various > corners.  I also implemented smooth_path which takes a polygon and > converts each edge to a bezier curve so that they meet smoothly (C1) > at the corners with a specified amount of bulge.    And I implemented > join_prism() which joins various kinds of prisms or prism to sphere or > plane with a fillet.  But none of this provides a general framework > for designing some arbitrarily curved 3d object. > > One approach to that sort of design is to start with a polyhedron and > then smooth it.  There are ways to do this such as Catmull smoothing > and other more sophisticated ones.  They depend on how the starting > shape is triangulated and are hard to control, though.  In particular, > what if you only want to smooth part of a polyhedron?  About a year > ago Martin Herdieckerhoff posted an intriguing message about a library > called Yari that used some subdivision methods to design rounded > shapes, but I don't think I ever saw any details about how it worked, > or a link to the actual algorithm. > > > On Sun, Jun 2, 2024 at 8:46 PM Jon Bondy via Discuss > <discuss@lists.openscad.org> wrote: > > I agree that what is missing is the API to do this kind of complex > curved design.  As to whether that is implemented directly in > OpenSCAD or in a pre-processor or a library may be moot.  That > said, once I skip over to another language, I may not return to > OpenSCAD. > > A different question would be "could we enhance OpenSCAD to the > point where relying on other languages is unnecessary?"  I'm sure > this has been pondered in the past. > > Jon > > > On 6/2/2024 12:16 PM, William F. Adams via Discuss wrote: >> On Sunday, June 2, 2024 at 07:26:06 AM EDT, Jon Bondy via Discuss >> <discuss@lists.openscad.org> <mailto:discuss@lists.openscad.org> >> wrote: >> >> The OpenSCAD file is incomprehensible, to the point of being >> useless.  You are writing in Python, not in OpenSCAD. You are >> just using OpenSCAD as rendering engine. >> >> Let's turn this around --- if there was an OpenSCAD module for >> representing such a design what would the interface look like? >> > <snip> > > <http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient> > Virus-free.www.avg.com > <http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient> > > > <#m_3168717318659623628_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2> > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org > > > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email todiscuss-leave@lists.openscad.org
RW
Rogier Wolff
Mon, Jun 3, 2024 2:14 PM

On Mon, Jun 03, 2024 at 07:19:54PM +0800, Chun Kit LAM via Discuss wrote:

Just FYI, the manifold backend has subdivision for smoothing shapes. Here
are some recent PRs that may be of interest:

Thinking of smoothing...

I just tested:

$fs = .2;
$fa = 4;

difference () {
rotate ([45,0,0])
linear_extrude (height=15, twist=360, convexity=10) translate ([.1,-20]) square ([20,40]);
translate ([-50,-50,1]) cube (100);
}

and this now results in a reasonable "curve" in the plane where the
cut happens. The "cube" is modeling the "slicer" for 3D printing.

In the past, the linear-extrude with twist would cause the triangles
close to the axis of rotation to become perpendicular to
eachother. That meant that the intersection "curve" would end up with
lots of small zigzag lines. 3D printing those meant that the printer
couldn't process the many segments fast enough and would slow down a
lot while mathematically there would simply be a smooth curve instead
of the almost-rightangle change-of-direction that would be commanded
thousands of times. That would impact printspeed (a lot) and quality
(a lot)!

But it seems that this has been fixed and there is some smoothing
going on? Can someone who still has an older version of openscad lying
around that the above model gives a zigzag line when you zoom in near
the origin?

The angles between adjacent triangles of the extruded form would have
been "almost 90 degrees" in the past, currently they are only about 20
degrees. The spacing uf the subdivision should be smaller near the
origin. Now there are subdivisions near the outside that result in
almost coplanar triangles (could have just as well been one triangle),
whereas smaller subdivision near the origin would have resulted in
even less "wiggle" of the interface line.

Ah! The manual now says:

Additional the segments parameter adds vertices (points) to the
extruded polygon resulting in smoother twisted geometries.

linear_extrude (height=1, twist=36, convexity=10, $fn=8) translate ([0,0]) square (10);

Here you can clearly see that the two triangles that meet at 0,0,1 are
nearly at right angles. Change $fn to 80 and you'll see that the
intended shape doesn't have the "meet at right angles" property.
In the past the triangles would extend out to the outside of the
shape and still be at right angles, so increasing $fn or "slices"
did not result in a smoother curve for the 3D printer.

In my last example, slicing it in this orientation never results in
the zigzag curve. For what I'm making with this the orientation of the
extrusion does NOT end up perpendicular to the printbed and then the
"bad effects" used to happen.

I can now go and remove my workarounds for this.

"Five screw-puzzles by George Hart"

if you inspect the STLs you'll see they were made with an older
version of openscad.

Roger. 

https://github.com/elalish/manifold/pull/793
https://github.com/elalish/manifold/pull/821

It doesn't seem too hard to expose the API to openscad, but not sure if
people are happy with having this manifold specific feature. Perhaps we
should try to find more people to try this.

On 3/6/2024 18:34, Adrian Mariano via Discuss wrote:

Well, a C language .h file basically describes an API.  Here's an
example of a solution that does a lot of interesting things.  I can't
find it at the moment, but it has the ability to make joints with
different levels of continuity, so G0 or G2, but the interface is all
about pointing and clicking. https://www.xnurbs.com/

On Mon, Jun 3, 2024 at 6:06 AM Jon Bondy jon@jonbondy.com wrote:

 Adrian:

 My use of the term API was a poor one.  I think William said it
 better.  We need a way of thinking about such complex shapes as
 procedures and functions and data, as in a C .H file, and then
 find a way to implement those functions in OpenSCAD, if that is
 even possible.  Up until now, I thought the problem lay in
 OpenSCAD's quirky feature set (no variables, minimal data
 structures), but now I can see that the problem is more in finding
 a design approach that is practical.  It seems that Sanjeev has
 conceived of how to create such complex shapes.  Perhaps we can
 learn from what he has done, and explore how and whether these
 functions can be implemented in OpenSCAD directly.

 Jon

 On 6/3/2024 12:37 AM, Adrian Mariano via Discuss wrote:
 Jon, I think you're underestimating the severity of the concern
 here.  We don't merely need an API to do this kind of design.  At
 least to me that suggests that a design approach exists and you
 just need to write its interface.  There is a perfectly
 satisfactory API to beziers in BOSL2, for example.  In actual
 fact it seems like what's needed is a design philosophy or
 strategy.  And indeed, if anybody has any ideas I'd be interested
 in hearing them.  I've implemented various things in BOSL2 that
 do curves using beziers, but none are particularly general.  I
 started with round_corners to round the corners of a polygon,
 which can apply beziers to the corners in 2d.  Later I wrote
 rounded_prism which does a sort of analogous thing of rounding
 edges of an arbitrary prism in 3d by placing beziers at the
 various corners.  I also implemented smooth_path which takes a
 polygon and converts each edge to a bezier curve so that they
 meet smoothly (C1) at the corners with a specified amount of
 bulge.    And I implemented join_prism() which joins various
 kinds of prisms or prism to sphere or plane with a fillet.  But
 none of this provides a general framework for designing some
 arbitrarily curved 3d object.

 One approach to that sort of design is to start with a polyhedron
 and then smooth it.  There are ways to do this such as Catmull
 smoothing and other more sophisticated ones.  They depend on how
 the starting shape is triangulated and are hard to control,
 though.  In particular, what if you only want to smooth part of a
 polyhedron?  About a year ago Martin Herdieckerhoff posted an
 intriguing message about a library called Yari that used some
 subdivision methods to design rounded shapes, but I don't think I
 ever saw any details about how it worked, or a link to the actual
 algorithm.


 On Sun, Jun 2, 2024 at 8:46 PM Jon Bondy via Discuss
 <discuss@lists.openscad.org> wrote:

     I agree that what is missing is the API to do this kind of
     complex curved design.  As to whether that is implemented
     directly in OpenSCAD or in a pre-processor or a library may
     be moot.  That said, once I skip over to another language, I
     may not return to OpenSCAD.

     A different question would be "could we enhance OpenSCAD to
     the point where relying on other languages is unnecessary?" 
     I'm sure this has been pondered in the past.

     Jon


     On 6/2/2024 12:16 PM, William F. Adams via Discuss wrote:
     On Sunday, June 2, 2024 at 07:26:06 AM EDT, Jon Bondy via
     Discuss <discuss@lists.openscad.org>
     <mailto:discuss@lists.openscad.org> wrote:

     The OpenSCAD file is incomprehensible, to the point of being
     useless.  You are writing in Python, not in OpenSCAD. You
     are just using OpenSCAD as  rendering engine.

     Let's turn this around --- if there was an OpenSCAD module
     for representing such a design what would the interface look
     like?
     <snip>

     <http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient>
     	Virus-free.www.avg.com
     <http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient>


     <#m_7325925207113937027_m_3168717318659623628_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
     _______________________________________________
     OpenSCAD mailing list
     To unsubscribe send an email to discuss-leave@lists.openscad.org


 _______________________________________________
 OpenSCAD mailing list
 To unsubscribe send an email todiscuss-leave@lists.openscad.org

OpenSCAD mailing list
To unsubscribe send an email todiscuss-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.

On Mon, Jun 03, 2024 at 07:19:54PM +0800, Chun Kit LAM via Discuss wrote: > Just FYI, the manifold backend has subdivision for smoothing shapes. Here > are some recent PRs that may be of interest: Thinking of smoothing... I just tested: $fs = .2; $fa = 4; difference () { rotate ([45,0,0]) linear_extrude (height=15, twist=360, convexity=10) translate ([.1,-20]) square ([20,40]); translate ([-50,-50,1]) cube (100); } and this now results in a reasonable "curve" in the plane where the cut happens. The "cube" is modeling the "slicer" for 3D printing. In the past, the linear-extrude with twist would cause the triangles close to the axis of rotation to become perpendicular to eachother. That meant that the intersection "curve" would end up with lots of small zigzag lines. 3D printing those meant that the printer couldn't process the many segments fast enough and would slow down a lot while mathematically there would simply be a smooth curve instead of the almost-rightangle change-of-direction that would be commanded thousands of times. That would impact printspeed (a lot) and quality (a lot)! But it seems that this has been fixed and there is some smoothing going on? Can someone who still has an older version of openscad lying around that the above model gives a zigzag line when you zoom in near the origin? The angles between adjacent triangles of the extruded form would have been "almost 90 degrees" in the past, currently they are only about 20 degrees. The spacing uf the subdivision should be smaller near the origin. Now there are subdivisions near the outside that result in almost coplanar triangles (could have just as well been one triangle), whereas smaller subdivision near the origin would have resulted in even less "wiggle" of the interface line. Ah! The manual now says: > Additional the segments parameter adds vertices (points) to the > extruded polygon resulting in smoother twisted geometries. linear_extrude (height=1, twist=36, convexity=10, $fn=8) translate ([0,0]) square (10); Here you can clearly see that the two triangles that meet at 0,0,1 are nearly at right angles. Change $fn to 80 and you'll see that the intended shape doesn't have the "meet at right angles" property. In the past the triangles would extend out to the outside of the shape and still be at right angles, so increasing $fn or "slices" did not result in a smoother curve for the 3D printer. In my last example, slicing it in this orientation never results in the zigzag curve. For what I'm making with this the orientation of the extrusion does NOT end up perpendicular to the printbed and then the "bad effects" used to happen. I can now go and remove my workarounds for this. "Five screw-puzzles by George Hart" if you inspect the STLs you'll see they were made with an older version of openscad. Roger. > > https://github.com/elalish/manifold/pull/793 > https://github.com/elalish/manifold/pull/821 > > It doesn't seem too hard to expose the API to openscad, but not sure if > people are happy with having this manifold specific feature. Perhaps we > should try to find more people to try this. > > On 3/6/2024 18:34, Adrian Mariano via Discuss wrote: > > Well, a C language .h file basically describes an API.  Here's an > > example of a solution that does a lot of interesting things.  I can't > > find it at the moment, but it has the ability to make joints with > > different levels of continuity, so G0 or G2, but the interface is all > > about pointing and clicking. https://www.xnurbs.com/ > > > > On Mon, Jun 3, 2024 at 6:06 AM Jon Bondy <jon@jonbondy.com> wrote: > > > > Adrian: > > > > My use of the term API was a poor one.  I think William said it > > better.  We need a way of thinking about such complex shapes as > > procedures and functions and data, as in a C .H file, and then > > find a way to implement those functions in OpenSCAD, if that is > > even possible.  Up until now, I thought the problem lay in > > OpenSCAD's quirky feature set (no variables, minimal data > > structures), but now I can see that the problem is more in finding > > a design approach that is practical.  It seems that Sanjeev has > > conceived of how to create such complex shapes.  Perhaps we can > > learn from what he has done, and explore how and whether these > > functions can be implemented in OpenSCAD directly. > > > > Jon > > > > On 6/3/2024 12:37 AM, Adrian Mariano via Discuss wrote: > > > Jon, I think you're underestimating the severity of the concern > > > here.  We don't merely need an API to do this kind of design.  At > > > least to me that suggests that a design approach exists and you > > > just need to write its interface.  There is a perfectly > > > satisfactory API to beziers in BOSL2, for example.  In actual > > > fact it seems like what's needed is a design philosophy or > > > strategy.  And indeed, if anybody has any ideas I'd be interested > > > in hearing them.  I've implemented various things in BOSL2 that > > > do curves using beziers, but none are particularly general.  I > > > started with round_corners to round the corners of a polygon, > > > which can apply beziers to the corners in 2d.  Later I wrote > > > rounded_prism which does a sort of analogous thing of rounding > > > edges of an arbitrary prism in 3d by placing beziers at the > > > various corners.  I also implemented smooth_path which takes a > > > polygon and converts each edge to a bezier curve so that they > > > meet smoothly (C1) at the corners with a specified amount of > > > bulge.    And I implemented join_prism() which joins various > > > kinds of prisms or prism to sphere or plane with a fillet.  But > > > none of this provides a general framework for designing some > > > arbitrarily curved 3d object. > > > > > > One approach to that sort of design is to start with a polyhedron > > > and then smooth it.  There are ways to do this such as Catmull > > > smoothing and other more sophisticated ones.  They depend on how > > > the starting shape is triangulated and are hard to control, > > > though.  In particular, what if you only want to smooth part of a > > > polyhedron?  About a year ago Martin Herdieckerhoff posted an > > > intriguing message about a library called Yari that used some > > > subdivision methods to design rounded shapes, but I don't think I > > > ever saw any details about how it worked, or a link to the actual > > > algorithm. > > > > > > > > > On Sun, Jun 2, 2024 at 8:46 PM Jon Bondy via Discuss > > > <discuss@lists.openscad.org> wrote: > > > > > > I agree that what is missing is the API to do this kind of > > > complex curved design.  As to whether that is implemented > > > directly in OpenSCAD or in a pre-processor or a library may > > > be moot.  That said, once I skip over to another language, I > > > may not return to OpenSCAD. > > > > > > A different question would be "could we enhance OpenSCAD to > > > the point where relying on other languages is unnecessary?"  > > > I'm sure this has been pondered in the past. > > > > > > Jon > > > > > > > > > On 6/2/2024 12:16 PM, William F. Adams via Discuss wrote: > > > > On Sunday, June 2, 2024 at 07:26:06 AM EDT, Jon Bondy via > > > > Discuss <discuss@lists.openscad.org> > > > > <mailto:discuss@lists.openscad.org> wrote: > > > > > > > > The OpenSCAD file is incomprehensible, to the point of being > > > > useless.  You are writing in Python, not in OpenSCAD. You > > > > are just using OpenSCAD as  rendering engine. > > > > > > > > Let's turn this around --- if there was an OpenSCAD module > > > > for representing such a design what would the interface look > > > > like? > > > > > > > <snip> > > > > > > <http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient> > > > Virus-free.www.avg.com > > > <http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient> > > > > > > > > > <#m_7325925207113937027_m_3168717318659623628_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2> > > > _______________________________________________ > > > OpenSCAD mailing list > > > To unsubscribe send an email to discuss-leave@lists.openscad.org > > > > > > > > > _______________________________________________ > > > OpenSCAD mailing list > > > To unsubscribe send an email todiscuss-leave@lists.openscad.org > > > > > > _______________________________________________ > > OpenSCAD mailing list > > To unsubscribe send an email todiscuss-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.
SP
Sanjeev Prabhakar
Mon, Jun 3, 2024 3:51 PM

I personally feel as a language python is far more powerful and has a
large support base.
I have also written a library in openscad, and finally had to switch to
python. At that time I had no clue about python. Even now my knowledge in
python is extremely limited.
You can say the first language I learnt is openSCAD and would like to thank
all of you for being a great support.
People who have worked in the software industry or have some coding
experience probably can learn it much faster.

On Mon, 3 Jun 2024 at 06:16, Jon Bondy via Discuss <
discuss@lists.openscad.org> wrote:

I agree that what is missing is the API to do this kind of complex curved
design.  As to whether that is implemented directly in OpenSCAD or in a
pre-processor or a library may be moot.  That said, once I skip over to
another language, I may not return to OpenSCAD.

A different question would be "could we enhance OpenSCAD to the point
where relying on other languages is unnecessary?"  I'm sure this has been
pondered in the past.

Jon

On 6/2/2024 12:16 PM, William F. Adams via Discuss wrote:

On Sunday, June 2, 2024 at 07:26:06 AM EDT, Jon Bondy via Discuss
discuss@lists.openscad.org discuss@lists.openscad.org wrote:

The OpenSCAD file is incomprehensible, to the point of being useless.  You
are writing in Python, not in OpenSCAD. You are just using OpenSCAD as
rendering engine.

Let's turn this around --- if there was an OpenSCAD module for
representing such a design what would the interface look like?

<snip>

http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient
Virus-free.www.avg.com
http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient
<#m_6857812283312750011_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>


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

I personally feel as a language python is far more powerful and has a large support base. I have also written a library in openscad, and finally had to switch to python. At that time I had no clue about python. Even now my knowledge in python is extremely limited. You can say the first language I learnt is openSCAD and would like to thank all of you for being a great support. People who have worked in the software industry or have some coding experience probably can learn it much faster. On Mon, 3 Jun 2024 at 06:16, Jon Bondy via Discuss < discuss@lists.openscad.org> wrote: > I agree that what is missing is the API to do this kind of complex curved > design. As to whether that is implemented directly in OpenSCAD or in a > pre-processor or a library may be moot. That said, once I skip over to > another language, I may not return to OpenSCAD. > > A different question would be "could we enhance OpenSCAD to the point > where relying on other languages is unnecessary?" I'm sure this has been > pondered in the past. > > Jon > > > On 6/2/2024 12:16 PM, William F. Adams via Discuss wrote: > > On Sunday, June 2, 2024 at 07:26:06 AM EDT, Jon Bondy via Discuss > <discuss@lists.openscad.org> <discuss@lists.openscad.org> wrote: > > The OpenSCAD file is incomprehensible, to the point of being useless. You > are writing in Python, not in OpenSCAD. You are just using OpenSCAD as > rendering engine. > > Let's turn this around --- if there was an OpenSCAD module for > representing such a design what would the interface look like? > > <snip> > > > > <http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient> > Virus-free.www.avg.com > <http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient> > <#m_6857812283312750011_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2> > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org >
AM
Adrian Mariano
Mon, Jun 3, 2024 8:33 PM

There are many CAD programs that can construct curves, perhaps beziers, or
perhaps something else, by using clicks of the mouse.  That is not
OpenSCAD!  The model has to be entirely described by code, not by mouse
clicks.

On Mon, Jun 3, 2024 at 7:37 AM Raymond West via Discuss <
discuss@lists.openscad.org> wrote:

As  a start, it would be easier to consider 2d. The ancient cad software
that I use, I can trace a line with a mouse/trackball/graphics pen/other
device, dropping points as it moves, if needed. I would think that a layer
could be superimposed over the openscad window, and the coordinates
calculated in that layer for a polygon, then translated into the openscad
system as changes were made (the customiser takes effect when a value is
changed, so the time lag could be acceptable). That  layer would be able to
generate polygons to fit or match existing shapes, and could solve the
distance measuring problems, in 2d, for many practical purposes. When it
comes to altering the shape of a square, say, then intermediate points
would need generating, so that they could be pushed around by the mouse. I
did a hand cranked method some time ago by saving the openscad 2d drawing
as an SVG, reading it in python (or maybe c++, can't remember), generated
additional points, and then moved them, and imported back into openscad.
The SVG conversions could have been avoided, had I knowledge of the
internals of openscad.

For 3d, that would need a bit more mental effort in relating a 3d object
to a 2d plane, and vice-versa. However3d digitisers and 'mice' are
available, at a price, although it is simple enough to create an imprecise.
mechanical arm type device.

On 03/06/2024 05:37, Adrian Mariano via Discuss wrote:

Jon, I think you're underestimating the severity of the concern here.  We
don't merely need an API to do this kind of design.  At least to me that
suggests that a design approach exists and you just need to write its
interface.  There is a perfectly satisfactory API to beziers in BOSL2, for
example.  In actual fact it seems like what's needed is a design philosophy
or strategy.  And indeed, if anybody has any ideas I'd be interested in
hearing them.  I've implemented various things in BOSL2 that do curves
using beziers, but none are particularly general.  I started with
round_corners to round the corners of a polygon, which can apply beziers to
the corners in 2d.  Later I wrote rounded_prism which does a sort of
analogous thing of rounding edges of an arbitrary prism in 3d by placing
beziers at the various corners.  I also implemented smooth_path which takes
a polygon and converts each edge to a bezier curve so that they meet
smoothly (C1) at the corners with a specified amount of bulge.    And I
implemented join_prism() which joins various kinds of prisms or prism to
sphere or plane with a fillet.  But none of this provides a general
framework for designing some arbitrarily curved 3d object.

One approach to that sort of design is to start with a polyhedron and then
smooth it.  There are ways to do this such as Catmull smoothing and other
more sophisticated ones.  They depend on how the starting shape is
triangulated and are hard to control, though.  In particular, what if you
only want to smooth part of a polyhedron?  About a year ago Martin
Herdieckerhoff posted an intriguing message about a library called Yari
that used some subdivision methods to design rounded shapes, but I don't
think I ever saw any details about how it worked, or a link to the actual
algorithm.

On Sun, Jun 2, 2024 at 8:46 PM Jon Bondy via Discuss <
discuss@lists.openscad.org> wrote:

I agree that what is missing is the API to do this kind of complex curved
design.  As to whether that is implemented directly in OpenSCAD or in a
pre-processor or a library may be moot.  That said, once I skip over to
another language, I may not return to OpenSCAD.

A different question would be "could we enhance OpenSCAD to the point
where relying on other languages is unnecessary?"  I'm sure this has been
pondered in the past.

Jon

On 6/2/2024 12:16 PM, William F. Adams via Discuss wrote:

On Sunday, June 2, 2024 at 07:26:06 AM EDT, Jon Bondy via Discuss
discuss@lists.openscad.org discuss@lists.openscad.org wrote:

The OpenSCAD file is incomprehensible, to the point of being useless.
You are writing in Python, not in OpenSCAD. You are just using OpenSCAD as
rendering engine.

Let's turn this around --- if there was an OpenSCAD module for
representing such a design what would the interface look like?

<snip>

http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient
Virus-free.www.avg.com
http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient
<#m_5625905036276870260_m_3168717318659623628_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>


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

There are many CAD programs that can construct curves, perhaps beziers, or perhaps something else, by using clicks of the mouse. That is not OpenSCAD! The model has to be entirely described by code, not by mouse clicks. On Mon, Jun 3, 2024 at 7:37 AM Raymond West via Discuss < discuss@lists.openscad.org> wrote: > As a start, it would be easier to consider 2d. The ancient cad software > that I use, I can trace a line with a mouse/trackball/graphics pen/other > device, dropping points as it moves, if needed. I would think that a layer > could be superimposed over the openscad window, and the coordinates > calculated in that layer for a polygon, then translated into the openscad > system as changes were made (the customiser takes effect when a value is > changed, so the time lag could be acceptable). That layer would be able to > generate polygons to fit or match existing shapes, and could solve the > distance measuring problems, in 2d, for many practical purposes. When it > comes to altering the shape of a square, say, then intermediate points > would need generating, so that they could be pushed around by the mouse. I > did a hand cranked method some time ago by saving the openscad 2d drawing > as an SVG, reading it in python (or maybe c++, can't remember), generated > additional points, and then moved them, and imported back into openscad. > The SVG conversions could have been avoided, had I knowledge of the > internals of openscad. > > For 3d, that would need a bit more mental effort in relating a 3d object > to a 2d plane, and vice-versa. However3d digitisers and 'mice' are > available, at a price, although it is simple enough to create an imprecise. > mechanical arm type device. > > > On 03/06/2024 05:37, Adrian Mariano via Discuss wrote: > > Jon, I think you're underestimating the severity of the concern here. We > don't merely need an API to do this kind of design. At least to me that > suggests that a design approach exists and you just need to write its > interface. There is a perfectly satisfactory API to beziers in BOSL2, for > example. In actual fact it seems like what's needed is a design philosophy > or strategy. And indeed, if anybody has any ideas I'd be interested in > hearing them. I've implemented various things in BOSL2 that do curves > using beziers, but none are particularly general. I started with > round_corners to round the corners of a polygon, which can apply beziers to > the corners in 2d. Later I wrote rounded_prism which does a sort of > analogous thing of rounding edges of an arbitrary prism in 3d by placing > beziers at the various corners. I also implemented smooth_path which takes > a polygon and converts each edge to a bezier curve so that they meet > smoothly (C1) at the corners with a specified amount of bulge. And I > implemented join_prism() which joins various kinds of prisms or prism to > sphere or plane with a fillet. But none of this provides a general > framework for designing some arbitrarily curved 3d object. > > One approach to that sort of design is to start with a polyhedron and then > smooth it. There are ways to do this such as Catmull smoothing and other > more sophisticated ones. They depend on how the starting shape is > triangulated and are hard to control, though. In particular, what if you > only want to smooth part of a polyhedron? About a year ago Martin > Herdieckerhoff posted an intriguing message about a library called Yari > that used some subdivision methods to design rounded shapes, but I don't > think I ever saw any details about how it worked, or a link to the actual > algorithm. > > > On Sun, Jun 2, 2024 at 8:46 PM Jon Bondy via Discuss < > discuss@lists.openscad.org> wrote: > >> I agree that what is missing is the API to do this kind of complex curved >> design. As to whether that is implemented directly in OpenSCAD or in a >> pre-processor or a library may be moot. That said, once I skip over to >> another language, I may not return to OpenSCAD. >> >> A different question would be "could we enhance OpenSCAD to the point >> where relying on other languages is unnecessary?" I'm sure this has been >> pondered in the past. >> >> Jon >> >> >> On 6/2/2024 12:16 PM, William F. Adams via Discuss wrote: >> >> On Sunday, June 2, 2024 at 07:26:06 AM EDT, Jon Bondy via Discuss >> <discuss@lists.openscad.org> <discuss@lists.openscad.org> wrote: >> >> The OpenSCAD file is incomprehensible, to the point of being useless. >> You are writing in Python, not in OpenSCAD. You are just using OpenSCAD as >> rendering engine. >> >> Let's turn this around --- if there was an OpenSCAD module for >> representing such a design what would the interface look like? >> >> <snip> >> >> >> >> <http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient> >> Virus-free.www.avg.com >> <http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient> >> <#m_5625905036276870260_m_3168717318659623628_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2> >> _______________________________________________ >> 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 >
JB
Jon Bondy
Mon, Jun 3, 2024 8:42 PM

I think the idea was to integrate a curve drawing pane within OpenSCAD
so as to avoid having to take that kind of thing off to InkScape, or
similar.  Not to make OpenSCAD entirely graphical, just this one
aspect.  The mouse clicks would be converted to a list of points which
OpenSCAD would then process.

On 6/3/2024 4:33 PM, Adrian Mariano via Discuss wrote:

There are many CAD programs that can construct curves, perhaps
beziers, or perhaps something else, by using clicks of the mouse. 
That is not OpenSCAD!  The model has to be entirely described by code,
not by mouse clicks.

On Mon, Jun 3, 2024 at 7:37 AM Raymond West via Discuss
discuss@lists.openscad.org wrote:

 As  a start, it would be easier to consider 2d. The ancient cad
 software that I use, I can trace a line with a
 mouse/trackball/graphics pen/other device, dropping points as it
 moves, if needed. I would think that a layer could be superimposed
 over the openscad window, and the coordinates calculated in that
 layer for a polygon, then translated into the openscad system as
 changes were made (the customiser takes effect when a value is
 changed, so the time lag could be acceptable). That  layer would
 be able to generate polygons to fit or match existing shapes, and
 could solve the distance measuring problems, in 2d, for many
 practical purposes. When it comes to altering the shape of a
 square, say, then intermediate points would need generating, so
 that they could be pushed around by the mouse. I did a hand
 cranked method some time ago by saving the openscad 2d drawing as
 an SVG, reading it in python (or maybe c++, can't remember),
 generated additional points, and then moved them, and imported
 back into openscad. The SVG conversions could have been avoided,
 had I knowledge of the internals of openscad.

 For 3d, that would need a bit more mental effort in relating a 3d
 object to a 2d plane, and vice-versa. However3d digitisers and
 'mice' are available, at a price, although it is simple enough to
 create an imprecise. mechanical arm type device.


 On 03/06/2024 05:37, Adrian Mariano via Discuss wrote:
 Jon, I think you're underestimating the severity of the concern
 here.  We don't merely need an API to do this kind of design.  At
 least to me that suggests that a design approach exists and you
 just need to write its interface.  There is a perfectly
 satisfactory API to beziers in BOSL2, for example.  In actual
 fact it seems like what's needed is a design philosophy or
 strategy.  And indeed, if anybody has any ideas I'd be interested
 in hearing them.  I've implemented various things in BOSL2 that
 do curves using beziers, but none are particularly general.  I
 started with round_corners to round the corners of a polygon,
 which can apply beziers to the corners in 2d.  Later I wrote
 rounded_prism which does a sort of analogous thing of rounding
 edges of an arbitrary prism in 3d by placing beziers at the
 various corners.  I also implemented smooth_path which takes a
 polygon and converts each edge to a bezier curve so that they
 meet smoothly (C1) at the corners with a specified amount of
 bulge.    And I implemented join_prism() which joins various
 kinds of prisms or prism to sphere or plane with a fillet.  But
 none of this provides a general framework for designing some
 arbitrarily curved 3d object.

 One approach to that sort of design is to start with a polyhedron
 and then smooth it.  There are ways to do this such as Catmull
 smoothing and other more sophisticated ones.  They depend on how
 the starting shape is triangulated and are hard to control,
 though.  In particular, what if you only want to smooth part of a
 polyhedron?  About a year ago Martin Herdieckerhoff posted an
 intriguing message about a library called Yari that used some
 subdivision methods to design rounded shapes, but I don't think I
 ever saw any details about how it worked, or a link to the actual
 algorithm.


 On Sun, Jun 2, 2024 at 8:46 PM Jon Bondy via Discuss
 <discuss@lists.openscad.org> wrote:

     I agree that what is missing is the API to do this kind of
     complex curved design.  As to whether that is implemented
     directly in OpenSCAD or in a pre-processor or a library may
     be moot.  That said, once I skip over to another language, I
     may not return to OpenSCAD.

     A different question would be "could we enhance OpenSCAD to
     the point where relying on other languages is unnecessary?" 
     I'm sure this has been pondered in the past.

     Jon


     On 6/2/2024 12:16 PM, William F. Adams via Discuss wrote:
     On Sunday, June 2, 2024 at 07:26:06 AM EDT, Jon Bondy via
     Discuss <discuss@lists.openscad.org>
     <mailto:discuss@lists.openscad.org> wrote:

     The OpenSCAD file is incomprehensible, to the point of being
     useless.  You are writing in Python, not in OpenSCAD. You
     are just using OpenSCAD as  rendering engine.

     Let's turn this around --- if there was an OpenSCAD module
     for representing such a design what would the interface look
     like?
     <snip>

     <http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient>
     	Virus-free.www.avg.com
     <http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient>


     <#m_5625905036276870260_m_3168717318659623628_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
     _______________________________________________
     OpenSCAD mailing list
     To unsubscribe send an email to discuss-leave@lists.openscad.org


 _______________________________________________
 OpenSCAD mailing list
 To unsubscribe send an email todiscuss-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 todiscuss-leave@lists.openscad.org

--
This email has been checked for viruses by AVG antivirus software.
www.avg.com

I think the idea was to integrate a curve drawing pane within OpenSCAD so as to avoid having to take that kind of thing off to InkScape, or similar.  Not to make OpenSCAD entirely graphical, just this one aspect.  The mouse clicks would be converted to a list of points which OpenSCAD would then process. On 6/3/2024 4:33 PM, Adrian Mariano via Discuss wrote: > There are many CAD programs that can construct curves, perhaps > beziers, or perhaps something else, by using clicks of the mouse.  > That is not OpenSCAD!  The model has to be entirely described by code, > not by mouse clicks. > > On Mon, Jun 3, 2024 at 7:37 AM Raymond West via Discuss > <discuss@lists.openscad.org> wrote: > > As  a start, it would be easier to consider 2d. The ancient cad > software that I use, I can trace a line with a > mouse/trackball/graphics pen/other device, dropping points as it > moves, if needed. I would think that a layer could be superimposed > over the openscad window, and the coordinates calculated in that > layer for a polygon, then translated into the openscad system as > changes were made (the customiser takes effect when a value is > changed, so the time lag could be acceptable). That  layer would > be able to generate polygons to fit or match existing shapes, and > could solve the distance measuring problems, in 2d, for many > practical purposes. When it comes to altering the shape of a > square, say, then intermediate points would need generating, so > that they could be pushed around by the mouse. I did a hand > cranked method some time ago by saving the openscad 2d drawing as > an SVG, reading it in python (or maybe c++, can't remember), > generated additional points, and then moved them, and imported > back into openscad. The SVG conversions could have been avoided, > had I knowledge of the internals of openscad. > > For 3d, that would need a bit more mental effort in relating a 3d > object to a 2d plane, and vice-versa. However3d digitisers and > 'mice' are available, at a price, although it is simple enough to > create an imprecise. mechanical arm type device. > > > On 03/06/2024 05:37, Adrian Mariano via Discuss wrote: > >> Jon, I think you're underestimating the severity of the concern >> here.  We don't merely need an API to do this kind of design.  At >> least to me that suggests that a design approach exists and you >> just need to write its interface.  There is a perfectly >> satisfactory API to beziers in BOSL2, for example.  In actual >> fact it seems like what's needed is a design philosophy or >> strategy.  And indeed, if anybody has any ideas I'd be interested >> in hearing them.  I've implemented various things in BOSL2 that >> do curves using beziers, but none are particularly general.  I >> started with round_corners to round the corners of a polygon, >> which can apply beziers to the corners in 2d.  Later I wrote >> rounded_prism which does a sort of analogous thing of rounding >> edges of an arbitrary prism in 3d by placing beziers at the >> various corners.  I also implemented smooth_path which takes a >> polygon and converts each edge to a bezier curve so that they >> meet smoothly (C1) at the corners with a specified amount of >> bulge.    And I implemented join_prism() which joins various >> kinds of prisms or prism to sphere or plane with a fillet.  But >> none of this provides a general framework for designing some >> arbitrarily curved 3d object. >> >> One approach to that sort of design is to start with a polyhedron >> and then smooth it.  There are ways to do this such as Catmull >> smoothing and other more sophisticated ones.  They depend on how >> the starting shape is triangulated and are hard to control, >> though.  In particular, what if you only want to smooth part of a >> polyhedron?  About a year ago Martin Herdieckerhoff posted an >> intriguing message about a library called Yari that used some >> subdivision methods to design rounded shapes, but I don't think I >> ever saw any details about how it worked, or a link to the actual >> algorithm. >> >> >> On Sun, Jun 2, 2024 at 8:46 PM Jon Bondy via Discuss >> <discuss@lists.openscad.org> wrote: >> >> I agree that what is missing is the API to do this kind of >> complex curved design.  As to whether that is implemented >> directly in OpenSCAD or in a pre-processor or a library may >> be moot.  That said, once I skip over to another language, I >> may not return to OpenSCAD. >> >> A different question would be "could we enhance OpenSCAD to >> the point where relying on other languages is unnecessary?"  >> I'm sure this has been pondered in the past. >> >> Jon >> >> >> On 6/2/2024 12:16 PM, William F. Adams via Discuss wrote: >>> On Sunday, June 2, 2024 at 07:26:06 AM EDT, Jon Bondy via >>> Discuss <discuss@lists.openscad.org> >>> <mailto:discuss@lists.openscad.org> wrote: >>> >>> The OpenSCAD file is incomprehensible, to the point of being >>> useless.  You are writing in Python, not in OpenSCAD. You >>> are just using OpenSCAD as  rendering engine. >>> >>> Let's turn this around --- if there was an OpenSCAD module >>> for representing such a design what would the interface look >>> like? >>> >> <snip> >> >> <http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient> >> Virus-free.www.avg.com >> <http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient> >> >> >> <#m_5625905036276870260_m_3168717318659623628_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2> >> _______________________________________________ >> OpenSCAD mailing list >> To unsubscribe send an email to discuss-leave@lists.openscad.org >> >> >> _______________________________________________ >> OpenSCAD mailing list >> To unsubscribe send an email todiscuss-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 todiscuss-leave@lists.openscad.org -- This email has been checked for viruses by AVG antivirus software. www.avg.com
GS
Guenther Sohler
Mon, Jun 3, 2024 8:54 PM

This is what my fork of openscad is :"somehow"already doing.
However, it does not insert coordinates into the code, but name of
"handles"  which are found nearby the mouse click.
Main issue is: without additional information its not possible to generate
3D coordinates from a mouse click which is in 2D screen coordinates

To get 3D coordinates for a mouse click you could cut the ray which is
marked by the mouse curser with some of the predefined planes eg XY plane
...
not sure, whats really meaningful here.

On Mon, Jun 3, 2024 at 10:43 PM Jon Bondy via Discuss <
discuss@lists.openscad.org> wrote:

I think the idea was to integrate a curve drawing pane within OpenSCAD so
as to avoid having to take that kind of thing off to InkScape, or similar.
Not to make OpenSCAD entirely graphical, just this one aspect.  The mouse
clicks would be converted to a list of points which OpenSCAD would then
process.
On 6/3/2024 4:33 PM, Adrian Mariano via Discuss wrote:

There are many CAD programs that can construct curves, perhaps beziers, or
perhaps something else, by using clicks of the mouse.  That is not
OpenSCAD!  The model has to be entirely described by code, not by mouse
clicks.

On Mon, Jun 3, 2024 at 7:37 AM Raymond West via Discuss <
discuss@lists.openscad.org> wrote:

As  a start, it would be easier to consider 2d. The ancient cad software
that I use, I can trace a line with a mouse/trackball/graphics pen/other
device, dropping points as it moves, if needed. I would think that a layer
could be superimposed over the openscad window, and the coordinates
calculated in that layer for a polygon, then translated into the openscad
system as changes were made (the customiser takes effect when a value is
changed, so the time lag could be acceptable). That  layer would be able to
generate polygons to fit or match existing shapes, and could solve the
distance measuring problems, in 2d, for many practical purposes. When it
comes to altering the shape of a square, say, then intermediate points
would need generating, so that they could be pushed around by the mouse. I
did a hand cranked method some time ago by saving the openscad 2d drawing
as an SVG, reading it in python (or maybe c++, can't remember), generated
additional points, and then moved them, and imported back into openscad.
The SVG conversions could have been avoided, had I knowledge of the
internals of openscad.

For 3d, that would need a bit more mental effort in relating a 3d object
to a 2d plane, and vice-versa. However3d digitisers and 'mice' are
available, at a price, although it is simple enough to create an imprecise.
mechanical arm type device.

On 03/06/2024 05:37, Adrian Mariano via Discuss wrote:

Jon, I think you're underestimating the severity of the concern here.  We
don't merely need an API to do this kind of design.  At least to me that
suggests that a design approach exists and you just need to write its
interface.  There is a perfectly satisfactory API to beziers in BOSL2, for
example.  In actual fact it seems like what's needed is a design philosophy
or strategy.  And indeed, if anybody has any ideas I'd be interested in
hearing them.  I've implemented various things in BOSL2 that do curves
using beziers, but none are particularly general.  I started with
round_corners to round the corners of a polygon, which can apply beziers to
the corners in 2d.  Later I wrote rounded_prism which does a sort of
analogous thing of rounding edges of an arbitrary prism in 3d by placing
beziers at the various corners.  I also implemented smooth_path which takes
a polygon and converts each edge to a bezier curve so that they meet
smoothly (C1) at the corners with a specified amount of bulge.    And I
implemented join_prism() which joins various kinds of prisms or prism to
sphere or plane with a fillet.  But none of this provides a general
framework for designing some arbitrarily curved 3d object.

One approach to that sort of design is to start with a polyhedron and
then smooth it.  There are ways to do this such as Catmull smoothing and
other more sophisticated ones.  They depend on how the starting shape is
triangulated and are hard to control, though.  In particular, what if you
only want to smooth part of a polyhedron?  About a year ago Martin
Herdieckerhoff posted an intriguing message about a library called Yari
that used some subdivision methods to design rounded shapes, but I don't
think I ever saw any details about how it worked, or a link to the actual
algorithm.

On Sun, Jun 2, 2024 at 8:46 PM Jon Bondy via Discuss <
discuss@lists.openscad.org> wrote:

I agree that what is missing is the API to do this kind of complex
curved design.  As to whether that is implemented directly in OpenSCAD or
in a pre-processor or a library may be moot.  That said, once I skip over
to another language, I may not return to OpenSCAD.

A different question would be "could we enhance OpenSCAD to the point
where relying on other languages is unnecessary?"  I'm sure this has been
pondered in the past.

Jon

On 6/2/2024 12:16 PM, William F. Adams via Discuss wrote:

On Sunday, June 2, 2024 at 07:26:06 AM EDT, Jon Bondy via Discuss
discuss@lists.openscad.org discuss@lists.openscad.org wrote:

The OpenSCAD file is incomprehensible, to the point of being useless.
You are writing in Python, not in OpenSCAD. You are just using OpenSCAD as
rendering engine.

Let's turn this around --- if there was an OpenSCAD module for
representing such a design what would the interface look like?

<snip>

http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient
Virus-free.www.avg.com
http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient
<#m_2950654322775549077_m_5625905036276870260_m_3168717318659623628_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>


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

This is what my fork of openscad is :"somehow"already doing. However, it does not insert coordinates into the code, but name of "handles" which are found nearby the mouse click. Main issue is: without additional information its not possible to generate 3D coordinates from a mouse click which is in 2D screen coordinates To get 3D coordinates for a mouse click you could cut the ray which is marked by the mouse curser with some of the predefined planes eg XY plane ... not sure, whats really meaningful here. On Mon, Jun 3, 2024 at 10:43 PM Jon Bondy via Discuss < discuss@lists.openscad.org> wrote: > I think the idea was to integrate a curve drawing pane within OpenSCAD so > as to avoid having to take that kind of thing off to InkScape, or similar. > Not to make OpenSCAD entirely graphical, just this one aspect. The mouse > clicks would be converted to a list of points which OpenSCAD would then > process. > On 6/3/2024 4:33 PM, Adrian Mariano via Discuss wrote: > > There are many CAD programs that can construct curves, perhaps beziers, or > perhaps something else, by using clicks of the mouse. That is not > OpenSCAD! The model has to be entirely described by code, not by mouse > clicks. > > On Mon, Jun 3, 2024 at 7:37 AM Raymond West via Discuss < > discuss@lists.openscad.org> wrote: > >> As a start, it would be easier to consider 2d. The ancient cad software >> that I use, I can trace a line with a mouse/trackball/graphics pen/other >> device, dropping points as it moves, if needed. I would think that a layer >> could be superimposed over the openscad window, and the coordinates >> calculated in that layer for a polygon, then translated into the openscad >> system as changes were made (the customiser takes effect when a value is >> changed, so the time lag could be acceptable). That layer would be able to >> generate polygons to fit or match existing shapes, and could solve the >> distance measuring problems, in 2d, for many practical purposes. When it >> comes to altering the shape of a square, say, then intermediate points >> would need generating, so that they could be pushed around by the mouse. I >> did a hand cranked method some time ago by saving the openscad 2d drawing >> as an SVG, reading it in python (or maybe c++, can't remember), generated >> additional points, and then moved them, and imported back into openscad. >> The SVG conversions could have been avoided, had I knowledge of the >> internals of openscad. >> >> For 3d, that would need a bit more mental effort in relating a 3d object >> to a 2d plane, and vice-versa. However3d digitisers and 'mice' are >> available, at a price, although it is simple enough to create an imprecise. >> mechanical arm type device. >> >> >> On 03/06/2024 05:37, Adrian Mariano via Discuss wrote: >> >> Jon, I think you're underestimating the severity of the concern here. We >> don't merely need an API to do this kind of design. At least to me that >> suggests that a design approach exists and you just need to write its >> interface. There is a perfectly satisfactory API to beziers in BOSL2, for >> example. In actual fact it seems like what's needed is a design philosophy >> or strategy. And indeed, if anybody has any ideas I'd be interested in >> hearing them. I've implemented various things in BOSL2 that do curves >> using beziers, but none are particularly general. I started with >> round_corners to round the corners of a polygon, which can apply beziers to >> the corners in 2d. Later I wrote rounded_prism which does a sort of >> analogous thing of rounding edges of an arbitrary prism in 3d by placing >> beziers at the various corners. I also implemented smooth_path which takes >> a polygon and converts each edge to a bezier curve so that they meet >> smoothly (C1) at the corners with a specified amount of bulge. And I >> implemented join_prism() which joins various kinds of prisms or prism to >> sphere or plane with a fillet. But none of this provides a general >> framework for designing some arbitrarily curved 3d object. >> >> One approach to that sort of design is to start with a polyhedron and >> then smooth it. There are ways to do this such as Catmull smoothing and >> other more sophisticated ones. They depend on how the starting shape is >> triangulated and are hard to control, though. In particular, what if you >> only want to smooth part of a polyhedron? About a year ago Martin >> Herdieckerhoff posted an intriguing message about a library called Yari >> that used some subdivision methods to design rounded shapes, but I don't >> think I ever saw any details about how it worked, or a link to the actual >> algorithm. >> >> >> On Sun, Jun 2, 2024 at 8:46 PM Jon Bondy via Discuss < >> discuss@lists.openscad.org> wrote: >> >>> I agree that what is missing is the API to do this kind of complex >>> curved design. As to whether that is implemented directly in OpenSCAD or >>> in a pre-processor or a library may be moot. That said, once I skip over >>> to another language, I may not return to OpenSCAD. >>> >>> A different question would be "could we enhance OpenSCAD to the point >>> where relying on other languages is unnecessary?" I'm sure this has been >>> pondered in the past. >>> >>> Jon >>> >>> >>> On 6/2/2024 12:16 PM, William F. Adams via Discuss wrote: >>> >>> On Sunday, June 2, 2024 at 07:26:06 AM EDT, Jon Bondy via Discuss >>> <discuss@lists.openscad.org> <discuss@lists.openscad.org> wrote: >>> >>> The OpenSCAD file is incomprehensible, to the point of being useless. >>> You are writing in Python, not in OpenSCAD. You are just using OpenSCAD as >>> rendering engine. >>> >>> Let's turn this around --- if there was an OpenSCAD module for >>> representing such a design what would the interface look like? >>> >>> <snip> >>> >>> >>> >>> <http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient> >>> Virus-free.www.avg.com >>> <http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient> >>> <#m_2950654322775549077_m_5625905036276870260_m_3168717318659623628_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2> >>> _______________________________________________ >>> 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 >
RW
Raymond West
Mon, Jun 3, 2024 9:37 PM

Hi Adrian,

I realise that, wrt other software, but they, in the main, rely on
lines, openscad does not. My suggestion was to use a mouse/whatever to
generate the points on a polygon, overlaid in effect on the openscad
window, to feed the coordinates into openscad. It is just another method
of data entry. In openscad there is no direct interaction between mind
and model, without knowing the mathematics. It is no difference in
defining a square by 'knowing' the four corner points for the polygon,
or the length of the sides and location, or deriving the corner points 
by some other means, such as, say a few mouse clicks. If you are trying
to interface to the real world, then it helps to have a number of tools
at your disposal. I didn't know that polygons, for example, had to be
entirely described by code. I imagine they were introduced 'cos folk
couldn't get the shapes they wanted by using squares and circles, I'm
therefore also surprised that svgs and stl's are allowed.

Anyway, it's a bit of a moot point, since in a few years, we'll be able
to draw a shape, and the AI flavour of the month will generate all the
mathematical formulae required to generate that shape in openscad or
whatever, in one seamless operation.

On 03/06/2024 21:33, Adrian Mariano via Discuss wrote:

There are many CAD programs that can construct curves, perhaps
beziers, or perhaps something else, by using clicks of the mouse. 
That is not OpenSCAD!  The model has to be entirely described by code,
not by mouse clicks.

On Mon, Jun 3, 2024 at 7:37 AM Raymond West via Discuss
discuss@lists.openscad.org wrote:

 As  a start, it would be easier to consider 2d. The ancient cad
 software that I use, I can trace a line with a
 mouse/trackball/graphics pen/other device, dropping points as it
 moves, if needed. I would think that a layer could be superimposed
 over the openscad window, and the coordinates calculated in that
 layer for a polygon, then translated into the openscad system as
 changes were made (the customiser takes effect when a value is
 changed, so the time lag could be acceptable). That  layer would
 be able to generate polygons to fit or match existing shapes, and
 could solve the distance measuring problems, in 2d, for many
 practical purposes. When it comes to altering the shape of a
 square, say, then intermediate points would need generating, so
 that they could be pushed around by the mouse. I did a hand
 cranked method some time ago by saving the openscad 2d drawing as
 an SVG, reading it in python (or maybe c++, can't remember),
 generated additional points, and then moved them, and imported
 back into openscad. The SVG conversions could have been avoided,
 had I knowledge of the internals of openscad.

 For 3d, that would need a bit more mental effort in relating a 3d
 object to a 2d plane, and vice-versa. However3d digitisers and
 'mice' are available, at a price, although it is simple enough to
 create an imprecise. mechanical arm type device.


 On 03/06/2024 05:37, Adrian Mariano via Discuss wrote:
 Jon, I think you're underestimating the severity of the concern
 here.  We don't merely need an API to do this kind of design.  At
 least to me that suggests that a design approach exists and you
 just need to write its interface.  There is a perfectly
 satisfactory API to beziers in BOSL2, for example.  In actual
 fact it seems like what's needed is a design philosophy or
 strategy.  And indeed, if anybody has any ideas I'd be interested
 in hearing them.  I've implemented various things in BOSL2 that
 do curves using beziers, but none are particularly general.  I
 started with round_corners to round the corners of a polygon,
 which can apply beziers to the corners in 2d.  Later I wrote
 rounded_prism which does a sort of analogous thing of rounding
 edges of an arbitrary prism in 3d by placing beziers at the
 various corners.  I also implemented smooth_path which takes a
 polygon and converts each edge to a bezier curve so that they
 meet smoothly (C1) at the corners with a specified amount of
 bulge.    And I implemented join_prism() which joins various
 kinds of prisms or prism to sphere or plane with a fillet.  But
 none of this provides a general framework for designing some
 arbitrarily curved 3d object.

 One approach to that sort of design is to start with a polyhedron
 and then smooth it.  There are ways to do this such as Catmull
 smoothing and other more sophisticated ones.  They depend on how
 the starting shape is triangulated and are hard to control,
 though.  In particular, what if you only want to smooth part of a
 polyhedron?  About a year ago Martin Herdieckerhoff posted an
 intriguing message about a library called Yari that used some
 subdivision methods to design rounded shapes, but I don't think I
 ever saw any details about how it worked, or a link to the actual
 algorithm.


 On Sun, Jun 2, 2024 at 8:46 PM Jon Bondy via Discuss
 <discuss@lists.openscad.org> wrote:

     I agree that what is missing is the API to do this kind of
     complex curved design.  As to whether that is implemented
     directly in OpenSCAD or in a pre-processor or a library may
     be moot.  That said, once I skip over to another language, I
     may not return to OpenSCAD.

     A different question would be "could we enhance OpenSCAD to
     the point where relying on other languages is unnecessary?" 
     I'm sure this has been pondered in the past.

     Jon


     On 6/2/2024 12:16 PM, William F. Adams via Discuss wrote:
     On Sunday, June 2, 2024 at 07:26:06 AM EDT, Jon Bondy via
     Discuss <discuss@lists.openscad.org>
     <mailto:discuss@lists.openscad.org> wrote:

     The OpenSCAD file is incomprehensible, to the point of being
     useless.  You are writing in Python, not in OpenSCAD. You
     are just using OpenSCAD as  rendering engine.

     Let's turn this around --- if there was an OpenSCAD module
     for representing such a design what would the interface look
     like?
     <snip>

     <http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient>
     	Virus-free.www.avg.com
     <http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient>


     <#m_5625905036276870260_m_3168717318659623628_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
     _______________________________________________
     OpenSCAD mailing list
     To unsubscribe send an email to discuss-leave@lists.openscad.org


 _______________________________________________
 OpenSCAD mailing list
 To unsubscribe send an email todiscuss-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 todiscuss-leave@lists.openscad.org

Hi Adrian, I realise that, wrt other software, but they, in the main, rely on lines, openscad does not. My suggestion was to use a mouse/whatever to generate the points on a polygon, overlaid in effect on the openscad window, to feed the coordinates into openscad. It is just another method of data entry. In openscad there is no direct interaction between mind and model, without knowing the mathematics. It is no difference in defining a square by 'knowing' the four corner points for the polygon, or the length of the sides and location, or deriving the corner points  by some other means, such as, say a few mouse clicks. If you are trying to interface to the real world, then it helps to have a number of tools at your disposal. I didn't know that polygons, for example, had to be entirely described by code. I imagine they were introduced 'cos folk couldn't get the shapes they wanted by using squares and circles, I'm therefore also surprised that svgs and stl's are allowed. Anyway, it's a bit of a moot point, since in a few years, we'll be able to draw a shape, and the AI flavour of the month will generate all the mathematical formulae required to generate that shape in openscad or whatever, in one seamless operation. On 03/06/2024 21:33, Adrian Mariano via Discuss wrote: > There are many CAD programs that can construct curves, perhaps > beziers, or perhaps something else, by using clicks of the mouse.  > That is not OpenSCAD!  The model has to be entirely described by code, > not by mouse clicks. > > On Mon, Jun 3, 2024 at 7:37 AM Raymond West via Discuss > <discuss@lists.openscad.org> wrote: > > As  a start, it would be easier to consider 2d. The ancient cad > software that I use, I can trace a line with a > mouse/trackball/graphics pen/other device, dropping points as it > moves, if needed. I would think that a layer could be superimposed > over the openscad window, and the coordinates calculated in that > layer for a polygon, then translated into the openscad system as > changes were made (the customiser takes effect when a value is > changed, so the time lag could be acceptable). That  layer would > be able to generate polygons to fit or match existing shapes, and > could solve the distance measuring problems, in 2d, for many > practical purposes. When it comes to altering the shape of a > square, say, then intermediate points would need generating, so > that they could be pushed around by the mouse. I did a hand > cranked method some time ago by saving the openscad 2d drawing as > an SVG, reading it in python (or maybe c++, can't remember), > generated additional points, and then moved them, and imported > back into openscad. The SVG conversions could have been avoided, > had I knowledge of the internals of openscad. > > For 3d, that would need a bit more mental effort in relating a 3d > object to a 2d plane, and vice-versa. However3d digitisers and > 'mice' are available, at a price, although it is simple enough to > create an imprecise. mechanical arm type device. > > > On 03/06/2024 05:37, Adrian Mariano via Discuss wrote: > >> Jon, I think you're underestimating the severity of the concern >> here.  We don't merely need an API to do this kind of design.  At >> least to me that suggests that a design approach exists and you >> just need to write its interface.  There is a perfectly >> satisfactory API to beziers in BOSL2, for example.  In actual >> fact it seems like what's needed is a design philosophy or >> strategy.  And indeed, if anybody has any ideas I'd be interested >> in hearing them.  I've implemented various things in BOSL2 that >> do curves using beziers, but none are particularly general.  I >> started with round_corners to round the corners of a polygon, >> which can apply beziers to the corners in 2d.  Later I wrote >> rounded_prism which does a sort of analogous thing of rounding >> edges of an arbitrary prism in 3d by placing beziers at the >> various corners.  I also implemented smooth_path which takes a >> polygon and converts each edge to a bezier curve so that they >> meet smoothly (C1) at the corners with a specified amount of >> bulge.    And I implemented join_prism() which joins various >> kinds of prisms or prism to sphere or plane with a fillet.  But >> none of this provides a general framework for designing some >> arbitrarily curved 3d object. >> >> One approach to that sort of design is to start with a polyhedron >> and then smooth it.  There are ways to do this such as Catmull >> smoothing and other more sophisticated ones.  They depend on how >> the starting shape is triangulated and are hard to control, >> though.  In particular, what if you only want to smooth part of a >> polyhedron?  About a year ago Martin Herdieckerhoff posted an >> intriguing message about a library called Yari that used some >> subdivision methods to design rounded shapes, but I don't think I >> ever saw any details about how it worked, or a link to the actual >> algorithm. >> >> >> On Sun, Jun 2, 2024 at 8:46 PM Jon Bondy via Discuss >> <discuss@lists.openscad.org> wrote: >> >> I agree that what is missing is the API to do this kind of >> complex curved design.  As to whether that is implemented >> directly in OpenSCAD or in a pre-processor or a library may >> be moot.  That said, once I skip over to another language, I >> may not return to OpenSCAD. >> >> A different question would be "could we enhance OpenSCAD to >> the point where relying on other languages is unnecessary?"  >> I'm sure this has been pondered in the past. >> >> Jon >> >> >> On 6/2/2024 12:16 PM, William F. Adams via Discuss wrote: >>> On Sunday, June 2, 2024 at 07:26:06 AM EDT, Jon Bondy via >>> Discuss <discuss@lists.openscad.org> >>> <mailto:discuss@lists.openscad.org> wrote: >>> >>> The OpenSCAD file is incomprehensible, to the point of being >>> useless.  You are writing in Python, not in OpenSCAD. You >>> are just using OpenSCAD as  rendering engine. >>> >>> Let's turn this around --- if there was an OpenSCAD module >>> for representing such a design what would the interface look >>> like? >>> >> <snip> >> >> <http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient> >> Virus-free.www.avg.com >> <http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient> >> >> >> <#m_5625905036276870260_m_3168717318659623628_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2> >> _______________________________________________ >> OpenSCAD mailing list >> To unsubscribe send an email to discuss-leave@lists.openscad.org >> >> >> _______________________________________________ >> OpenSCAD mailing list >> To unsubscribe send an email todiscuss-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 todiscuss-leave@lists.openscad.org
GB
Glenn Butcher
Mon, Jun 3, 2024 10:33 PM

I wrote a helper program to allow drawing of a polygon interactively,
then export it to a OpenSCAD array:

https://github.com/butcherg/wxpolygon

It exports either two-tuple or three-tuple arrays, where in the latter
case the third item is a radius that can be converted to a curve by the
Round-Anything polyround() module:

https://github.com/Irev-Dev/Round-Anything

With that and a path_extrude() module I found on Thingiverse I modeled a
steam locomotive:

https://github.com/butcherg/DRG_168/

Having an interactive way to define polygons was a significant boon to
my OpenSCAD modeling, but I don't think I'd push for including the
capability directly in OpenSCAD.  For one, I've found such interactivity
to be frequently supplanted by inserting parametrics in the array to
accommodate having the shape produced by the polygon resize using
dimensions for the model defined explicitly elsewhere...

I am happy for those who find utility in the python -> openscad
translator.  Me, I'm quite happy with the functionality of the existing
OpenSCAD language...

On 6/3/24 15:37, Raymond West via Discuss wrote:

Hi Adrian,

I realise that, wrt other software, but they, in the main, rely on
lines, openscad does not. My suggestion was to use a mouse/whatever to
generate the points on a polygon, overlaid in effect on the openscad
window, to feed the coordinates into openscad. It is just another
method of data entry. In openscad there is no direct interaction
between mind and model, without knowing the mathematics. It is no
difference in defining a square by 'knowing' the four corner points
for the polygon, or the length of the sides and location, or deriving
the corner points  by some other means, such as, say a few mouse
clicks. If you are trying to interface to the real world, then it
helps to have a number of tools at your disposal. I didn't know that
polygons, for example, had to be entirely described by code. I imagine
they were introduced 'cos folk couldn't get the shapes they wanted by
using squares and circles, I'm therefore also surprised that svgs and
stl's are allowed.

Anyway, it's a bit of a moot point, since in a few years, we'll be
able to draw a shape, and the AI flavour of the month will generate
all the mathematical formulae required to generate that shape in
openscad or whatever, in one seamless operation.

On 03/06/2024 21:33, Adrian Mariano via Discuss wrote:

There are many CAD programs that can construct curves, perhaps
beziers, or perhaps something else, by using clicks of the mouse. 
That is not OpenSCAD!  The model has to be entirely described by
code, not by mouse clicks.

On Mon, Jun 3, 2024 at 7:37 AM Raymond West via Discuss
discuss@lists.openscad.org wrote:

 As  a start, it would be easier to consider 2d. The ancient cad
 software that I use, I can trace a line with a
 mouse/trackball/graphics pen/other device, dropping points as it
 moves, if needed. I would think that a layer could be
 superimposed over the openscad window, and the coordinates
 calculated in that layer for a polygon, then translated into the
 openscad system as changes were made (the customiser takes effect
 when a value is changed, so the time lag could be acceptable).
 That  layer would be able to generate polygons to fit or match
 existing shapes, and could solve the distance measuring problems,
 in 2d, for many practical purposes. When it comes to altering the
 shape of a square, say, then intermediate points would need
 generating, so that they could be pushed around by the mouse. I
 did a hand cranked method some time ago by saving the openscad 2d
 drawing as an SVG, reading it in python (or maybe c++, can't
 remember), generated additional points, and then moved them, and
 imported back into openscad. The SVG conversions could have been
 avoided, had I knowledge of the internals of openscad.

 For 3d, that would need a bit more mental effort in relating a 3d
 object to a 2d plane, and vice-versa. However3d digitisers and
 'mice' are available, at a price, although it is simple enough to
 create an imprecise. mechanical arm type device.


 On 03/06/2024 05:37, Adrian Mariano via Discuss wrote:
 Jon, I think you're underestimating the severity of the concern
 here.  We don't merely need an API to do this kind of design. 
 At least to me that suggests that a design approach exists and
 you just need to write its interface.  There is a perfectly
 satisfactory API to beziers in BOSL2, for example. In actual
 fact it seems like what's needed is a design philosophy or
 strategy.  And indeed, if anybody has any ideas I'd be
 interested in hearing them.  I've implemented various things in
 BOSL2 that do curves using beziers, but none are particularly
 general.  I started with round_corners to round the corners of a
 polygon, which can apply beziers to the corners in 2d.  Later I
 wrote rounded_prism which does a sort of analogous thing of
 rounding edges of an arbitrary prism in 3d by placing beziers at
 the various corners.  I also implemented smooth_path which takes
 a polygon and converts each edge to a bezier curve so that they
 meet smoothly (C1) at the corners with a specified amount of
 bulge.    And I implemented join_prism() which joins various
 kinds of prisms or prism to sphere or plane with a fillet.  But
 none of this provides a general framework for designing some
 arbitrarily curved 3d object.

 One approach to that sort of design is to start with a
 polyhedron and then smooth it.  There are ways to do this such
 as Catmull smoothing and other more sophisticated ones.  They
 depend on how the starting shape is triangulated and are hard to
 control, though.  In particular, what if you only want to smooth
 part of a polyhedron?  About a year ago Martin Herdieckerhoff
 posted an intriguing message about a library called Yari that
 used some subdivision methods to design rounded shapes, but I
 don't think I ever saw any details about how it worked, or a
 link to the actual algorithm.


 On Sun, Jun 2, 2024 at 8:46 PM Jon Bondy via Discuss
 <discuss@lists.openscad.org> wrote:

     I agree that what is missing is the API to do this kind of
     complex curved design.  As to whether that is implemented
     directly in OpenSCAD or in a pre-processor or a library may
     be moot. That said, once I skip over to another language, I
     may not return to OpenSCAD.

     A different question would be "could we enhance OpenSCAD to
     the point where relying on other languages is unnecessary?" 
     I'm sure this has been pondered in the past.

     Jon


     On 6/2/2024 12:16 PM, William F. Adams via Discuss wrote:
     On Sunday, June 2, 2024 at 07:26:06 AM EDT, Jon Bondy via
     Discuss <discuss@lists.openscad.org>
     <mailto:discuss@lists.openscad.org> wrote:

     The OpenSCAD file is incomprehensible, to the point of
     being useless.  You are writing in Python, not in OpenSCAD.
     You are just using OpenSCAD as rendering engine.

     Let's turn this around --- if there was an OpenSCAD module
     for representing such a design what would the interface
     look like?
     <snip>

     <http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient>
     	Virus-free.www.avg.com
     <http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient>


     <#m_5625905036276870260_m_3168717318659623628_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
     _______________________________________________
     OpenSCAD mailing list
     To unsubscribe send an email to discuss-leave@lists.openscad.org


 _______________________________________________
 OpenSCAD mailing list
 To unsubscribe send an email todiscuss-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 todiscuss-leave@lists.openscad.org


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

I wrote a helper program to allow drawing of a polygon interactively, then export it to a OpenSCAD array: https://github.com/butcherg/wxpolygon It exports either two-tuple or three-tuple arrays, where in the latter case the third item is a radius that can be converted to a curve by the Round-Anything polyround() module: https://github.com/Irev-Dev/Round-Anything With that and a path_extrude() module I found on Thingiverse I modeled a steam locomotive: https://github.com/butcherg/DRG_168/ Having an interactive way to define polygons was a significant boon to my OpenSCAD modeling, but I don't think I'd push for including the capability directly in OpenSCAD.  For one, I've found such interactivity to be frequently supplanted by inserting parametrics in the array to accommodate having the shape produced by the polygon resize using dimensions for the model defined explicitly elsewhere... I am happy for those who find utility in the python -> openscad translator.  Me, I'm quite happy with the functionality of the existing OpenSCAD language... On 6/3/24 15:37, Raymond West via Discuss wrote: > > Hi Adrian, > > I realise that, wrt other software, but they, in the main, rely on > lines, openscad does not. My suggestion was to use a mouse/whatever to > generate the points on a polygon, overlaid in effect on the openscad > window, to feed the coordinates into openscad. It is just another > method of data entry. In openscad there is no direct interaction > between mind and model, without knowing the mathematics. It is no > difference in defining a square by 'knowing' the four corner points > for the polygon, or the length of the sides and location, or deriving > the corner points  by some other means, such as, say a few mouse > clicks. If you are trying to interface to the real world, then it > helps to have a number of tools at your disposal. I didn't know that > polygons, for example, had to be entirely described by code. I imagine > they were introduced 'cos folk couldn't get the shapes they wanted by > using squares and circles, I'm therefore also surprised that svgs and > stl's are allowed. > > Anyway, it's a bit of a moot point, since in a few years, we'll be > able to draw a shape, and the AI flavour of the month will generate > all the mathematical formulae required to generate that shape in > openscad or whatever, in one seamless operation. > > On 03/06/2024 21:33, Adrian Mariano via Discuss wrote: >> There are many CAD programs that can construct curves, perhaps >> beziers, or perhaps something else, by using clicks of the mouse.  >> That is not OpenSCAD!  The model has to be entirely described by >> code, not by mouse clicks. >> >> On Mon, Jun 3, 2024 at 7:37 AM Raymond West via Discuss >> <discuss@lists.openscad.org> wrote: >> >> As  a start, it would be easier to consider 2d. The ancient cad >> software that I use, I can trace a line with a >> mouse/trackball/graphics pen/other device, dropping points as it >> moves, if needed. I would think that a layer could be >> superimposed over the openscad window, and the coordinates >> calculated in that layer for a polygon, then translated into the >> openscad system as changes were made (the customiser takes effect >> when a value is changed, so the time lag could be acceptable). >> That  layer would be able to generate polygons to fit or match >> existing shapes, and could solve the distance measuring problems, >> in 2d, for many practical purposes. When it comes to altering the >> shape of a square, say, then intermediate points would need >> generating, so that they could be pushed around by the mouse. I >> did a hand cranked method some time ago by saving the openscad 2d >> drawing as an SVG, reading it in python (or maybe c++, can't >> remember), generated additional points, and then moved them, and >> imported back into openscad. The SVG conversions could have been >> avoided, had I knowledge of the internals of openscad. >> >> For 3d, that would need a bit more mental effort in relating a 3d >> object to a 2d plane, and vice-versa. However3d digitisers and >> 'mice' are available, at a price, although it is simple enough to >> create an imprecise. mechanical arm type device. >> >> >> On 03/06/2024 05:37, Adrian Mariano via Discuss wrote: >> >>> Jon, I think you're underestimating the severity of the concern >>> here.  We don't merely need an API to do this kind of design.  >>> At least to me that suggests that a design approach exists and >>> you just need to write its interface.  There is a perfectly >>> satisfactory API to beziers in BOSL2, for example. In actual >>> fact it seems like what's needed is a design philosophy or >>> strategy.  And indeed, if anybody has any ideas I'd be >>> interested in hearing them.  I've implemented various things in >>> BOSL2 that do curves using beziers, but none are particularly >>> general.  I started with round_corners to round the corners of a >>> polygon, which can apply beziers to the corners in 2d.  Later I >>> wrote rounded_prism which does a sort of analogous thing of >>> rounding edges of an arbitrary prism in 3d by placing beziers at >>> the various corners.  I also implemented smooth_path which takes >>> a polygon and converts each edge to a bezier curve so that they >>> meet smoothly (C1) at the corners with a specified amount of >>> bulge.    And I implemented join_prism() which joins various >>> kinds of prisms or prism to sphere or plane with a fillet.  But >>> none of this provides a general framework for designing some >>> arbitrarily curved 3d object. >>> >>> One approach to that sort of design is to start with a >>> polyhedron and then smooth it.  There are ways to do this such >>> as Catmull smoothing and other more sophisticated ones.  They >>> depend on how the starting shape is triangulated and are hard to >>> control, though.  In particular, what if you only want to smooth >>> part of a polyhedron?  About a year ago Martin Herdieckerhoff >>> posted an intriguing message about a library called Yari that >>> used some subdivision methods to design rounded shapes, but I >>> don't think I ever saw any details about how it worked, or a >>> link to the actual algorithm. >>> >>> >>> On Sun, Jun 2, 2024 at 8:46 PM Jon Bondy via Discuss >>> <discuss@lists.openscad.org> wrote: >>> >>> I agree that what is missing is the API to do this kind of >>> complex curved design.  As to whether that is implemented >>> directly in OpenSCAD or in a pre-processor or a library may >>> be moot. That said, once I skip over to another language, I >>> may not return to OpenSCAD. >>> >>> A different question would be "could we enhance OpenSCAD to >>> the point where relying on other languages is unnecessary?"  >>> I'm sure this has been pondered in the past. >>> >>> Jon >>> >>> >>> On 6/2/2024 12:16 PM, William F. Adams via Discuss wrote: >>>> On Sunday, June 2, 2024 at 07:26:06 AM EDT, Jon Bondy via >>>> Discuss <discuss@lists.openscad.org> >>>> <mailto:discuss@lists.openscad.org> wrote: >>>> >>>> The OpenSCAD file is incomprehensible, to the point of >>>> being useless.  You are writing in Python, not in OpenSCAD. >>>> You are just using OpenSCAD as rendering engine. >>>> >>>> Let's turn this around --- if there was an OpenSCAD module >>>> for representing such a design what would the interface >>>> look like? >>>> >>> <snip> >>> >>> <http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient> >>> Virus-free.www.avg.com >>> <http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient> >>> >>> >>> <#m_5625905036276870260_m_3168717318659623628_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2> >>> _______________________________________________ >>> OpenSCAD mailing list >>> To unsubscribe send an email to discuss-leave@lists.openscad.org >>> >>> >>> _______________________________________________ >>> OpenSCAD mailing list >>> To unsubscribe send an email todiscuss-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 todiscuss-leave@lists.openscad.org > > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email todiscuss-leave@lists.openscad.org
SP
Sanjeev Prabhakar
Wed, Jun 5, 2024 2:06 AM

I have posted an example of my design approach in a youtube video
(designing a mobile stand).

https://youtu.be/qb4QSLyCpNI

On Mon, 3 Jun 2024 at 06:58, Sanjeev Prabhakar sprabhakar2006@gmail.com
wrote:

I am not good at explaining things. When I start explaining with diagrams,
it takes too long and I don't have that much time.
You can read the code in my github file openscad1.py and I can answer some
specific questions.
There are some 18 types of arc functions defined.
Key idea in these functions is to define the arcs in 2d which are not very
tough to define in openscad language as well and thereafter the same
functions can be used in 3d arcs. What you need is a method to transform 3d
points to 2d and then back to 3d at its original location.
Also there is no complex mathematics involved here

On Sun, 2 Jun 2024 at 21:47, William F. Adams via Discuss <
discuss@lists.openscad.org> wrote:

On Sunday, June 2, 2024 at 07:26:06 AM EDT, Jon Bondy via Discuss <
discuss@lists.openscad.org> wrote:

The OpenSCAD file is incomprehensible, to the point of being useless.
You are writing in Python, not in OpenSCAD. You are just using OpenSCAD as
rendering engine.

Let's turn this around --- if there was an OpenSCAD module for
representing such a design what would the interface look like?

I've asked before about representing curved surfaces in a fashion which
was elegant and expressible, and which folks who do not have an
understanding of higher maths could not merely grasp, but also write/use
--- while a couple of techniques have been put forward, I wasn't able to
wrap my mind around them, and I will readily admit to this being my
deficient education.

I've actually just finished adding support for arcs in my current project:

https://github.com/WillAdams/gcodepreview

[image: Inline image]

(though I need to improve it to have Z-axis movement/cutting as well, and
yes, for some reason the arc generated come in as 25.1mm x 25mm curves
which don't meet up so as to make a circle, and they generate an error when
importing the DXF into some programs...)

Once that is done, I eventually hope to start working on adding some sort
of support for curves in 3 dimensions, or representing a curved surface ---
what is a way to do this which is:

  • reasonably concise
  • expressive and powerful
  • suitable to be calculated out within OpenSCAD

My current plan is to just do curves of tool movement in 3 dimensions ---
an overhead view of a Bézier curve for X and Y coordinates, and a
representation of a side view as a curve which shows Y and Z coordinates
--- to make a curved surface it would be necessary to arrange a sufficient
number of toolpaths so as to represent that tool movement when cutting out
that surface and ultimately this would need to be captured as G-code for
making that cut.

At one point in time I had a number of links which I had researched:

-
https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Other_Language_Features#Surface
- Thingiverse: Bezier Heart in OpenScad
<https://www.thingiverse.com/thing:8483>
   - https://www.thingiverse.com/thing:8931
-
http://climberg.de/page/openscad-implementation-of-bezier-curves-of-any-degrees/
 https://climberg.de/post/openscad_bezier_curves
- https://github.com/JustinSDK/dotSCAD [19]
<http://forum.openscad.org/larger-number-of-control-points-for-Bezier-td22435.html>
 https://openhome.cc/eGossip/OpenSCAD/BezierCurve.html
https://openhome.cc/eGossip/OpenSCAD/lib-bezier_surface.html
- http://forum.openscad.org/smooth-3-D-curves-tc7766.html
- https://github.com/RLuckom/bezier-scad
https://www.raphaelluckom.com/posts/bezier_curves.html
-
http://forum.openscad.org/Rectangle-with-one-curved-edge-td21097.html
- http://kitwallace.tumblr.com/post/76273401911/loxodrome-in-openscad
- http://www.thingiverse.com/thing:1208001 [20]
<http://forum.openscad.org/Spline-interpolation-nSpline-td15207.html>
- https://www.blockscad3d.com/community/projects/68284

and I would be glad of reading recommendations, or example code which is
carefully and thoroughly explained.

William

--
https://designinto3d.com/
Sphinx of black quartz, judge my vow.


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

I have posted an example of my design approach in a youtube video (designing a mobile stand). https://youtu.be/qb4QSLyCpNI On Mon, 3 Jun 2024 at 06:58, Sanjeev Prabhakar <sprabhakar2006@gmail.com> wrote: > I am not good at explaining things. When I start explaining with diagrams, > it takes too long and I don't have that much time. > You can read the code in my github file openscad1.py and I can answer some > specific questions. > There are some 18 types of arc functions defined. > Key idea in these functions is to define the arcs in 2d which are not very > tough to define in openscad language as well and thereafter the same > functions can be used in 3d arcs. What you need is a method to transform 3d > points to 2d and then back to 3d at its original location. > Also there is no complex mathematics involved here > > On Sun, 2 Jun 2024 at 21:47, William F. Adams via Discuss < > discuss@lists.openscad.org> wrote: > >> On Sunday, June 2, 2024 at 07:26:06 AM EDT, Jon Bondy via Discuss < >> discuss@lists.openscad.org> wrote: >> >> The OpenSCAD file is incomprehensible, to the point of being useless. >> You are writing in Python, not in OpenSCAD. You are just using OpenSCAD as >> rendering engine. >> >> Let's turn this around --- if there was an OpenSCAD module for >> representing such a design what would the interface look like? >> >> I've asked before about representing curved surfaces in a fashion which >> was elegant and expressible, and which folks who do not have an >> understanding of higher maths could not merely grasp, but also write/use >> --- while a couple of techniques have been put forward, I wasn't able to >> wrap my mind around them, and I will readily admit to this being my >> deficient education. >> >> I've actually just finished adding support for arcs in my current project: >> >> https://github.com/WillAdams/gcodepreview >> >> [image: Inline image] >> >> >> (though I need to improve it to have Z-axis movement/cutting as well, and >> yes, for some reason the arc generated come in as 25.1mm x 25mm curves >> which don't meet up so as to make a circle, and they generate an error when >> importing the DXF into some programs...) >> >> Once that is done, I eventually hope to start working on adding some sort >> of support for curves in 3 dimensions, or representing a curved surface --- >> what is a way to do this which is: >> >> - reasonably concise >> - expressive and powerful >> - suitable to be calculated out within OpenSCAD >> >> My current plan is to just do curves of tool movement in 3 dimensions --- >> an overhead view of a Bézier curve for X and Y coordinates, and a >> representation of a side view as a curve which shows Y and Z coordinates >> --- to make a curved surface it would be necessary to arrange a sufficient >> number of toolpaths so as to represent that tool movement when cutting out >> that surface and ultimately this would need to be captured as G-code for >> making that cut. >> >> At one point in time I had a number of links which I had researched: >> >> >> - >> https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Other_Language_Features#Surface >> - Thingiverse: Bezier Heart in OpenScad >> <https://www.thingiverse.com/thing:8483> >> - https://www.thingiverse.com/thing:8931 >> - >> http://climberg.de/page/openscad-implementation-of-bezier-curves-of-any-degrees/ >> https://climberg.de/post/openscad_bezier_curves >> - https://github.com/JustinSDK/dotSCAD [19] >> <http://forum.openscad.org/larger-number-of-control-points-for-Bezier-td22435.html> >> https://openhome.cc/eGossip/OpenSCAD/BezierCurve.html >> https://openhome.cc/eGossip/OpenSCAD/lib-bezier_surface.html >> - http://forum.openscad.org/smooth-3-D-curves-tc7766.html >> - https://github.com/RLuckom/bezier-scad >> https://www.raphaelluckom.com/posts/bezier_curves.html >> - >> http://forum.openscad.org/Rectangle-with-one-curved-edge-td21097.html >> - http://kitwallace.tumblr.com/post/76273401911/loxodrome-in-openscad >> - http://www.thingiverse.com/thing:1208001 [20] >> <http://forum.openscad.org/Spline-interpolation-nSpline-td15207.html> >> - https://www.blockscad3d.com/community/projects/68284 >> >> >> >> >> and I would be glad of reading recommendations, or example code which is >> carefully and thoroughly explained. >> >> William >> >> -- >> https://designinto3d.com/ >> Sphinx of black quartz, judge my vow. >> >> >> >> >> _______________________________________________ >> OpenSCAD mailing list >> To unsubscribe send an email to discuss-leave@lists.openscad.org >> >