http://forum.openscad.org/file/n15275/arrayoscad.png
This has been simple so far, but I've run out of math skills.
In the image below, the cylinders crossed by the radial lines are generated
by the code above. Each segment can be considered a ring of cylinders, but
not as easily calculated as the radial cylinders. As an example, the blue
cylinders on ring 2 (0,1,2) are tangent to the pair on ring one. The centers
of these six are on a circle with the center at the origin.
Ring 3 has a pair at each section, but also a common circle/center/origin.
Rings 4 and 5 have two separate circle/center/origin references.
I did a Google search to discover if there was the equivalent of the AutoCAD
command circle, tangent, tangent, radius but came up empty in that respect.
I'd like to build code that would allow any (reasonable) number of rings and
fill in the missing cylinders in an accurate manner. I would also expect
that as the ring number becomes greater, there would be an increase in the
number of unique circle/center/origin relationships as well. I believe that
I could generate some arbitrary numbers and adjust them until the design
requirements are met, but I'd very much prefer to have a formula as a base
for the fill in cylinders.
The future code will include a z-translate specific to the ring number, but
I expect that's going to be as simple as it sounds.
Any ideas?
http://forum.openscad.org/file/n15275/array.png
--
View this message in context: http://forum.openscad.org/Trigonometry-everyone-s-favorite-subject-tp15275.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
sounds simple. Put any number for n!
board();
module board(r=10, n=5, h=1)
{
cylinder(h=h, r=r);
for(k=[0:60:359])
rotate([0, 0, k])
for(i=[1:n])
for(j=[0:n-i])
translate([jr+2ri, jsqrt(3)*r, 0])
cylinder(h=h, r=r);
}
--
View this message in context: http://forum.openscad.org/Trigonometry-everyone-s-favorite-subject-tp15275p15276.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
that's pretty impressive for such a tiny bit of code. The results are almost
spot-on for my project.
I changed the translate z to j*2, the 2 being an arbitrary value, and it
"elevated" the wrong items.
What's the easiest way to translate z for each ring in turn? That is, the
center cylinder would remain in place (or not) while the first six outward
would be affected by the associated value, then the next twelve, and so on.
--
View this message in context: http://forum.openscad.org/Trigonometry-everyone-s-favorite-subject-tp15275p15277.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
try (i+j)*2 instead
fred_dot_u wrote
that's pretty impressive for such a tiny bit of code. The results are
almost spot-on for my project.
I changed the translate z to j*2, the 2 being an arbitrary value, and it
"elevated" the wrong items.
What's the easiest way to translate z for each ring in turn? That is, the
center cylinder would remain in place (or not) while the first six outward
would be affected by the associated value, then the next twelve, and so
on.
--
View this message in context: http://forum.openscad.org/Trigonometry-everyone-s-favorite-subject-tp15275p15278.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
thehans, that was it! I added a fourth parameter to the module (step) and
used (i+j)*-step in the code to get a downward increment. It's beautiful!
http://forum.openscad.org/file/n15279/array.png
The next segment of code is yet tricky for me, as I have not attempted to
understand how the just-completed section works.
Another set of cylinders with the same centers as the previous code, but
smaller diameter (r-value) and stepped the same amount, then "subtracted"
from the main body. I suspect that this may be an example of where
children() would be used.
Anyone please do not provide the raw code for this, as I'd like to exercise
the brain cells and determine how the previous code does what it does, to
see if this is the correct route.
A confirmation or refutation that children() is the right direction would be
helpful, or any other general suggestions.
thanks
fred
--
View this message in context: http://forum.openscad.org/Trigonometry-everyone-s-favorite-subject-tp15275p15279.html
Sent from the OpenSCAD mailing list archive at Nabble.com.