Difference between revisions of "FreeCad Gear Box"

From OpenCircuits
Jump to navigation Jump to search
Line 194: Line 194:
  
  
[[Category:Python]] [[Category:FreeCad]] [[Category: CAD]]
+
[[Category:Python]] [[Category:FreeCad]] [[Category: CAD]]  [[Category:CAD/3DPrint]]

Revision as of 06:28, 26 January 2018

What

This is a little record of my work to make and print a gearbox using FreeCad. Not everything here may be right, I am a beginner, but in some ways that is a plus, as I approach this with the ignorance of a beginner, and will answer some beginner questions that others may consider obvious. FreeCad Issues/Solutions

Issues

FreeCad has a bunch of workbenches and types of objects that it can create. But in all cases you seem to know a bunch of values which are not directly generated by the FreeCad itself. This gives two poblems:

  • What are the values you need?
  • What workbench should you use.

Additionally:

  • You need to make printable parts, large over hangs are not printable. Objects like pyramids are easy, inverted pyramids are hard. So make sure stacked up parts are broken up in the right way to be printable. Some may be printed upside down, then turned over in the real world.

A Python Helper Program

In my approach to the problem each part needs to be positioned ( so far in the z axis ) so that all the parts come together correctly. I started to do this by making a sketch of a side view of the gearbox ( will add here later ). Then I began a spreadsheet of the z positions. I do not really like spreadsheets because I find them very error prone and compared to programming a bit tedious. So I wrote a Python program. Initially I just set up a large number of variables and did the math. This was using Python as pretty much a general purpose calculator. Then I began to see a pattern in the calculations.

A Pattern

The pattern goes like this:

  • Each part has a bunch of values that effect z positions
    • Bottom of the part.
    • Thickness of the part.
    • Midpoint of the part.
    • Top of the part.
  • Clearly there are some simple relations between these values.
  • Parts are often stacked up. In the gear box:
    • Bottom plate
    • Washer
    • Spacer
    • Lower Gear
    • Upper Gear
    • Spacer
    • Washer
    • Upper Plate
  • Some calculations:
    • A part's bottom z position + part's thichness = part's top z position
    • One part's top z position becomes the next part's bottom z position.

Pattern into Python

Two classes have been found useful so far.

  • Part3D This is a set of z values, top, bottom.... , a name for the part, some simple calculations, and a print method to show the values. Easy way to set values and see them.
  • PartStack This is an list of parts ( Part3D ) to be stacked up in the z direction. It has a name, an order of parts, simple relations between the parts, and a nice way of printing the values.
  • Nothing very complicated, but have proved to be handy and not error prone.
  • Email me for the code, or given the idea it is pretty easy to write yourself, perhaps better. Later I will find a good upload location.

Sample Calculation

Input/Code

import gear

print"""Set some standards
"""

washer_thick   = .1
gear_clear     = .5
gear_thick     = 5.
plate_thick    = 1.

a_stack    =  gear.PartStack( "two gears" )

l_plate  = gear.Part3D( "l_plate", plate_thick )
a_stack.add_up( l_plate )
a_stack.comp_z_top_mid()

l_washer = gear.Part3D( "l_washer", washer_thick )
a_stack.add_up( l_washer )
a_stack.comp_z_top_mid()


l_spacer = gear.Part3D( "l_spacer", 5.0 )
a_stack.add_up( l_spacer )
a_stack.comp_z_top_mid()


l_gear = gear.Part3D( "l_gear", gear_thick )
a_stack.add_up( l_gear )
l_gear.comp_z_top_mid()


u_gear = gear.Part3D( "u_gear", gear_thick + gear_clear )
a_stack.add_up( u_gear )
u_gear.comp_z_top_mid()

u_spacer = gear.Part3D( "u_spacer", 5. )
a_stack.add_up( u_spacer )
u_spacer.comp_z_top_mid()

u_washer = gear.Part3D( "l_washer", washer_thick )
a_stack.add_up( u_washer )
a_stack.comp_z_top_mid()


u_plate = gear.Part3D( "u_plate", 5. )
a_stack.add_up( u_plate )
u_plate.comp_z_top_mid()

a_stack.print_stack()

Output

Set some standards

------------ Stack: two gears ------------
l_plate
     bot  = 0.0
     thick= 1.0
     mid  = 0.5
     top  = 1.0
l_washer
     bot  = 1.0
     thick= 0.1
     mid  = 1.05
     top  = 1.1
l_spacer
     bot  = 1.1
     thick= 5.0
     mid  = 3.6
     top  = 6.1
l_gear
     bot  = 6.1
     thick= 5.0
     mid  = 8.6
     top  = 11.1
u_gear
     bot  = 11.1
     thick= 5.5
     mid  = 13.85
     top  = 16.6
u_spacer
     bot  = 16.6
     thick= 5.0
     mid  = 19.1
     top  = 21.6
l_washer
     bot  = 21.6
     thick= 0.1
     mid  = 21.65
     top  = 21.7
u_plate
     bot  = 21.7
     thick= 5.0
     mid  = 24.2
     top  = 26.7

Off to FreeCad

WorkBenches

  • Most part basic seem to be easily made in the Part workbench.
  • I installed the gear workbench to make the gears.
  • I am planning to do parts step by step each in its own file and then combine into more and more complete parts.

Generic Parts

I first I made what I called generic parts. The plan is to make a part, copy it later to another document and customize it. Then the custom parts are put together to make a printable part. My generic parts are:

  • Generic Shaft: just a cylinder, I am not planning on printing my shafts, but rather using brass shafts, so this part will be used as a "drill" through other parts.
  • Generic Washer: two cylinders, one used as a drill through the other. Dimensioned to look like a washer.
  • Generic Spacer: two cylinders, one used as a drill through the other. Dimensioned to look like a washer.
  • Generic Gear: just a gear from the Gear workbench.

Individual Parts

Next I made individual parts, one document ( file ) for each part, these are copied out of the generic parts then tweaked:

  • Lower plate
  • Lower washer ( will use metal, will not print )
  • Lower spacer
  • Lower gear
  • Upper gear
  • Upper spacer
  • Upper plate
  • Gear shaft

Printable Parts

Some all of the parts above are printable but it makes sense to combine a few:

  • Gear plus: Lower gear, Upper gear, Upper spacer, shaft as hole through all.


For Cura

Downloaded and installed Cura. Now it looks like I need to export a file from my freecad format file, which to pick?

Look at *Manual:Preparing models for 3D printing - FreeCAD Documentation