discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

Fillet

ME
Mark Erbaugh
Sat, Jan 11, 2025 2:02 AM

To enhance my OpenSCAD skills, I attempted on of the Reddit CAD challenges.

They provide a drawing and you need to model the part.

Here’s what I came up with

The only thing I haven’t figured out is how to place the fillet on the intersection of the vertical and horizontal tubes.

I would appreciate any comments on my design and in particular a solution to the fillet.

Mark

To enhance my OpenSCAD skills, I attempted on of the Reddit CAD challenges. They provide a drawing and you need to model the part. Here’s what I came up with The only thing I haven’t figured out is how to place the fillet on the intersection of the vertical and horizontal tubes. I would appreciate any comments on my design and in particular a solution to the fillet. Mark
TA
Todd Allen
Sat, Jan 11, 2025 3:11 AM

I would try Bosl2's join_prism() to do the fillet.

On Fri, Jan 10, 2025, 8:03 PM Mark Erbaugh via Discuss <
discuss@lists.openscad.org> wrote:

To enhance my OpenSCAD skills, I attempted on of the Reddit CAD challenges.

They provide a drawing and you need to model the part.

Here’s what I came up with

The only thing I haven’t figured out is how to place the fillet on the
intersection of the vertical and horizontal tubes.

I would appreciate any comments on my design and in particular a solution
to the fillet.

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

I would try Bosl2's join_prism() to do the fillet. On Fri, Jan 10, 2025, 8:03 PM Mark Erbaugh via Discuss < discuss@lists.openscad.org> wrote: > To enhance my OpenSCAD skills, I attempted on of the Reddit CAD challenges. > > They provide a drawing and you need to model the part. > > > > Here’s what I came up with > > > > > > The only thing I haven’t figured out is how to place the fillet on the > intersection of the vertical and horizontal tubes. > > I would appreciate any comments on my design and in particular a solution > to the fillet. > > Mark_______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org >
SP
Sanjeev Prabhakar
Sun, Jan 12, 2025 9:32 AM

It's a little difficult to go line by line and understand the code written
by you (At Least for me).

I appreciate the final outcome from your code though.

I would suggest you learn to write models through points in space, create
meshes and use module polyhedron to render the final model.

The sooner you can do that the better.

For creating fillets, you need to to find intersection points between the 2
solids.That would need some work.

Getting the fillets from primitives in openSCAD is extremely difficult as
per my understanding.

Good luck

On Sat, 11 Jan 2025 at 07:33, Mark Erbaugh via Discuss <
discuss@lists.openscad.org> wrote:

To enhance my OpenSCAD skills, I attempted on of the Reddit CAD challenges.

They provide a drawing and you need to model the part.

Here’s what I came up with

The only thing I haven’t figured out is how to place the fillet on the
intersection of the vertical and horizontal tubes.

I would appreciate any comments on my design and in particular a solution
to the fillet.

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

It's a little difficult to go line by line and understand the code written by you (At Least for me). I appreciate the final outcome from your code though. I would suggest you learn to write models through points in space, create meshes and use module polyhedron to render the final model. The sooner you can do that the better. For creating fillets, you need to to find intersection points between the 2 solids.That would need some work. Getting the fillets from primitives in openSCAD is extremely difficult as per my understanding. Good luck On Sat, 11 Jan 2025 at 07:33, Mark Erbaugh via Discuss < discuss@lists.openscad.org> wrote: > To enhance my OpenSCAD skills, I attempted on of the Reddit CAD challenges. > > They provide a drawing and you need to model the part. > > > > Here’s what I came up with > > > > > > The only thing I haven’t figured out is how to place the fillet on the > intersection of the vertical and horizontal tubes. > > I would appreciate any comments on my design and in particular a solution > to the fillet. > > Mark_______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org >
JB
Jon Bondy
Sun, Jan 12, 2025 12:53 PM

"learn to write models through points in space, create meshes ... The
sooner you can do that the better."

Our goals are opposite.  Languages like OpenSCAD are useful to me
EXACTLY because I do not have to create meshes by hand.

On 1/12/2025 4:32 AM, Sanjeev Prabhakar via Discuss wrote:

It's a little difficult to go line by line and understand the code
written by you (At Least for me).

I appreciate the final outcome from your code though.

I would suggest you learn to write models through points in space,
create meshes and use module polyhedron to render the final model.

The sooner you can do that the better.

For creating fillets, you need to to find intersection points between
the 2 solids.That would need some work.

Getting the fillets from primitives in openSCAD is extremely difficult
as per my understanding.

Good luck

On Sat, 11 Jan 2025 at 07:33, Mark Erbaugh via Discuss
discuss@lists.openscad.org wrote:

 To enhance my OpenSCAD skills, I attempted on of the Reddit CAD
 challenges.

 They provide a drawing and you need to model the part.



 Here’s what I came up with





 The only thing I haven’t figured out is how to place the fillet on
 the intersection of the vertical and horizontal tubes.

 I would appreciate any comments on my design and in particular a
 solution to the fillet.

 Mark_______________________________________________
 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

"learn to write models through points in space, create meshes ... The sooner you can do that the better." Our goals are opposite.  Languages like OpenSCAD are useful to me EXACTLY because I do not have to create meshes by hand. On 1/12/2025 4:32 AM, Sanjeev Prabhakar via Discuss wrote: > It's a little difficult to go line by line and understand the code > written by you (At Least for me). > > I appreciate the final outcome from your code though. > > I would suggest you learn to write models through points in space, > create meshes and use module polyhedron to render the final model. > > The sooner you can do that the better. > > For creating fillets, you need to to find intersection points between > the 2 solids.That would need some work. > > Getting the fillets from primitives in openSCAD is extremely difficult > as per my understanding. > > Good luck > > > On Sat, 11 Jan 2025 at 07:33, Mark Erbaugh via Discuss > <discuss@lists.openscad.org> wrote: > > To enhance my OpenSCAD skills, I attempted on of the Reddit CAD > challenges. > > They provide a drawing and you need to model the part. > > > > Here’s what I came up with > > > > > > The only thing I haven’t figured out is how to place the fillet on > the intersection of the vertical and horizontal tubes. > > I would appreciate any comments on my design and in particular a > solution to the fillet. > > Mark_______________________________________________ > 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
ME
Mark Erbaugh
Sun, Jan 12, 2025 1:33 PM

First,

Thanks for the replies.

The method I used was to do as much in 2D and then rotate_extruded that into 3D. In both modules top() (vertical piece) and side() (horizontal piece) the outline array and polygon() creates a 2D outline of one side of the cross-section of the pipe with flange. The fillet module adds a 2d fillet under the flange. The polygons are created in the XY plane with the flange on the X axis and will be translated and rotated into the final position. Since the horizontal piece is symmetrical around the Y axis (which is the X axis before rotation), the polygon only creates half and that is mirrored.

After the rotate extrude, the hole for the other pipe is added as are the bolt holes. The two pieces are then rotated and translated so that the intersection is at the origin and the two pieces are joined() with a union.

I’m not sure I fully understand the comment of creating meshes from polyhedra. I thought that was the purpose of OpenSCAD.

Mark

On Jan 12, 2025, at 7:53 AM, Jon Bondy jon@jonbondy.com wrote:

"learn to write models through points in space, create meshes ... The sooner you can do that the better."

Our goals are opposite.  Languages like OpenSCAD are useful to me EXACTLY because I do not have to create meshes by hand.

On 1/12/2025 4:32 AM, Sanjeev Prabhakar via Discuss wrote:

It's a little difficult to go line by line and understand the code written by you (At Least for me).

I appreciate the final outcome from your code though.

I would suggest you learn to write models through points in space, create meshes and use module polyhedron to render the final model.

The sooner you can do that the better.

For creating fillets, you need to to find intersection points between the 2 solids.That would need some work.

Getting the fillets from primitives in openSCAD is extremely difficult as per my understanding.

Good luck

On Sat, 11 Jan 2025 at 07:33, Mark Erbaugh via Discuss <discuss@lists.openscad.org mailto:discuss@lists.openscad.org> wrote:

To enhance my OpenSCAD skills, I attempted on of the Reddit CAD challenges.

They provide a drawing and you need to model the part.

Here’s what I came up with

The only thing I haven’t figured out is how to place the fillet on the intersection of the vertical and horizontal tubes.

I would appreciate any comments on my design and in particular a solution to the fillet.

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


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

First, Thanks for the replies. The method I used was to do as much in 2D and then rotate_extruded that into 3D. In both modules top() (vertical piece) and side() (horizontal piece) the outline array and polygon() creates a 2D outline of one side of the cross-section of the pipe with flange. The fillet module adds a 2d fillet under the flange. The polygons are created in the XY plane with the flange on the X axis and will be translated and rotated into the final position. Since the horizontal piece is symmetrical around the Y axis (which is the X axis before rotation), the polygon only creates half and that is mirrored. After the rotate extrude, the hole for the other pipe is added as are the bolt holes. The two pieces are then rotated and translated so that the intersection is at the origin and the two pieces are joined() with a union. I’m not sure I fully understand the comment of creating meshes from polyhedra. I thought that was the purpose of OpenSCAD. Mark > On Jan 12, 2025, at 7:53 AM, Jon Bondy <jon@jonbondy.com> wrote: > > "learn to write models through points in space, create meshes ... The sooner you can do that the better." > > Our goals are opposite. Languages like OpenSCAD are useful to me EXACTLY because I do not have to create meshes by hand. > > > > On 1/12/2025 4:32 AM, Sanjeev Prabhakar via Discuss wrote: >> It's a little difficult to go line by line and understand the code written by you (At Least for me). >> >> I appreciate the final outcome from your code though. >> >> I would suggest you learn to write models through points in space, create meshes and use module polyhedron to render the final model. >> >> The sooner you can do that the better. >> >> For creating fillets, you need to to find intersection points between the 2 solids.That would need some work. >> >> Getting the fillets from primitives in openSCAD is extremely difficult as per my understanding. >> >> Good luck >> >> >> On Sat, 11 Jan 2025 at 07:33, Mark Erbaugh via Discuss <discuss@lists.openscad.org <mailto:discuss@lists.openscad.org>> wrote: >>> To enhance my OpenSCAD skills, I attempted on of the Reddit CAD challenges. >>> >>> They provide a drawing and you need to model the part. >>> >>> >>> >>> Here’s what I came up with >>> >>> >>> >>> >>> >>> The only thing I haven’t figured out is how to place the fillet on the intersection of the vertical and horizontal tubes. >>> >>> I would appreciate any comments on my design and in particular a solution to the fillet. >>> >>> Mark_______________________________________________ >>> OpenSCAD mailing list >>> To unsubscribe send an email to discuss-leave@lists.openscad.org <mailto:discuss-leave@lists.openscad.org> >> >> >> _______________________________________________ >> OpenSCAD mailing list >> To unsubscribe send an email to discuss-leave@lists.openscad.org <mailto:discuss-leave@lists.openscad.org> > > <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> <x-msg://1/#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
DP
David Phillip Oster
Sun, Jan 12, 2025 3:47 PM

Taking Todd Allen's suggestion, here is amended .scad, adding the fillet in
BOSL2.  I've marked the additional source code lines with '// add' to make
them easier to see.

On Fri, Jan 10, 2025 at 7:11 PM Todd Allen via Discuss <
discuss@lists.openscad.org> wrote:

I would try Bosl2's join_prism() to do the fillet.

On Fri, Jan 10, 2025, 8:03 PM Mark Erbaugh via Discuss <
discuss@lists.openscad.org> wrote:

To enhance my OpenSCAD skills, I attempted on of the Reddit CAD
challenges.

They provide a drawing and you need to model the part.

Here’s what I came up with

The only thing I haven’t figured out is how to place the fillet on the
intersection of the vertical and horizontal tubes.

I would appreciate any comments on my design and in particular a solution
to the fillet.

Mark_______________________________________________
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

Taking Todd Allen's suggestion, here is amended .scad, adding the fillet in BOSL2. I've marked the additional source code lines with '// add' to make them easier to see. On Fri, Jan 10, 2025 at 7:11 PM Todd Allen via Discuss < discuss@lists.openscad.org> wrote: > I would try Bosl2's join_prism() to do the fillet. > > On Fri, Jan 10, 2025, 8:03 PM Mark Erbaugh via Discuss < > discuss@lists.openscad.org> wrote: > >> To enhance my OpenSCAD skills, I attempted on of the Reddit CAD >> challenges. >> >> They provide a drawing and you need to model the part. >> >> >> >> Here’s what I came up with >> >> >> >> >> >> The only thing I haven’t figured out is how to place the fillet on the >> intersection of the vertical and horizontal tubes. >> >> I would appreciate any comments on my design and in particular a solution >> to the fillet. >> >> Mark_______________________________________________ >> 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 >
ME
Mark Erbaugh
Sun, Jan 12, 2025 4:34 PM

David,

Thanks.

I’ll put learning BOSL2 on my todo list. I already had it installed and your script worked fine.

Mark

On Jan 12, 2025, at 10:47 AM, David Phillip Oster via Discuss discuss@lists.openscad.org wrote:

Taking Todd Allen's suggestion, here is amended .scad, adding the fillet in BOSL2.  I've marked the additional source code lines with '// add' to make them easier to see.

On Fri, Jan 10, 2025 at 7:11 PM Todd Allen via Discuss <discuss@lists.openscad.org mailto:discuss@lists.openscad.org> wrote:

I would try Bosl2's join_prism() to do the fillet.

On Fri, Jan 10, 2025, 8:03 PM Mark Erbaugh via Discuss <discuss@lists.openscad.org mailto:discuss@lists.openscad.org> wrote:

To enhance my OpenSCAD skills, I attempted on of the Reddit CAD challenges.

They provide a drawing and you need to model the part.

Here’s what I came up with

The only thing I haven’t figured out is how to place the fillet on the intersection of the vertical and horizontal tubes.

I would appreciate any comments on my design and in particular a solution to the fillet.

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


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

<Challenge 11-fillet.scad>_______________________________________________
OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

David, Thanks. I’ll put learning BOSL2 on my todo list. I already had it installed and your script worked fine. Mark > On Jan 12, 2025, at 10:47 AM, David Phillip Oster via Discuss <discuss@lists.openscad.org> wrote: > > Taking Todd Allen's suggestion, here is amended .scad, adding the fillet in BOSL2. I've marked the additional source code lines with '// add' to make them easier to see. > > On Fri, Jan 10, 2025 at 7:11 PM Todd Allen via Discuss <discuss@lists.openscad.org <mailto:discuss@lists.openscad.org>> wrote: >> I would try Bosl2's join_prism() to do the fillet. >> >> >> On Fri, Jan 10, 2025, 8:03 PM Mark Erbaugh via Discuss <discuss@lists.openscad.org <mailto:discuss@lists.openscad.org>> wrote: >>> To enhance my OpenSCAD skills, I attempted on of the Reddit CAD challenges. >>> >>> They provide a drawing and you need to model the part. >>> >>> >>> >>> Here’s what I came up with >>> >>> >>> >>> >>> >>> The only thing I haven’t figured out is how to place the fillet on the intersection of the vertical and horizontal tubes. >>> >>> I would appreciate any comments on my design and in particular a solution to the fillet. >>> >>> Mark_______________________________________________ >>> OpenSCAD mailing list >>> To unsubscribe send an email to discuss-leave@lists.openscad.org <mailto:discuss-leave@lists.openscad.org> >> _______________________________________________ >> OpenSCAD mailing list >> To unsubscribe send an email to discuss-leave@lists.openscad.org <mailto:discuss-leave@lists.openscad.org> > <Challenge 11-fillet.scad>_______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org
SP
Sanjeev Prabhakar
Sun, Jan 12, 2025 5:00 PM

OK, just for a simple example of creating a cube
consider the following code. 'swp' is a module which creates the mesh from
the points.
p0: is a square in x-y plane
p1: is a square translated to 10 units in z-direction.
you can play around with the coordinates in p0 and p1 to see different
shapes


p0=[[0,0,0],[10,0,0],[10,10,0],[0,10,0]];
p1=[[0,0,10],[10,0,10],[10,10,10],[0,10,10]];

cube_1=[p0,p1];

swp(cube_1);

function faces(sol)=

//    calculate the faces for the vertices with shape l x m with first and
the last end closed
let(
l=len(sol),
m=len(sol[0]),
n1=[for(i=[0:m-1])i],
n2=[for(i=[0:l-2]) each ([ for(j=[0:m-1])
each
j<m-1?[[(j+1)+im,j+im,j+(i+1)m],[(j+1)+im,j+(i+1)m,(j+1)+(i+1)m]]:
[[0+i
m,j+i
m,j+(i+1)m],[0+im,j+(i+1)*m,0+(i+1)*m]]
])],
n3=[for(i=[0:m-1])i+(l-1)*m],
n4=[for(i=[len(n3)-1:-1:0])n3[i]],
n=[n1,each (n2),n4]
)n;

function faces_1(sol)=

//    calculate the faces for the vertices with shape l x m with first and
the last end open
let(
l=len(sol),
m=len(sol[0]),
n2=[for(i=[0:l-2])each([ for(j=[0:m-1])
each
j<m-1?[[(j+1)+im,j+im,j+(i+1)m],[(j+1)+im,j+(i+1)m,(j+1)+(i+1)m]]:
[[0+i
m,j+i
m,j+(i+1)m],[0+im,j+(i+1)*m,0+(i+1)*m]]
])]

)n2;

function vertices(sol)=
[each for (p=sol)p];

// module for rendering the polyhedron with ends closed
module swp(sol){
let(
v1=vertices(sol),
f1=faces(sol)
)
polyhedron(v1,f1,convexity=10);

}


On Sun, 12 Jan 2025 at 21:51, Mark Erbaugh via Discuss <
discuss@lists.openscad.org> wrote:

First,

Thanks for the replies.

The method I used was to do as much in 2D and then rotate_extruded that
into 3D. In both modules top() (vertical piece) and side() (horizontal
piece) the outline array and polygon() creates a 2D outline of one side of
the cross-section of the pipe with flange. The fillet module adds a 2d
fillet under the flange. The polygons are created in the XY plane with the
flange on the X axis and will be translated and rotated into the final
position. Since the horizontal piece is symmetrical around the Y axis
(which is the X axis before rotation), the polygon only creates half and
that is mirrored.

After the rotate extrude, the hole for the other pipe is added as are the
bolt holes. The two pieces are then rotated and translated so that the
intersection is at the origin and the two pieces are joined() with a union.

I’m not sure I fully understand the comment of creating meshes from
polyhedra. I thought that was the purpose of OpenSCAD.

Mark

On Jan 12, 2025, at 7:53 AM, Jon Bondy jon@jonbondy.com wrote:

"learn to write models through points in space, create meshes ... The
sooner you can do that the better."

Our goals are opposite.  Languages like OpenSCAD are useful to me EXACTLY
because I do not have to create meshes by hand.

On 1/12/2025 4:32 AM, Sanjeev Prabhakar via Discuss wrote:

It's a little difficult to go line by line and understand the code written
by you (At Least for me).

I appreciate the final outcome from your code though.

I would suggest you learn to write models through points in space, create
meshes and use module polyhedron to render the final model.

The sooner you can do that the better.

For creating fillets, you need to to find intersection points between the
2 solids.That would need some work.

Getting the fillets from primitives in openSCAD is extremely difficult as
per my understanding.

Good luck

On Sat, 11 Jan 2025 at 07:33, Mark Erbaugh via Discuss <
discuss@lists.openscad.org> wrote:

To enhance my OpenSCAD skills, I attempted on of the Reddit CAD
challenges.

They provide a drawing and you need to model the part.

Here’s what I came up with

The only thing I haven’t figured out is how to place the fillet on the
intersection of the vertical and horizontal tubes.

I would appreciate any comments on my design and in particular a solution
to the fillet.

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

OK, just for a simple example of creating a cube consider the following code. 'swp' is a module which creates the mesh from the points. p0: is a square in x-y plane p1: is a square translated to 10 units in z-direction. you can play around with the coordinates in p0 and p1 to see different shapes **************************************************************************************** p0=[[0,0,0],[10,0,0],[10,10,0],[0,10,0]]; p1=[[0,0,10],[10,0,10],[10,10,10],[0,10,10]]; cube_1=[p0,p1]; swp(cube_1); function faces(sol)= // calculate the faces for the vertices with shape l x m with first and the last end closed let( l=len(sol), m=len(sol[0]), n1=[for(i=[0:m-1])i], n2=[for(i=[0:l-2]) each ([ for(j=[0:m-1]) each j<m-1?[[(j+1)+i*m,j+i*m,j+(i+1)*m],[(j+1)+i*m,j+(i+1)*m,(j+1)+(i+1)*m]]: [[0+i*m,j+i*m,j+(i+1)*m],[0+i*m,j+(i+1)*m,0+(i+1)*m]] ])], n3=[for(i=[0:m-1])i+(l-1)*m], n4=[for(i=[len(n3)-1:-1:0])n3[i]], n=[n1,each (n2),n4] )n; function faces_1(sol)= // calculate the faces for the vertices with shape l x m with first and the last end open let( l=len(sol), m=len(sol[0]), n2=[for(i=[0:l-2])each([ for(j=[0:m-1]) each j<m-1?[[(j+1)+i*m,j+i*m,j+(i+1)*m],[(j+1)+i*m,j+(i+1)*m,(j+1)+(i+1)*m]]: [[0+i*m,j+i*m,j+(i+1)*m],[0+i*m,j+(i+1)*m,0+(i+1)*m]] ])] )n2; function vertices(sol)= [each for (p=sol)p]; // module for rendering the polyhedron with ends closed module swp(sol){ let( v1=vertices(sol), f1=faces(sol) ) polyhedron(v1,f1,convexity=10); } ********************************************************************** On Sun, 12 Jan 2025 at 21:51, Mark Erbaugh via Discuss < discuss@lists.openscad.org> wrote: > First, > > Thanks for the replies. > > The method I used was to do as much in 2D and then rotate_extruded that > into 3D. In both modules top() (vertical piece) and side() (horizontal > piece) the outline array and polygon() creates a 2D outline of one side of > the cross-section of the pipe with flange. The fillet module adds a 2d > fillet under the flange. The polygons are created in the XY plane with the > flange on the X axis and will be translated and rotated into the final > position. Since the horizontal piece is symmetrical around the Y axis > (which is the X axis before rotation), the polygon only creates half and > that is mirrored. > > After the rotate extrude, the hole for the other pipe is added as are the > bolt holes. The two pieces are then rotated and translated so that the > intersection is at the origin and the two pieces are joined() with a union. > > I’m not sure I fully understand the comment of creating meshes from > polyhedra. I thought that was the purpose of OpenSCAD. > > Mark > > > > > On Jan 12, 2025, at 7:53 AM, Jon Bondy <jon@jonbondy.com> wrote: > > "learn to write models through points in space, create meshes ... The > sooner you can do that the better." > > Our goals are opposite. Languages like OpenSCAD are useful to me EXACTLY > because I do not have to create meshes by hand. > > > On 1/12/2025 4:32 AM, Sanjeev Prabhakar via Discuss wrote: > > It's a little difficult to go line by line and understand the code written > by you (At Least for me). > > I appreciate the final outcome from your code though. > > I would suggest you learn to write models through points in space, create > meshes and use module polyhedron to render the final model. > > The sooner you can do that the better. > > For creating fillets, you need to to find intersection points between the > 2 solids.That would need some work. > > Getting the fillets from primitives in openSCAD is extremely difficult as > per my understanding. > > Good luck > > > On Sat, 11 Jan 2025 at 07:33, Mark Erbaugh via Discuss < > discuss@lists.openscad.org> wrote: > >> To enhance my OpenSCAD skills, I attempted on of the Reddit CAD >> challenges. >> >> They provide a drawing and you need to model the part. >> >> >> >> Here’s what I came up with >> >> >> >> >> >> The only thing I haven’t figured out is how to place the fillet on the >> intersection of the vertical and horizontal tubes. >> >> I would appreciate any comments on my design and in particular a solution >> to the fillet. >> >> Mark_______________________________________________ >> 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 > > > > <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> > > > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org >
RW
Raymond West
Sun, Jan 12, 2025 5:27 PM

Useful bit of script, Sanjeev. Makes construction of some polyhedra simple.

On 12/01/2025 17:00, Sanjeev Prabhakar via Discuss wrote:

OK, just for a simple example of creating a cube
consider the following code. 'swp' is a module which creates the mesh
from the points.
p0: is a square in x-y plane
p1: is a square translated to 10 units in z-direction.
you can play around with the coordinates in p0 and p1 to see different
shapes


p0=[[0,0,0],[10,0,0],[10,10,0],[0,10,0]];
p1=[[0,0,10],[10,0,10],[10,10,10],[0,10,10]];

cube_1=[p0,p1];

swp(cube_1);

function faces(sol)=

//    calculate the faces for the vertices with shape l x m with first
and the last end closed
    let(
    l=len(sol),
    m=len(sol[0]),
    n1=[for(i=[0:m-1])i],
    n2=[for(i=[0:l-2]) each ([ for(j=[0:m-1])
    each
j<m-1?[[(j+1)+im,j+im,j+(i+1)m],[(j+1)+im,j+(i+1)m,(j+1)+(i+1)m]]:
    [[0+i
m,j+i
m,j+(i+1)m],[0+im,j+(i+1)*m,0+(i+1)*m]]
    ])],
    n3=[for(i=[0:m-1])i+(l-1)*m],
    n4=[for(i=[len(n3)-1:-1:0])n3[i]],
    n=[n1,each (n2),n4]
    )n;

function faces_1(sol)=

//    calculate the faces for the vertices with shape l x m with first
and the last end open
    let(
    l=len(sol),
    m=len(sol[0]),
    n2=[for(i=[0:l-2])each([ for(j=[0:m-1])
    each
j<m-1?[[(j+1)+im,j+im,j+(i+1)m],[(j+1)+im,j+(i+1)m,(j+1)+(i+1)m]]:
    [[0+i
m,j+i
m,j+(i+1)m],[0+im,j+(i+1)*m,0+(i+1)*m]]
    ])]

    )n2;

 function vertices(sol)=
[each for (p=sol)p];

// module for rendering the polyhedron with ends closed
module swp(sol){
let(
v1=vertices(sol),
f1=faces(sol)
)
polyhedron(v1,f1,convexity=10);

}


On Sun, 12 Jan 2025 at 21:51, Mark Erbaugh via Discuss
discuss@lists.openscad.org wrote:

 First,

 Thanks for the replies.

 The method I used was to do as much in 2D and then rotate_extruded
 that into 3D. In both modules top() (vertical piece) and side()
 (horizontal piece) the outline array and polygon() creates a 2D
 outline of one side of the cross-section of the pipe with flange.
 The fillet module adds a 2d fillet under the flange. The polygons
 are created in the XY plane with the flange on the X axis and will
 be translated and rotated into the final position. Since the
 horizontal piece is symmetrical around the Y axis (which is the X
 axis before rotation), the polygon only creates half and that is
 mirrored.

 After the rotate extrude, the hole for the other pipe is added as
 are the bolt holes. The two pieces are then rotated and translated
 so that the intersection is at the origin and the two pieces are
 joined() with a union.

 I’m not sure I fully understand the comment of creating meshes
 from polyhedra. I thought that was the purpose of OpenSCAD.

 Mark
 On Jan 12, 2025, at 7:53 AM, Jon Bondy <jon@jonbondy.com> wrote:

 "learn to write models through points in space, create meshes ...
 The sooner you can do that the better."

 Our goals are opposite.  Languages like OpenSCAD are useful to me
 EXACTLY because I do not have to create meshes by hand.


 On 1/12/2025 4:32 AM, Sanjeev Prabhakar via Discuss wrote:
 It's a little difficult to go line by line and understand the
 code written by you (At Least for me).

 I appreciate the final outcome from your code though.

 I would suggest you learn to write models through points in
 space, create meshes and use module polyhedron to render the
 final model.

 The sooner you can do that the better.

 For creating fillets, you need to to find intersection points
 between the 2 solids.That would need some work.

 Getting the fillets from primitives in openSCAD is
 extremely difficult as per my understanding.

 Good luck


 On Sat, 11 Jan 2025 at 07:33, Mark Erbaugh via Discuss
 <discuss@lists.openscad.org> wrote:

     To enhance my OpenSCAD skills, I attempted on of the Reddit
     CAD challenges.

     They provide a drawing and you need to model the part.



     Here’s what I came up with





     The only thing I haven’t figured out is how to place the
     fillet on the intersection of the vertical and horizontal tubes.

     I would appreciate any comments on my design and in
     particular a solution to the fillet.

     Mark_______________________________________________
     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
 <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>
 _______________________________________________
 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

Useful bit of script, Sanjeev. Makes construction of some polyhedra simple. On 12/01/2025 17:00, Sanjeev Prabhakar via Discuss wrote: > OK, just for a simple example of creating a cube > consider the following code. 'swp' is a module which creates the mesh > from the points. > p0: is a square in x-y plane > p1: is a square translated to 10 units in z-direction. > you can play around with the coordinates in p0 and p1 to see different > shapes > **************************************************************************************** > > p0=[[0,0,0],[10,0,0],[10,10,0],[0,10,0]]; > p1=[[0,0,10],[10,0,10],[10,10,10],[0,10,10]]; > > cube_1=[p0,p1]; > > swp(cube_1); > > > > > > > function faces(sol)= > > //    calculate the faces for the vertices with shape l x m with first > and the last end closed >     let( >     l=len(sol), >     m=len(sol[0]), >     n1=[for(i=[0:m-1])i], >     n2=[for(i=[0:l-2]) each ([ for(j=[0:m-1]) >     each > j<m-1?[[(j+1)+i*m,j+i*m,j+(i+1)*m],[(j+1)+i*m,j+(i+1)*m,(j+1)+(i+1)*m]]: >     [[0+i*m,j+i*m,j+(i+1)*m],[0+i*m,j+(i+1)*m,0+(i+1)*m]] >     ])], >     n3=[for(i=[0:m-1])i+(l-1)*m], >     n4=[for(i=[len(n3)-1:-1:0])n3[i]], >     n=[n1,each (n2),n4] >     )n; > > > function faces_1(sol)= > > //    calculate the faces for the vertices with shape l x m with first > and the last end open >     let( >     l=len(sol), >     m=len(sol[0]), >     n2=[for(i=[0:l-2])each([ for(j=[0:m-1]) >     each > j<m-1?[[(j+1)+i*m,j+i*m,j+(i+1)*m],[(j+1)+i*m,j+(i+1)*m,(j+1)+(i+1)*m]]: >     [[0+i*m,j+i*m,j+(i+1)*m],[0+i*m,j+(i+1)*m,0+(i+1)*m]] >     ])] > >     )n2; > >  function vertices(sol)= > [each for (p=sol)p]; > > // module for rendering the polyhedron with ends closed > module swp(sol){ > let( > v1=vertices(sol), > f1=faces(sol) > ) > polyhedron(v1,f1,convexity=10); > > } > > ********************************************************************** > > On Sun, 12 Jan 2025 at 21:51, Mark Erbaugh via Discuss > <discuss@lists.openscad.org> wrote: > > First, > > Thanks for the replies. > > The method I used was to do as much in 2D and then rotate_extruded > that into 3D. In both modules top() (vertical piece) and side() > (horizontal piece) the outline array and polygon() creates a 2D > outline of one side of the cross-section of the pipe with flange. > The fillet module adds a 2d fillet under the flange. The polygons > are created in the XY plane with the flange on the X axis and will > be translated and rotated into the final position. Since the > horizontal piece is symmetrical around the Y axis (which is the X > axis before rotation), the polygon only creates half and that is > mirrored. > > After the rotate extrude, the hole for the other pipe is added as > are the bolt holes. The two pieces are then rotated and translated > so that the intersection is at the origin and the two pieces are > joined() with a union. > > I’m not sure I fully understand the comment of creating meshes > from polyhedra. I thought that was the purpose of OpenSCAD. > > Mark > > > > >> On Jan 12, 2025, at 7:53 AM, Jon Bondy <jon@jonbondy.com> wrote: >> >> "learn to write models through points in space, create meshes ... >> The sooner you can do that the better." >> >> Our goals are opposite.  Languages like OpenSCAD are useful to me >> EXACTLY because I do not have to create meshes by hand. >> >> >> On 1/12/2025 4:32 AM, Sanjeev Prabhakar via Discuss wrote: >>> It's a little difficult to go line by line and understand the >>> code written by you (At Least for me). >>> >>> I appreciate the final outcome from your code though. >>> >>> I would suggest you learn to write models through points in >>> space, create meshes and use module polyhedron to render the >>> final model. >>> >>> The sooner you can do that the better. >>> >>> For creating fillets, you need to to find intersection points >>> between the 2 solids.That would need some work. >>> >>> Getting the fillets from primitives in openSCAD is >>> extremely difficult as per my understanding. >>> >>> Good luck >>> >>> >>> On Sat, 11 Jan 2025 at 07:33, Mark Erbaugh via Discuss >>> <discuss@lists.openscad.org> wrote: >>> >>> To enhance my OpenSCAD skills, I attempted on of the Reddit >>> CAD challenges. >>> >>> They provide a drawing and you need to model the part. >>> >>> >>> >>> Here’s what I came up with >>> >>> >>> >>> >>> >>> The only thing I haven’t figured out is how to place the >>> fillet on the intersection of the vertical and horizontal tubes. >>> >>> I would appreciate any comments on my design and in >>> particular a solution to the fillet. >>> >>> Mark_______________________________________________ >>> 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 >> >> <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> >> >> > > _______________________________________________ > 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
ME
Mark Erbaugh
Sun, Jan 12, 2025 6:22 PM

I ran the code in OpenSCAD, but how is that different from a simple cube(10); which is a lot easier to type and understand?

Is this what OpenSCAD’s cube() does under the hood? Is that how more complex shapes are generated by BOSL2?

I asked a question on this forum a while back about using multmatrix to combine a series of rotate(), scale() and  translate() calls into a single transformation, thinking that it might be quicker if those calls were done many times in a script and the answer was that OpenSCAD combines those calls, and computes one matrix and uses the matrix in its calculations. So I’m thinking that if OpenSCAD has a  module to do it, that module should be used.

This raises a question: are the routines in OpenSCAD written in a lower level OpenSCAD or do they go to a lower level language, such as C(++).

Mark

On Jan 12, 2025, at 12:00 PM, Sanjeev Prabhakar sprabhakar2006@gmail.com wrote:

p0=[[0,0,0],[10,0,0],[10,10,0],[0,10,0]];
p1=[[0,0,10],[10,0,10],[10,10,10],[0,10,10]];

cube_1=[p0,p1];

swp(cube_1);

function faces(sol)=

//    calculate the faces for the vertices with shape l x m with first and the last end closed
let(
l=len(sol),
m=len(sol[0]),
n1=[for(i=[0:m-1])i],
n2=[for(i=[0:l-2]) each ([ for(j=[0:m-1])
each
j<m-1?[[(j+1)+im,j+im,j+(i+1)m],[(j+1)+im,j+(i+1)m,(j+1)+(i+1)m]]:
[[0+i
m,j+i
m,j+(i+1)m],[0+im,j+(i+1)*m,0+(i+1)*m]]
])],
n3=[for(i=[0:m-1])i+(l-1)*m],
n4=[for(i=[len(n3)-1:-1:0])n3[i]],
n=[n1,each (n2),n4]
)n;

function faces_1(sol)=

//    calculate the faces for the vertices with shape l x m with first and the last end open
let(
l=len(sol),
m=len(sol[0]),
n2=[for(i=[0:l-2])each([ for(j=[0:m-1])
each
j<m-1?[[(j+1)+im,j+im,j+(i+1)m],[(j+1)+im,j+(i+1)m,(j+1)+(i+1)m]]:
[[0+i
m,j+i
m,j+(i+1)m],[0+im,j+(i+1)*m,0+(i+1)*m]]
])]

 )n2; 

function vertices(sol)=
[each for (p=sol)p];

// module for rendering the polyhedron with ends closed
module swp(sol){
let(
v1=vertices(sol),
f1=faces(sol)
)
polyhedron(v1,f1,convexity=10);

}

I ran the code in OpenSCAD, but how is that different from a simple cube(10); which is a lot easier to type and understand? Is this what OpenSCAD’s cube() does under the hood? Is that how more complex shapes are generated by BOSL2? I asked a question on this forum a while back about using multmatrix to combine a series of rotate(), scale() and translate() calls into a single transformation, thinking that it might be quicker if those calls were done many times in a script and the answer was that OpenSCAD combines those calls, and computes one matrix and uses the matrix in its calculations. So I’m thinking that if OpenSCAD has a module to do it, that module should be used. This raises a question: are the routines in OpenSCAD written in a lower level OpenSCAD or do they go to a lower level language, such as C(++). Mark > On Jan 12, 2025, at 12:00 PM, Sanjeev Prabhakar <sprabhakar2006@gmail.com> wrote: > > p0=[[0,0,0],[10,0,0],[10,10,0],[0,10,0]]; > p1=[[0,0,10],[10,0,10],[10,10,10],[0,10,10]]; > > cube_1=[p0,p1]; > > swp(cube_1); > > > > > > > function faces(sol)= > > // calculate the faces for the vertices with shape l x m with first and the last end closed > let( > l=len(sol), > m=len(sol[0]), > n1=[for(i=[0:m-1])i], > n2=[for(i=[0:l-2]) each ([ for(j=[0:m-1]) > each > j<m-1?[[(j+1)+i*m,j+i*m,j+(i+1)*m],[(j+1)+i*m,j+(i+1)*m,(j+1)+(i+1)*m]]: > [[0+i*m,j+i*m,j+(i+1)*m],[0+i*m,j+(i+1)*m,0+(i+1)*m]] > ])], > n3=[for(i=[0:m-1])i+(l-1)*m], > n4=[for(i=[len(n3)-1:-1:0])n3[i]], > n=[n1,each (n2),n4] > )n; > > > function faces_1(sol)= > > // calculate the faces for the vertices with shape l x m with first and the last end open > let( > l=len(sol), > m=len(sol[0]), > n2=[for(i=[0:l-2])each([ for(j=[0:m-1]) > each > j<m-1?[[(j+1)+i*m,j+i*m,j+(i+1)*m],[(j+1)+i*m,j+(i+1)*m,(j+1)+(i+1)*m]]: > [[0+i*m,j+i*m,j+(i+1)*m],[0+i*m,j+(i+1)*m,0+(i+1)*m]] > ])] > > )n2; > > function vertices(sol)= > [each for (p=sol)p]; > > // module for rendering the polyhedron with ends closed > module swp(sol){ > let( > v1=vertices(sol), > f1=faces(sol) > ) > polyhedron(v1,f1,convexity=10); > > } >
AM
Adrian Mariano
Sun, Jan 12, 2025 6:32 PM

The point I think is that the points could be arbitrar---not points on a
cube---and then you can get a shape that you couldn't get with a simple
primitive.  BOSL2 has two general-purpose functions for this kind of
thing, which help you construct a polyhedron from an array of points of any
size, not just a grid.  They are vnf_vertex_array() and skin(). Helper
functions like this are, in my opinion, essential for creating polyhedra if
you need them to make a more complex shape because they organize the
process so that the resulting polyhedron is guaranteed to be valid and not
broken like happened to the guy on the other thread.

https://github.com/BelfrySCAD/BOSL2/wiki/vnf.scad#function-vnf_vertex_array
https://github.com/BelfrySCAD/BOSL2/wiki/skin.scad#functionmodule-skin

There is no reason to make a cube this way.

On Sun, Jan 12, 2025 at 1:22 PM Mark Erbaugh via Discuss <
discuss@lists.openscad.org> wrote:

I ran the code in OpenSCAD, but how is that different from a simple
cube(10); which is a lot easier to type and understand?

Is this what OpenSCAD’s cube() does under the hood? Is that how more
complex shapes are generated by BOSL2?

I asked a question on this forum a while back about using multmatrix to
combine a series of rotate(), scale() and  translate() calls into a single
transformation, thinking that it might be quicker if those calls were done
many times in a script and the answer was that OpenSCAD combines those
calls, and computes one matrix and uses the matrix in its calculations. So
I’m thinking that if OpenSCAD has a  module to do it, that module should be
used.

This raises a question: are the routines in OpenSCAD written in a lower
level OpenSCAD or do they go to a lower level language, such as C(++).

Mark

On Jan 12, 2025, at 12:00 PM, Sanjeev Prabhakar sprabhakar2006@gmail.com
wrote:

p0=[[0,0,0],[10,0,0],[10,10,0],[0,10,0]];
p1=[[0,0,10],[10,0,10],[10,10,10],[0,10,10]];

cube_1=[p0,p1];

swp(cube_1);

function faces(sol)=

//    calculate the faces for the vertices with shape l x m with first and
the last end closed
let(
l=len(sol),
m=len(sol[0]),
n1=[for(i=[0:m-1])i],
n2=[for(i=[0:l-2]) each ([ for(j=[0:m-1])
each

j<m-1?[[(j+1)+im,j+im,j+(i+1)m],[(j+1)+im,j+(i+1)m,(j+1)+(i+1)m]]:
[[0+i
m,j+i
m,j+(i+1)m],[0+im,j+(i+1)*m,0+(i+1)*m]]
])],
n3=[for(i=[0:m-1])i+(l-1)*m],
n4=[for(i=[len(n3)-1:-1:0])n3[i]],
n=[n1,each (n2),n4]
)n;

function faces_1(sol)=

//    calculate the faces for the vertices with shape l x m with first and
the last end open
let(
l=len(sol),
m=len(sol[0]),
n2=[for(i=[0:l-2])each([ for(j=[0:m-1])
each

j<m-1?[[(j+1)+im,j+im,j+(i+1)m],[(j+1)+im,j+(i+1)m,(j+1)+(i+1)m]]:
[[0+i
m,j+i
m,j+(i+1)m],[0+im,j+(i+1)*m,0+(i+1)*m]]
])]

 )n2;

function vertices(sol)=
[each for (p=sol)p];

// module for rendering the polyhedron with ends closed
module swp(sol){
let(
v1=vertices(sol),
f1=faces(sol)
)
polyhedron(v1,f1,convexity=10);

}


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

The point I think is that the points could be arbitrar---not points on a cube---and then you can get a shape that you couldn't get with a simple primitive. BOSL2 has two general-purpose functions for this kind of thing, which help you construct a polyhedron from an array of points of any size, not just a grid. They are vnf_vertex_array() and skin(). Helper functions like this are, in my opinion, essential for creating polyhedra if you need them to make a more complex shape because they organize the process so that the resulting polyhedron is guaranteed to be valid and not broken like happened to the guy on the other thread. https://github.com/BelfrySCAD/BOSL2/wiki/vnf.scad#function-vnf_vertex_array https://github.com/BelfrySCAD/BOSL2/wiki/skin.scad#functionmodule-skin There is no reason to make a cube this way. On Sun, Jan 12, 2025 at 1:22 PM Mark Erbaugh via Discuss < discuss@lists.openscad.org> wrote: > I ran the code in OpenSCAD, but how is that different from a simple > cube(10); which is a lot easier to type and understand? > > Is this what OpenSCAD’s cube() does under the hood? Is that how more > complex shapes are generated by BOSL2? > > I asked a question on this forum a while back about using multmatrix to > combine a series of rotate(), scale() and translate() calls into a single > transformation, thinking that it might be quicker if those calls were done > many times in a script and the answer was that OpenSCAD combines those > calls, and computes one matrix and uses the matrix in its calculations. So > I’m thinking that if OpenSCAD has a module to do it, that module should be > used. > > This raises a question: are the routines in OpenSCAD written in a lower > level OpenSCAD or do they go to a lower level language, such as C(++). > > Mark > > > On Jan 12, 2025, at 12:00 PM, Sanjeev Prabhakar <sprabhakar2006@gmail.com> > wrote: > > p0=[[0,0,0],[10,0,0],[10,10,0],[0,10,0]]; > p1=[[0,0,10],[10,0,10],[10,10,10],[0,10,10]]; > > cube_1=[p0,p1]; > > swp(cube_1); > > > > > > > function faces(sol)= > > // calculate the faces for the vertices with shape l x m with first and > the last end closed > let( > l=len(sol), > m=len(sol[0]), > n1=[for(i=[0:m-1])i], > n2=[for(i=[0:l-2]) each ([ for(j=[0:m-1]) > each > > j<m-1?[[(j+1)+i*m,j+i*m,j+(i+1)*m],[(j+1)+i*m,j+(i+1)*m,(j+1)+(i+1)*m]]: > [[0+i*m,j+i*m,j+(i+1)*m],[0+i*m,j+(i+1)*m,0+(i+1)*m]] > ])], > n3=[for(i=[0:m-1])i+(l-1)*m], > n4=[for(i=[len(n3)-1:-1:0])n3[i]], > n=[n1,each (n2),n4] > )n; > > > function faces_1(sol)= > > // calculate the faces for the vertices with shape l x m with first and > the last end open > let( > l=len(sol), > m=len(sol[0]), > n2=[for(i=[0:l-2])each([ for(j=[0:m-1]) > each > > j<m-1?[[(j+1)+i*m,j+i*m,j+(i+1)*m],[(j+1)+i*m,j+(i+1)*m,(j+1)+(i+1)*m]]: > [[0+i*m,j+i*m,j+(i+1)*m],[0+i*m,j+(i+1)*m,0+(i+1)*m]] > ])] > > )n2; > > function vertices(sol)= > [each for (p=sol)p]; > > // module for rendering the polyhedron with ends closed > module swp(sol){ > let( > v1=vertices(sol), > f1=faces(sol) > ) > polyhedron(v1,f1,convexity=10); > > } > > > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org >
SP
Sanjeev Prabhakar
Mon, Jan 13, 2025 1:39 AM

Cube is just to explain the process.
Much complex shapes can be developed with a list of points in a similar way.

Once you create models with the list of points , there are a lot of
operations which can be done on them like calculating the intersection
between 2 solids.

But this is only required if you need to do some complex things like
fillets.

Otherwise stock openSCAD is good enough.

On Sun, 12 Jan, 2025, 11:52 pm Mark Erbaugh via Discuss, <
discuss@lists.openscad.org> wrote:

I ran the code in OpenSCAD, but how is that different from a simple
cube(10); which is a lot easier to type and understand?

Is this what OpenSCAD’s cube() does under the hood? Is that how more
complex shapes are generated by BOSL2?

I asked a question on this forum a while back about using multmatrix to
combine a series of rotate(), scale() and  translate() calls into a single
transformation, thinking that it might be quicker if those calls were done
many times in a script and the answer was that OpenSCAD combines those
calls, and computes one matrix and uses the matrix in its calculations. So
I’m thinking that if OpenSCAD has a  module to do it, that module should be
used.

This raises a question: are the routines in OpenSCAD written in a lower
level OpenSCAD or do they go to a lower level language, such as C(++).

Mark

On Jan 12, 2025, at 12:00 PM, Sanjeev Prabhakar sprabhakar2006@gmail.com
wrote:

p0=[[0,0,0],[10,0,0],[10,10,0],[0,10,0]];
p1=[[0,0,10],[10,0,10],[10,10,10],[0,10,10]];

cube_1=[p0,p1];

swp(cube_1);

function faces(sol)=

//    calculate the faces for the vertices with shape l x m with first and
the last end closed
let(
l=len(sol),
m=len(sol[0]),
n1=[for(i=[0:m-1])i],
n2=[for(i=[0:l-2]) each ([ for(j=[0:m-1])
each

j<m-1?[[(j+1)+im,j+im,j+(i+1)m],[(j+1)+im,j+(i+1)m,(j+1)+(i+1)m]]:
[[0+i
m,j+i
m,j+(i+1)m],[0+im,j+(i+1)*m,0+(i+1)*m]]
])],
n3=[for(i=[0:m-1])i+(l-1)*m],
n4=[for(i=[len(n3)-1:-1:0])n3[i]],
n=[n1,each (n2),n4]
)n;

function faces_1(sol)=

//    calculate the faces for the vertices with shape l x m with first and
the last end open
let(
l=len(sol),
m=len(sol[0]),
n2=[for(i=[0:l-2])each([ for(j=[0:m-1])
each

j<m-1?[[(j+1)+im,j+im,j+(i+1)m],[(j+1)+im,j+(i+1)m,(j+1)+(i+1)m]]:
[[0+i
m,j+i
m,j+(i+1)m],[0+im,j+(i+1)*m,0+(i+1)*m]]
])]

 )n2;

function vertices(sol)=
[each for (p=sol)p];

// module for rendering the polyhedron with ends closed
module swp(sol){
let(
v1=vertices(sol),
f1=faces(sol)
)
polyhedron(v1,f1,convexity=10);

}


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

Cube is just to explain the process. Much complex shapes can be developed with a list of points in a similar way. Once you create models with the list of points , there are a lot of operations which can be done on them like calculating the intersection between 2 solids. But this is only required if you need to do some complex things like fillets. Otherwise stock openSCAD is good enough. On Sun, 12 Jan, 2025, 11:52 pm Mark Erbaugh via Discuss, < discuss@lists.openscad.org> wrote: > I ran the code in OpenSCAD, but how is that different from a simple > cube(10); which is a lot easier to type and understand? > > Is this what OpenSCAD’s cube() does under the hood? Is that how more > complex shapes are generated by BOSL2? > > I asked a question on this forum a while back about using multmatrix to > combine a series of rotate(), scale() and translate() calls into a single > transformation, thinking that it might be quicker if those calls were done > many times in a script and the answer was that OpenSCAD combines those > calls, and computes one matrix and uses the matrix in its calculations. So > I’m thinking that if OpenSCAD has a module to do it, that module should be > used. > > This raises a question: are the routines in OpenSCAD written in a lower > level OpenSCAD or do they go to a lower level language, such as C(++). > > Mark > > > On Jan 12, 2025, at 12:00 PM, Sanjeev Prabhakar <sprabhakar2006@gmail.com> > wrote: > > p0=[[0,0,0],[10,0,0],[10,10,0],[0,10,0]]; > p1=[[0,0,10],[10,0,10],[10,10,10],[0,10,10]]; > > cube_1=[p0,p1]; > > swp(cube_1); > > > > > > > function faces(sol)= > > // calculate the faces for the vertices with shape l x m with first and > the last end closed > let( > l=len(sol), > m=len(sol[0]), > n1=[for(i=[0:m-1])i], > n2=[for(i=[0:l-2]) each ([ for(j=[0:m-1]) > each > > j<m-1?[[(j+1)+i*m,j+i*m,j+(i+1)*m],[(j+1)+i*m,j+(i+1)*m,(j+1)+(i+1)*m]]: > [[0+i*m,j+i*m,j+(i+1)*m],[0+i*m,j+(i+1)*m,0+(i+1)*m]] > ])], > n3=[for(i=[0:m-1])i+(l-1)*m], > n4=[for(i=[len(n3)-1:-1:0])n3[i]], > n=[n1,each (n2),n4] > )n; > > > function faces_1(sol)= > > // calculate the faces for the vertices with shape l x m with first and > the last end open > let( > l=len(sol), > m=len(sol[0]), > n2=[for(i=[0:l-2])each([ for(j=[0:m-1]) > each > > j<m-1?[[(j+1)+i*m,j+i*m,j+(i+1)*m],[(j+1)+i*m,j+(i+1)*m,(j+1)+(i+1)*m]]: > [[0+i*m,j+i*m,j+(i+1)*m],[0+i*m,j+(i+1)*m,0+(i+1)*m]] > ])] > > )n2; > > function vertices(sol)= > [each for (p=sol)p]; > > // module for rendering the polyhedron with ends closed > module swp(sol){ > let( > v1=vertices(sol), > f1=faces(sol) > ) > polyhedron(v1,f1,convexity=10); > > } > > > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org >
SP
Sanjeev Prabhakar
Mon, Jan 13, 2025 5:10 PM

This is my python few lines of code for this:


from openscad2 import *
sec=circle(9/2,s=100)
path=corner_radius(pts1([[0,0],[1.5,0],[0,19+1,1],[2,0],[0,2],[-2,0],
[0,-1],[-1.5,0],[0,-19]]),10)

sol1=translate([0,0,-9],prism(sec,path))

path1=corner_radius(pts1([[0,0],[1.5,0],[0,.35],[2,0],[0,2],[-3,0,1],[0,24,1],
[3,0],[0,2],[-2,0],[0,.35],[-1.5,0],[0,-28.7]]),10)
sol2=translate([-14,0,0],rot('y90',prism(sec,path1)))
l1=ip_sol2sol(sol1,slice_sol(sol2[15:17],2))
l2=o_3d(l1,sol1,1)
l3=i_p_p(sol2,l1,-1)
f1=convert_3lines2fillet_closed(l3,l2,l1)
f2=mirror_surface(f1,[1,0,0],[0,0,0])

d1=o_solid([0,0,1],circle(9/2,s=100),20,-8)
d2=o_solid([1,0,0],circle(9/2,s=100),20,-10)
with open('trial.scad','w+') as f:
f.write(f'''
include<dependencies2.scad>
difference(){{
{swp(sol1)}
{swp(d2)}
}}
difference(){{
{swp_c(sol2)}
{swp(d1)}
}}
{swp_c(f1)}
{swp_c(f2)}

''')

[image: Screenshot 2025-01-13 at 10.33.27 PM.png]

scad output file is attached, but this is all just points in space

On Mon, 13 Jan 2025 at 07:09, Sanjeev Prabhakar sprabhakar2006@gmail.com
wrote:

Cube is just to explain the process.
Much complex shapes can be developed with a list of points in a
similar way.

Once you create models with the list of points , there are a lot of
operations which can be done on them like calculating the intersection
between 2 solids.

But this is only required if you need to do some complex things like
fillets.

Otherwise stock openSCAD is good enough.

On Sun, 12 Jan, 2025, 11:52 pm Mark Erbaugh via Discuss, <
discuss@lists.openscad.org> wrote:

I ran the code in OpenSCAD, but how is that different from a simple
cube(10); which is a lot easier to type and understand?

Is this what OpenSCAD’s cube() does under the hood? Is that how more
complex shapes are generated by BOSL2?

I asked a question on this forum a while back about using multmatrix to
combine a series of rotate(), scale() and  translate() calls into a single
transformation, thinking that it might be quicker if those calls were done
many times in a script and the answer was that OpenSCAD combines those
calls, and computes one matrix and uses the matrix in its calculations. So
I’m thinking that if OpenSCAD has a  module to do it, that module should be
used.

This raises a question: are the routines in OpenSCAD written in a lower
level OpenSCAD or do they go to a lower level language, such as C(++).

Mark

On Jan 12, 2025, at 12:00 PM, Sanjeev Prabhakar sprabhakar2006@gmail.com
wrote:

p0=[[0,0,0],[10,0,0],[10,10,0],[0,10,0]];
p1=[[0,0,10],[10,0,10],[10,10,10],[0,10,10]];

cube_1=[p0,p1];

swp(cube_1);

function faces(sol)=

//    calculate the faces for the vertices with shape l x m with first
and the last end closed
let(
l=len(sol),
m=len(sol[0]),
n1=[for(i=[0:m-1])i],
n2=[for(i=[0:l-2]) each ([ for(j=[0:m-1])
each

j<m-1?[[(j+1)+im,j+im,j+(i+1)m],[(j+1)+im,j+(i+1)m,(j+1)+(i+1)m]]:
[[0+i
m,j+i
m,j+(i+1)m],[0+im,j+(i+1)*m,0+(i+1)*m]]
])],
n3=[for(i=[0:m-1])i+(l-1)*m],
n4=[for(i=[len(n3)-1:-1:0])n3[i]],
n=[n1,each (n2),n4]
)n;

function faces_1(sol)=

//    calculate the faces for the vertices with shape l x m with first
and the last end open
let(
l=len(sol),
m=len(sol[0]),
n2=[for(i=[0:l-2])each([ for(j=[0:m-1])
each

j<m-1?[[(j+1)+im,j+im,j+(i+1)m],[(j+1)+im,j+(i+1)m,(j+1)+(i+1)m]]:
[[0+i
m,j+i
m,j+(i+1)m],[0+im,j+(i+1)*m,0+(i+1)*m]]
])]

 )n2;

function vertices(sol)=
[each for (p=sol)p];

// module for rendering the polyhedron with ends closed
module swp(sol){
let(
v1=vertices(sol),
f1=faces(sol)
)
polyhedron(v1,f1,convexity=10);

}


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

This is my python few lines of code for this: ********************************************************************** from openscad2 import * sec=circle(9/2,s=100) path=corner_radius(pts1([[0,0],[1.5,0],[0,19+1,1],[2,0],[0,2],[-2,0], [0,-1],[-1.5,0],[0,-19]]),10) sol1=translate([0,0,-9],prism(sec,path)) path1=corner_radius(pts1([[0,0],[1.5,0],[0,.35],[2,0],[0,2],[-3,0,1],[0,24,1], [3,0],[0,2],[-2,0],[0,.35],[-1.5,0],[0,-28.7]]),10) sol2=translate([-14,0,0],rot('y90',prism(sec,path1))) l1=ip_sol2sol(sol1,slice_sol(sol2[15:17],2)) l2=o_3d(l1,sol1,1) l3=i_p_p(sol2,l1,-1) f1=convert_3lines2fillet_closed(l3,l2,l1) f2=mirror_surface(f1,[1,0,0],[0,0,0]) d1=o_solid([0,0,1],circle(9/2,s=100),20,-8) d2=o_solid([1,0,0],circle(9/2,s=100),20,-10) with open('trial.scad','w+') as f: f.write(f''' include<dependencies2.scad> difference(){{ {swp(sol1)} {swp(d2)} }} difference(){{ {swp_c(sol2)} {swp(d1)} }} {swp_c(f1)} {swp_c(f2)} ''') ***************************************************************************** [image: Screenshot 2025-01-13 at 10.33.27 PM.png] scad output file is attached, but this is all just points in space On Mon, 13 Jan 2025 at 07:09, Sanjeev Prabhakar <sprabhakar2006@gmail.com> wrote: > Cube is just to explain the process. > Much complex shapes can be developed with a list of points in a > similar way. > > Once you create models with the list of points , there are a lot of > operations which can be done on them like calculating the intersection > between 2 solids. > > But this is only required if you need to do some complex things like > fillets. > > Otherwise stock openSCAD is good enough. > > > On Sun, 12 Jan, 2025, 11:52 pm Mark Erbaugh via Discuss, < > discuss@lists.openscad.org> wrote: > >> I ran the code in OpenSCAD, but how is that different from a simple >> cube(10); which is a lot easier to type and understand? >> >> Is this what OpenSCAD’s cube() does under the hood? Is that how more >> complex shapes are generated by BOSL2? >> >> I asked a question on this forum a while back about using multmatrix to >> combine a series of rotate(), scale() and translate() calls into a single >> transformation, thinking that it might be quicker if those calls were done >> many times in a script and the answer was that OpenSCAD combines those >> calls, and computes one matrix and uses the matrix in its calculations. So >> I’m thinking that if OpenSCAD has a module to do it, that module should be >> used. >> >> This raises a question: are the routines in OpenSCAD written in a lower >> level OpenSCAD or do they go to a lower level language, such as C(++). >> >> Mark >> >> >> On Jan 12, 2025, at 12:00 PM, Sanjeev Prabhakar <sprabhakar2006@gmail.com> >> wrote: >> >> p0=[[0,0,0],[10,0,0],[10,10,0],[0,10,0]]; >> p1=[[0,0,10],[10,0,10],[10,10,10],[0,10,10]]; >> >> cube_1=[p0,p1]; >> >> swp(cube_1); >> >> >> >> >> >> >> function faces(sol)= >> >> // calculate the faces for the vertices with shape l x m with first >> and the last end closed >> let( >> l=len(sol), >> m=len(sol[0]), >> n1=[for(i=[0:m-1])i], >> n2=[for(i=[0:l-2]) each ([ for(j=[0:m-1]) >> each >> >> j<m-1?[[(j+1)+i*m,j+i*m,j+(i+1)*m],[(j+1)+i*m,j+(i+1)*m,(j+1)+(i+1)*m]]: >> [[0+i*m,j+i*m,j+(i+1)*m],[0+i*m,j+(i+1)*m,0+(i+1)*m]] >> ])], >> n3=[for(i=[0:m-1])i+(l-1)*m], >> n4=[for(i=[len(n3)-1:-1:0])n3[i]], >> n=[n1,each (n2),n4] >> )n; >> >> >> function faces_1(sol)= >> >> // calculate the faces for the vertices with shape l x m with first >> and the last end open >> let( >> l=len(sol), >> m=len(sol[0]), >> n2=[for(i=[0:l-2])each([ for(j=[0:m-1]) >> each >> >> j<m-1?[[(j+1)+i*m,j+i*m,j+(i+1)*m],[(j+1)+i*m,j+(i+1)*m,(j+1)+(i+1)*m]]: >> [[0+i*m,j+i*m,j+(i+1)*m],[0+i*m,j+(i+1)*m,0+(i+1)*m]] >> ])] >> >> )n2; >> >> function vertices(sol)= >> [each for (p=sol)p]; >> >> // module for rendering the polyhedron with ends closed >> module swp(sol){ >> let( >> v1=vertices(sol), >> f1=faces(sol) >> ) >> polyhedron(v1,f1,convexity=10); >> >> } >> >> >> _______________________________________________ >> OpenSCAD mailing list >> To unsubscribe send an email to discuss-leave@lists.openscad.org >> >
RW
Raymond West
Mon, Jan 13, 2025 7:28 PM

You can get the path of the plain tube joints in raw openscad (thin
walls and intersection). You can then Minkowski that path, using an
extruded square with the corners cut away by circles, which almost gives
the required rounded fillet. However the fillet radius needs to change
as it follows the path, and the shape needs to rotate, and Minkowski is
too slow in this instance. A flat fillet would be simpler, I think,
since could get the path for the edges of the fillet on each tube. IIrc,
freecad can fillet openscad script generated files, but changes
everything to multi-matrix. If it wasn't a requirement for it to be
parametric, then I suppose a quarter of one joint fillet could be
manually or mathematically  generated in fine enough steps, and that
replicated 8 times.

On 13/01/2025 17:10, Sanjeev Prabhakar via Discuss wrote:

This is my python few lines of code for this:


from openscad2 import *
sec=circle(9/2,s=100)
path=corner_radius(pts1([[0,0],[1.5,0],[0,19+1,1],[2,0],[0,2],[-2,0],
                        [0,-1],[-1.5,0],[0,-19]]),10)

sol1=translate([0,0,-9],prism(sec,path))

path1=corner_radius(pts1([[0,0],[1.5,0],[0,.35],[2,0],[0,2],[-3,0,1],[0,24,1],
 [3,0],[0,2],[-2,0],[0,.35],[-1.5,0],[0,-28.7]]),10)
sol2=translate([-14,0,0],rot('y90',prism(sec,path1)))
l1=ip_sol2sol(sol1,slice_sol(sol2[15:17],2))
l2=o_3d(l1,sol1,1)
l3=i_p_p(sol2,l1,-1)
f1=convert_3lines2fillet_closed(l3,l2,l1)
f2=mirror_surface(f1,[1,0,0],[0,0,0])

d1=o_solid([0,0,1],circle(9/2,s=100),20,-8)
d2=o_solid([1,0,0],circle(9/2,s=100),20,-10)
with open('trial.scad','w+') as f:
    f.write(f'''
    include<dependencies2.scad>
    difference(){{
    {swp(sol1)}
    {swp(d2)}
    }}
    difference(){{
    {swp_c(sol2)}
    {swp(d1)}
    }}
    {swp_c(f1)}
    {swp_c(f2)}

    ''')


Screenshot 2025-01-13 at 10.33.27 PM.png

scad output file is attached, but this is all just points in space

On Mon, 13 Jan 2025 at 07:09, Sanjeev Prabhakar
sprabhakar2006@gmail.com wrote:

 Cube is just to explain the process.
 Much complex shapes can be developed with a list of points in a
 similar way.

 Once you create models with the list of points , there are a lot
 of operations which can be done on them like calculating the
 intersection between 2 solids.

 But this is only required if you need to do some complex things
 like fillets.

 Otherwise stock openSCAD is good enough.


 On Sun, 12 Jan, 2025, 11:52 pm Mark Erbaugh via Discuss,
 <discuss@lists.openscad.org> wrote:

     I ran the code in OpenSCAD, but how is that different from a
     simple cube(10); which is a lot easier to type and understand?

     Is this what OpenSCAD’s cube() does under the hood? Is that
     how more complex shapes are generated by BOSL2?

     I asked a question on this forum a while back about using
     multmatrix to combine a series of rotate(), scale() and
      translate() calls into a single transformation, thinking that
     it might be quicker if those calls were done many times in a
     script and the answer was that OpenSCAD combines those calls,
     and computes one matrix and uses the matrix in its
     calculations. So I’m thinking that if OpenSCAD has a  module
     to do it, that module should be used.

     This raises a question: are the routines in OpenSCAD written
     in a lower level OpenSCAD or do they go to a lower level
     language, such as C(++).

     Mark
     On Jan 12, 2025, at 12:00 PM, Sanjeev Prabhakar
     <sprabhakar2006@gmail.com> wrote:

     p0=[[0,0,0],[10,0,0],[10,10,0],[0,10,0]];
     p1=[[0,0,10],[10,0,10],[10,10,10],[0,10,10]];

     cube_1=[p0,p1];

     swp(cube_1);






     function faces(sol)=

     //    calculate the faces for the vertices with shape l x m
     with first and the last end closed
         let(
         l=len(sol),
         m=len(sol[0]),
         n1=[for(i=[0:m-1])i],
         n2=[for(i=[0:l-2]) each ([ for(j=[0:m-1])
         each
     j<m-1?[[(j+1)+i*m,j+i*m,j+(i+1)*m],[(j+1)+i*m,j+(i+1)*m,(j+1)+(i+1)*m]]:
     [[0+i*m,j+i*m,j+(i+1)*m],[0+i*m,j+(i+1)*m,0+(i+1)*m]]
         ])],
         n3=[for(i=[0:m-1])i+(l-1)*m],
         n4=[for(i=[len(n3)-1:-1:0])n3[i]],
         n=[n1,each (n2),n4]
         )n;


     function faces_1(sol)=

     //    calculate the faces for the vertices with shape l x m
     with first and the last end open
         let(
         l=len(sol),
         m=len(sol[0]),
         n2=[for(i=[0:l-2])each([ for(j=[0:m-1])
         each
     j<m-1?[[(j+1)+i*m,j+i*m,j+(i+1)*m],[(j+1)+i*m,j+(i+1)*m,(j+1)+(i+1)*m]]:
     [[0+i*m,j+i*m,j+(i+1)*m],[0+i*m,j+(i+1)*m,0+(i+1)*m]]
         ])]

         )n2;

      function vertices(sol)=
     [each for (p=sol)p];

     // module for rendering the polyhedron with ends closed
     module swp(sol){
     let(
     v1=vertices(sol),
     f1=faces(sol)
     )
     polyhedron(v1,f1,convexity=10);

     }
     _______________________________________________
     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

You can get the path of the plain tube joints in raw openscad (thin walls and intersection). You can then Minkowski that path, using an extruded square with the corners cut away by circles, which almost gives the required rounded fillet. However the fillet radius needs to change as it follows the path, and the shape needs to rotate, and Minkowski is too slow in this instance. A flat fillet would be simpler, I think, since could get the path for the edges of the fillet on each tube. IIrc, freecad can fillet openscad script generated files, but changes everything to multi-matrix. If it wasn't a requirement for it to be parametric, then I suppose a quarter of one joint fillet could be manually or mathematically  generated in fine enough steps, and that replicated 8 times. On 13/01/2025 17:10, Sanjeev Prabhakar via Discuss wrote: > This is my python few lines of code for this: > > ********************************************************************** > from openscad2 import * > sec=circle(9/2,s=100) > path=corner_radius(pts1([[0,0],[1.5,0],[0,19+1,1],[2,0],[0,2],[-2,0], >                         [0,-1],[-1.5,0],[0,-19]]),10) > > sol1=translate([0,0,-9],prism(sec,path)) > > path1=corner_radius(pts1([[0,0],[1.5,0],[0,.35],[2,0],[0,2],[-3,0,1],[0,24,1], >  [3,0],[0,2],[-2,0],[0,.35],[-1.5,0],[0,-28.7]]),10) > sol2=translate([-14,0,0],rot('y90',prism(sec,path1))) > l1=ip_sol2sol(sol1,slice_sol(sol2[15:17],2)) > l2=o_3d(l1,sol1,1) > l3=i_p_p(sol2,l1,-1) > f1=convert_3lines2fillet_closed(l3,l2,l1) > f2=mirror_surface(f1,[1,0,0],[0,0,0]) > > d1=o_solid([0,0,1],circle(9/2,s=100),20,-8) > d2=o_solid([1,0,0],circle(9/2,s=100),20,-10) > with open('trial.scad','w+') as f: >     f.write(f''' >     include<dependencies2.scad> >     difference(){{ >     {swp(sol1)} >     {swp(d2)} >     }} >     difference(){{ >     {swp_c(sol2)} >     {swp(d1)} >     }} >     {swp_c(f1)} >     {swp_c(f2)} > >     ''') > ***************************************************************************** > Screenshot 2025-01-13 at 10.33.27 PM.png > > scad output file is attached, but this is all just points in space > > > On Mon, 13 Jan 2025 at 07:09, Sanjeev Prabhakar > <sprabhakar2006@gmail.com> wrote: > > Cube is just to explain the process. > Much complex shapes can be developed with a list of points in a > similar way. > > Once you create models with the list of points , there are a lot > of operations which can be done on them like calculating the > intersection between 2 solids. > > But this is only required if you need to do some complex things > like fillets. > > Otherwise stock openSCAD is good enough. > > > On Sun, 12 Jan, 2025, 11:52 pm Mark Erbaugh via Discuss, > <discuss@lists.openscad.org> wrote: > > I ran the code in OpenSCAD, but how is that different from a > simple cube(10); which is a lot easier to type and understand? > > Is this what OpenSCAD’s cube() does under the hood? Is that > how more complex shapes are generated by BOSL2? > > I asked a question on this forum a while back about using > multmatrix to combine a series of rotate(), scale() and >  translate() calls into a single transformation, thinking that > it might be quicker if those calls were done many times in a > script and the answer was that OpenSCAD combines those calls, > and computes one matrix and uses the matrix in its > calculations. So I’m thinking that if OpenSCAD has a  module > to do it, that module should be used. > > This raises a question: are the routines in OpenSCAD written > in a lower level OpenSCAD or do they go to a lower level > language, such as C(++). > > Mark > > >> On Jan 12, 2025, at 12:00 PM, Sanjeev Prabhakar >> <sprabhakar2006@gmail.com> wrote: >> >> p0=[[0,0,0],[10,0,0],[10,10,0],[0,10,0]]; >> p1=[[0,0,10],[10,0,10],[10,10,10],[0,10,10]]; >> >> cube_1=[p0,p1]; >> >> swp(cube_1); >> >> >> >> >> >> >> function faces(sol)= >> >> //    calculate the faces for the vertices with shape l x m >> with first and the last end closed >>     let( >>     l=len(sol), >>     m=len(sol[0]), >>     n1=[for(i=[0:m-1])i], >>     n2=[for(i=[0:l-2]) each ([ for(j=[0:m-1]) >>     each >> j<m-1?[[(j+1)+i*m,j+i*m,j+(i+1)*m],[(j+1)+i*m,j+(i+1)*m,(j+1)+(i+1)*m]]: >> [[0+i*m,j+i*m,j+(i+1)*m],[0+i*m,j+(i+1)*m,0+(i+1)*m]] >>     ])], >>     n3=[for(i=[0:m-1])i+(l-1)*m], >>     n4=[for(i=[len(n3)-1:-1:0])n3[i]], >>     n=[n1,each (n2),n4] >>     )n; >> >> >> function faces_1(sol)= >> >> //    calculate the faces for the vertices with shape l x m >> with first and the last end open >>     let( >>     l=len(sol), >>     m=len(sol[0]), >>     n2=[for(i=[0:l-2])each([ for(j=[0:m-1]) >>     each >> j<m-1?[[(j+1)+i*m,j+i*m,j+(i+1)*m],[(j+1)+i*m,j+(i+1)*m,(j+1)+(i+1)*m]]: >> [[0+i*m,j+i*m,j+(i+1)*m],[0+i*m,j+(i+1)*m,0+(i+1)*m]] >>     ])] >> >>     )n2; >> >>  function vertices(sol)= >> [each for (p=sol)p]; >> >> // module for rendering the polyhedron with ends closed >> module swp(sol){ >> let( >> v1=vertices(sol), >> f1=faces(sol) >> ) >> polyhedron(v1,f1,convexity=10); >> >> } >> > > _______________________________________________ > 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
SP
Sanjeev Prabhakar
Tue, Jan 14, 2025 12:56 AM

Hi Ray,

The point I want to make here is that if you learn to draw models with
points in space instead of openSCAD primitives, it gives a lot of added
flexibility to draw many complex models.

I am sure there could be ways to generate the same thing someway in stock
openscad.

Like you mentioned minkowski but it might take a very long time to render.

Finally, I wish python could be added in openscad as an alternate language,
which can make things much easier.

Regards

On Tue, 14 Jan, 2025, 12:59 am Raymond West via Discuss, <
discuss@lists.openscad.org> wrote:

You can get the path of the plain tube joints in raw openscad (thin walls
and intersection). You can then Minkowski that path, using an extruded
square with the corners cut away by circles, which almost gives the
required rounded fillet. However the fillet radius needs to change as it
follows the path, and the shape needs to rotate, and Minkowski is too slow
in this instance. A flat fillet would be simpler, I think, since could get
the path for the edges of the fillet on each tube. IIrc, freecad can fillet
openscad script generated files, but changes everything to multi-matrix. If
it wasn't a requirement for it to be parametric, then I suppose a quarter
of one joint fillet could be manually or mathematically  generated in fine
enough steps, and that replicated 8 times.
On 13/01/2025 17:10, Sanjeev Prabhakar via Discuss wrote:

This is my python few lines of code for this:


from openscad2 import *
sec=circle(9/2,s=100)
path=corner_radius(pts1([[0,0],[1.5,0],[0,19+1,1],[2,0],[0,2],[-2,0],
[0,-1],[-1.5,0],[0,-19]]),10)

sol1=translate([0,0,-9],prism(sec,path))

path1=corner_radius(pts1([[0,0],[1.5,0],[0,.35],[2,0],[0,2],[-3,0,1],[0,24,1],

[3,0],[0,2],[-2,0],[0,.35],[-1.5,0],[0,-28.7]]),10)
sol2=translate([-14,0,0],rot('y90',prism(sec,path1)))
l1=ip_sol2sol(sol1,slice_sol(sol2[15:17],2))
l2=o_3d(l1,sol1,1)
l3=i_p_p(sol2,l1,-1)
f1=convert_3lines2fillet_closed(l3,l2,l1)
f2=mirror_surface(f1,[1,0,0],[0,0,0])

d1=o_solid([0,0,1],circle(9/2,s=100),20,-8)
d2=o_solid([1,0,0],circle(9/2,s=100),20,-10)
with open('trial.scad','w+') as f:
f.write(f'''
include<dependencies2.scad>
difference(){{
{swp(sol1)}
{swp(d2)}
}}
difference(){{
{swp_c(sol2)}
{swp(d1)}
}}
{swp_c(f1)}
{swp_c(f2)}

 ''')

[image: Screenshot 2025-01-13 at 10.33.27 PM.png]

scad output file is attached, but this is all just points in space

On Mon, 13 Jan 2025 at 07:09, Sanjeev Prabhakar sprabhakar2006@gmail.com
wrote:

Cube is just to explain the process.
Much complex shapes can be developed with a list of points in a
similar way.

Once you create models with the list of points , there are a lot of
operations which can be done on them like calculating the intersection
between 2 solids.

But this is only required if you need to do some complex things like
fillets.

Otherwise stock openSCAD is good enough.

On Sun, 12 Jan, 2025, 11:52 pm Mark Erbaugh via Discuss, <
discuss@lists.openscad.org> wrote:

I ran the code in OpenSCAD, but how is that different from a simple
cube(10); which is a lot easier to type and understand?

Is this what OpenSCAD’s cube() does under the hood? Is that how more
complex shapes are generated by BOSL2?

I asked a question on this forum a while back about using multmatrix to
combine a series of rotate(), scale() and  translate() calls into a single
transformation, thinking that it might be quicker if those calls were done
many times in a script and the answer was that OpenSCAD combines those
calls, and computes one matrix and uses the matrix in its calculations. So
I’m thinking that if OpenSCAD has a  module to do it, that module should be
used.

This raises a question: are the routines in OpenSCAD written in a lower
level OpenSCAD or do they go to a lower level language, such as C(++).

Mark

On Jan 12, 2025, at 12:00 PM, Sanjeev Prabhakar <
sprabhakar2006@gmail.com> wrote:

p0=[[0,0,0],[10,0,0],[10,10,0],[0,10,0]];
p1=[[0,0,10],[10,0,10],[10,10,10],[0,10,10]];

cube_1=[p0,p1];

swp(cube_1);

function faces(sol)=

//    calculate the faces for the vertices with shape l x m with first
and the last end closed
let(
l=len(sol),
m=len(sol[0]),
n1=[for(i=[0:m-1])i],
n2=[for(i=[0:l-2]) each ([ for(j=[0:m-1])
each

j<m-1?[[(j+1)+im,j+im,j+(i+1)m],[(j+1)+im,j+(i+1)m,(j+1)+(i+1)m]]:
[[0+i
m,j+i
m,j+(i+1)m],[0+im,j+(i+1)*m,0+(i+1)*m]]
])],
n3=[for(i=[0:m-1])i+(l-1)*m],
n4=[for(i=[len(n3)-1:-1:0])n3[i]],
n=[n1,each (n2),n4]
)n;

function faces_1(sol)=

//    calculate the faces for the vertices with shape l x m with first
and the last end open
let(
l=len(sol),
m=len(sol[0]),
n2=[for(i=[0:l-2])each([ for(j=[0:m-1])
each

j<m-1?[[(j+1)+im,j+im,j+(i+1)m],[(j+1)+im,j+(i+1)m,(j+1)+(i+1)m]]:
[[0+i
m,j+i
m,j+(i+1)m],[0+im,j+(i+1)*m,0+(i+1)*m]]
])]

 )n2;

function vertices(sol)=
[each for (p=sol)p];

// module for rendering the polyhedron with ends closed
module swp(sol){
let(
v1=vertices(sol),
f1=faces(sol)
)
polyhedron(v1,f1,convexity=10);

}


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

Hi Ray, The point I want to make here is that if you learn to draw models with points in space instead of openSCAD primitives, it gives a lot of added flexibility to draw many complex models. I am sure there could be ways to generate the same thing someway in stock openscad. Like you mentioned minkowski but it might take a very long time to render. Finally, I wish python could be added in openscad as an alternate language, which can make things much easier. Regards On Tue, 14 Jan, 2025, 12:59 am Raymond West via Discuss, < discuss@lists.openscad.org> wrote: > You can get the path of the plain tube joints in raw openscad (thin walls > and intersection). You can then Minkowski that path, using an extruded > square with the corners cut away by circles, which almost gives the > required rounded fillet. However the fillet radius needs to change as it > follows the path, and the shape needs to rotate, and Minkowski is too slow > in this instance. A flat fillet would be simpler, I think, since could get > the path for the edges of the fillet on each tube. IIrc, freecad can fillet > openscad script generated files, but changes everything to multi-matrix. If > it wasn't a requirement for it to be parametric, then I suppose a quarter > of one joint fillet could be manually or mathematically generated in fine > enough steps, and that replicated 8 times. > On 13/01/2025 17:10, Sanjeev Prabhakar via Discuss wrote: > > This is my python few lines of code for this: > > ********************************************************************** > from openscad2 import * > sec=circle(9/2,s=100) > path=corner_radius(pts1([[0,0],[1.5,0],[0,19+1,1],[2,0],[0,2],[-2,0], > [0,-1],[-1.5,0],[0,-19]]),10) > > sol1=translate([0,0,-9],prism(sec,path)) > > > path1=corner_radius(pts1([[0,0],[1.5,0],[0,.35],[2,0],[0,2],[-3,0,1],[0,24,1], > > [3,0],[0,2],[-2,0],[0,.35],[-1.5,0],[0,-28.7]]),10) > sol2=translate([-14,0,0],rot('y90',prism(sec,path1))) > l1=ip_sol2sol(sol1,slice_sol(sol2[15:17],2)) > l2=o_3d(l1,sol1,1) > l3=i_p_p(sol2,l1,-1) > f1=convert_3lines2fillet_closed(l3,l2,l1) > f2=mirror_surface(f1,[1,0,0],[0,0,0]) > > d1=o_solid([0,0,1],circle(9/2,s=100),20,-8) > d2=o_solid([1,0,0],circle(9/2,s=100),20,-10) > with open('trial.scad','w+') as f: > f.write(f''' > include<dependencies2.scad> > difference(){{ > {swp(sol1)} > {swp(d2)} > }} > difference(){{ > {swp_c(sol2)} > {swp(d1)} > }} > {swp_c(f1)} > {swp_c(f2)} > > ''') > > ***************************************************************************** > [image: Screenshot 2025-01-13 at 10.33.27 PM.png] > > scad output file is attached, but this is all just points in space > > > On Mon, 13 Jan 2025 at 07:09, Sanjeev Prabhakar <sprabhakar2006@gmail.com> > wrote: > >> Cube is just to explain the process. >> Much complex shapes can be developed with a list of points in a >> similar way. >> >> Once you create models with the list of points , there are a lot of >> operations which can be done on them like calculating the intersection >> between 2 solids. >> >> But this is only required if you need to do some complex things like >> fillets. >> >> Otherwise stock openSCAD is good enough. >> >> >> On Sun, 12 Jan, 2025, 11:52 pm Mark Erbaugh via Discuss, < >> discuss@lists.openscad.org> wrote: >> >>> I ran the code in OpenSCAD, but how is that different from a simple >>> cube(10); which is a lot easier to type and understand? >>> >>> Is this what OpenSCAD’s cube() does under the hood? Is that how more >>> complex shapes are generated by BOSL2? >>> >>> I asked a question on this forum a while back about using multmatrix to >>> combine a series of rotate(), scale() and translate() calls into a single >>> transformation, thinking that it might be quicker if those calls were done >>> many times in a script and the answer was that OpenSCAD combines those >>> calls, and computes one matrix and uses the matrix in its calculations. So >>> I’m thinking that if OpenSCAD has a module to do it, that module should be >>> used. >>> >>> This raises a question: are the routines in OpenSCAD written in a lower >>> level OpenSCAD or do they go to a lower level language, such as C(++). >>> >>> Mark >>> >>> >>> On Jan 12, 2025, at 12:00 PM, Sanjeev Prabhakar < >>> sprabhakar2006@gmail.com> wrote: >>> >>> p0=[[0,0,0],[10,0,0],[10,10,0],[0,10,0]]; >>> p1=[[0,0,10],[10,0,10],[10,10,10],[0,10,10]]; >>> >>> cube_1=[p0,p1]; >>> >>> swp(cube_1); >>> >>> >>> >>> >>> >>> >>> function faces(sol)= >>> >>> // calculate the faces for the vertices with shape l x m with first >>> and the last end closed >>> let( >>> l=len(sol), >>> m=len(sol[0]), >>> n1=[for(i=[0:m-1])i], >>> n2=[for(i=[0:l-2]) each ([ for(j=[0:m-1]) >>> each >>> >>> j<m-1?[[(j+1)+i*m,j+i*m,j+(i+1)*m],[(j+1)+i*m,j+(i+1)*m,(j+1)+(i+1)*m]]: >>> [[0+i*m,j+i*m,j+(i+1)*m],[0+i*m,j+(i+1)*m,0+(i+1)*m]] >>> ])], >>> n3=[for(i=[0:m-1])i+(l-1)*m], >>> n4=[for(i=[len(n3)-1:-1:0])n3[i]], >>> n=[n1,each (n2),n4] >>> )n; >>> >>> >>> function faces_1(sol)= >>> >>> // calculate the faces for the vertices with shape l x m with first >>> and the last end open >>> let( >>> l=len(sol), >>> m=len(sol[0]), >>> n2=[for(i=[0:l-2])each([ for(j=[0:m-1]) >>> each >>> >>> j<m-1?[[(j+1)+i*m,j+i*m,j+(i+1)*m],[(j+1)+i*m,j+(i+1)*m,(j+1)+(i+1)*m]]: >>> [[0+i*m,j+i*m,j+(i+1)*m],[0+i*m,j+(i+1)*m,0+(i+1)*m]] >>> ])] >>> >>> )n2; >>> >>> function vertices(sol)= >>> [each for (p=sol)p]; >>> >>> // module for rendering the polyhedron with ends closed >>> module swp(sol){ >>> let( >>> v1=vertices(sol), >>> f1=faces(sol) >>> ) >>> polyhedron(v1,f1,convexity=10); >>> >>> } >>> >>> >>> _______________________________________________ >>> 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 >
JD
John David
Tue, Jan 14, 2025 2:58 AM

re: python as an alternative language...

You might want to take a look at https://pythonscad.org/ and
https://github.com/SolidCode/SolidPython.  I played with them a year or two
ago when working on some 3D parametric optimization using genetic
algorithms.  I have not finished that work, and it will be quite awhile
before I can get back to it.

On Mon, Jan 13, 2025 at 7:57 PM Sanjeev Prabhakar via Discuss <
discuss@lists.openscad.org> wrote:

Hi Ray,

The point I want to make here is that if you learn to draw models with
points in space instead of openSCAD primitives, it gives a lot of added
flexibility to draw many complex models.

I am sure there could be ways to generate the same thing someway in stock
openscad.

Like you mentioned minkowski but it might take a very long time to render.

Finally, I wish python could be added in openscad as an alternate
language, which can make things much easier.

Regards

On Tue, 14 Jan, 2025, 12:59 am Raymond West via Discuss, <
discuss@lists.openscad.org> wrote:

You can get the path of the plain tube joints in raw openscad (thin walls
and intersection). You can then Minkowski that path, using an extruded
square with the corners cut away by circles, which almost gives the
required rounded fillet. However the fillet radius needs to change as it
follows the path, and the shape needs to rotate, and Minkowski is too slow
in this instance. A flat fillet would be simpler, I think, since could get
the path for the edges of the fillet on each tube. IIrc, freecad can fillet
openscad script generated files, but changes everything to multi-matrix. If
it wasn't a requirement for it to be parametric, then I suppose a quarter
of one joint fillet could be manually or mathematically  generated in fine
enough steps, and that replicated 8 times.
On 13/01/2025 17:10, Sanjeev Prabhakar via Discuss wrote:

This is my python few lines of code for this:


from openscad2 import *
sec=circle(9/2,s=100)
path=corner_radius(pts1([[0,0],[1.5,0],[0,19+1,1],[2,0],[0,2],[-2,0],
[0,-1],[-1.5,0],[0,-19]]),10)

sol1=translate([0,0,-9],prism(sec,path))

path1=corner_radius(pts1([[0,0],[1.5,0],[0,.35],[2,0],[0,2],[-3,0,1],[0,24,1],

[3,0],[0,2],[-2,0],[0,.35],[-1.5,0],[0,-28.7]]),10)
sol2=translate([-14,0,0],rot('y90',prism(sec,path1)))
l1=ip_sol2sol(sol1,slice_sol(sol2[15:17],2))
l2=o_3d(l1,sol1,1)
l3=i_p_p(sol2,l1,-1)
f1=convert_3lines2fillet_closed(l3,l2,l1)
f2=mirror_surface(f1,[1,0,0],[0,0,0])

d1=o_solid([0,0,1],circle(9/2,s=100),20,-8)
d2=o_solid([1,0,0],circle(9/2,s=100),20,-10)
with open('trial.scad','w+') as f:
f.write(f'''
include<dependencies2.scad>
difference(){{
{swp(sol1)}
{swp(d2)}
}}
difference(){{
{swp_c(sol2)}
{swp(d1)}
}}
{swp_c(f1)}
{swp_c(f2)}

 ''')

[image: Screenshot 2025-01-13 at 10.33.27 PM.png]

scad output file is attached, but this is all just points in space

On Mon, 13 Jan 2025 at 07:09, Sanjeev Prabhakar sprabhakar2006@gmail.com
wrote:

Cube is just to explain the process.
Much complex shapes can be developed with a list of points in a
similar way.

Once you create models with the list of points , there are a lot of
operations which can be done on them like calculating the intersection
between 2 solids.

But this is only required if you need to do some complex things like
fillets.

Otherwise stock openSCAD is good enough.

On Sun, 12 Jan, 2025, 11:52 pm Mark Erbaugh via Discuss, <
discuss@lists.openscad.org> wrote:

I ran the code in OpenSCAD, but how is that different from a simple
cube(10); which is a lot easier to type and understand?

Is this what OpenSCAD’s cube() does under the hood? Is that how more
complex shapes are generated by BOSL2?

I asked a question on this forum a while back about using multmatrix to
combine a series of rotate(), scale() and  translate() calls into a single
transformation, thinking that it might be quicker if those calls were done
many times in a script and the answer was that OpenSCAD combines those
calls, and computes one matrix and uses the matrix in its calculations. So
I’m thinking that if OpenSCAD has a  module to do it, that module should be
used.

This raises a question: are the routines in OpenSCAD written in a lower
level OpenSCAD or do they go to a lower level language, such as C(++).

Mark

On Jan 12, 2025, at 12:00 PM, Sanjeev Prabhakar <
sprabhakar2006@gmail.com> wrote:

p0=[[0,0,0],[10,0,0],[10,10,0],[0,10,0]];
p1=[[0,0,10],[10,0,10],[10,10,10],[0,10,10]];

cube_1=[p0,p1];

swp(cube_1);

function faces(sol)=

//    calculate the faces for the vertices with shape l x m with first
and the last end closed
let(
l=len(sol),
m=len(sol[0]),
n1=[for(i=[0:m-1])i],
n2=[for(i=[0:l-2]) each ([ for(j=[0:m-1])
each

j<m-1?[[(j+1)+im,j+im,j+(i+1)m],[(j+1)+im,j+(i+1)m,(j+1)+(i+1)m]]:
[[0+i
m,j+i
m,j+(i+1)m],[0+im,j+(i+1)*m,0+(i+1)*m]]
])],
n3=[for(i=[0:m-1])i+(l-1)*m],
n4=[for(i=[len(n3)-1:-1:0])n3[i]],
n=[n1,each (n2),n4]
)n;

function faces_1(sol)=

//    calculate the faces for the vertices with shape l x m with first
and the last end open
let(
l=len(sol),
m=len(sol[0]),
n2=[for(i=[0:l-2])each([ for(j=[0:m-1])
each

j<m-1?[[(j+1)+im,j+im,j+(i+1)m],[(j+1)+im,j+(i+1)m,(j+1)+(i+1)m]]:
[[0+i
m,j+i
m,j+(i+1)m],[0+im,j+(i+1)*m,0+(i+1)*m]]
])]

 )n2;

function vertices(sol)=
[each for (p=sol)p];

// module for rendering the polyhedron with ends closed
module swp(sol){
let(
v1=vertices(sol),
f1=faces(sol)
)
polyhedron(v1,f1,convexity=10);

}


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

re: python as an alternative language... You might want to take a look at https://pythonscad.org/ and https://github.com/SolidCode/SolidPython. I played with them a year or two ago when working on some 3D parametric optimization using genetic algorithms. I have not finished that work, and it will be quite awhile before I can get back to it. On Mon, Jan 13, 2025 at 7:57 PM Sanjeev Prabhakar via Discuss < discuss@lists.openscad.org> wrote: > Hi Ray, > > The point I want to make here is that if you learn to draw models with > points in space instead of openSCAD primitives, it gives a lot of added > flexibility to draw many complex models. > > I am sure there could be ways to generate the same thing someway in stock > openscad. > > Like you mentioned minkowski but it might take a very long time to render. > > Finally, I wish python could be added in openscad as an alternate > language, which can make things much easier. > > Regards > > > On Tue, 14 Jan, 2025, 12:59 am Raymond West via Discuss, < > discuss@lists.openscad.org> wrote: > >> You can get the path of the plain tube joints in raw openscad (thin walls >> and intersection). You can then Minkowski that path, using an extruded >> square with the corners cut away by circles, which almost gives the >> required rounded fillet. However the fillet radius needs to change as it >> follows the path, and the shape needs to rotate, and Minkowski is too slow >> in this instance. A flat fillet would be simpler, I think, since could get >> the path for the edges of the fillet on each tube. IIrc, freecad can fillet >> openscad script generated files, but changes everything to multi-matrix. If >> it wasn't a requirement for it to be parametric, then I suppose a quarter >> of one joint fillet could be manually or mathematically generated in fine >> enough steps, and that replicated 8 times. >> On 13/01/2025 17:10, Sanjeev Prabhakar via Discuss wrote: >> >> This is my python few lines of code for this: >> >> ********************************************************************** >> from openscad2 import * >> sec=circle(9/2,s=100) >> path=corner_radius(pts1([[0,0],[1.5,0],[0,19+1,1],[2,0],[0,2],[-2,0], >> [0,-1],[-1.5,0],[0,-19]]),10) >> >> sol1=translate([0,0,-9],prism(sec,path)) >> >> >> path1=corner_radius(pts1([[0,0],[1.5,0],[0,.35],[2,0],[0,2],[-3,0,1],[0,24,1], >> >> [3,0],[0,2],[-2,0],[0,.35],[-1.5,0],[0,-28.7]]),10) >> sol2=translate([-14,0,0],rot('y90',prism(sec,path1))) >> l1=ip_sol2sol(sol1,slice_sol(sol2[15:17],2)) >> l2=o_3d(l1,sol1,1) >> l3=i_p_p(sol2,l1,-1) >> f1=convert_3lines2fillet_closed(l3,l2,l1) >> f2=mirror_surface(f1,[1,0,0],[0,0,0]) >> >> d1=o_solid([0,0,1],circle(9/2,s=100),20,-8) >> d2=o_solid([1,0,0],circle(9/2,s=100),20,-10) >> with open('trial.scad','w+') as f: >> f.write(f''' >> include<dependencies2.scad> >> difference(){{ >> {swp(sol1)} >> {swp(d2)} >> }} >> difference(){{ >> {swp_c(sol2)} >> {swp(d1)} >> }} >> {swp_c(f1)} >> {swp_c(f2)} >> >> ''') >> >> ***************************************************************************** >> [image: Screenshot 2025-01-13 at 10.33.27 PM.png] >> >> scad output file is attached, but this is all just points in space >> >> >> On Mon, 13 Jan 2025 at 07:09, Sanjeev Prabhakar <sprabhakar2006@gmail.com> >> wrote: >> >>> Cube is just to explain the process. >>> Much complex shapes can be developed with a list of points in a >>> similar way. >>> >>> Once you create models with the list of points , there are a lot of >>> operations which can be done on them like calculating the intersection >>> between 2 solids. >>> >>> But this is only required if you need to do some complex things like >>> fillets. >>> >>> Otherwise stock openSCAD is good enough. >>> >>> >>> On Sun, 12 Jan, 2025, 11:52 pm Mark Erbaugh via Discuss, < >>> discuss@lists.openscad.org> wrote: >>> >>>> I ran the code in OpenSCAD, but how is that different from a simple >>>> cube(10); which is a lot easier to type and understand? >>>> >>>> Is this what OpenSCAD’s cube() does under the hood? Is that how more >>>> complex shapes are generated by BOSL2? >>>> >>>> I asked a question on this forum a while back about using multmatrix to >>>> combine a series of rotate(), scale() and translate() calls into a single >>>> transformation, thinking that it might be quicker if those calls were done >>>> many times in a script and the answer was that OpenSCAD combines those >>>> calls, and computes one matrix and uses the matrix in its calculations. So >>>> I’m thinking that if OpenSCAD has a module to do it, that module should be >>>> used. >>>> >>>> This raises a question: are the routines in OpenSCAD written in a lower >>>> level OpenSCAD or do they go to a lower level language, such as C(++). >>>> >>>> Mark >>>> >>>> >>>> On Jan 12, 2025, at 12:00 PM, Sanjeev Prabhakar < >>>> sprabhakar2006@gmail.com> wrote: >>>> >>>> p0=[[0,0,0],[10,0,0],[10,10,0],[0,10,0]]; >>>> p1=[[0,0,10],[10,0,10],[10,10,10],[0,10,10]]; >>>> >>>> cube_1=[p0,p1]; >>>> >>>> swp(cube_1); >>>> >>>> >>>> >>>> >>>> >>>> >>>> function faces(sol)= >>>> >>>> // calculate the faces for the vertices with shape l x m with first >>>> and the last end closed >>>> let( >>>> l=len(sol), >>>> m=len(sol[0]), >>>> n1=[for(i=[0:m-1])i], >>>> n2=[for(i=[0:l-2]) each ([ for(j=[0:m-1]) >>>> each >>>> >>>> j<m-1?[[(j+1)+i*m,j+i*m,j+(i+1)*m],[(j+1)+i*m,j+(i+1)*m,(j+1)+(i+1)*m]]: >>>> [[0+i*m,j+i*m,j+(i+1)*m],[0+i*m,j+(i+1)*m,0+(i+1)*m]] >>>> ])], >>>> n3=[for(i=[0:m-1])i+(l-1)*m], >>>> n4=[for(i=[len(n3)-1:-1:0])n3[i]], >>>> n=[n1,each (n2),n4] >>>> )n; >>>> >>>> >>>> function faces_1(sol)= >>>> >>>> // calculate the faces for the vertices with shape l x m with first >>>> and the last end open >>>> let( >>>> l=len(sol), >>>> m=len(sol[0]), >>>> n2=[for(i=[0:l-2])each([ for(j=[0:m-1]) >>>> each >>>> >>>> j<m-1?[[(j+1)+i*m,j+i*m,j+(i+1)*m],[(j+1)+i*m,j+(i+1)*m,(j+1)+(i+1)*m]]: >>>> [[0+i*m,j+i*m,j+(i+1)*m],[0+i*m,j+(i+1)*m,0+(i+1)*m]] >>>> ])] >>>> >>>> )n2; >>>> >>>> function vertices(sol)= >>>> [each for (p=sol)p]; >>>> >>>> // module for rendering the polyhedron with ends closed >>>> module swp(sol){ >>>> let( >>>> v1=vertices(sol), >>>> f1=faces(sol) >>>> ) >>>> polyhedron(v1,f1,convexity=10); >>>> >>>> } >>>> >>>> >>>> _______________________________________________ >>>> 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
Tue, Jan 14, 2025 11:59 AM

I've used cadquery, which is sort of openscad with python. However it
constructs its solids differently, and some aspects do not work well,
giving distorted images. iirc, things like a sphere has a seam in it,
and if you try to take a scallop out of a surface of a cube, say, then
the sphere has to be rotated so the seam is not in the that region.
https://cadquery.readthedocs.io/en/latest/vis.html shows the seam in the
illustrations. I found the only sparse support was on Reddit,  I
couldn't find a forum/email list as helpful or responsive as this.

But I thought that the idea in this 'puzzle' was to use openscad script
only, else you may as well use any other language/cad program. My idea,
although it failed in this case, gives a very good representation of a
beginner's welded joint...

But I  agree that the points in space is important, I have in the past
resorted to exporting an SVG, and in python (or any other language would
suffice) calculated intermediate points and manipulated them, saved, and
reimported to openscad. It would be nice if openscad could
programmatically export and import plain text files, but in order to
keep the functional paradigm, I expect it would have  to be two separate
compiles. Finding work-arounds is interesting.

On 14/01/2025 02:58, John David via Discuss wrote:

re: python as an alternative language...

You might want to take a look at https://pythonscad.org/ and
https://github.com/SolidCode/SolidPython. I played with them a year or
two ago when working on some 3D parametric optimization using genetic
algorithms.  I have not finished that work, and it will be quite
awhile before I can get back to it.

On Mon, Jan 13, 2025 at 7:57 PM Sanjeev Prabhakar via Discuss
discuss@lists.openscad.org wrote:

 Hi Ray,

 The point I want to make here is that if you learn to draw models
 with points in space instead of openSCAD primitives, it gives a
 lot of added flexibility to draw many complex models.

 I am sure there could be ways to generate the same thing someway
 in stock openscad.

 Like you mentioned minkowski but it might take a very long time to
 render.

 Finally, I wish python could be added in openscad as an alternate
 language, which can make things much easier.

 Regards


 On Tue, 14 Jan, 2025, 12:59 am Raymond West via Discuss,
 <discuss@lists.openscad.org> wrote:

     You can get the path of the plain tube joints in raw openscad
     (thin walls and intersection). You can then Minkowski that
     path, using an extruded square with the corners cut away by
     circles, which almost gives the required rounded fillet.
     However the fillet radius needs to change as it follows the
     path, and the shape needs to rotate, and Minkowski is too slow
     in this instance. A flat fillet would be simpler, I think,
     since could get the path for the edges of the fillet on each
     tube. IIrc, freecad can fillet openscad script generated
     files, but changes everything to multi-matrix. If it wasn't a
     requirement for it to be parametric, then I suppose a quarter
     of one joint fillet could be manually or mathematically 
     generated in fine enough steps, and that replicated 8 times.

     On 13/01/2025 17:10, Sanjeev Prabhakar via Discuss wrote:
     This is my python few lines of code for this:

     **********************************************************************
     from openscad2 import *
     sec=circle(9/2,s=100)
     path=corner_radius(pts1([[0,0],[1.5,0],[0,19+1,1],[2,0],[0,2],[-2,0],
     [0,-1],[-1.5,0],[0,-19]]),10)

     sol1=translate([0,0,-9],prism(sec,path))

     path1=corner_radius(pts1([[0,0],[1.5,0],[0,.35],[2,0],[0,2],[-3,0,1],[0,24,1],
      [3,0],[0,2],[-2,0],[0,.35],[-1.5,0],[0,-28.7]]),10)
     sol2=translate([-14,0,0],rot('y90',prism(sec,path1)))
     l1=ip_sol2sol(sol1,slice_sol(sol2[15:17],2))
     l2=o_3d(l1,sol1,1)
     l3=i_p_p(sol2,l1,-1)
     f1=convert_3lines2fillet_closed(l3,l2,l1)
     f2=mirror_surface(f1,[1,0,0],[0,0,0])

     d1=o_solid([0,0,1],circle(9/2,s=100),20,-8)
     d2=o_solid([1,0,0],circle(9/2,s=100),20,-10)
     with open('trial.scad','w+') as f:
         f.write(f'''
         include<dependencies2.scad>
         difference(){{
         {swp(sol1)}
         {swp(d2)}
         }}
         difference(){{
         {swp_c(sol2)}
         {swp(d1)}
         }}
         {swp_c(f1)}
         {swp_c(f2)}

         ''')
     *****************************************************************************
     Screenshot 2025-01-13 at 10.33.27 PM.png

     scad output file is attached, but this is all just points in
     space


     On Mon, 13 Jan 2025 at 07:09, Sanjeev Prabhakar
     <sprabhakar2006@gmail.com> wrote:

         Cube is just to explain the process.
         Much complex shapes can be developed with a list of
         points in a similar way.

         Once you create models with the list of points , there
         are a lot of operations which can be done on them like
         calculating the intersection between 2 solids.

         But this is only required if you need to do some complex
         things like fillets.

         Otherwise stock openSCAD is good enough.


         On Sun, 12 Jan, 2025, 11:52 pm Mark Erbaugh via Discuss,
         <discuss@lists.openscad.org> wrote:

             I ran the code in OpenSCAD, but how is that different
             from a simple cube(10); which is a lot easier to type
             and understand?

             Is this what OpenSCAD’s cube() does under the hood?
             Is that how more complex shapes are generated by BOSL2?

             I asked a question on this forum a while back about
             using multmatrix to combine a series of rotate(),
             scale() and  translate() calls into a single
             transformation, thinking that it might be quicker if
             those calls were done many times in a script and the
             answer was that OpenSCAD combines those calls, and
             computes one matrix and uses the matrix in its
             calculations. So I’m thinking that if OpenSCAD has a
              module to do it, that module should be used.

             This raises a question: are the routines in OpenSCAD
             written in a lower level OpenSCAD or do they go to a
             lower level language, such as C(++).

             Mark
             On Jan 12, 2025, at 12:00 PM, Sanjeev Prabhakar
             <sprabhakar2006@gmail.com> wrote:

             p0=[[0,0,0],[10,0,0],[10,10,0],[0,10,0]];
             p1=[[0,0,10],[10,0,10],[10,10,10],[0,10,10]];

             cube_1=[p0,p1];

             swp(cube_1);






             function faces(sol)=

             //    calculate the faces for the vertices with
             shape l x m with first and the last end closed
                 let(
                 l=len(sol),
                 m=len(sol[0]),
                 n1=[for(i=[0:m-1])i],
                 n2=[for(i=[0:l-2]) each ([ for(j=[0:m-1])
                 each
             j<m-1?[[(j+1)+i*m,j+i*m,j+(i+1)*m],[(j+1)+i*m,j+(i+1)*m,(j+1)+(i+1)*m]]:
             [[0+i*m,j+i*m,j+(i+1)*m],[0+i*m,j+(i+1)*m,0+(i+1)*m]]
                 ])],
                 n3=[for(i=[0:m-1])i+(l-1)*m],
             n4=[for(i=[len(n3)-1:-1:0])n3[i]],
                 n=[n1,each (n2),n4]
                 )n;


             function faces_1(sol)=

             //    calculate the faces for the vertices with
             shape l x m with first and the last end open
                 let(
                 l=len(sol),
                 m=len(sol[0]),
                 n2=[for(i=[0:l-2])each([ for(j=[0:m-1])
                 each
             j<m-1?[[(j+1)+i*m,j+i*m,j+(i+1)*m],[(j+1)+i*m,j+(i+1)*m,(j+1)+(i+1)*m]]:
             [[0+i*m,j+i*m,j+(i+1)*m],[0+i*m,j+(i+1)*m,0+(i+1)*m]]
                 ])]

                 )n2;

              function vertices(sol)=
             [each for (p=sol)p];

             // module for rendering the polyhedron with ends closed
             module swp(sol){
             let(
             v1=vertices(sol),
             f1=faces(sol)
             )
             polyhedron(v1,f1,convexity=10);

             }
             _______________________________________________
             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 to discuss-leave@lists.openscad.org

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

I've used cadquery, which is sort of openscad with python. However it constructs its solids differently, and some aspects do not work well, giving distorted images. iirc, things like a sphere has a seam in it, and if you try to take a scallop out of a surface of a cube, say, then the sphere has to be rotated so the seam is not in the that region. https://cadquery.readthedocs.io/en/latest/vis.html shows the seam in the illustrations. I found the only sparse support was on Reddit,  I couldn't find a forum/email list as helpful or responsive as this. But I thought that the idea in this 'puzzle' was to use openscad script only, else you may as well use any other language/cad program. My idea, although it failed in this case, gives a very good representation of a beginner's welded joint... But I  agree that the points in space is important, I have in the past resorted to exporting an SVG, and in python (or any other language would suffice) calculated intermediate points and manipulated them, saved, and reimported to openscad. It would be nice if openscad could programmatically export and import plain text files, but in order to keep the functional paradigm, I expect it would have  to be two separate compiles. Finding work-arounds is interesting. On 14/01/2025 02:58, John David via Discuss wrote: > re: python as an alternative language... > > You might want to take a look at https://pythonscad.org/ and > https://github.com/SolidCode/SolidPython. I played with them a year or > two ago when working on some 3D parametric optimization using genetic > algorithms.  I have not finished that work, and it will be quite > awhile before I can get back to it. > > On Mon, Jan 13, 2025 at 7:57 PM Sanjeev Prabhakar via Discuss > <discuss@lists.openscad.org> wrote: > > Hi Ray, > > The point I want to make here is that if you learn to draw models > with points in space instead of openSCAD primitives, it gives a > lot of added flexibility to draw many complex models. > > I am sure there could be ways to generate the same thing someway > in stock openscad. > > Like you mentioned minkowski but it might take a very long time to > render. > > Finally, I wish python could be added in openscad as an alternate > language, which can make things much easier. > > Regards > > > On Tue, 14 Jan, 2025, 12:59 am Raymond West via Discuss, > <discuss@lists.openscad.org> wrote: > > You can get the path of the plain tube joints in raw openscad > (thin walls and intersection). You can then Minkowski that > path, using an extruded square with the corners cut away by > circles, which almost gives the required rounded fillet. > However the fillet radius needs to change as it follows the > path, and the shape needs to rotate, and Minkowski is too slow > in this instance. A flat fillet would be simpler, I think, > since could get the path for the edges of the fillet on each > tube. IIrc, freecad can fillet openscad script generated > files, but changes everything to multi-matrix. If it wasn't a > requirement for it to be parametric, then I suppose a quarter > of one joint fillet could be manually or mathematically  > generated in fine enough steps, and that replicated 8 times. > > On 13/01/2025 17:10, Sanjeev Prabhakar via Discuss wrote: >> This is my python few lines of code for this: >> >> ********************************************************************** >> from openscad2 import * >> sec=circle(9/2,s=100) >> path=corner_radius(pts1([[0,0],[1.5,0],[0,19+1,1],[2,0],[0,2],[-2,0], >> [0,-1],[-1.5,0],[0,-19]]),10) >> >> sol1=translate([0,0,-9],prism(sec,path)) >> >> path1=corner_radius(pts1([[0,0],[1.5,0],[0,.35],[2,0],[0,2],[-3,0,1],[0,24,1], >>  [3,0],[0,2],[-2,0],[0,.35],[-1.5,0],[0,-28.7]]),10) >> sol2=translate([-14,0,0],rot('y90',prism(sec,path1))) >> l1=ip_sol2sol(sol1,slice_sol(sol2[15:17],2)) >> l2=o_3d(l1,sol1,1) >> l3=i_p_p(sol2,l1,-1) >> f1=convert_3lines2fillet_closed(l3,l2,l1) >> f2=mirror_surface(f1,[1,0,0],[0,0,0]) >> >> d1=o_solid([0,0,1],circle(9/2,s=100),20,-8) >> d2=o_solid([1,0,0],circle(9/2,s=100),20,-10) >> with open('trial.scad','w+') as f: >>     f.write(f''' >>     include<dependencies2.scad> >>     difference(){{ >>     {swp(sol1)} >>     {swp(d2)} >>     }} >>     difference(){{ >>     {swp_c(sol2)} >>     {swp(d1)} >>     }} >>     {swp_c(f1)} >>     {swp_c(f2)} >> >>     ''') >> ***************************************************************************** >> Screenshot 2025-01-13 at 10.33.27 PM.png >> >> scad output file is attached, but this is all just points in >> space >> >> >> On Mon, 13 Jan 2025 at 07:09, Sanjeev Prabhakar >> <sprabhakar2006@gmail.com> wrote: >> >> Cube is just to explain the process. >> Much complex shapes can be developed with a list of >> points in a similar way. >> >> Once you create models with the list of points , there >> are a lot of operations which can be done on them like >> calculating the intersection between 2 solids. >> >> But this is only required if you need to do some complex >> things like fillets. >> >> Otherwise stock openSCAD is good enough. >> >> >> On Sun, 12 Jan, 2025, 11:52 pm Mark Erbaugh via Discuss, >> <discuss@lists.openscad.org> wrote: >> >> I ran the code in OpenSCAD, but how is that different >> from a simple cube(10); which is a lot easier to type >> and understand? >> >> Is this what OpenSCAD’s cube() does under the hood? >> Is that how more complex shapes are generated by BOSL2? >> >> I asked a question on this forum a while back about >> using multmatrix to combine a series of rotate(), >> scale() and  translate() calls into a single >> transformation, thinking that it might be quicker if >> those calls were done many times in a script and the >> answer was that OpenSCAD combines those calls, and >> computes one matrix and uses the matrix in its >> calculations. So I’m thinking that if OpenSCAD has a >>  module to do it, that module should be used. >> >> This raises a question: are the routines in OpenSCAD >> written in a lower level OpenSCAD or do they go to a >> lower level language, such as C(++). >> >> Mark >> >> >>> On Jan 12, 2025, at 12:00 PM, Sanjeev Prabhakar >>> <sprabhakar2006@gmail.com> wrote: >>> >>> p0=[[0,0,0],[10,0,0],[10,10,0],[0,10,0]]; >>> p1=[[0,0,10],[10,0,10],[10,10,10],[0,10,10]]; >>> >>> cube_1=[p0,p1]; >>> >>> swp(cube_1); >>> >>> >>> >>> >>> >>> >>> function faces(sol)= >>> >>> //    calculate the faces for the vertices with >>> shape l x m with first and the last end closed >>>     let( >>>     l=len(sol), >>>     m=len(sol[0]), >>>     n1=[for(i=[0:m-1])i], >>>     n2=[for(i=[0:l-2]) each ([ for(j=[0:m-1]) >>>     each >>> j<m-1?[[(j+1)+i*m,j+i*m,j+(i+1)*m],[(j+1)+i*m,j+(i+1)*m,(j+1)+(i+1)*m]]: >>> [[0+i*m,j+i*m,j+(i+1)*m],[0+i*m,j+(i+1)*m,0+(i+1)*m]] >>>     ])], >>>     n3=[for(i=[0:m-1])i+(l-1)*m], >>> n4=[for(i=[len(n3)-1:-1:0])n3[i]], >>>     n=[n1,each (n2),n4] >>>     )n; >>> >>> >>> function faces_1(sol)= >>> >>> //    calculate the faces for the vertices with >>> shape l x m with first and the last end open >>>     let( >>>     l=len(sol), >>>     m=len(sol[0]), >>>     n2=[for(i=[0:l-2])each([ for(j=[0:m-1]) >>>     each >>> j<m-1?[[(j+1)+i*m,j+i*m,j+(i+1)*m],[(j+1)+i*m,j+(i+1)*m,(j+1)+(i+1)*m]]: >>> [[0+i*m,j+i*m,j+(i+1)*m],[0+i*m,j+(i+1)*m,0+(i+1)*m]] >>>     ])] >>> >>>     )n2; >>> >>>  function vertices(sol)= >>> [each for (p=sol)p]; >>> >>> // module for rendering the polyhedron with ends closed >>> module swp(sol){ >>> let( >>> v1=vertices(sol), >>> f1=faces(sol) >>> ) >>> polyhedron(v1,f1,convexity=10); >>> >>> } >>> >> >> _______________________________________________ >> 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 to discuss-leave@lists.openscad.org > > > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email todiscuss-leave@lists.openscad.org
RW
Raymond West
Tue, Jan 14, 2025 12:34 PM

This gives a flat fillet (which I've called a bevel - depends if you
think it is internal or external, draughtsman or carpenter)

module tube(d){
       linear_extrude(100)
      difference(){
       circle(d=d);
       circle (d=d-0.0001);
     };
 }

 hull(){
  intersection(){
         tube(30);  //upright tube
       translate([-0,0,50])
       rotate([0,90,0])
         tube(20+bevel);
         }
          intersection(){
         tube(30+bevel);  // side tube
       translate([-0,0,50])
       rotate([0,90,0])
         tube(20);
         }
 }

 $fn=100;
         cylinder(d=30,h=100);
       translate([-0,0,50])
       rotate([0,90,0])
       cylinder(d=20,h=50);

        bevel=6;  //  greater than 2.

On 14/01/2025 11:59, Raymond West via Discuss wrote:

I've used cadquery, which is sort of openscad with python. However it
constructs its solids differently, and some aspects do not work well,
giving distorted images. iirc, things like a sphere has a seam in it,
and if you try to take a scallop out of a surface of a cube, say, then
the sphere has to be rotated so the seam is not in the that region.
https://cadquery.readthedocs.io/en/latest/vis.html shows the seam in
the illustrations. I found the only sparse support was on Reddit,  I
couldn't find a forum/email list as helpful or responsive as this.

But I thought that the idea in this 'puzzle' was to use openscad
script only, else you may as well use any other language/cad program.
My idea, although it failed in this case, gives a very good
representation of a beginner's welded joint...

But I  agree that the points in space is important, I have in the past
resorted to exporting an SVG, and in python (or any other language
would suffice) calculated intermediate points and manipulated them,
saved, and reimported to openscad. It would be nice if openscad could
programmatically export and import plain text files, but in order to
keep the functional paradigm, I expect it would have  to be two
separate compiles. Finding work-arounds is interesting.

On 14/01/2025 02:58, John David via Discuss wrote:

re: python as an alternative language...

You might want to take a look at https://pythonscad.org/ and
https://github.com/SolidCode/SolidPython. I played with them a year
or two ago when working on some 3D parametric optimization using
genetic algorithms.  I have not finished that work, and it will be
quite awhile before I can get back to it.

On Mon, Jan 13, 2025 at 7:57 PM Sanjeev Prabhakar via Discuss
discuss@lists.openscad.org wrote:

 Hi Ray,

 The point I want to make here is that if you learn to draw models
 with points in space instead of openSCAD primitives, it gives a
 lot of added flexibility to draw many complex models.

 I am sure there could be ways to generate the same thing someway
 in stock openscad.

 Like you mentioned minkowski but it might take a very long time
 to render.

 Finally, I wish python could be added in openscad as an alternate
 language, which can make things much easier.

 Regards


 On Tue, 14 Jan, 2025, 12:59 am Raymond West via Discuss,
 <discuss@lists.openscad.org> wrote:

     You can get the path of the plain tube joints in raw openscad
     (thin walls and intersection). You can then Minkowski that
     path, using an extruded square with the corners cut away by
     circles, which almost gives the required rounded fillet.
     However the fillet radius needs to change as it follows the
     path, and the shape needs to rotate, and Minkowski is too
     slow in this instance. A flat fillet would be simpler, I
     think, since could get the path for the edges of the fillet
     on each tube. IIrc, freecad can fillet openscad script
     generated files, but changes everything to multi-matrix. If
     it wasn't a requirement for it to be parametric, then I
     suppose a quarter of one joint fillet could be manually or
     mathematically  generated in fine enough steps, and that
     replicated 8 times.

     On 13/01/2025 17:10, Sanjeev Prabhakar via Discuss wrote:
     This is my python few lines of code for this:

     **********************************************************************
     from openscad2 import *
     sec=circle(9/2,s=100)
     path=corner_radius(pts1([[0,0],[1.5,0],[0,19+1,1],[2,0],[0,2],[-2,0],
     [0,-1],[-1.5,0],[0,-19]]),10)

     sol1=translate([0,0,-9],prism(sec,path))

     path1=corner_radius(pts1([[0,0],[1.5,0],[0,.35],[2,0],[0,2],[-3,0,1],[0,24,1],
      [3,0],[0,2],[-2,0],[0,.35],[-1.5,0],[0,-28.7]]),10)
     sol2=translate([-14,0,0],rot('y90',prism(sec,path1)))
     l1=ip_sol2sol(sol1,slice_sol(sol2[15:17],2))
     l2=o_3d(l1,sol1,1)
     l3=i_p_p(sol2,l1,-1)
     f1=convert_3lines2fillet_closed(l3,l2,l1)
     f2=mirror_surface(f1,[1,0,0],[0,0,0])

     d1=o_solid([0,0,1],circle(9/2,s=100),20,-8)
     d2=o_solid([1,0,0],circle(9/2,s=100),20,-10)
     with open('trial.scad','w+') as f:
         f.write(f'''
         include<dependencies2.scad>
         difference(){{
         {swp(sol1)}
         {swp(d2)}
         }}
         difference(){{
         {swp_c(sol2)}
         {swp(d1)}
         }}
         {swp_c(f1)}
         {swp_c(f2)}

         ''')
     *****************************************************************************
     Screenshot 2025-01-13 at 10.33.27 PM.png

     scad output file is attached, but this is all just points in
     space


     On Mon, 13 Jan 2025 at 07:09, Sanjeev Prabhakar
     <sprabhakar2006@gmail.com> wrote:

         Cube is just to explain the process.
         Much complex shapes can be developed with a list of
         points in a similar way.

         Once you create models with the list of points , there
         are a lot of operations which can be done on them like
         calculating the intersection between 2 solids.

         But this is only required if you need to do some complex
         things like fillets.

         Otherwise stock openSCAD is good enough.


         On Sun, 12 Jan, 2025, 11:52 pm Mark Erbaugh via Discuss,
         <discuss@lists.openscad.org> wrote:

             I ran the code in OpenSCAD, but how is that
             different from a simple cube(10); which is a lot
             easier to type and understand?

             Is this what OpenSCAD’s cube() does under the hood?
             Is that how more complex shapes are generated by BOSL2?

             I asked a question on this forum a while back about
             using multmatrix to combine a series of rotate(),
             scale() and  translate() calls into a single
             transformation, thinking that it might be quicker if
             those calls were done many times in a script and the
             answer was that OpenSCAD combines those calls, and
             computes one matrix and uses the matrix in its
             calculations. So I’m thinking that if OpenSCAD has a
              module to do it, that module should be used.

             This raises a question: are the routines in OpenSCAD
             written in a lower level OpenSCAD or do they go to a
             lower level language, such as C(++).

             Mark
             On Jan 12, 2025, at 12:00 PM, Sanjeev Prabhakar
             <sprabhakar2006@gmail.com> wrote:

             p0=[[0,0,0],[10,0,0],[10,10,0],[0,10,0]];
             p1=[[0,0,10],[10,0,10],[10,10,10],[0,10,10]];

             cube_1=[p0,p1];

             swp(cube_1);






             function faces(sol)=

             //    calculate the faces for the vertices with
             shape l x m with first and the last end closed
                 let(
                 l=len(sol),
                 m=len(sol[0]),
                 n1=[for(i=[0:m-1])i],
                 n2=[for(i=[0:l-2]) each ([ for(j=[0:m-1])
                 each
             j<m-1?[[(j+1)+i*m,j+i*m,j+(i+1)*m],[(j+1)+i*m,j+(i+1)*m,(j+1)+(i+1)*m]]:
             [[0+i*m,j+i*m,j+(i+1)*m],[0+i*m,j+(i+1)*m,0+(i+1)*m]]
                 ])],
             n3=[for(i=[0:m-1])i+(l-1)*m],
             n4=[for(i=[len(n3)-1:-1:0])n3[i]],
                 n=[n1,each (n2),n4]
                 )n;


             function faces_1(sol)=

             //    calculate the faces for the vertices with
             shape l x m with first and the last end open
                 let(
                 l=len(sol),
                 m=len(sol[0]),
                 n2=[for(i=[0:l-2])each([ for(j=[0:m-1])
                 each
             j<m-1?[[(j+1)+i*m,j+i*m,j+(i+1)*m],[(j+1)+i*m,j+(i+1)*m,(j+1)+(i+1)*m]]:
             [[0+i*m,j+i*m,j+(i+1)*m],[0+i*m,j+(i+1)*m,0+(i+1)*m]]
                 ])]

                 )n2;

              function vertices(sol)=
             [each for (p=sol)p];

             // module for rendering the polyhedron with ends closed
             module swp(sol){
             let(
             v1=vertices(sol),
             f1=faces(sol)
             )
             polyhedron(v1,f1,convexity=10);

             }
             _______________________________________________
             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 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

This gives a flat fillet (which I've called a bevel - depends if you think it is internal or external, draughtsman or carpenter) module tube(d){        linear_extrude(100)       difference(){        circle(d=d);        circle (d=d-0.0001);      };  }  hull(){   intersection(){          tube(30);  //upright tube        translate([-0,0,50])        rotate([0,90,0])          tube(20+bevel);          }           intersection(){          tube(30+bevel);  // side tube        translate([-0,0,50])        rotate([0,90,0])          tube(20);          }  }  $fn=100;          cylinder(d=30,h=100);        translate([-0,0,50])        rotate([0,90,0])        cylinder(d=20,h=50);         bevel=6;  //  greater than 2. On 14/01/2025 11:59, Raymond West via Discuss wrote: > > I've used cadquery, which is sort of openscad with python. However it > constructs its solids differently, and some aspects do not work well, > giving distorted images. iirc, things like a sphere has a seam in it, > and if you try to take a scallop out of a surface of a cube, say, then > the sphere has to be rotated so the seam is not in the that region. > https://cadquery.readthedocs.io/en/latest/vis.html shows the seam in > the illustrations. I found the only sparse support was on Reddit,  I > couldn't find a forum/email list as helpful or responsive as this. > > But I thought that the idea in this 'puzzle' was to use openscad > script only, else you may as well use any other language/cad program. > My idea, although it failed in this case, gives a very good > representation of a beginner's welded joint... > > But I  agree that the points in space is important, I have in the past > resorted to exporting an SVG, and in python (or any other language > would suffice) calculated intermediate points and manipulated them, > saved, and reimported to openscad. It would be nice if openscad could > programmatically export and import plain text files, but in order to > keep the functional paradigm, I expect it would have  to be two > separate compiles. Finding work-arounds is interesting. > > On 14/01/2025 02:58, John David via Discuss wrote: >> re: python as an alternative language... >> >> You might want to take a look at https://pythonscad.org/ and >> https://github.com/SolidCode/SolidPython. I played with them a year >> or two ago when working on some 3D parametric optimization using >> genetic algorithms.  I have not finished that work, and it will be >> quite awhile before I can get back to it. >> >> On Mon, Jan 13, 2025 at 7:57 PM Sanjeev Prabhakar via Discuss >> <discuss@lists.openscad.org> wrote: >> >> Hi Ray, >> >> The point I want to make here is that if you learn to draw models >> with points in space instead of openSCAD primitives, it gives a >> lot of added flexibility to draw many complex models. >> >> I am sure there could be ways to generate the same thing someway >> in stock openscad. >> >> Like you mentioned minkowski but it might take a very long time >> to render. >> >> Finally, I wish python could be added in openscad as an alternate >> language, which can make things much easier. >> >> Regards >> >> >> On Tue, 14 Jan, 2025, 12:59 am Raymond West via Discuss, >> <discuss@lists.openscad.org> wrote: >> >> You can get the path of the plain tube joints in raw openscad >> (thin walls and intersection). You can then Minkowski that >> path, using an extruded square with the corners cut away by >> circles, which almost gives the required rounded fillet. >> However the fillet radius needs to change as it follows the >> path, and the shape needs to rotate, and Minkowski is too >> slow in this instance. A flat fillet would be simpler, I >> think, since could get the path for the edges of the fillet >> on each tube. IIrc, freecad can fillet openscad script >> generated files, but changes everything to multi-matrix. If >> it wasn't a requirement for it to be parametric, then I >> suppose a quarter of one joint fillet could be manually or >> mathematically  generated in fine enough steps, and that >> replicated 8 times. >> >> On 13/01/2025 17:10, Sanjeev Prabhakar via Discuss wrote: >>> This is my python few lines of code for this: >>> >>> ********************************************************************** >>> from openscad2 import * >>> sec=circle(9/2,s=100) >>> path=corner_radius(pts1([[0,0],[1.5,0],[0,19+1,1],[2,0],[0,2],[-2,0], >>> [0,-1],[-1.5,0],[0,-19]]),10) >>> >>> sol1=translate([0,0,-9],prism(sec,path)) >>> >>> path1=corner_radius(pts1([[0,0],[1.5,0],[0,.35],[2,0],[0,2],[-3,0,1],[0,24,1], >>>  [3,0],[0,2],[-2,0],[0,.35],[-1.5,0],[0,-28.7]]),10) >>> sol2=translate([-14,0,0],rot('y90',prism(sec,path1))) >>> l1=ip_sol2sol(sol1,slice_sol(sol2[15:17],2)) >>> l2=o_3d(l1,sol1,1) >>> l3=i_p_p(sol2,l1,-1) >>> f1=convert_3lines2fillet_closed(l3,l2,l1) >>> f2=mirror_surface(f1,[1,0,0],[0,0,0]) >>> >>> d1=o_solid([0,0,1],circle(9/2,s=100),20,-8) >>> d2=o_solid([1,0,0],circle(9/2,s=100),20,-10) >>> with open('trial.scad','w+') as f: >>>     f.write(f''' >>>     include<dependencies2.scad> >>>     difference(){{ >>>     {swp(sol1)} >>>     {swp(d2)} >>>     }} >>>     difference(){{ >>>     {swp_c(sol2)} >>>     {swp(d1)} >>>     }} >>>     {swp_c(f1)} >>>     {swp_c(f2)} >>> >>>     ''') >>> ***************************************************************************** >>> Screenshot 2025-01-13 at 10.33.27 PM.png >>> >>> scad output file is attached, but this is all just points in >>> space >>> >>> >>> On Mon, 13 Jan 2025 at 07:09, Sanjeev Prabhakar >>> <sprabhakar2006@gmail.com> wrote: >>> >>> Cube is just to explain the process. >>> Much complex shapes can be developed with a list of >>> points in a similar way. >>> >>> Once you create models with the list of points , there >>> are a lot of operations which can be done on them like >>> calculating the intersection between 2 solids. >>> >>> But this is only required if you need to do some complex >>> things like fillets. >>> >>> Otherwise stock openSCAD is good enough. >>> >>> >>> On Sun, 12 Jan, 2025, 11:52 pm Mark Erbaugh via Discuss, >>> <discuss@lists.openscad.org> wrote: >>> >>> I ran the code in OpenSCAD, but how is that >>> different from a simple cube(10); which is a lot >>> easier to type and understand? >>> >>> Is this what OpenSCAD’s cube() does under the hood? >>> Is that how more complex shapes are generated by BOSL2? >>> >>> I asked a question on this forum a while back about >>> using multmatrix to combine a series of rotate(), >>> scale() and  translate() calls into a single >>> transformation, thinking that it might be quicker if >>> those calls were done many times in a script and the >>> answer was that OpenSCAD combines those calls, and >>> computes one matrix and uses the matrix in its >>> calculations. So I’m thinking that if OpenSCAD has a >>>  module to do it, that module should be used. >>> >>> This raises a question: are the routines in OpenSCAD >>> written in a lower level OpenSCAD or do they go to a >>> lower level language, such as C(++). >>> >>> Mark >>> >>> >>>> On Jan 12, 2025, at 12:00 PM, Sanjeev Prabhakar >>>> <sprabhakar2006@gmail.com> wrote: >>>> >>>> p0=[[0,0,0],[10,0,0],[10,10,0],[0,10,0]]; >>>> p1=[[0,0,10],[10,0,10],[10,10,10],[0,10,10]]; >>>> >>>> cube_1=[p0,p1]; >>>> >>>> swp(cube_1); >>>> >>>> >>>> >>>> >>>> >>>> >>>> function faces(sol)= >>>> >>>> //    calculate the faces for the vertices with >>>> shape l x m with first and the last end closed >>>>     let( >>>>     l=len(sol), >>>>     m=len(sol[0]), >>>>     n1=[for(i=[0:m-1])i], >>>>     n2=[for(i=[0:l-2]) each ([ for(j=[0:m-1]) >>>>     each >>>> j<m-1?[[(j+1)+i*m,j+i*m,j+(i+1)*m],[(j+1)+i*m,j+(i+1)*m,(j+1)+(i+1)*m]]: >>>> [[0+i*m,j+i*m,j+(i+1)*m],[0+i*m,j+(i+1)*m,0+(i+1)*m]] >>>>     ])], >>>> n3=[for(i=[0:m-1])i+(l-1)*m], >>>> n4=[for(i=[len(n3)-1:-1:0])n3[i]], >>>>     n=[n1,each (n2),n4] >>>>     )n; >>>> >>>> >>>> function faces_1(sol)= >>>> >>>> //    calculate the faces for the vertices with >>>> shape l x m with first and the last end open >>>>     let( >>>>     l=len(sol), >>>>     m=len(sol[0]), >>>>     n2=[for(i=[0:l-2])each([ for(j=[0:m-1]) >>>>     each >>>> j<m-1?[[(j+1)+i*m,j+i*m,j+(i+1)*m],[(j+1)+i*m,j+(i+1)*m,(j+1)+(i+1)*m]]: >>>> [[0+i*m,j+i*m,j+(i+1)*m],[0+i*m,j+(i+1)*m,0+(i+1)*m]] >>>>     ])] >>>> >>>>     )n2; >>>> >>>>  function vertices(sol)= >>>> [each for (p=sol)p]; >>>> >>>> // module for rendering the polyhedron with ends closed >>>> module swp(sol){ >>>> let( >>>> v1=vertices(sol), >>>> f1=faces(sol) >>>> ) >>>> polyhedron(v1,f1,convexity=10); >>>> >>>> } >>>> >>> >>> _______________________________________________ >>> 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 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
ME
Mark Erbaugh
Tue, Jan 14, 2025 1:55 PM

I’m the OP. I was hoping for a pure OpenSCAD solution, but it’s obviously the fillet is not as simple. I just watched a YT video from FOSDEM 2020 with Marius Kintel (one of the developers of OpenSCAD).

https://www.youtube.com/watch?v=4EZL4O6b0BE&t=6s
Designing functional objects with functional objects OpenSCAD: Past, present and/or future
youtube.com

He mentioned using OpenSCAD for the basic model and using other programs to add details such as fillets.

Mark

On Jan 14, 2025, at 7:34 AM, Raymond West via Discuss discuss@lists.openscad.org wrote:

This gives a flat fillet (which I've called a bevel - depends if you think it is internal or external, draughtsman or carpenter)

module tube(d){
linear_extrude(100)
difference(){
circle(d=d);
circle (d=d-0.0001);
};
}

hull(){
intersection(){
tube(30);  //upright tube
translate([-0,0,50])
rotate([0,90,0])
tube(20+bevel);
}
intersection(){
tube(30+bevel);  // side tube
translate([-0,0,50])
rotate([0,90,0])
tube(20);
}
}

$fn=100;
cylinder(d=30,h=100);
translate([-0,0,50])
rotate([0,90,0])
cylinder(d=20,h=50);

     bevel=6;  //  greater than 2.

On 14/01/2025 11:59, Raymond West via Discuss wrote:

I've used cadquery, which is sort of openscad with python. However it constructs its solids differently, and some aspects do not work well, giving distorted images. iirc, things like a sphere has a seam in it, and if you try to take a scallop out of a surface of a cube, say, then the sphere has to be rotated so the seam is not in the that region. https://cadquery.readthedocs.io/en/latest/vis.html shows the seam in the illustrations. I found the only sparse support was on Reddit,  I couldn't find a forum/email list as helpful or responsive as this.

But I thought that the idea in this 'puzzle' was to use openscad script only, else you may as well use any other language/cad program. My idea, although it failed in this case, gives a very good representation of a beginner's welded joint...

But I  agree that the points in space is important, I have in the past resorted to exporting an SVG, and in python (or any other language would suffice) calculated intermediate points and manipulated them, saved, and reimported to openscad. It would be nice if openscad could programmatically export and import plain text files, but in order to keep the functional paradigm, I expect it would have  to be two separate compiles. Finding work-arounds is interesting.

On 14/01/2025 02:58, John David via Discuss wrote:

re: python as an alternative language...

You might want to take a look at https://pythonscad.org/ and https://github.com/SolidCode/SolidPython.  I played with them a year or two ago when working on some 3D parametric optimization using genetic algorithms.  I have not finished that work, and it will be quite awhile before I can get back to it.

On Mon, Jan 13, 2025 at 7:57 PM Sanjeev Prabhakar via Discuss <discuss@lists.openscad.org mailto:discuss@lists.openscad.org> wrote:

Hi Ray,

The point I want to make here is that if you learn to draw models with points in space instead of openSCAD primitives, it gives a lot of added flexibility to draw many complex models.

I am sure there could be ways to generate the same thing someway in stock openscad.

Like you mentioned minkowski but it might take a very long time to render.

Finally, I wish python could be added in openscad as an alternate language, which can make things much easier.

Regards

On Tue, 14 Jan, 2025, 12:59 am Raymond West via Discuss, <discuss@lists.openscad.org mailto:discuss@lists.openscad.org> wrote:

You can get the path of the plain tube joints in raw openscad (thin walls and intersection). You can then Minkowski that path, using an extruded square with the corners cut away by circles, which almost gives the required rounded fillet. However the fillet radius needs to change as it follows the path, and the shape needs to rotate, and Minkowski is too slow in this instance. A flat fillet would be simpler, I think, since could get the path for the edges of the fillet on each tube. IIrc, freecad can fillet openscad script generated files, but changes everything to multi-matrix. If it wasn't a requirement for it to be parametric, then I suppose a quarter of one joint fillet could be manually or mathematically  generated in fine enough steps, and that replicated 8 times.

On 13/01/2025 17:10, Sanjeev Prabhakar via Discuss wrote:

This is my python few lines of code for this:


from openscad2 import *
sec=circle(9/2,s=100)
path=corner_radius(pts1([[0,0],[1.5,0],[0,19+1,1],[2,0],[0,2],[-2,0],
[0,-1],[-1.5,0],[0,-19]]),10)

sol1=translate([0,0,-9],prism(sec,path))

path1=corner_radius(pts1([[0,0],[1.5,0],[0,.35],[2,0],[0,2],[-3,0,1],[0,24,1],
[3,0],[0,2],[-2,0],[0,.35],[-1.5,0],[0,-28.7]]),10)
sol2=translate([-14,0,0],rot('y90',prism(sec,path1)))
l1=ip_sol2sol(sol1,slice_sol(sol2[15:17],2))
l2=o_3d(l1,sol1,1)
l3=i_p_p(sol2,l1,-1)
f1=convert_3lines2fillet_closed(l3,l2,l1)
f2=mirror_surface(f1,[1,0,0],[0,0,0])

d1=o_solid([0,0,1],circle(9/2,s=100),20,-8)
d2=o_solid([1,0,0],circle(9/2,s=100),20,-10)
with open('trial.scad','w+') as f:
f.write(f'''
include<dependencies2.scad>
difference(){{
{swp(sol1)}
{swp(d2)}
}}
difference(){{
{swp_c(sol2)}
{swp(d1)}
}}
{swp_c(f1)}
{swp_c(f2)}

 ''')

scad output file is attached, but this is all just points in space

On Mon, 13 Jan 2025 at 07:09, Sanjeev Prabhakar <sprabhakar2006@gmail.com mailto:sprabhakar2006@gmail.com> wrote:

Cube is just to explain the process.
Much complex shapes can be developed with a list of points in a similar way.

Once you create models with the list of points , there are a lot of operations which can be done on them like calculating the intersection between 2 solids.

But this is only required if you need to do some complex things like fillets.

Otherwise stock openSCAD is good enough.

On Sun, 12 Jan, 2025, 11:52 pm Mark Erbaugh via Discuss, <discuss@lists.openscad.org mailto:discuss@lists.openscad.org> wrote:

I ran the code in OpenSCAD, but how is that different from a simple cube(10); which is a lot easier to type and understand?

Is this what OpenSCAD’s cube() does under the hood? Is that how more complex shapes are generated by BOSL2?

I asked a question on this forum a while back about using multmatrix to combine a series of rotate(), scale() and  translate() calls into a single transformation, thinking that it might be quicker if those calls were done many times in a script and the answer was that OpenSCAD combines those calls, and computes one matrix and uses the matrix in its calculations. So I’m thinking that if OpenSCAD has a  module to do it, that module should be used.

This raises a question: are the routines in OpenSCAD written in a lower level OpenSCAD or do they go to a lower level language, such as C(++).

Mark

On Jan 12, 2025, at 12:00 PM, Sanjeev Prabhakar <sprabhakar2006@gmail.com mailto:sprabhakar2006@gmail.com> wrote:

p0=[[0,0,0],[10,0,0],[10,10,0],[0,10,0]];
p1=[[0,0,10],[10,0,10],[10,10,10],[0,10,10]];

cube_1=[p0,p1];

swp(cube_1);

function faces(sol)=

//    calculate the faces for the vertices with shape l x m with first and the last end closed
let(
l=len(sol),
m=len(sol[0]),
n1=[for(i=[0:m-1])i],
n2=[for(i=[0:l-2]) each ([ for(j=[0:m-1])
each
j<m-1?[[(j+1)+im,j+im,j+(i+1)m],[(j+1)+im,j+(i+1)m,(j+1)+(i+1)m]]:
[[0+i
m,j+i
m,j+(i+1)m],[0+im,j+(i+1)*m,0+(i+1)*m]]
])],
n3=[for(i=[0:m-1])i+(l-1)*m],
n4=[for(i=[len(n3)-1:-1:0])n3[i]],
n=[n1,each (n2),n4]
)n;

function faces_1(sol)=

//    calculate the faces for the vertices with shape l x m with first and the last end open
let(
l=len(sol),
m=len(sol[0]),
n2=[for(i=[0:l-2])each([ for(j=[0:m-1])
each
j<m-1?[[(j+1)+im,j+im,j+(i+1)m],[(j+1)+im,j+(i+1)m,(j+1)+(i+1)m]]:
[[0+i
m,j+i
m,j+(i+1)m],[0+im,j+(i+1)*m,0+(i+1)*m]]
])]

 )n2; 

function vertices(sol)=
[each for (p=sol)p];

// module for rendering the polyhedron with ends closed
module swp(sol){
let(
v1=vertices(sol),
f1=faces(sol)
)
polyhedron(v1,f1,convexity=10);

}


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


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


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


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


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


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


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

I’m the OP. I was hoping for a pure OpenSCAD solution, but it’s obviously the fillet is not as simple. I just watched a YT video from FOSDEM 2020 with Marius Kintel (one of the developers of OpenSCAD). https://www.youtube.com/watch?v=4EZL4O6b0BE&t=6s Designing functional objects with functional objects OpenSCAD: Past, present and/or future youtube.com He mentioned using OpenSCAD for the basic model and using other programs to add details such as fillets. Mark > On Jan 14, 2025, at 7:34 AM, Raymond West via Discuss <discuss@lists.openscad.org> wrote: > > This gives a flat fillet (which I've called a bevel - depends if you think it is internal or external, draughtsman or carpenter) > > > > module tube(d){ > linear_extrude(100) > difference(){ > circle(d=d); > circle (d=d-0.0001); > }; > } > > hull(){ > intersection(){ > tube(30); //upright tube > translate([-0,0,50]) > rotate([0,90,0]) > tube(20+bevel); > } > intersection(){ > tube(30+bevel); // side tube > translate([-0,0,50]) > rotate([0,90,0]) > tube(20); > } > } > > $fn=100; > cylinder(d=30,h=100); > translate([-0,0,50]) > rotate([0,90,0]) > cylinder(d=20,h=50); > > > bevel=6; // greater than 2. > > On 14/01/2025 11:59, Raymond West via Discuss wrote: >> I've used cadquery, which is sort of openscad with python. However it constructs its solids differently, and some aspects do not work well, giving distorted images. iirc, things like a sphere has a seam in it, and if you try to take a scallop out of a surface of a cube, say, then the sphere has to be rotated so the seam is not in the that region. https://cadquery.readthedocs.io/en/latest/vis.html shows the seam in the illustrations. I found the only sparse support was on Reddit, I couldn't find a forum/email list as helpful or responsive as this. >> >> But I thought that the idea in this 'puzzle' was to use openscad script only, else you may as well use any other language/cad program. My idea, although it failed in this case, gives a very good representation of a beginner's welded joint... >> >> But I agree that the points in space is important, I have in the past resorted to exporting an SVG, and in python (or any other language would suffice) calculated intermediate points and manipulated them, saved, and reimported to openscad. It would be nice if openscad could programmatically export and import plain text files, but in order to keep the functional paradigm, I expect it would have to be two separate compiles. Finding work-arounds is interesting. >> >> On 14/01/2025 02:58, John David via Discuss wrote: >>> re: python as an alternative language... >>> >>> You might want to take a look at https://pythonscad.org/ and https://github.com/SolidCode/SolidPython. I played with them a year or two ago when working on some 3D parametric optimization using genetic algorithms. I have not finished that work, and it will be quite awhile before I can get back to it. >>> >>> On Mon, Jan 13, 2025 at 7:57 PM Sanjeev Prabhakar via Discuss <discuss@lists.openscad.org <mailto:discuss@lists.openscad.org>> wrote: >>>> Hi Ray, >>>> >>>> The point I want to make here is that if you learn to draw models with points in space instead of openSCAD primitives, it gives a lot of added flexibility to draw many complex models. >>>> >>>> I am sure there could be ways to generate the same thing someway in stock openscad. >>>> >>>> Like you mentioned minkowski but it might take a very long time to render. >>>> >>>> Finally, I wish python could be added in openscad as an alternate language, which can make things much easier. >>>> >>>> Regards >>>> >>>> >>>> On Tue, 14 Jan, 2025, 12:59 am Raymond West via Discuss, <discuss@lists.openscad.org <mailto:discuss@lists.openscad.org>> wrote: >>>>> You can get the path of the plain tube joints in raw openscad (thin walls and intersection). You can then Minkowski that path, using an extruded square with the corners cut away by circles, which almost gives the required rounded fillet. However the fillet radius needs to change as it follows the path, and the shape needs to rotate, and Minkowski is too slow in this instance. A flat fillet would be simpler, I think, since could get the path for the edges of the fillet on each tube. IIrc, freecad can fillet openscad script generated files, but changes everything to multi-matrix. If it wasn't a requirement for it to be parametric, then I suppose a quarter of one joint fillet could be manually or mathematically generated in fine enough steps, and that replicated 8 times. >>>>> >>>>> On 13/01/2025 17:10, Sanjeev Prabhakar via Discuss wrote: >>>>>> This is my python few lines of code for this: >>>>>> >>>>>> ********************************************************************** >>>>>> from openscad2 import * >>>>>> sec=circle(9/2,s=100) >>>>>> path=corner_radius(pts1([[0,0],[1.5,0],[0,19+1,1],[2,0],[0,2],[-2,0], >>>>>> [0,-1],[-1.5,0],[0,-19]]),10) >>>>>> >>>>>> sol1=translate([0,0,-9],prism(sec,path)) >>>>>> >>>>>> path1=corner_radius(pts1([[0,0],[1.5,0],[0,.35],[2,0],[0,2],[-3,0,1],[0,24,1], >>>>>> [3,0],[0,2],[-2,0],[0,.35],[-1.5,0],[0,-28.7]]),10) >>>>>> sol2=translate([-14,0,0],rot('y90',prism(sec,path1))) >>>>>> l1=ip_sol2sol(sol1,slice_sol(sol2[15:17],2)) >>>>>> l2=o_3d(l1,sol1,1) >>>>>> l3=i_p_p(sol2,l1,-1) >>>>>> f1=convert_3lines2fillet_closed(l3,l2,l1) >>>>>> f2=mirror_surface(f1,[1,0,0],[0,0,0]) >>>>>> >>>>>> d1=o_solid([0,0,1],circle(9/2,s=100),20,-8) >>>>>> d2=o_solid([1,0,0],circle(9/2,s=100),20,-10) >>>>>> with open('trial.scad','w+') as f: >>>>>> f.write(f''' >>>>>> include<dependencies2.scad> >>>>>> difference(){{ >>>>>> {swp(sol1)} >>>>>> {swp(d2)} >>>>>> }} >>>>>> difference(){{ >>>>>> {swp_c(sol2)} >>>>>> {swp(d1)} >>>>>> }} >>>>>> {swp_c(f1)} >>>>>> {swp_c(f2)} >>>>>> >>>>>> ''') >>>>>> ***************************************************************************** >>>>>> >>>>>> >>>>>> scad output file is attached, but this is all just points in space >>>>>> >>>>>> >>>>>> On Mon, 13 Jan 2025 at 07:09, Sanjeev Prabhakar <sprabhakar2006@gmail.com <mailto:sprabhakar2006@gmail.com>> wrote: >>>>>>> Cube is just to explain the process. >>>>>>> Much complex shapes can be developed with a list of points in a similar way. >>>>>>> >>>>>>> Once you create models with the list of points , there are a lot of operations which can be done on them like calculating the intersection between 2 solids. >>>>>>> >>>>>>> But this is only required if you need to do some complex things like fillets. >>>>>>> >>>>>>> Otherwise stock openSCAD is good enough. >>>>>>> >>>>>>> >>>>>>> On Sun, 12 Jan, 2025, 11:52 pm Mark Erbaugh via Discuss, <discuss@lists.openscad.org <mailto:discuss@lists.openscad.org>> wrote: >>>>>>>> I ran the code in OpenSCAD, but how is that different from a simple cube(10); which is a lot easier to type and understand? >>>>>>>> >>>>>>>> Is this what OpenSCAD’s cube() does under the hood? Is that how more complex shapes are generated by BOSL2? >>>>>>>> >>>>>>>> I asked a question on this forum a while back about using multmatrix to combine a series of rotate(), scale() and translate() calls into a single transformation, thinking that it might be quicker if those calls were done many times in a script and the answer was that OpenSCAD combines those calls, and computes one matrix and uses the matrix in its calculations. So I’m thinking that if OpenSCAD has a module to do it, that module should be used. >>>>>>>> >>>>>>>> This raises a question: are the routines in OpenSCAD written in a lower level OpenSCAD or do they go to a lower level language, such as C(++). >>>>>>>> >>>>>>>> Mark >>>>>>>> >>>>>>>> >>>>>>>>> On Jan 12, 2025, at 12:00 PM, Sanjeev Prabhakar <sprabhakar2006@gmail.com <mailto:sprabhakar2006@gmail.com>> wrote: >>>>>>>>> >>>>>>>>> p0=[[0,0,0],[10,0,0],[10,10,0],[0,10,0]]; >>>>>>>>> p1=[[0,0,10],[10,0,10],[10,10,10],[0,10,10]]; >>>>>>>>> >>>>>>>>> cube_1=[p0,p1]; >>>>>>>>> >>>>>>>>> swp(cube_1); >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> function faces(sol)= >>>>>>>>> >>>>>>>>> // calculate the faces for the vertices with shape l x m with first and the last end closed >>>>>>>>> let( >>>>>>>>> l=len(sol), >>>>>>>>> m=len(sol[0]), >>>>>>>>> n1=[for(i=[0:m-1])i], >>>>>>>>> n2=[for(i=[0:l-2]) each ([ for(j=[0:m-1]) >>>>>>>>> each >>>>>>>>> j<m-1?[[(j+1)+i*m,j+i*m,j+(i+1)*m],[(j+1)+i*m,j+(i+1)*m,(j+1)+(i+1)*m]]: >>>>>>>>> [[0+i*m,j+i*m,j+(i+1)*m],[0+i*m,j+(i+1)*m,0+(i+1)*m]] >>>>>>>>> ])], >>>>>>>>> n3=[for(i=[0:m-1])i+(l-1)*m], >>>>>>>>> n4=[for(i=[len(n3)-1:-1:0])n3[i]], >>>>>>>>> n=[n1,each (n2),n4] >>>>>>>>> )n; >>>>>>>>> >>>>>>>>> >>>>>>>>> function faces_1(sol)= >>>>>>>>> >>>>>>>>> // calculate the faces for the vertices with shape l x m with first and the last end open >>>>>>>>> let( >>>>>>>>> l=len(sol), >>>>>>>>> m=len(sol[0]), >>>>>>>>> n2=[for(i=[0:l-2])each([ for(j=[0:m-1]) >>>>>>>>> each >>>>>>>>> j<m-1?[[(j+1)+i*m,j+i*m,j+(i+1)*m],[(j+1)+i*m,j+(i+1)*m,(j+1)+(i+1)*m]]: >>>>>>>>> [[0+i*m,j+i*m,j+(i+1)*m],[0+i*m,j+(i+1)*m,0+(i+1)*m]] >>>>>>>>> ])] >>>>>>>>> >>>>>>>>> )n2; >>>>>>>>> >>>>>>>>> function vertices(sol)= >>>>>>>>> [each for (p=sol)p]; >>>>>>>>> >>>>>>>>> // module for rendering the polyhedron with ends closed >>>>>>>>> module swp(sol){ >>>>>>>>> let( >>>>>>>>> v1=vertices(sol), >>>>>>>>> f1=faces(sol) >>>>>>>>> ) >>>>>>>>> polyhedron(v1,f1,convexity=10); >>>>>>>>> >>>>>>>>> } >>>>>>>>> >>>>>>>> >>>>>>>> _______________________________________________ >>>>>>>> OpenSCAD mailing list >>>>>>>> To unsubscribe send an email to discuss-leave@lists.openscad.org <mailto:discuss-leave@lists.openscad.org> >>>>>> >>>>>> >>>>>> _______________________________________________ >>>>>> OpenSCAD mailing list >>>>>> To unsubscribe send an email to discuss-leave@lists.openscad.org <mailto:discuss-leave@lists.openscad.org> >>>>> _______________________________________________ >>>>> OpenSCAD mailing list >>>>> To unsubscribe send an email to discuss-leave@lists.openscad.org <mailto:discuss-leave@lists.openscad.org> >>>> _______________________________________________ >>>> OpenSCAD mailing list >>>> To unsubscribe send an email to discuss-leave@lists.openscad.org <mailto:discuss-leave@lists.openscad.org> >>> >>> >>> _______________________________________________ >>> OpenSCAD mailing list >>> To unsubscribe send an email to discuss-leave@lists.openscad.org <mailto:discuss-leave@lists.openscad.org> >> >> >> _______________________________________________ >> OpenSCAD mailing list >> To unsubscribe send an email to discuss-leave@lists.openscad.org <mailto:discuss-leave@lists.openscad.org> > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org
JB
Jon Bondy
Tue, Jan 14, 2025 2:26 PM

Perhaps I am mistaken, but I thought that fillets were possible in many
cases using the BOSL2 library.

Jon

On 1/14/2025 8:55 AM, Mark Erbaugh via Discuss wrote:

I’m the OP. I was hoping for a pure OpenSCAD solution, but it’s
obviously the fillet is not as simple. I just watched a YT video from
FOSDEM 2020 with Marius Kintel (one of the developers of OpenSCAD).

maxresdefault.jpeg
Designing functional objects with functional objects OpenSCAD: Past,
present and/or future https://www.youtube.com/watch?v=4EZL4O6b0BE&t=6s
youtube.com https://www.youtube.com/watch?v=4EZL4O6b0BE&t=6s

https://www.youtube.com/watch?v=4EZL4O6b0BE&t=6s

He mentioned using OpenSCAD for the basic model and using other
programs to add details such as fillets.

Mark

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

Perhaps I am mistaken, but I thought that fillets were possible in many cases using the BOSL2 library. Jon On 1/14/2025 8:55 AM, Mark Erbaugh via Discuss wrote: > I’m the OP. I was hoping for a pure OpenSCAD solution, but it’s > obviously the fillet is not as simple. I just watched a YT video from > FOSDEM 2020 with Marius Kintel (one of the developers of OpenSCAD). > > maxresdefault.jpeg > Designing functional objects with functional objects OpenSCAD: Past, > present and/or future <https://www.youtube.com/watch?v=4EZL4O6b0BE&t=6s> > youtube.com <https://www.youtube.com/watch?v=4EZL4O6b0BE&t=6s> > > <https://www.youtube.com/watch?v=4EZL4O6b0BE&t=6s> > > He mentioned using OpenSCAD for the basic model and using other > programs to add details such as fillets. > > Mark -- This email has been checked for viruses by AVG antivirus software. www.avg.com
SP
Sanjeev Prabhakar
Tue, Jan 14, 2025 2:45 PM

I could not see any chamfer or fillet here.
Anything missing?

On Tue, 14 Jan 2025 at 18:04, Raymond West via Discuss <
discuss@lists.openscad.org> wrote:

This gives a flat fillet (which I've called a bevel - depends if you think
it is internal or external, draughtsman or carpenter)

module tube(d){
linear_extrude(100)
difference(){
circle(d=d);
circle (d=d-0.0001);
};
}

hull(){
intersection(){
tube(30);  //upright tube
translate([-0,0,50])
rotate([0,90,0])
tube(20+bevel);
}
intersection(){
tube(30+bevel);  // side tube
translate([-0,0,50])
rotate([0,90,0])
tube(20);
}
}

$fn=100;
cylinder(d=30,h=100);
translate([-0,0,50])
rotate([0,90,0])
cylinder(d=20,h=50);

     bevel=6;  //  greater than 2.
I could not see any chamfer or fillet here. Anything missing? On Tue, 14 Jan 2025 at 18:04, Raymond West via Discuss < discuss@lists.openscad.org> wrote: > This gives a flat fillet (which I've called a bevel - depends if you think > it is internal or external, draughtsman or carpenter) > > > module tube(d){ > linear_extrude(100) > difference(){ > circle(d=d); > circle (d=d-0.0001); > }; > } > > hull(){ > intersection(){ > tube(30); //upright tube > translate([-0,0,50]) > rotate([0,90,0]) > tube(20+bevel); > } > intersection(){ > tube(30+bevel); // side tube > translate([-0,0,50]) > rotate([0,90,0]) > tube(20); > } > } > > $fn=100; > cylinder(d=30,h=100); > translate([-0,0,50]) > rotate([0,90,0]) > cylinder(d=20,h=50); > > > bevel=6; // greater than 2. >
JB
Jordan Brown
Tue, Jan 14, 2025 3:41 PM

On 1/14/2025 6:26 AM, Jon Bondy via Discuss wrote:

Perhaps I am mistaken, but I thought that fillets were possible in
many cases using the BOSL2 library.

There are several techniques for fillets and chamfers/roundoffs.  They
are just rarely easy.  BOSL2 does offer a lot of options, which it does
the hard way (by constructing polyhedra) and then hides the difficulty.

On 1/14/2025 6:26 AM, Jon Bondy via Discuss wrote: > > Perhaps I am mistaken, but I thought that fillets were possible in > many cases using the BOSL2 library. > There are several techniques for fillets and chamfers/roundoffs.  They are just rarely easy.  BOSL2 does offer a lot of options, which it does the hard way (by constructing polyhedra) and then hides the difficulty.
JJ
jon jonbondy.com
Tue, Jan 14, 2025 9:48 PM

Hiding the difficulty.  That's what I want!

On 1/14/2025 10:41 AM, Jordan Brown wrote:

On 1/14/2025 6:26 AM, Jon Bondy via Discuss wrote:

Perhaps I am mistaken, but I thought that fillets were possible in
many cases using the BOSL2 library.

There are several techniques for fillets and chamfers/roundoffs. They
are just rarely easy.  BOSL2 does offer a lot of options, which it
does the hard way (by constructing polyhedra) and then hides the
difficulty.

Hiding the difficulty.  That's what I want! On 1/14/2025 10:41 AM, Jordan Brown wrote: > On 1/14/2025 6:26 AM, Jon Bondy via Discuss wrote: >> >> Perhaps I am mistaken, but I thought that fillets were possible in >> many cases using the BOSL2 library. >> > > There are several techniques for fillets and chamfers/roundoffs. They > are just rarely easy.  BOSL2 does offer a lot of options, which it > does the hard way (by constructing polyhedra) and then hides the > difficulty. >
DP
David Phillip Oster
Wed, Jan 15, 2025 1:47 AM

On Tue, Jan 14, 2025 at 6:45 AM Sanjeev Prabhakar via Discuss <
discuss@lists.openscad.org> wrote:

I could not see any chamfer or fillet here.
Anything missing?

On Tue, 14 Jan 2025 at 18:04, Raymond West via Discuss <
discuss@lists.openscad.org> wrote:

This gives a flat fillet (which I've called a bevel - depends if you
think it is internal or external, draughtsman or carpenter)

    circle (d=d-0.0001);

That inset is too big for my copy of  OpenSCAD (version 2024.03.01,
macOS).  Changing it to circle (d=d-0.01); works.

On Tue, Jan 14, 2025 at 6:45 AM Sanjeev Prabhakar via Discuss < discuss@lists.openscad.org> wrote: > I could not see any chamfer or fillet here. > Anything missing? > > On Tue, 14 Jan 2025 at 18:04, Raymond West via Discuss < > discuss@lists.openscad.org> wrote: > >> This gives a flat fillet (which I've called a bevel - depends if you >> think it is internal or external, draughtsman or carpenter) >> >> … > circle (d=d-0.0001); >> > … That inset is too big for my copy of OpenSCAD (version 2024.03.01, macOS). Changing it to circle (d=d-0.01); works.