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) Mesh [source] 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.htmCurrently only shape ‘hex’ is available.
-
screw
(d, length, filet_length=None, head='SH', drive=None, detail=False)[source] 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:
- see wikipedia for the [drive types](https://en.wikipedia.org/wiki/List_of_screw_drives)
- see [here for a guide of what to use](https://www.homestratosphere.com/types-of-screws/)
- see wikipedia for [standard screw thread](https://en.wikipedia.org/wiki/ISO_metric_screw_thread)
-
washer
(d, e=None, h=None) Mesh [source] 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
-
bolt
(a: dvec3, b: dvec3, dscrew: float, washera=False, washerb=False) Solid [source] convenient function to create a screw, nut and washers assembly
Parameters: - a – the screw placement
- b – the nut placement
- dscrew – the screw
d
parameter - washera – if True, place a washer between the screw head and
a
- washerb – if True, place a washer between the nut and
b
Coilsprings
-
coilspring_compression
(length, d=None, thickness=None, solid=True)[source] 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
-
coilspring_tension
(length, d=None, thickness=None, solid=True)[source] 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
-
coilspring_torsion
(arm, angle=0.7853981633974483, d=None, length=None, thickness=None, hook=None, solid=True) Solid [source] 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
Bearings
-
bearing
(dint, dext=None, h=None, circulating='ball', contact=0, hint=None, hext=None, sealing=False, detail=False) Solid [source] 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 bearingpi/2
for thrust (axial) bearings0 < 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 thedetail=True
option.# bounded representation of a ball bearing bearing(12)
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)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)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)
-
slidebearing
(dint, h=None, thickness=None, shoulder=None, opened=False) Solid [source] 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 opening to better fit bad bore diameter slidebearing(10, 12, 0.5, open=True)With shoulder
# put a shoulder to support a slight thrust slidebearing(10, 12, shoulder=3)
Standard sections for extrusion
-
section_tslot
(size=1, slot=None, thickness=None, depth=None) Web [source] Standard T-Slot section. That section features slots on each side to put nuts at any position.
-
section_s
(height=1, width=None, flange=None, thickness=None) Web [source] Standard S (short flange) section. Very efficient to support flexion efforts.
Numeric helpers
-
stfloor
(x, precision=0.1)[source] Return a numeric value fitting x, with lower digits being the under closest digits from
standard_digits
precision
gives the relative tolerance interval for the returned number, so we are sure it lays in[x*(1-precision), x]
-
stceil
(x, precision=0.1)[source] Return a numeric value fitting x, with lower digits being the above closest digits from
standard_digits
precision
gives the relative tolerance interval for the returned number, so we are sure it lays in[x, x*(1+precision)]
-
standard_digits
convenient shapes to integrate standard parts
-
screw_slot
(axis: Axis, dscrew: float, rslot=None, hole=True, expand=True) Mesh [source] slot shape for a screw the result can then be used in a boolean operation to reserve set a screw place in an arbitrary shape
Parameters: - axis – the screw axis placement, z toward the screw head (part exterior)
- dscrew – the screw diameter
- rslot – the screw head slot radius
- hole –
- if
True
, enables a cylindric hole for screw body - if
float
, it is the screw hole length
- if
- expand –
- if
True
, enables slots sides - if
float
, it is the slot sides height
- if
-
bolt_slot
(a: dvec3, b: dvec3, dscrew: float, rslot=None, hole=True, expanda=True, expandb=True) Mesh [source] bolt shape for a screw musch like
screw_slot()
but with two endingsParameters: - a – position of screw head
- b – position of nut
- dscrew – the screw diameter
- rslot – the screw head slot radius
- hole – enabled the cylindric hole between the head and nut slots
- expanda –
- if
True
, enables slot sides on tipa
orb
- if
float
, it is the slot side height
- if
- expandb –
- if
True
, enables slot sides on tipa
orb
- if
float
, it is the slot side height
- if
Example
>>> a, b = vec3(...), vec3(...) >>> bolts = bolt(a, b, 3) >>> part_hole = bolt_slot(a, b, 3)
-
bearing_slot_exterior
(axis: Axis, dext: float, height: float, shouldering=True, circlip=False, evade=True, expand=True)[source] slot for a bearing exterior ring, such as returned by
bearing()
Parameters: - axis – bearing axis placement
- dext – bearing
dext
parameter - height – bearing
h
parameter - shouldering – generate a shoulder to support the top side of the bearing’s exterior ring
- circlip – enable a slot for a circlip to support the bottom side of the bearing’s exterior ring
- evade – set expansion to evasive rather that straight
- expand –
expand the slot with evasive or straight surfaces to ease itnersection with other meshes
True
enables expansion with a default lengthfloat
set the expansion distance
-
bearing_slot_interior
(axis: Axis, dint: float, height: float, shouldering=True, circlip=False, evade=True, expand=True) Mesh [source] slot for a bearing interior ring, such as returned by
bearing()
Parameters: - axis – bearing axis placement
- dint – bearing
dint
parameter - height – bearing
h
parameter - shouldering – generate a shoulder to support the top side of the bearing’s interior ring
- circlip – generate a slot for a circlip to support the bottom side of the bearing’s interior ring
- evade – set expansion to evasive rather that straight
- expand –
expand the slot with evasive or straight surfaces to ease itnersection with other meshes
True
enables expansion with a default lengthfloat
set the expansion distance