openscad / MCAD

OpenSCAD Parametric CAD Library (LGPL 2.1)
http://reprap.org/wiki/MCAD
578 stars 192 forks source link

UX of MCAD/involute_gears.scad gear(), having difficulties in figuring out how to create a simple gear without inner hub #103

Open mofosyne opened 2 years ago

mofosyne commented 2 years ago

Currently trying to just make a simple flat gear using MCAD lib used in OpenSCAD version 2019.05

Not sure if the latest lib already fixed this, but I've found difficulties with just creating a simple flat gear without a spoke for decorative purpose.

I ended up just copying the gear() module and manually modifying it to throw away the inner hub.

Is this something that can already be done with the right setting, if so is this documented yet?

The other approach is to include a simple_gear() module like below for those who don't want to fiddle with extra features like the hub.

use <MCAD/involute_gears.scad>

module simple_gear (
    number_of_teeth=15,
    circular_pitch=false, 
    diametral_pitch=false,
    pressure_angle=28,
    clearance = 0.2,
    backlash=0,
    twist=0,
    involute_facets=0,
    flat=false)
{
    pi=3.1415926535897932384626433832795;

    if (circular_pitch==false && diametral_pitch==false)
        echo("MCAD ERROR: gear module needs either a diametral_pitch or circular_pitch");

    //Convert diametrial pitch to our native circular pitch
    circular_pitch = (circular_pitch!=false?circular_pitch:180/diametral_pitch);

    // Pitch diameter: Diameter of pitch circle.
    pitch_diameter  =  number_of_teeth * circular_pitch / 180;
    pitch_radius = pitch_diameter/2;
    echo ("Teeth:", number_of_teeth, " Pitch radius:", pitch_radius);

    // Base Circle
    base_radius = pitch_radius*cos(pressure_angle);

    // Diametrial pitch: Number of teeth per unit length.
    pitch_diametrial = number_of_teeth / pitch_diameter;

    // Addendum: Radial distance from pitch circle to outside circle.
    addendum = 1/pitch_diametrial;

    //Outer Circle
    outer_radius = pitch_radius+addendum;

    // Dedendum: Radial distance from pitch circle to root diameter
    dedendum = addendum + clearance;

    // Root diameter: Diameter of bottom of tooth spaces.
    root_radius = pitch_radius-dedendum;
    backlash_angle = backlash / pitch_radius * 180 / pi;
    half_thick_angle = (360 / number_of_teeth - backlash_angle) / 4;

    linear_exturde_flat_option(flat=flat, height=rim_thickness, convexity=10, twist=twist)
    gear_shape (
        number_of_teeth,
        pitch_radius = pitch_radius,
        root_radius = root_radius,
        base_radius = base_radius,
        outer_radius = outer_radius,
        half_thick_angle = half_thick_angle,
        involute_facets=involute_facets);
}

simple_gear(number_of_teeth=20, circular_pitch=200, rim_thickness = 2);

Which gives what I want

image

If i use gear(number_of_teeth=20, circular_pitch=200, rim_thickness = 2) then i get an unexpected extra hub

image

--- Want to back this issue? **[Post a bounty on it!](https://app.bountysource.com/issues/112003111-ux-of-mcad-involute_gears-scad-gear-having-difficulties-in-figuring-out-how-to-create-a-simple-gear-without-inner-hub?utm_campaign=plugin&utm_content=tracker%2F86517&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://app.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F86517&utm_medium=issues&utm_source=github).