Hi All,
I need a bit of help with some geometry, my maths in this area is a bit
rusty.
I want to be able to draw a "cylinder" between any two arbitrary points in
space, x1,y1,z1 and x2,y2,z2 but to draw the cylinder I need to rotate and
translate it i.e.
translate([x1,y1,z1])
{
rotate(a=[a, b, c])
{
cylinder(h=length, d=dia);
}
}
translate is easy, it's just x1,y1,z1 and cylinder length is easy, its is
square root of the sum of (xlength^2)+(ylength^2)+(zlength^2) but I just
can't seem to get the angles to rotate correct.
Has anyone done a module like this that they would be willing to share ?
Or is there another, easier way that doesn't require the sperical
coordinates ?
Many Thanks
PhilipJ
--
Sent from: http://forum.openscad.org/
We had this theme some weeks ago. Ronaldo's mirror solution is brilliant.
http://forum.openscad.org/Rotation-question-tp24970p25000.html
--
Sent from: http://forum.openscad.org/
Also if you can accept spherical ends you can simply translate two spheres to
the end points and take the hull. That is better if you want to join them up
end to end.
--
Sent from: http://forum.openscad.org/
Hi,
I did it with hull() as you suggest but it was rather slow and as there are
going to be a lot of these "rods" I wanted to try a different method by
adding a cylinder to fill in between the two spheres.
My aim is to draw up a geodisic dome by specifying the "node" points in
x,y,z coordinated, then create an stl file to 3D print it.
thanks
PhilipJ
--
Sent from: http://forum.openscad.org/
PhilipJ wrote
I did it with hull() as you suggest but it was rather slow and as there
are
going to be a lot of these "rods" I wanted to try a different method by
adding a cylinder to fill in between the two spheres.
The hull() operation is rather fast. The union of a (large) number of rods
is the cause of longer render times. Adding cylinders to the spheres will be
worse.
--
Sent from: http://forum.openscad.org/
You can also try a *
https://github.com/runsun/OpenSCAD_Tips/blob/master/snippets.md#line
Line()* function, which is also based on one of Ronaldo's codes.
$ Runsun Pan, PhD $ libs: scadx , doctest , faces ( git ), offline doc ( git ), runscad.py ( 2 , git ), editor of choice: CudaText ( OpenSCAD lexer ); $ Tips ; $ Snippets
--
Sent from: http://forum.openscad.org/
Hi again,
I tried the hull() method with just 4 rods and it took 6 seconds to render
when the file was double clicked compared to almost instanteneous (as fast
as openSCAD opens, the image is there on the screen).
I'm still using Version 2015.03-2, could this be a problem ?
code is:
$fn=100;
rod_dia=3;
module rod(x1, y1, z1, x2, y2, z2, d)
{
hull()
{
translate([x1,y1,z1])
sphere(d/2);
translate([x2,y2,z2]) {
sphere(d/2);
}
}
}
rod(0,0,0, 10,10, 30, rod_dia);
rod(20,0,0, 10,10, 30, rod_dia);
rod(0,20,0, 10,10, 30, rod_dia);
rod(20,20,0, 10,10, 30, rod_dia);
regards
PhilipJ
--
Sent from: http://forum.openscad.org/
On 07.01.19 17:45, PhilipJ wrote:
Hi again,
I tried the hull() method with just 4 rods and it took 6 seconds to render
when the file was double clicked compared to almost instanteneous (as fast
as openSCAD opens, the image is there on the screen).
I'm still using Version 2015.03-2, could this be a problem ?
code is:
$fn=100;
$fn=100 is pretty big.
Using a smaller number would cut down rendering and preview time.
Note that rendering (F6) is usually much slower then preview (F5)
with kind regards,
Michael Frey
Hi, thanks for the link.
I'm still trying to learn the language of openSCAD so could you explain:
in the module first line it says:
"module Line( pts, r=0.05, closed=false, color=undef, transp=1, fn=4 )"
what is "pts" ?
I assume it is the points for the line but how do I pass them into the
module through this one variable ?
As an example: how would I draw a line from 0,0,0 to 30,30,30 ?
Many thanks for your time
PhilipJ
--
Sent from: http://forum.openscad.org/
$fn=100 is pretty big.
Using a smaller number would cut down rendering and preview time.
Thanks, I tried different values, 10 makes the rods look like hexagons, 30
was still a bit rough but rendered 4 rods in 11 seconds, still seems awfully
slow.
If th rods are made of cylinders and spheres with no hull function then the
Render takes fractions of a second, but I'm still trying to resolve the
cartesian to spherical coods bit so I can rotate the cylinder to the correct
angles to join up...
thanks for the suggestions
PhilipJ
--
Sent from: http://forum.openscad.org/