standard - common standard parametric parts

Module exposing many functions to create/visualize standard parts. Those are following the ISO (metric) specifications as often as possible.

Most parts are as easy to create as:

>>> nut(8)    # nut with nominal diameter 8mm
>>> screw(8, 16)   # screw with match diameter 8mm, and length 16mm

The parts usually have many optional parameters that default to usual recommended values. You can override this by setting the keyword arguments:

>>> screw(8, 16, head='button', drive='slot')

screw stuff

nut(d, type='hex', detail=False) madcad.mesh.Mesh

create a standard nut model using the given shape type

Parameters
  • d – nominal diameter of the matching screw

  • type – the nut shape

  • detail – if True, the thread surface will be generated, else it will only be a cylinder

If d alone is given, the other parameters default to the ISO specs: https://www.engineersedge.com/iso_flat_washer.htm

Currently only shape ‘hex’ is available.

../_images/hexnut.png
screw(d, length, filet_length=None, head='SH', drive=None, detail=False)

create a standard screw using the given drive and head shapes

Parameters
  • d – nominal diameter of the screw

  • length – length from the screw head to the tip of the screw

  • filet_length – length of the filet on the screw (from the tip), defaults to length

  • head – name of the screw head shape

  • drive – name of the screw drive shape

  • detail – if True, the thread surface will be generated, else it will only be a cylinder

It’s also possible to specify head and drive at once, using their codenames:

>>> screw(5, 16, head='SHT')   # socket head and torx drive
available screw heads:
  • socket (default)

  • button

  • flat (aka. cone)

available screw drives:
  • hex

  • torx (not yet available)

  • phillips (cross) (not yet available)

  • slot

All possible shapes:
../_images/screw.png
washer(d, e=None, h=None) madcad.mesh.Mesh

create a standard washer. Washers are useful to offset screws and avoid them to scratch the mount part

Parameters
  • d – the nominal interior diameter (screw or anything else), the exact washer interior is slightly bigger

  • e – exterior diameter

  • h – height/thickness

If d alone is given, the other parameters default to the ISO specs: https://www.engineersedge.com/iso_flat_washer.htm

../_images/washer.png

coilsprings

coilspring_compression(length, d=None, thickness=None, solid=True)

return a Mesh model of a croilspring meant for use in compression

Parameters
  • length – the distance between its two ends

  • d – the exterior diameter (the coilspring can fit in a cylinder of that diameter)

  • thickness – the wire diameter of the spring (useless if solid is disabled)

  • solid – disable it to get only the tube path of the coil, and have a Wire as return value

../_images/coilspring-compression.png
coilspring_tension(length, d=None, thickness=None, solid=True)

return a Mesh model of a croilspring meant for use in tension

Parameters
  • length – the distance between its two hooks

  • d – the exterior diameter (the coilspring can fit in a cylinder of that diameter)

  • thickness – the wire diameter of the spring (useless if solid is disabled)

  • solid – disable it to get only the tube path of the coil, and have a Wire as return value

../_images/coilspring-tension.png
coilspring_torsion(arm, angle=0.7853981633974483, d=None, length=None, thickness=None, hook=None, solid=True)

return a Mesh model of a croilspring meant for use in torsion

Parameters
  • arm – the arms length from the coil axis

  • length – the coil length (and distance between its hooks)

  • d – the exterior diameter (the coilspring can fit in a cylinder of that diameter)

  • thickness – the wire diameter of the spring (useless if solid is disabled)

  • hook – the length of arm hooks (negative for hooks toward the interior)

  • solid – disable it to get only the tube path of the coil, and have a Wire as return value

../_images/coilspring-torsion.png

bearings

bearing(dint, dext=None, h=None, circulating='ball', contact=0, hint=None, hext=None, sealing=False, detail=False)

Circulating bearings rely on rolling elements to avoid friction and widen the part life. Its friction depends on the rotation speed but not on the current load.

see bearing specs at https://koyo.jtekt.co.jp/en/support/bearing-knowledge/

Parameters
  • dint – interior bore diameter

  • dext – exterior ring diameter

  • h – total height of the bearing

  • hint – height of the interior ring. Only for angled roller bearings

  • hext – height of the exterior ring. Only for angled roller bearings

  • circulating

    The type of circulating element in the bearing

    • ball

    • roller

  • contact

    Contact angle (aka pressure angle). It decided what directions of force the bearing can sustain.

    • 0 for radial bearing

    • pi/2 for thrust (axial) bearings

    • 0 < contact < pi/2 for conic bearings

  • sealing – True if the bearing has a sealing side. Only for balls bearings with contact = 0

  • detail – If True, the returned model will have the circulating elements and cage, if False the returned element is just a bounding representation

examples

By default bearing() provides a simplified representation of the bearing, showing mostly its functionnal surfaces (interfaces with other parts). To show all the interior details, use the detail=True option.

# bounded representation of a ball bearing
bearing(12)
../_images/bearing-bounded.png

overview

  • ball bearing

    Those are extremely flexible in the force direction, way to mount, and quite cheap because widely used.

    # detailed representation of a ball bearing
    bearing(12, detail=True)
    
    ../_images/bearing-ball.png
  • roller bearing

    Those can hold a much bigger force than ball bearings, but must be carefully mounted in the direction of that force to always be in pressure (requiring extra design for this)

    # roller bearing
    bearing(12, circulating='roller', contact=radians(20), detail=True)
    
    ../_images/bearing-roller.png
  • thrust bearing

    Those can hold a bigger force that radial ball bearings, but must be carefully mounted to always stay in pressure. They also are less precise than the two previous.

    # thrust bearing
    bearing(12, contact=radians(90), detail=True)
    
    ../_images/bearing-thrust.png
slidebearing(dint, h=None, thickness=None, shoulder=None, opened=False)

Slide bearings rely on gliding parts to ensure a good pivot. It’s much cheaper than circulating bearings and much more compact. But needs lubricant and has a shorter life than circulating bearings. Its friction depends on the rotation speed and on the load.

Parameters
  • dint – interior diameter

  • h – exterior height (under shoulder if there is)

  • thickness – shell thickness, can be automatically determined

  • shoulder – distance from bore to shoulder tip, put 0 to disable

  • opened – enable to have a slight breach that allows a better fitting to the placement hole

examples

  • with slight breach

    # put an openning to better fit bad bore diameter
    slidebearing(10, 12, 0.5, open=True)
    
    ../_images/slidebearing-opened.png
  • with shoulder

    # put a shoulder to support a slight thrust
    slidebearing(10, 12, shoulder=3)
    
    ../_images/slidebearing-shoulder.png