Nabble removed Mailing-list integration from the Forum.
This killed the Forum. This is now an ARCHIVE.
It is likely Nabble will shutdown in the future.
Hello all,
I am a newbie in OpenSCAD. A few objects have worked well. Now I come to a problem that I can not fix. I have a bar of 100 and I want to bend it 25° after 25. Therefore I have made the following: I have one cube with 25 and the other with 75. cube([10, 25, 10.5], center=true); color("red") rotate([0,0,25]) translate([(-10.5)/2+0.45, -46.6, 0]) cube([10, 75, 10.5], center=true); With the command rotate I do not get on so properly. How can I get this better so that the two edges also fit? Thanks Mike Sent from the OpenSCAD mailing list archive at Nabble.com. _______________________________________________ OpenSCAD mailing list To unsubscribe send an email to [hidden email] |
You have to to 3 steps
1. Translate the object, so the point you want to rotate by is on [0,0,0] (or at least the axis, you want to rotate by, should be @ 0,0 2. Rotate 3. Translate the rotated object to the target position cube([10, 25, 10.5], center=true); color("red") translate([10/2,25/2, 0]) rotate([0,0,25]) translate([-10/2,75/2, 0]) cube([10, 75, 10.5], center=true); Sent from the OpenSCAD mailing list archive at Nabble.com. _______________________________________________ OpenSCAD mailing list To unsubscribe send an email to [hidden email] |
This animation will show you whats happening (so you can better understand)
// animate with FPS=5 Steps=50 cube([10, 25, 10.5], center=true); function ft(s1,s2)=($t<s1) ? 0 : ($t>s2) ? 1: ($t-s1)/(s2-s1); color("red") translate([10/2,25/2, 0]*ft(0.7,1.00)) rotate([0,0,25]*ft(0.4,0.7)) translate([-10/2,75/2, 0]*ft(0,0.4)) cube([10, 75, 10.5], center=true); Sent from the OpenSCAD mailing list archive at Nabble.com. _______________________________________________ OpenSCAD mailing list To unsubscribe send an email to [hidden email] |
Or even better with these timing parameters
// animate with FPS=5 Steps=50 cube([10, 25, 10.5], center=true); function ft(s1,s2)=($t<s1) ? 0 : ($t>s2) ? 1: ($t-s1)/(s2-s1); color("red") translate([10/2,25/2, 0]*ft(0.7,0.9)) rotate([0,0,25]*ft(0.4,0.6)) translate([-10/2,75/2, 0]*ft(0.1,0.3)) cube([10, 75, 10.5], center=true); Sent from the OpenSCAD mailing list archive at Nabble.com. _______________________________________________ OpenSCAD mailing list To unsubscribe send an email to [hidden email] |
In reply to this post by bassklampfe
That works only for the single case of 'bends' parallel to the
side of the 'cube'. In other instances the joint probably has to
be mitred, (or worse - tapered cylinder?) On 17/04/2021 10:07, bassklampfe wrote:
You have to to 3 steps _______________________________________________ OpenSCAD mailing list To unsubscribe send an email to [hidden email] |
In reply to this post by bassklampfe
Thank you bassklampfe.
Now my understanding about the rotate is better. And also I will change something in future too: first create the objetct then I will translate to the target position. Sent from the OpenSCAD mailing list archive at Nabble.com. _______________________________________________ OpenSCAD mailing list To unsubscribe send an email to [hidden email] |
In reply to this post by q166132
The simplest way to do this is the way bassklampfe showed, but he is mistaken in thinking that 3 steps are required. It can be done with two steps, as you were trying to do, but your translation vector is incorrect. I’m not sure how you arrived at the numbers you used, but this is the correct way to calculate the translation vector.
_______________________________________________ OpenSCAD mailing list To unsubscribe send an email to [hidden email] |
I found this https://stackoverflow.com/questions/45826208/openscad-rotating-around-a-particular-point module rotate_about_pt(z, y, pt) { translate(pt) rotate([0, y, z]) translate(-pt) children(); } It took me a bit to figure it out, but it does work. Dan White | [hidden email] ------------------------------------------------ “Sometimes I think the surest sign that intelligent life exists elsewhere in the universe is that none of it has tried to contact us.” (Bill Waterson: Calvin & Hobbes)
_______________________________________________ OpenSCAD mailing list To unsubscribe send an email to [hidden email] |
Free forum by Nabble | Edit this page |