Created
November 23, 2019 18:58
-
-
Save thehans/56f4cc63f5f7ad941c516b93eba67c8d to your computer and use it in GitHub Desktop.
Example of creating a cutout for a 3D object which is pivoting around the origin.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module rotate_extrude3D(clearance, bounds=[1000,1000]) { | |
rotate_extrude() | |
intersection() { // clip to positive x axis before rotate_extrude | |
translate([0,-bounds[1]/2]) square(bounds); | |
offset(delta=clearance) // add clearance to profile | |
union() for(a=[-90:$fa:90]) // union projections from multiple angles | |
projection() rotate([-90,a]) children(); | |
} | |
} | |
difference() { | |
translate([0,0,-10]) cube([100,100,100]); | |
// assumes object is pointing along positive X axis before sweeping | |
rotate_extrude3D(clearance=0.5, $fs=1, $fa=1) mything(); | |
} | |
// View -> animate to show sweeping | |
%rotate($t*360) mything(); | |
module mything() { | |
union() { | |
cube([50,20,2]); | |
cube([50,2,10]); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment