Understood.
How do I work around this implicit for loop union then?
Thank you!
--
Sent from: http://forum.openscad.org/
Never mind, I think I have it solved:
$fn = 20;
delta = 0.5;
module gen_node(coords, d, h)
{
translate(coords)
cylinder(d1=d, d2=0, h=h);
}
data = [
[[4, 5, 0], 10, 10],
[[0, 0, 0], 10, 20],
[[-5, 3, 0], 15, 10],
[[-2, 6, 0], 15, 7],
[[2, 16, 0], 20, 20],
];
module embedded(target)
{
intersection()
{
gen_node(data[target][0], data[target][1], data[target][2]);
linear_extrude(height=1000)
projection()
{
difference()
{
gen_node(data[target][0], data[target][1], data[target][2]);
for(i=[0:len(data)])
{
if(i != target)
{
gen_node(data[i][0], data[i][1] + delta, data[i][2]);
}
}
}
}
}
}
for(i = [0:len(data)])
{
embedded(i);
}
Having to embed the module call in the actual operation feels wrong to me,
but I don't think it's possible any other way.
--
Sent from: http://forum.openscad.org/
</file/t2594/example_05.png>
I thought for sure my delta solution would work...but sadly it appears
inconsistent.
Is there an easy way to fix that I wonder?
Thank you!
--
Sent from: http://forum.openscad.org/
I think I'm closer with:
$fn = 20;
delta = 0.5;
module gen_node(coords, d, h)
{
translate(coords)
cylinder(d1=d, d2=0, h=h);
}
data = [
[[4, 5, 0], 10, 10],
[[0, 0, 0], 10, 20],
[[-5, 3, 0], 15, 10],
[[-2, 6, 0], 15, 7],
[[2, 16, 0], 20, 20],
];
module embedded(target)
{
translate(data[target][0])
scale([(data[target][1] - delta)/data[target][1], (data[target][1] -
delta)/data[target][1], 1])
translate(-data[target][0])
intersection()
{
gen_node(data[target][0], data[target][1], data[target][2]);
linear_extrude(height=1000)
projection()
{
difference()
{
gen_node(data[target][0], data[target][1], data[target][2]);
for(i=[0:len(data)])
{
if(i != target)
{
gen_node(data[i][0], data[i][1], data[i][2]);
}
}
}
}
}
}
for(i = [0:len(data) - 1])
{
embedded(i);
}
</file/t2594/example_06.png>
This is at least consistent per edge, but not consistent per node or
globally.
--
Sent from: http://forum.openscad.org/
I don't think that changing the cone shapes is a good idea to get the
intended gap. And in some cases, there is no displacement of the
embeded(target) which produces a good gap, for instance when one cone base
is entirely inside another cone base. So, the general problem of finding
appropriate small cone displacement to get gaps has no solution. To find a
solution when one exists seems to be a hard problem.
I tried a heuristic strategy that does not work in many cases; change the
main code to:
delta = 0.02;
for(i = [0:len(data)-1])
{
translate(displ(i))
embedded(i);
}
where displ() is defined by:
function sum(l) =
[for(i=[0:len(l)-1]) 1]*l;
function displ(i) =
let( ctp = sum([for(di=data) di[0]])/len(data) )
delta*(data[i][0]-ctp);
BTW, two 'for' in your code have an improper last index and I got a
warnings of undef values delivered to translate.
Correction:
for(i=[0:len(data)-1])
Em seg, 8 de jul de 2019 às 10:31, guaranteed_interwoven <
kerryhall@gmail.com> escreveu:
I think I'm closer with:
$fn = 20;
delta = 0.5;
module gen_node(coords, d, h)
{
translate(coords)
cylinder(d1=d, d2=0, h=h);
}
data = [
[[4, 5, 0], 10, 10],
[[0, 0, 0], 10, 20],
[[-5, 3, 0], 15, 10],
[[-2, 6, 0], 15, 7],
[[2, 16, 0], 20, 20],
];
module embedded(target)
{
translate(data[target][0])
scale([(data[target][1] - delta)/data[target][1], (data[target][1] -
delta)/data[target][1], 1])
translate(-data[target][0])
intersection()
{
gen_node(data[target][0], data[target][1], data[target][2]);
linear_extrude(height=1000)
projection()
{
difference()
{
gen_node(data[target][0], data[target][1], data[target][2]);
for(i=[0:len(data)])
{
if(i != target)
{
gen_node(data[i][0], data[i][1], data[i][2]);
}
}
}
}
}
}
for(i = [0:len(data) - 1])
{
embedded(i);
}
</file/t2594/example_06.png>
This is at least consistent per edge, but not consistent per node or
globally.
--
Sent from: http://forum.openscad.org/
OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
why not using offset() after the projection?
module embedded(target, delta)
{
intersection()
{
gen_node(data[target][0], data[target][1], data[target][2]);
linear_extrude(height=1000, convexity = 5)
offset(-delta)
projection()
{
difference()
{
gen_node(data[target][0], data[target][1], data[target][2]);
for(i=[0:len(data)-1])
{
if(i != target)
{
gen_node(data[i][0], data[i][1], data[i][2]);
}
}
}
}
}
}
--
Sent from: http://forum.openscad.org/
A very effective method to create a kerf between the split parts. It works
even when the center of a cone base is inside another cone base.
The linear_extrude height in embedded() could be the height of the target
cone preferably with some extra and translated down to avoid z-fighting in
preview. Would not be better the convexity of linear_extrude be something
like 2*len(data) ?
A terça, 9/07/2019, 09:16, Parkinbot rudolf@digitaldocument.de escreveu:
why not using offset() after the projection?
module embedded(target, delta)
{
intersection()
{
gen_node(data[target][0], data[target][1], data[target][2]);
linear_extrude(height=1000, convexity = 5)
offset(-delta)
projection()
{
difference()
{
gen_node(data[target][0], data[target][1], data[target][2]);
for(i=[0:len(data)-1])
{
if(i != target)
{
gen_node(data[i][0], data[i][1], data[i][2]);
}
}
}
}
}
}
--
Sent from: http://forum.openscad.org/
OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Ronaldo wrote
Would not be better the convexity of linear_extrude be something like
2*len(data) ?
I never dived deeper into convexity parametrization. Yours looks like a
pessimistic heuristic. I tend to use 5, or in very complex designs 10, if I
ever specifiy it ;-)
--
Sent from: http://forum.openscad.org/