RW
Raymond West
Wed, Feb 5, 2025 1:10 PM
Hi Sanjeev,
I've no need for it to smooth the inside of a polygon, at the moment.
For the few occasions I may need it, I can use the inbuilt openscad
offset, save as svg, convert it with the python script, and use the
generated polygon points. Alternatively, in some cases, I could resize
the initial polygon. For example, say I have four points making a
square, with side lengths of 50, and I want to round the corners inside
that square, by a radius of 10, then using the ChatGPT script, I think
it will give the desired results with a square with side lengths 30.
Here's some code, works with squares, nothing else, afaik. You could
create the generic solution for any polygon.😉
// --- Example Usage for squares only ----
side = 50;
wt = 10;// Fillet (wall thickness) radius at each vertex
os=side/2;
pl1 = [[-os, -os], [os,-os], [os, os], [-os, os]]; // Base polygon
arc_segments = 50; // Number of points to generate along each fillet arc
pl2 = fillet_polygon_points(pl1, wt, arc_segments);
// Draw the final rounded polygon.
difference() {
   polygon(pl2);
   polygon(pl1);
}
scale= (side-wt-wt)/(side);
echo(scale=scale,new_side=scaleside);
pl3=pl1scale;
pl4=fillet_polygon_points(pl3, wt, arc_segments);
#polygon(pl4);
On 05/02/2025 01:54, Sanjeev Prabhakar wrote:
Thanks
Does it offset inside the polygon also?
On Wed, 5 Feb 2025 at 02:29, Raymond West via Discuss
discuss@lists.openscad.org wrote:
After many hours of arguing, explaining that openscad is not
python, I finally got a script that I can use. I've attached it
below. I don't think I have the strength to get the full
functionality of 'offset' to work with point described polygons.
In the middle of this, I got it to write a python script to get
the points from an svg file into a list in openscad format. It got
that, more or less, in the first attempt. I'd written similar a
few years ago, couldn't find it.
On 02/02/2025 19:58, Raymond West via Discuss wrote:
Hi Roel,
I've been experimenting with ChatGPT and openscad (and python)
for a while - the free version. It is much, much better with
python. It is frustrating with openscad - it starts off with good
intentions, then keeps repeating the same mistakes. I
continuously have to remind it about variables being immutable,
and that openscad works in degrees, for example. After a half day
of arguing, I generally give up. Not that I know any, but I
think its behaviour is symptomatic of a petulant child (and
ChatGPT agreed with that description).
My current 'problem', one that you may wish to test, is -
I can generate a shape by using, say, circle( d=50,$fn=f) to give
a pentagon if f=5, square if f=4, etc.. I need the vertices for
creating that type of polygon. Not too difficult. If I want
rounded corners, then I can use offset (r=x). Try to get your
ChatGPT to generate the vertices for a polygon from that, i.e. a
polygon with rounded corners, say points 0.1 apart around the
circumference of the curves. I would be interested to see how you
and ChatGPT get on, if you want to try. It is easier if the
origin is within the polygon. I do not expect it to use
Bosl2/python/other libraries in its solution, just raw openscad
script.
Best wishes,
Ray
On 29/01/2025 17:46, Roel Vanhout via Discuss wrote:
Ah I'm sorry, it seems custom GPT's are available only when you
have a Plus (i.e., paid) account, I hadn't realized that when I
wrote the email. I will look into whether I can expose mine to
other users - although mine isn't really set up for public use,
more tuned to my needs and habits. But if anyone is interested
and/or wants to play around with it I'll see what I can do.
Cheers
o 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
Hi Sanjeev,
I've no need for it to smooth the inside of a polygon, at the moment.
For the few occasions I may need it, I can use the inbuilt openscad
offset, save as svg, convert it with the python script, and use the
generated polygon points. Alternatively, in some cases, I could resize
the initial polygon. For example, say I have four points making a
square, with side lengths of 50, and I want to round the corners inside
that square, by a radius of 10, then using the ChatGPT script, I think
it will give the desired results with a square with side lengths 30.
Here's some code, works with squares, nothing else, afaik. You could
create the generic solution for any polygon.😉
// --- Example Usage for squares only ----
side = 50;
wt = 10;// Fillet (wall thickness) radius at each vertex
os=side/2;
pl1 = [[-os, -os], [os,-os], [os, os], [-os, os]]; // Base polygon
arc_segments = 50; // Number of points to generate along each fillet arc
pl2 = fillet_polygon_points(pl1, wt, arc_segments);
// Draw the final rounded polygon.
difference() {
   polygon(pl2);
   polygon(pl1);
}
scale= (side-wt-wt)/(side);
echo(scale=scale,new_side=scale*side);
pl3=pl1*scale;
pl4=fillet_polygon_points(pl3, wt, arc_segments);
#polygon(pl4);
On 05/02/2025 01:54, Sanjeev Prabhakar wrote:
> Thanks
> Does it offset inside the polygon also?
>
> On Wed, 5 Feb 2025 at 02:29, Raymond West via Discuss
> <discuss@lists.openscad.org> wrote:
>
> After many hours of arguing, explaining that openscad is not
> python, I finally got a script that I can use. I've attached it
> below. I don't think I have the strength to get the full
> functionality of 'offset' to work with point described polygons.
>
> In the middle of this, I got it to write a python script to get
> the points from an svg file into a list in openscad format. It got
> that, more or less, in the first attempt. I'd written similar a
> few years ago, couldn't find it.
>
> On 02/02/2025 19:58, Raymond West via Discuss wrote:
>>
>> Hi Roel,
>>
>> I've been experimenting with ChatGPT and openscad (and python)
>> for a while - the free version. It is much, much better with
>> python. It is frustrating with openscad - it starts off with good
>> intentions, then keeps repeating the same mistakes. I
>> continuously have to remind it about variables being immutable,
>> and that openscad works in degrees, for example. After a half day
>> of arguing, I generally give up. Not that I know any, but I
>> think its behaviour is symptomatic of a petulant child (and
>> ChatGPT agreed with that description).
>>
>> My current 'problem', one that you may wish to test, is -
>>
>> I can generate a shape by using, say, circle( d=50,$fn=f) to give
>> a pentagon if f=5, square if f=4, etc.. I need the vertices for
>> creating that type of polygon. Not too difficult. If I want
>> rounded corners, then I can use offset (r=x). Try to get your
>> ChatGPT to generate the vertices for a polygon from that, i.e. a
>> polygon with rounded corners, say points 0.1 apart around the
>> circumference of the curves. I would be interested to see how you
>> and ChatGPT get on, if you want to try. It is easier if the
>> origin is within the polygon. I do not expect it to use
>> Bosl2/python/other libraries in its solution, just raw openscad
>> script.
>>
>> Best wishes,
>>
>> Ray
>>
>> On 29/01/2025 17:46, Roel Vanhout via Discuss wrote:
>>> Ah I'm sorry, it seems custom GPT's are available only when you
>>> have a Plus (i.e., paid) account, I hadn't realized that when I
>>> wrote the email. I will look into whether I can expose mine to
>>> other users - although mine isn't really set up for public use,
>>> more tuned to my needs and habits. But if anyone is interested
>>> and/or wants to play around with it I'll see what I can do.
>>>
>>> Cheers
>>> o 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
>
SP
Sanjeev Prabhakar
Wed, Feb 5, 2025 4:51 PM
Hi Ray,
As far as I know, offset is one of the toughest functions to write. But if
you do it correctly, there are plenty of applications.
e.g. a prism like below is application of outer and inner offset
[image: Screenshot 2025-02-05 at 10.20.12 PM.png]
On Wed, 5 Feb 2025 at 18:40, Raymond West via Discuss <
discuss@lists.openscad.org> wrote:
Hi Sanjeev,
I've no need for it to smooth the inside of a polygon, at the moment. For
the few occasions I may need it, I can use the inbuilt openscad offset,
save as svg, convert it with the python script, and use the generated
polygon points. Alternatively, in some cases, I could resize the initial
polygon. For example, say I have four points making a square, with side
lengths of 50, and I want to round the corners inside that square, by a
radius of 10, then using the ChatGPT script, I think it will give the
desired results with a square with side lengths 30.
Here's some code, works with squares, nothing else, afaik. You could
create the generic solution for any polygon.😉
// --- Example Usage for squares only ----
side = 50;
wt = 10;// Fillet (wall thickness) radius at each vertex
os=side/2;
pl1 = [[-os, -os], [os,-os], [os, os], [-os, os]]; // Base polygon
arc_segments = 50; // Number of points to generate along each fillet arc
pl2 = fillet_polygon_points(pl1, wt, arc_segments);
// Draw the final rounded polygon.
difference() {
polygon(pl2);
polygon(pl1);
}
scale= (side-wt-wt)/(side);
echo(scale=scale,new_side=scaleside);
pl3=pl1scale;
pl4=fillet_polygon_points(pl3, wt, arc_segments);
#polygon(pl4);
On 05/02/2025 01:54, Sanjeev Prabhakar wrote:
Thanks
Does it offset inside the polygon also?
On Wed, 5 Feb 2025 at 02:29, Raymond West via Discuss <
discuss@lists.openscad.org> wrote:
After many hours of arguing, explaining that openscad is not python, I
finally got a script that I can use. I've attached it below. I don't think
I have the strength to get the full functionality of 'offset' to work with
point described polygons.
In the middle of this, I got it to write a python script to get the
points from an svg file into a list in openscad format. It got that, more
or less, in the first attempt. I'd written similar a few years ago,
couldn't find it.
On 02/02/2025 19:58, Raymond West via Discuss wrote:
Hi Roel,
I've been experimenting with ChatGPT and openscad (and python) for a
while - the free version. It is much, much better with python. It is
frustrating with openscad - it starts off with good intentions, then keeps
repeating the same mistakes. I continuously have to remind it about
variables being immutable, and that openscad works in degrees, for example.
After a half day of arguing, I generally give up. Not that I know any, but
I think its behaviour is symptomatic of a petulant child (and ChatGPT
agreed with that description).
My current 'problem', one that you may wish to test, is -
I can generate a shape by using, say, circle( d=50,$fn=f) to give a
pentagon if f=5, square if f=4, etc.. I need the vertices for creating that
type of polygon. Not too difficult. If I want rounded corners, then I can
use offset (r=x). Try to get your ChatGPT to generate the vertices for a
polygon from that, i.e. a polygon with rounded corners, say points 0.1
apart around the circumference of the curves. I would be interested to see
how you and ChatGPT get on, if you want to try. It is easier if the origin
is within the polygon. I do not expect it to use Bosl2/python/other
libraries in its solution, just raw openscad script.
Best wishes,
Ray
On 29/01/2025 17:46, Roel Vanhout via Discuss wrote:
Ah I'm sorry, it seems custom GPT's are available only when you have a
Plus (i.e., paid) account, I hadn't realized that when I wrote the email. I
will look into whether I can expose mine to other users - although mine
isn't really set up for public use, more tuned to my needs and habits. But
if anyone is interested and/or wants to play around with it I'll see what I
can do.
Cheers
o 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
Hi Ray,
As far as I know, offset is one of the toughest functions to write. But if
you do it correctly, there are plenty of applications.
e.g. a prism like below is application of outer and inner offset
[image: Screenshot 2025-02-05 at 10.20.12 PM.png]
On Wed, 5 Feb 2025 at 18:40, Raymond West via Discuss <
discuss@lists.openscad.org> wrote:
> Hi Sanjeev,
>
> I've no need for it to smooth the inside of a polygon, at the moment. For
> the few occasions I may need it, I can use the inbuilt openscad offset,
> save as svg, convert it with the python script, and use the generated
> polygon points. Alternatively, in some cases, I could resize the initial
> polygon. For example, say I have four points making a square, with side
> lengths of 50, and I want to round the corners inside that square, by a
> radius of 10, then using the ChatGPT script, I think it will give the
> desired results with a square with side lengths 30.
>
> Here's some code, works with squares, nothing else, afaik. You could
> create the generic solution for any polygon.😉
>
> // --- Example Usage for squares only ----
> side = 50;
> wt = 10;// Fillet (wall thickness) radius at each vertex
>
> os=side/2;
> pl1 = [[-os, -os], [os,-os], [os, os], [-os, os]]; // Base polygon
>
> arc_segments = 50; // Number of points to generate along each fillet arc
>
> pl2 = fillet_polygon_points(pl1, wt, arc_segments);
>
> // Draw the final rounded polygon.
> difference() {
> polygon(pl2);
> polygon(pl1);
> }
>
> scale= (side-wt-wt)/(side);
> echo(scale=scale,new_side=scale*side);
> pl3=pl1*scale;
>
> pl4=fillet_polygon_points(pl3, wt, arc_segments);
> #polygon(pl4);
> On 05/02/2025 01:54, Sanjeev Prabhakar wrote:
>
> Thanks
> Does it offset inside the polygon also?
>
> On Wed, 5 Feb 2025 at 02:29, Raymond West via Discuss <
> discuss@lists.openscad.org> wrote:
>
>> After many hours of arguing, explaining that openscad is not python, I
>> finally got a script that I can use. I've attached it below. I don't think
>> I have the strength to get the full functionality of 'offset' to work with
>> point described polygons.
>>
>> In the middle of this, I got it to write a python script to get the
>> points from an svg file into a list in openscad format. It got that, more
>> or less, in the first attempt. I'd written similar a few years ago,
>> couldn't find it.
>> On 02/02/2025 19:58, Raymond West via Discuss wrote:
>>
>> Hi Roel,
>>
>> I've been experimenting with ChatGPT and openscad (and python) for a
>> while - the free version. It is much, much better with python. It is
>> frustrating with openscad - it starts off with good intentions, then keeps
>> repeating the same mistakes. I continuously have to remind it about
>> variables being immutable, and that openscad works in degrees, for example.
>> After a half day of arguing, I generally give up. Not that I know any, but
>> I think its behaviour is symptomatic of a petulant child (and ChatGPT
>> agreed with that description).
>>
>> My current 'problem', one that you may wish to test, is -
>>
>> I can generate a shape by using, say, circle( d=50,$fn=f) to give a
>> pentagon if f=5, square if f=4, etc.. I need the vertices for creating that
>> type of polygon. Not too difficult. If I want rounded corners, then I can
>> use offset (r=x). Try to get your ChatGPT to generate the vertices for a
>> polygon from that, i.e. a polygon with rounded corners, say points 0.1
>> apart around the circumference of the curves. I would be interested to see
>> how you and ChatGPT get on, if you want to try. It is easier if the origin
>> is within the polygon. I do not expect it to use Bosl2/python/other
>> libraries in its solution, just raw openscad script.
>>
>> Best wishes,
>>
>> Ray
>> On 29/01/2025 17:46, Roel Vanhout via Discuss wrote:
>>
>> Ah I'm sorry, it seems custom GPT's are available only when you have a
>> Plus (i.e., paid) account, I hadn't realized that when I wrote the email. I
>> will look into whether I can expose mine to other users - although mine
>> isn't really set up for public use, more tuned to my needs and habits. But
>> if anyone is interested and/or wants to play around with it I'll see what I
>> can do.
>>
>> Cheers
>> o 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
>