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+im,j+im,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+im,j+im,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)+im,j+im,j+(i+1)m],[(j+1)+im,j+(i+1)m,(j+1)+(i+1)m]]:
[[0+im,j+im,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+im,j+im,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)+im,j+im,j+(i+1)m],[(j+1)+im,j+(i+1)m,(j+1)+(i+1)m]]:
[[0+im,j+im,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+im,j+im,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
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
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+im,j+im,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+im,j+im,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
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+im,j+im,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+im,j+im,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
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
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
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+im,j+im,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+im,j+im,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
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