Need help rotating thru-holes

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Need help rotating thru-holes

Skybound
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
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Need help rotating thru-holes

Parkinbot
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
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Need help rotating thru-holes

Skybound
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!
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Need help rotating thru-holes

Parkinbot
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.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Need help rotating thru-holes

Ronaldo
In reply to this post by Skybound
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
Loading...