discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

generic method of rounding

SP
Sanjeev Prabhakar
Fri, Mar 10, 2023 11:30 PM

First of all 3d objects/ solids/ prisms, whatever you may call them, have
to be made through the list of points.

There are in most of the cases 3 ways I make solids and most likely you
also i.e. through a

  • path_extrude method, when the path is curved or anything
  • Linear extrude method
  • offset method from path, where x-coordinates of the path is used to
    offset the section and y-coordinate of the path is used to translate the
    offsetted section to z-coordinate.

for the offset method, which i call function prism, 3d resize function can
give the offset of the solid, at whatever location it is placed. for
resizing what you need is the 3d bounding box dimensions, of the prism. To
that bounding box dimension, add 2 times the offset amount and an offsetted
solid can be achieved.

for other 2 methods i.e. path_extrude and linear extrude(in case it is
twisted) a function needs to be written to offset the solid at their
original location.

The way I do that is following:
find normal of each section in the path_extrude (you have it already when
you know the path)
with the help of normals, transform the section points to x-y plane,
convert to 2d points, offset the section and then revert the offsetted
points to their original location.

So, once you can offset the solids at their original locations, you can do
the filleting by the intersection method.

You can check the following main functions I have written:

prism(sec,path)

path_extrude(sec,path)

rsz3dc(prism,rsz) - basically this resizes the 'prism'  to dimensions
defined in 'rsz' keeping the same center of mass.

offset_sol(sol,d,o=0): function to calculate offset of a 3d object by
distance 'd'. option 'o' can be set to '0' or '1' depending on the shape of
the object.In case the shape of the 3d object is twisted,option should be
set to '1'. in few special cases this function may not work.

I hope i could clarify to some extent

On Sat, 11 Mar 2023 at 02:52, Adrian Mariano avm4@cornell.edu wrote:

Can you give a description of the method?

On Fri, Mar 10, 2023 at 12:09 PM Sanjeev Prabhakar <
sprabhakar2006@gmail.com> wrote:

yes

On Fri, 10 Mar 2023 at 22:36, Father Horton fatherhorton@gmail.com
wrote:

Do you have this on GitHub?

On Fri, Mar 10, 2023 at 11:02 AM Sanjeev Prabhakar <
sprabhakar2006@gmail.com> wrote:

yes it is the same approach basically but it can be applied at objects
wherever their location is and to different shapes and not only primitives

On Fri, 10 Mar 2023 at 22:25, Daniel Harvey dwaharvey@gmail.com
wrote:

Isn’t this the same as the approach I suggested and Adrian modified a
couple of weeks ago?

On Fri, Mar 10, 2023 at 09:46 Sanjeev Prabhakar <
sprabhakar2006@gmail.com> wrote:

Right now I maynot be able to do this in openscad, but I am sure
Adrian/ BOSL developers can do this for everyone who is using only
openscad. I think it is not too difficult, but this is super efficient.

On Fri, 10 Mar 2023 at 21:54, jon jon@jonbondy.com wrote:

I have no idea what "this way" means, and I do not use Python.

But the pictures look good

On 3/10/2023 11:01 AM, Sanjeev Prabhakar wrote:

I must say that everyone should see this way of rounding which is
possible with almost all the cases where the 2 intersecting solids are
convex in shape.

This is superfast

few pictures below:
[image: Screenshot 2023-03-10 at 9.11.42 PM.png]

[image: Screenshot 2023-03-10 at 8.48.35 PM.png]

[image: Screenshot 2023-03-10 at 9.28.57 PM.png]

and i think this can be achieved in pure openscad, although i have
done this through python.

This is done with 3d resizing the intersecting solids and that's all.


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


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

First of all 3d objects/ solids/ prisms, whatever you may call them, have to be made through the list of points. There are in most of the cases 3 ways I make solids and most likely you also i.e. through a - path_extrude method, when the path is curved or anything - Linear extrude method - offset method from path, where x-coordinates of the path is used to offset the section and y-coordinate of the path is used to translate the offsetted section to z-coordinate. for the offset method, which i call function prism, 3d resize function can give the offset of the solid, at whatever location it is placed. for resizing what you need is the 3d bounding box dimensions, of the prism. To that bounding box dimension, add 2 times the offset amount and an offsetted solid can be achieved. for other 2 methods i.e. path_extrude and linear extrude(in case it is twisted) a function needs to be written to offset the solid at their original location. The way I do that is following: find normal of each section in the path_extrude (you have it already when you know the path) with the help of normals, transform the section points to x-y plane, convert to 2d points, offset the section and then revert the offsetted points to their original location. So, once you can offset the solids at their original locations, you can do the filleting by the intersection method. You can check the following main functions I have written: prism(sec,path) path_extrude(sec,path) rsz3dc(prism,rsz) - basically this resizes the 'prism' to dimensions defined in 'rsz' keeping the same center of mass. offset_sol(sol,d,o=0): function to calculate offset of a 3d object by distance 'd'. option 'o' can be set to '0' or '1' depending on the shape of the object.In case the shape of the 3d object is twisted,option should be set to '1'. in few special cases this function may not work. I hope i could clarify to some extent On Sat, 11 Mar 2023 at 02:52, Adrian Mariano <avm4@cornell.edu> wrote: > Can you give a description of the method? > > On Fri, Mar 10, 2023 at 12:09 PM Sanjeev Prabhakar < > sprabhakar2006@gmail.com> wrote: > >> yes >> >> On Fri, 10 Mar 2023 at 22:36, Father Horton <fatherhorton@gmail.com> >> wrote: >> >>> Do you have this on GitHub? >>> >>> On Fri, Mar 10, 2023 at 11:02 AM Sanjeev Prabhakar < >>> sprabhakar2006@gmail.com> wrote: >>> >>>> yes it is the same approach basically but it can be applied at objects >>>> wherever their location is and to different shapes and not only primitives >>>> >>>> On Fri, 10 Mar 2023 at 22:25, Daniel Harvey <dwaharvey@gmail.com> >>>> wrote: >>>> >>>>> Isn’t this the same as the approach I suggested and Adrian modified a >>>>> couple of weeks ago? >>>>> >>>>> On Fri, Mar 10, 2023 at 09:46 Sanjeev Prabhakar < >>>>> sprabhakar2006@gmail.com> wrote: >>>>> >>>>>> Right now I maynot be able to do this in openscad, but I am sure >>>>>> Adrian/ BOSL developers can do this for everyone who is using only >>>>>> openscad. I think it is not too difficult, but this is super efficient. >>>>>> >>>>>> >>>>>> On Fri, 10 Mar 2023 at 21:54, jon <jon@jonbondy.com> wrote: >>>>>> >>>>>>> I have no idea what "this way" means, and I do not use Python. >>>>>>> >>>>>>> But the pictures look good >>>>>>> >>>>>>> >>>>>>> On 3/10/2023 11:01 AM, Sanjeev Prabhakar wrote: >>>>>>> >>>>>>> I must say that everyone should see this way of rounding which is >>>>>>> possible with almost all the cases where the 2 intersecting solids are >>>>>>> convex in shape. >>>>>>> >>>>>>> This is superfast >>>>>>> >>>>>>> few pictures below: >>>>>>> [image: Screenshot 2023-03-10 at 9.11.42 PM.png] >>>>>>> >>>>>>> [image: Screenshot 2023-03-10 at 8.48.35 PM.png] >>>>>>> >>>>>>> [image: Screenshot 2023-03-10 at 9.28.57 PM.png] >>>>>>> >>>>>>> >>>>>>> and i think this can be achieved in pure openscad, although i have >>>>>>> done this through python. >>>>>>> >>>>>>> This is done with 3d resizing the intersecting solids and that's all. >>>>>>> >>>>>>> >>>>>>> >>>>>>> _______________________________________________ >>>>>>> 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 >>> >> _______________________________________________ >> 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 >
SP
Sanjeev Prabhakar
Fri, Mar 10, 2023 11:44 PM

offset_sol function is based on the function offset_3d which offsets any
section at it's original 3d location

[image: image.png]

On Sat, 11 Mar 2023 at 05:00, Sanjeev Prabhakar sprabhakar2006@gmail.com
wrote:

First of all 3d objects/ solids/ prisms, whatever you may call them, have
to be made through the list of points.

There are in most of the cases 3 ways I make solids and most likely you
also i.e. through a

  • path_extrude method, when the path is curved or anything
  • Linear extrude method
  • offset method from path, where x-coordinates of the path is used to
    offset the section and y-coordinate of the path is used to translate the
    offsetted section to z-coordinate.

for the offset method, which i call function prism, 3d resize function can
give the offset of the solid, at whatever location it is placed. for
resizing what you need is the 3d bounding box dimensions, of the prism. To
that bounding box dimension, add 2 times the offset amount and an offsetted
solid can be achieved.

for other 2 methods i.e. path_extrude and linear extrude(in case it is
twisted) a function needs to be written to offset the solid at their
original location.

The way I do that is following:
find normal of each section in the path_extrude (you have it already when
you know the path)
with the help of normals, transform the section points to x-y plane,
convert to 2d points, offset the section and then revert the offsetted
points to their original location.

So, once you can offset the solids at their original locations, you can do
the filleting by the intersection method.

You can check the following main functions I have written:

prism(sec,path)

path_extrude(sec,path)

rsz3dc(prism,rsz) - basically this resizes the 'prism'  to dimensions
defined in 'rsz' keeping the same center of mass.

offset_sol(sol,d,o=0): function to calculate offset of a 3d object by
distance 'd'. option 'o' can be set to '0' or '1' depending on the shape of
the object.In case the shape of the 3d object is twisted,option should be
set to '1'. in few special cases this function may not work.

I hope i could clarify to some extent

offset_sol function is based on the function offset_3d which offsets any section at it's original 3d location [image: image.png] On Sat, 11 Mar 2023 at 05:00, Sanjeev Prabhakar <sprabhakar2006@gmail.com> wrote: > First of all 3d objects/ solids/ prisms, whatever you may call them, have > to be made through the list of points. > > There are in most of the cases 3 ways I make solids and most likely you > also i.e. through a > - path_extrude method, when the path is curved or anything > - Linear extrude method > - offset method from path, where x-coordinates of the path is used to > offset the section and y-coordinate of the path is used to translate the > offsetted section to z-coordinate. > > for the offset method, which i call function prism, 3d resize function can > give the offset of the solid, at whatever location it is placed. for > resizing what you need is the 3d bounding box dimensions, of the prism. To > that bounding box dimension, add 2 times the offset amount and an offsetted > solid can be achieved. > > for other 2 methods i.e. path_extrude and linear extrude(in case it is > twisted) a function needs to be written to offset the solid at their > original location. > > The way I do that is following: > find normal of each section in the path_extrude (you have it already when > you know the path) > with the help of normals, transform the section points to x-y plane, > convert to 2d points, offset the section and then revert the offsetted > points to their original location. > > So, once you can offset the solids at their original locations, you can do > the filleting by the intersection method. > > You can check the following main functions I have written: > > prism(sec,path) > > path_extrude(sec,path) > > rsz3dc(prism,rsz) - basically this resizes the 'prism' to dimensions > defined in 'rsz' keeping the same center of mass. > > offset_sol(sol,d,o=0): function to calculate offset of a 3d object by > distance 'd'. option 'o' can be set to '0' or '1' depending on the shape of > the object.In case the shape of the 3d object is twisted,option should be > set to '1'. in few special cases this function may not work. > > I hope i could clarify to some extent > > > > > > > >> >>