first commit

This commit is contained in:
2026-07-22 13:48:46 +08:00
commit c87751c3dc
2820 changed files with 726976 additions and 0 deletions
+40
View File
@@ -0,0 +1,40 @@
# SimpleCAD Standard Library Index
This index includes generated docs for standard part factory functions. Use these functions first when a task needs a standard mechanical part and does not require complex custom geometry changes.
## Import Surfaces
- Recommended package-level module export: `import simplecadapi as scad`, then call functions through submodules such as `scad.std.gear.<function>(...)` and `scad.std.bearing.<function>(...)`.
- Direct submodule import is also supported, for example `from simplecadapi.std.gear import make_spur_gear_rsolid` or `from simplecadapi.std.bearing import make_ball_bearing_rassembly`.
## Usage Guidance
- Prefer standard-library factories for standard bearings, gears, ring gears, and racks before hand-modeling profiles with core geometry APIs.
- Standard parts return normal SimpleCAD shapes or product assemblies, so they can be transformed, tagged, assembled, exported, or combined with core geometry operations.
- Switch to core geometry APIs only when the requested standard part needs substantial custom geometry beyond the factory parameters.
## Bearing Assemblies
- [make_ball_bearing_rassembly](make_ball_bearing_rassembly.md) *(from std/bearing.py)* `stdlib`
## External Gears
- [make_helical_gear_rsolid](make_helical_gear_rsolid.md) *(from std/gear.py)* `stdlib`
- [make_herringbone_gear_rsolid](make_herringbone_gear_rsolid.md) *(from std/gear.py)* `stdlib`
- [make_spur_gear_rsolid](make_spur_gear_rsolid.md) *(from std/gear.py)* `stdlib`
## Internal Ring Gears
- [make_helical_ring_gear_rsolid](make_helical_ring_gear_rsolid.md) *(from std/gear.py)* `stdlib`
- [make_herringbone_ring_gear_rsolid](make_herringbone_ring_gear_rsolid.md) *(from std/gear.py)* `stdlib`
- [make_spur_ring_gear_rsolid](make_spur_ring_gear_rsolid.md) *(from std/gear.py)* `stdlib`
## Cycloidal Reducer Discs
- [make_cycloidal_disc_rsolid](make_cycloidal_disc_rsolid.md) *(from std/gear.py)* `stdlib`
## Racks
- [make_helical_rack_rsolid](make_helical_rack_rsolid.md) *(from std/gear.py)* `stdlib`
- [make_herringbone_rack_rsolid](make_herringbone_rack_rsolid.md) *(from std/gear.py)* `stdlib`
- [make_spur_rack_rsolid](make_spur_rack_rsolid.md) *(from std/gear.py)* `stdlib`
@@ -0,0 +1,59 @@
# make_ball_bearing_rassembly
## API Definition
```python
def make_ball_bearing_rassembly(bore_diameter: float, outer_diameter: float, bearing_width: float, ball_diameter: float, ball_count: Optional[int] = None, raceway_clearance: float = 0.02, edge_chamfer: float = 0.0, assembly_id: str = 'ball_bearing', drive_angle_degrees: Optional[float] = None) -> Assembly
```
*Source: std/bearing.py*
## Import Surface
- standard library: `import simplecadapi as scad` then `scad.std.bearing.make_ball_bearing_rassembly(...)`; direct submodule import: `from simplecadapi.std.bearing import make_ball_bearing_rassembly`
## Description
Create a parameterized radial ball bearing assembly.
This factory returns an `Assembly`, not a merged `Solid`, because a bearing
has useful internal structure. The returned assembly contains stable
component ids `outer_ring`, `inner_ring`, and `ball_00`, `ball_01`, ... .
The inner and outer rings each carry an `axis` connector, and the assembly
includes one revolute constraint named `inner_outer_revolute` between those
two axes. Use `bearing.get_component("inner_ring").item.body` to access
the inner-ring geometry directly, or use connector refs such as
`make_connector_ref_rconnectorref("inner_ring", "axis")` when adding shaft
or housing constraints to the same assembly.
The returned bearing assembly also forwards public assembly-level connectors
`inner_axis` and `outer_axis` from `inner_ring.axis` and `outer_ring.axis`.
Parent assemblies can constrain to those connectors without depending on the
bearing's internal component structure. These public axes are offset to the
bearing center plane.
The returned bearing is not grounded. Ground the parent assembly's housing,
shaft, or fixture components explicitly; the standard bearing assembly does
not emit `GroundedJoint` objects that would lock a parent mechanism.
Parameters use explicit SDK-style names rather than compact catalog labels:
`bore_diameter` maps to common `id`, `outer_diameter` maps to `od`,
`bearing_width` maps to axial bearing thickness, `ball_diameter` maps to
ball size, `raceway_clearance` maps to print clearance around the balls, and
`edge_chamfer` maps to edge break/chamfer. There is intentionally no
Python keyword-only `*` separator in this signature so the function remains
callable with either positional or keyword arguments.
`ball_count=None` lets the factory infer a conservative visual ball count
from the pitch circle. Explicit `ball_count` is accepted when you need to
match a real bearing or a printed cage design. Balls are direct sphere
primitive solids, and the inner and outer rings are revolved from arc-groove
profiles to create continuous toroidal raceway grooves. Balls are visual
rolling elements fixed at their authored positions; the currently modeled
kinematic degree of freedom is only the inner-ring-to-outer-ring revolute
joint.
For printable bearings, the classic checks from many parametric generators
are still useful: `((outer_diameter - bore_diameter) / 2) - ball_diameter`
should leave enough radial wall thickness, and `bearing_width - ball_diameter`
should be positive so balls do not protrude axially.
@@ -0,0 +1,104 @@
# make_cycloidal_disc_rsolid
## API Definition
```python
def make_cycloidal_disc_rsolid(n_lobes: int, ring_pin_pitch_radius: float, roller_radius: float, eccentricity: float, gear_height: float = 6.0, *, bore_radius: float = 0.0, output_pin_count: int = 0, output_pin_pitch_radius: float = 0.0, output_pin_clearance_radius: float = 0.0, output_pin_phase: float = 0.0, sample_count_per_lobe: int = 33, spline_tolerance: float = 0.005, max_control_points: int = 20) -> Solid
```
*Source: std/gear.py*
## Import Surface
- standard library: `import simplecadapi as scad` then `scad.std.gear.make_cycloidal_disc_rsolid(...)`; direct submodule import: `from simplecadapi.std.gear import make_cycloidal_disc_rsolid`
## Description
Create a cycloidal reducer disc for a one-tooth-difference pin ring.
This is a single-disc geometric standard part. Real compact reducers often
stack two identical-lobe discs to balance output-pin side loads. In that
assembly-level pattern, separate two concepts that are easy to confuse:
- Place the two input eccentric cam centers 180 degrees apart, for example
``(+e, 0)`` and ``(-e, 0)``, so their orbit loads oppose each other.
- Tooth-index the second cycloidal profile by half a lobe, not by a full
180 degree shape rotation. For a disc with ``n_lobes`` lobes, that
geometric body phase is ``180 / n_lobes`` degrees. A 10-lobe disc rotated
by 180 degrees is exactly five full lobe pitches and is visually and
mechanically equivalent to no tooth-index phase change.
If output-pin clearance holes must stay aligned to one shared output pin
set, compensate the second disc's ``output_pin_phase`` by subtracting the
same body phase before rotating the finished disc body.
## Parameters
### n_lobes
- **Type**: `int`
- **Description**: Number of cycloidal lobes. The matching fixed pin ring has
### ``n_lobes + 1`` pins and gives a single-stage ``n_lobes
- **Description**: 1`` reduction.
### ring_pin_pitch_radius
- **Type**: `float`
- **Description**: Radius of the fixed ring pin centers in mm.
### roller_radius
- **Type**: `float`
- **Description**: Radius of the fixed ring pins or rollers used to offset the profile.
### eccentricity
- **Type**: `float`
- **Description**: Input crank eccentricity in mm.
### gear_height
- **Type**: `float, default 6.0`
- **Description**: Disc thickness / extrusion height along Z in mm.
### bore_radius
- **Type**: `float, default 0.0`
- **Description**: Optional central bore radius. Zero leaves the disc unbored.
### output_pin_count
- **Type**: `int, default 0`
- **Description**: Optional number of circular output-pin clearance holes.
### output_pin_pitch_radius
- **Type**: `float, default 0.0`
- **Description**: Radius of the output-pin clearance hole centers in mm.
### output_pin_clearance_radius
- **Type**: `float, default 0.0`
- **Description**: Radius of each output-pin clearance hole in mm.
### output_pin_phase
- **Type**: `float, default 0.0`
- **Description**: Angular phase of the first output-pin clearance hole in degrees, in the unrotated disc's local frame. When a finished disc is rotated to create a tooth-index phase in a twin-disc stack, subtract that same rotation from ``output_pin_phase`` if the clearance holes should remain aligned to the same global output pins.
### sample_count_per_lobe
- **Type**: `int, default 33`
- **Description**: Number of analytic samples fitted into each lobe B-spline segment.
### spline_tolerance
- **Type**: `float, default 0.005`
- **Description**: Cubic B-spline fit tolerance in mm.
### max_control_points
- **Type**: `int, default 20`
- **Description**: Maximum poles allowed for each fitted lobe segment.
@@ -0,0 +1,64 @@
# make_helical_gear_rsolid
## API Definition
```python
def make_helical_gear_rsolid(n_teeth: int, module: float, pressure_angle: float = 20.0, helix_angle: float = 30.0, gear_height: float = 8.0, *, addendum_factor: float = 1.0, clearance_factor: float = 0.25, backlash: float = 0.0) -> Solid
```
*Source: std/gear.py*
## Import Surface
- standard library: `import simplecadapi as scad` then `scad.std.gear.make_helical_gear_rsolid(...)`; direct submodule import: `from simplecadapi.std.gear import make_helical_gear_rsolid`
## Description
Create an involute helical gear.
Non-zero helix angles are modeled as small-step ruled lofts through rotated
copies of one profile. The small angular step keeps closed-wire section
correspondence stable while ruled faces avoid smooth loft bulging in STEP
exports.
## Parameters
### n_teeth
- **Type**: `int`
- **Description**: Number of teeth (>= 3).
### module
- **Type**: `float`
- **Description**: Gear module in mm.
### pressure_angle
- **Type**: `float, default 20`
- **Description**: Pressure angle in degrees.
### helix_angle
- **Type**: `float, default 30`
- **Description**: Helix angle in degrees.
### gear_height
- **Type**: `float, default 8.0`
- **Description**: Gear thickness along Z in mm.
### addendum_factor
- **Type**: `float, default 1.0`
- **Description**: Tooth addendum as a multiple of module.
### clearance_factor
- **Type**: `float, default 0.25`
- **Description**: Root clearance beyond the addendum, as a multiple of module.
### backlash
- **Type**: `float, default 0.0`
- **Description**: Circumferential tooth-thickness reduction at the pitch circle in mm.
@@ -0,0 +1,44 @@
# make_helical_rack_rsolid
## API Definition
```python
def make_helical_rack_rsolid(module: float, n_teeth: int = 10, pressure_angle: float = 20.0, helix_angle: float = 25.0, rack_height: float = 8.0) -> Solid
```
*Source: std/gear.py*
## Import Surface
- standard library: `import simplecadapi as scad` then `scad.std.gear.make_helical_rack_rsolid(...)`; direct submodule import: `from simplecadapi.std.gear import make_helical_rack_rsolid`
## Description
Create a helical rack.
## Parameters
### module
- **Type**: `float`
- **Description**: Gear module in mm (tooth pitch = pi * module).
### n_teeth
- **Type**: `int, default 10`
- **Description**: Number of teeth along the rack.
### pressure_angle
- **Type**: `float, default 20`
- **Description**: Pressure angle in degrees.
### helix_angle
- **Type**: `float, default 25`
- **Description**: Helix angle in degrees.
### rack_height
- **Type**: `float, default 8.0`
- **Description**: Rack thickness along Z in mm.
@@ -0,0 +1,69 @@
# make_helical_ring_gear_rsolid
## API Definition
```python
def make_helical_ring_gear_rsolid(n_teeth: int, module: float, pressure_angle: float = 20.0, helix_angle: float = 25.0, gear_height: float = 8.0, rim_thickness: float = 3.0, backlash: float = 0.0, *, addendum_factor: float = 1.0, clearance_factor: float = 0.25) -> Solid
```
*Source: std/gear.py*
## Import Surface
- standard library: `import simplecadapi as scad` then `scad.std.gear.make_helical_ring_gear_rsolid(...)`; direct submodule import: `from simplecadapi.std.gear import make_helical_ring_gear_rsolid`
## Description
Create an internal helical ring gear.
The outer rim is extruded directly. The internal tooth void is built as a
small-step ruled loft through rotated copies of the internal profile, then
subtracted from the rim. Ruled sections avoid smooth loft bulging in STEP
exports while preserving stable section correspondence.
## Parameters
### n_teeth
- **Type**: `int`
- **Description**: Number of internal teeth (>= 3).
### module
- **Type**: `float`
- **Description**: Gear module in mm.
### pressure_angle
- **Type**: `float, default 20`
- **Description**: Pressure angle in degrees.
### helix_angle
- **Type**: `float, default 25`
- **Description**: Helix angle in degrees.
### gear_height
- **Type**: `float, default 8.0`
- **Description**: Ring gear thickness along Z in mm.
### rim_thickness
- **Type**: `float, default 3.0`
- **Description**: Thickness of the rim beyond the tooth roots in mm.
### backlash
- **Type**: `float, default 0.0`
- **Description**: Circumferential tooth-space clearance at the pitch circle in mm.
### addendum_factor
- **Type**: `float, default 1.0`
- **Description**: Internal tooth addendum as a multiple of module.
### clearance_factor
- **Type**: `float, default 0.25`
- **Description**: Internal tooth root clearance beyond the addendum, as a multiple of module.
@@ -0,0 +1,64 @@
# make_herringbone_gear_rsolid
## API Definition
```python
def make_herringbone_gear_rsolid(n_teeth: int, module: float, pressure_angle: float = 20.0, helix_angle: float = 32.0, gear_height: float = 10.0, *, addendum_factor: float = 1.0, clearance_factor: float = 0.25, backlash: float = 0.0) -> Solid
```
*Source: std/gear.py*
## Import Surface
- standard library: `import simplecadapi as scad` then `scad.std.gear.make_herringbone_gear_rsolid(...)`; direct submodule import: `from simplecadapi.std.gear import make_herringbone_gear_rsolid`
## Description
Create an involute herringbone (double-helical) gear.
Each half is modeled as a small-step ruled loft through rotated copies of
one profile, with a shared center section forming the herringbone ridge.
This keeps closed-wire section correspondence stable while avoiding smooth
loft bulging in STEP exports.
## Parameters
### n_teeth
- **Type**: `int`
- **Description**: Number of teeth (>= 3).
### module
- **Type**: `float`
- **Description**: Gear module in mm.
### pressure_angle
- **Type**: `float, default 20`
- **Description**: Pressure angle in degrees.
### helix_angle
- **Type**: `float, default 32`
- **Description**: Helix angle of each half in degrees.
### gear_height
- **Type**: `float, default 10.0`
- **Description**: Total gear thickness along Z in mm.
### addendum_factor
- **Type**: `float, default 1.0`
- **Description**: Tooth addendum as a multiple of module.
### clearance_factor
- **Type**: `float, default 0.25`
- **Description**: Root clearance beyond the addendum, as a multiple of module.
### backlash
- **Type**: `float, default 0.0`
- **Description**: Circumferential tooth-thickness reduction at the pitch circle in mm.
@@ -0,0 +1,44 @@
# make_herringbone_rack_rsolid
## API Definition
```python
def make_herringbone_rack_rsolid(module: float, n_teeth: int = 10, pressure_angle: float = 20.0, helix_angle: float = 30.0, rack_height: float = 10.0) -> Solid
```
*Source: std/gear.py*
## Import Surface
- standard library: `import simplecadapi as scad` then `scad.std.gear.make_herringbone_rack_rsolid(...)`; direct submodule import: `from simplecadapi.std.gear import make_herringbone_rack_rsolid`
## Description
Create a herringbone rack.
## Parameters
### module
- **Type**: `float`
- **Description**: Gear module in mm (tooth pitch = pi * module).
### n_teeth
- **Type**: `int, default 10`
- **Description**: Number of teeth along the rack.
### pressure_angle
- **Type**: `float, default 20`
- **Description**: Pressure angle in degrees.
### helix_angle
- **Type**: `float, default 30`
- **Description**: Helix angle of each half in degrees.
### rack_height
- **Type**: `float, default 10.0`
- **Description**: Total rack thickness along Z in mm.
@@ -0,0 +1,69 @@
# make_herringbone_ring_gear_rsolid
## API Definition
```python
def make_herringbone_ring_gear_rsolid(n_teeth: int, module: float, pressure_angle: float = 20.0, helix_angle: float = 30.0, gear_height: float = 10.0, rim_thickness: float = 3.0, backlash: float = 0.0, *, addendum_factor: float = 1.0, clearance_factor: float = 0.25) -> Solid
```
*Source: std/gear.py*
## Import Surface
- standard library: `import simplecadapi as scad` then `scad.std.gear.make_herringbone_ring_gear_rsolid(...)`; direct submodule import: `from simplecadapi.std.gear import make_herringbone_ring_gear_rsolid`
## Description
Create an internal herringbone ring gear.
The outer rim is extruded directly. The internal tooth void is built as two
small-step ruled loft halves sharing the center herringbone section, then
subtracted from the rim. Ruled sections avoid smooth loft bulging in STEP
exports while preserving stable section correspondence.
## Parameters
### n_teeth
- **Type**: `int`
- **Description**: Number of internal teeth (>= 3).
### module
- **Type**: `float`
- **Description**: Gear module in mm.
### pressure_angle
- **Type**: `float, default 20`
- **Description**: Pressure angle in degrees.
### helix_angle
- **Type**: `float, default 30`
- **Description**: Helix angle of each half in degrees.
### gear_height
- **Type**: `float, default 10.0`
- **Description**: Total ring gear thickness along Z in mm.
### rim_thickness
- **Type**: `float, default 3.0`
- **Description**: Thickness of the rim beyond the tooth roots in mm.
### backlash
- **Type**: `float, default 0.0`
- **Description**: Circumferential tooth-space clearance at the pitch circle in mm.
### addendum_factor
- **Type**: `float, default 1.0`
- **Description**: Internal tooth addendum as a multiple of module.
### clearance_factor
- **Type**: `float, default 0.25`
- **Description**: Internal tooth root clearance beyond the addendum, as a multiple of module.
@@ -0,0 +1,54 @@
# make_spur_gear_rsolid
## API Definition
```python
def make_spur_gear_rsolid(n_teeth: int, module: float, pressure_angle: float = 20.0, gear_height: float = 6.0, *, addendum_factor: float = 1.0, clearance_factor: float = 0.25, backlash: float = 0.0) -> Solid
```
*Source: std/gear.py*
## Import Surface
- standard library: `import simplecadapi as scad` then `scad.std.gear.make_spur_gear_rsolid(...)`; direct submodule import: `from simplecadapi.std.gear import make_spur_gear_rsolid`
## Description
Create an involute spur gear (straight teeth, helix angle = 0).
## Parameters
### n_teeth
- **Type**: `int`
- **Description**: Number of teeth (>= 3).
### module
- **Type**: `float`
- **Description**: Gear module in mm (pitch diameter = module * n_teeth).
### pressure_angle
- **Type**: `float, default 20`
- **Description**: Pressure angle in degrees.
### gear_height
- **Type**: `float, default 6.0`
- **Description**: Gear thickness / extrusion height along Z in mm.
### addendum_factor
- **Type**: `float, default 1.0`
- **Description**: Tooth addendum as a multiple of module, matching FreeCAD's tooth height factor default.
### clearance_factor
- **Type**: `float, default 0.25`
- **Description**: Root clearance beyond the addendum, as a multiple of module.
### backlash
- **Type**: `float, default 0.0`
- **Description**: Circumferential tooth-thickness reduction at the pitch circle in mm.
@@ -0,0 +1,39 @@
# make_spur_rack_rsolid
## API Definition
```python
def make_spur_rack_rsolid(module: float, n_teeth: int = 10, pressure_angle: float = 20.0, rack_height: float = 6.0) -> Solid
```
*Source: std/gear.py*
## Import Surface
- standard library: `import simplecadapi as scad` then `scad.std.gear.make_spur_rack_rsolid(...)`; direct submodule import: `from simplecadapi.std.gear import make_spur_rack_rsolid`
## Description
Create a straight-tooth rack.
## Parameters
### module
- **Type**: `float`
- **Description**: Gear module in mm (tooth pitch = pi * module).
### n_teeth
- **Type**: `int, default 10`
- **Description**: Number of teeth along the rack.
### pressure_angle
- **Type**: `float, default 20`
- **Description**: Pressure angle in degrees.
### rack_height
- **Type**: `float, default 6.0`
- **Description**: Rack thickness along Z in mm.
@@ -0,0 +1,59 @@
# make_spur_ring_gear_rsolid
## API Definition
```python
def make_spur_ring_gear_rsolid(n_teeth: int, module: float, pressure_angle: float = 20.0, gear_height: float = 6.0, rim_thickness: float = 3.0, backlash: float = 0.0, *, addendum_factor: float = 1.0, clearance_factor: float = 0.25) -> Solid
```
*Source: std/gear.py*
## Import Surface
- standard library: `import simplecadapi as scad` then `scad.std.gear.make_spur_ring_gear_rsolid(...)`; direct submodule import: `from simplecadapi.std.gear import make_spur_ring_gear_rsolid`
## Description
Create an internal spur ring gear.
## Parameters
### n_teeth
- **Type**: `int`
- **Description**: Number of internal teeth (>= 3).
### module
- **Type**: `float`
- **Description**: Gear module in mm.
### pressure_angle
- **Type**: `float, default 20`
- **Description**: Pressure angle in degrees.
### gear_height
- **Type**: `float, default 6.0`
- **Description**: Ring gear thickness along Z in mm.
### rim_thickness
- **Type**: `float, default 3.0`
- **Description**: Thickness of the rim beyond the tooth tips in mm.
### backlash
- **Type**: `float, default 0.0`
- **Description**: Circumferential tooth-space clearance at the pitch circle in mm.
### addendum_factor
- **Type**: `float, default 1.0`
- **Description**: Internal tooth addendum as a multiple of module.
### clearance_factor
- **Type**: `float, default 0.25`
- **Description**: Internal tooth root clearance beyond the addendum, as a multiple of module.