discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

Need help rotating thru-holes

S
Skybound
Wed, Jul 19, 2017 1:42 AM

I'm trying to build a servo valve that at one point had 8 thru holes per both
of 2 faces, but being new to coding, and extremely new to OpenSCAD, I am
only able to get so far.  Someone helped me with creating the spline
receiver, so it should clearly depict the code that came from me and someone
else.  It seems I've nearly everything dialed in except for servo height at
assembly, but I can easily locate the respective cubes and make the
correction(s).  However, it seems that everything I try to re-render those 8
thru holes is failing.  Would someone be willing to have a look and suggest
corrections?  I think the design is pretty straight forward and I hope as
simple as it could get.

Thanks for your consideration.

Unstacked_Servo_Gate_Valve.scad
http://forum.openscad.org/file/n21851/Unstacked_Servo_Gate_Valve.scad

--
View this message in context: http://forum.openscad.org/Need-help-rotating-thru-holes-tp21851.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

I'm trying to build a servo valve that at one point had 8 thru holes per both of 2 faces, but being new to coding, and extremely new to OpenSCAD, I am only able to get so far. Someone helped me with creating the spline receiver, so it should clearly depict the code that came from me and someone else. It seems I've nearly everything dialed in except for servo height at assembly, but I can easily locate the respective cubes and make the correction(s). However, it seems that everything I try to re-render those 8 thru holes is failing. Would someone be willing to have a look and suggest corrections? I think the design is pretty straight forward and I hope as simple as it could get. Thanks for your consideration. Unstacked_Servo_Gate_Valve.scad <http://forum.openscad.org/file/n21851/Unstacked_Servo_Gate_Valve.scad> -- View this message in context: http://forum.openscad.org/Need-help-rotating-thru-holes-tp21851.html Sent from the OpenSCAD mailing list archive at Nabble.com.
P
Parkinbot
Wed, Jul 19, 2017 11:45 AM

It is better to design a thing centered, pack it into a module and translate
it later as a whole.
To show how this is done, I rewrote your ValveTop into a module and
corrected your radius. For debugging you can add '#' in front of an object
to see where it gets placed in 3D space.

Skybound wrote

//------------Servo Gate Valve------------//

//Valve Top
translate([80, 0, 0])
ValveTop();

module ValveTop()
{
difference()
{
cylinder(h=4, r=41, $fn=90);
cylinder(h=1.5, r=36, $fn=90);
cylinder(h=6, r=5, $fn=75);
translate([26, 0, 0])cylinder(h=6, r=7.894, $fn=75);

 for(a = [0 : 45 : 337.5])
   rotate([0, 0, a]) 

translate([26, 0, 0])cylinder(h=6, r=7.894, $fn=75);

}
}

difference() { //1/2" PVC Nipple Top
translate([106, 0, 4])cylinder(h=26, r=10.668, $fn=75);
translate([106, 0, 0])cylinder(h=32, r=7.894, $fn=75);
}
// ... and so on

--
View this message in context: http://forum.openscad.org/Need-help-rotating-thru-holes-tp21851p21863.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

It is better to design a thing centered, pack it into a module and translate it later as a whole. To show how this is done, I rewrote your ValveTop into a module and corrected your radius. For debugging you can add '#' in front of an object to see where it gets placed in 3D space. Skybound wrote > //------------Servo Gate Valve------------// > > //Valve Top > translate([80, 0, 0]) > ValveTop(); > > module ValveTop() > { > difference() > { > cylinder(h=4, r=41, $fn=90); > cylinder(h=1.5, r=36, $fn=90); > cylinder(h=6, r=5, $fn=75); > translate([26, 0, 0])cylinder(h=6, r=7.894, $fn=75); > > for(a = [0 : 45 : 337.5]) > rotate([0, 0, a]) > # translate([26, 0, 0])cylinder(h=6, r=7.894, $fn=75); > } > } > > difference() { //1/2" PVC Nipple Top > translate([106, 0, 4])cylinder(h=26, r=10.668, $fn=75); > translate([106, 0, 0])cylinder(h=32, r=7.894, $fn=75); > } > // ... and so on -- View this message in context: http://forum.openscad.org/Need-help-rotating-thru-holes-tp21851p21863.html Sent from the OpenSCAD mailing list archive at Nabble.com.
S
Skybound
Wed, Jul 19, 2017 12:10 PM

Thank you so much Parkinbot!  I will rearrange the 3 parts to be modules.  In
order for "rotate" to work this way, does the axis need to be centered on X
and Y, or is there a way to rotate an object around a different axis?

Thanks again for the tips, they were so helpful!

--
View this message in context: http://forum.openscad.org/Need-help-rotating-thru-holes-tp21851p21864.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

Thank you so much Parkinbot! I will rearrange the 3 parts to be modules. In order for "rotate" to work this way, does the axis need to be centered on X and Y, or is there a way to rotate an object around a different axis? Thanks again for the tips, they were so helpful! -- View this message in context: http://forum.openscad.org/Need-help-rotating-thru-holes-tp21851p21864.html Sent from the OpenSCAD mailing list archive at Nabble.com.
P
Parkinbot
Wed, Jul 19, 2017 8:25 PM

you can only rotate around the three cartesian axes. If you want a different
axis you have to compose that. As I wrote, it is best, to design an object
around the origin and take advantage from the symmetries and so on. Then you
place it by rotating and translating it. You can also translate first and
then rotate it, depending on what you want and which symmetries you final
object demands.

--
View this message in context: http://forum.openscad.org/Need-help-rotating-thru-holes-tp21851p21868.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

you can only rotate around the three cartesian axes. If you want a different axis you have to compose that. As I wrote, it is best, to design an object around the origin and take advantage from the symmetries and so on. Then you place it by rotating and translating it. You can also translate first and then rotate it, depending on what you want and which symmetries you final object demands. -- View this message in context: http://forum.openscad.org/Need-help-rotating-thru-holes-tp21851p21868.html Sent from the OpenSCAD mailing list archive at Nabble.com.
R
Ronaldo
Wed, Jul 19, 2017 8:45 PM

Skybound wrote

In order for "rotate" to work this way, does the axis need to be centered
on X and Y, or is there a way to rotate an object around a different axis?

You can rotate around any axis passing through the origin.  To see the
options, take a look on:

https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Transformations#rotate
https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Transformations#rotate

--
View this message in context: http://forum.openscad.org/Need-help-rotating-thru-holes-tp21851p21869.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

Skybound wrote > In order for "rotate" to work this way, does the axis need to be centered > on X and Y, or is there a way to rotate an object around a different axis? You can rotate around any axis passing through the origin. To see the options, take a look on: https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Transformations#rotate <https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Transformations#rotate> -- View this message in context: http://forum.openscad.org/Need-help-rotating-thru-holes-tp21851p21869.html Sent from the OpenSCAD mailing list archive at Nabble.com.