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); > > } >