Primitives in OpenSCAD are a really great for adding and subtracting your way to what you want. Add a cylinder here, subtract another there, you got a rim.
However if you have a complex shape that can be extruded, a polygon will be much more efficient. A little harder to visualize though for sure.
You define your profile as a set of points which define a 2D object. Be prepared to do some math.. :)
polygon(points=[
[rim_ir,rim_h/2-rim_edge_z-wall_thickness],
[rim_ir+wall_thickness,rim_h/2],
[rim_or+wall_thickness,rim_h/2],
[rim_or+rim_edge_x,rim_h/2-rim_edge_z],
[rim_or,rim_h/2-rim_edge_z*4],
[rim_or,-rim_h/2+rim_edge_z*4],
[rim_or+rim_edge_x,-rim_h/2+rim_edge_z],
[rim_or+wall_thickness,-rim_h/2],
[rim_ir+wall_thickness,-rim_h/2],
[rim_ir,-rim_h/2+rim_edge_z+wall_thickness],
[rim_ir,-hub_offset-wall_thickness*3],
[rim_ir-wall_thickness,-hub_offset-wall_thickness],
[rim_ir-wall_thickness,-hub_offset],
[rim_ir,-hub_offset],
]);
Which gives you your 2D object.

Then you do your extrusion on that by adding a rotate_extrude(), and you got your 3D shape.

Add some holes, and you got a rim. Well actually, the position of the holes defined the position of the rim above, but now I get to add them back in. :)

The code which generates that is 20 lines long, and most of those are just for readability of the polygon array.
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.