Skip to content

armgit / SOMA

Public Imported from GitHub
0

Desktop app for designing parametric 3D models in CadQuery together with the coding agent of your choice

App: Neue Skills, 3D-Druck und Toleranzen überarbeitet (E45, E47)

Kai-Jungsthoefel29f23b8a28c6
diff --git a/app/resources/skills/3d-druck.md b/app/resources/skills/3d-druck.md
index f16b93f..c35e508 100644
--- a/app/resources/skills/3d-druck.md
+++ b/app/resources/skills/3d-druck.md
@@ -3,7 +3,9 @@ title: 3D-Druck (FDM)
name: 3D printing (FDM)
summary: Druckbare Wandstärken, Überhänge bis {{overhang}}°, Spiel für Passungen, Ausrichtung auf dem Druckbett, Gewinde über Einschmelzmuttern.
order: 10
-topics: Drucker und Material; Wände und kleine Details; Überhänge und Brücken; Ausrichtung und Bauraum; Spiel und Passungen; Schrauben und Gewinde; Export als STL oder 3MF
+category: Fertigungsverfahren
+default: off
+topics: Drucker und Material; Wände und kleine Details; Überhänge und Brücken; Ausrichtung und Bauraum; Spiel und Passungen; Schrauben und Gewinde; Prüfen und Export
var material: PLA | | Material | PLA, PETG, ABS, ASA, TPU
var nozzle: 0.4 | mm | Düse | 0.1..1.2
var layer: 0.2 | mm | Schichthöhe | 0.04..0.8
@@ -17,8 +19,8 @@ var clearance: 0.3 | mm | Spiel je Seite (Gleitpassung) | 0..3
---
# Skill: 3D printing (FDM)
-The parts will be printed on a filament printer (FDM). The user set these values in the app, they are binding unless
-the user says otherwise in the chat or in `NOTES.md`:
+The parts are printed on a filament printer (FDM). The user set these values in the app. They apply unless the user
+says otherwise in the chat or in `NOTES.md`:
| Setting | Value |
|---|---|
@@ -31,50 +33,65 @@ the user says otherwise in the chat or in `NOTES.md`:
| Minimum wall | {{min_wall}} mm |
| Clearance per side for sliding fits | {{clearance}} mm |
-Put them into named constants at the top of `model.py` (`NOZZLE = {{nozzle}}`, `CLEARANCE = {{clearance}}`,
-`MAX_OVERHANG = {{overhang}}`, `BED = ({{bed_x}}, {{bed_y}}, {{bed_z}})`) and use the constants, not the numbers.
+Constants at the top of `model.py`: `NOZZLE = {{nozzle}}`, `CLEARANCE = {{clearance}}`, `MAX_OVERHANG = {{overhang}}`,
+`BED = ({{bed_x}}, {{bed_y}}, {{bed_z}})`.
## Walls and small features
-- Walls at least {{min_wall}} mm, more where the part carries load or holds screws. Prefer multiples of the nozzle width
- ({{nozzle}} mm).
+- Walls at least {{min_wall}} mm, more where the part carries load or holds screws. Prefer multiples of the nozzle width.
- No feature thinner than two nozzle widths, no gap narrower than 0.5 mm, no pin thinner than 2 mm.
-- Embossed or engraved text: at least three layers high or deep, letters at least 5 mm tall.
+- Text: at least three layers high or deep, letters at least 5 mm tall.
## Overhangs and bridges
- Overhangs up to {{overhang}}° from vertical (0° is a vertical wall, 90° a flat ceiling) print without support. Avoid
- shapes that need support, or say clearly where they do.
+ shapes that need support, or say where they do.
- Bridges (flat ceilings between two walls) up to {{bridge}} mm are fine.
-- Horizontal holes whose top would overhang more than {{overhang}}°: give them a pointed (teardrop) or flat top instead
- of a round one.
-- Edges on the print bed: chamfer them (0.5 to 1 mm) instead of filleting. A fillet there becomes an overhang.
+- Horizontal holes: pointed (teardrop) or flat top instead of round when the top would overhang too much.
+- Edges on the bed: chamfer 0.5 to 1 mm, no fillet. A fillet there is an overhang, the chamfer also hides the
+ squashed first layer.
## Orientation and size
-- Design each part with its largest flat face on the bed and say which orientation you assume.
-- Layers are the weak direction. Loads should run along the layers, not pull them apart. Snap hooks and clips lie flat.
-- If a part does not fit the build volume of {{bed_x}} × {{bed_y}} × {{bed_z}} mm, split it into pieces that do (with
- alignment pins or a lap joint) and register every piece with `add_part`.
-- One `add_part` per printed body. Do not merge parts that are printed separately.
+- Largest flat face on the bed. Say which orientation you assume.
+- Layers are the weak direction (about half the strength). Loads run along the layers, snap hooks and clips lie flat.
+- Parts larger than the build volume: split them (alignment pins or a lap joint), each piece its own `add_part`.
+- One `add_part` per printed body.
+
+## Material
+
+PLA: stiff, soft above about 55 °C. PETG: tougher, add 0.1 mm to sliding clearances. ABS and ASA: shrink and warp,
+round the corners of large flat parts. TPU: flexible, thicker walls, no press fits.
## Fits and clearances
-- Parts that slide or turn in each other: {{clearance}} mm clearance per side. Loose fit: add 0.1 mm. Press fit: 0.1 mm
- or less, suggest a small test print first.
-- Lids, drawers and sliding parts: at least {{clearance}} mm gap on every side.
-- Printed holes come out about 0.1 to 0.2 mm smaller than modeled. Model screw holes 0.2 mm larger than the nominal
- clearance hole.
-- Every clearance is a named constant. Mating faces never touch with zero gap.
+- Sliding or turning: {{clearance}} mm per side. Loose: add 0.1 mm. Press fit: 0.1 mm or less, suggest a test print.
+- Printed holes come out 0.1 to 0.2 mm small: model screw holes 0.2 mm larger than the nominal clearance hole.
+- Mating faces never touch with zero gap.
## Screws and threads
-- Do not print metric threads below M6. Use heat-set inserts or self-tapping screws instead.
-- Heat-set inserts, typical hole sizes for short inserts: M2 Ø 3.2, M2.5 Ø 3.6, M3 Ø 4.0, M4 Ø 5.6, M5 Ø 6.4 mm, depth
- insert length + 1 mm. Sizes differ between makers: note your assumption in `NOTES.md` or ask the user.
+- No printed metric threads below M6: heat-set inserts or self-tapping screws.
+- Heat-set inserts (short ones), hole Ø: M2 3.2, M2.5 3.6, M3 4.0, M4 5.6, M5 6.4 mm, depth insert length + 1 mm.
+ Makers differ: note your assumption in `NOTES.md`.
- Self-tapping screws for plastic (about 3 mm): hole Ø 2.5 mm.
-- Screw bosses: outer diameter at least 2.5 × the hole, joined to the wall or with ribs, never free-standing and thin.
+- Screw bosses: outer Ø at least 2.5 × the hole, joined to a wall or ribs.
+
+## Checks before you finish
+
+Rotate a copy of each part into print orientation (bed at Z = 0), then:
+
+```python
+import math
+bb = part.val().BoundingBox()
+assert bb.xlen <= BED[0] and bb.ylen <= BED[1] and bb.zlen <= BED[2]
-## Export
+def overhang_faces(part):
+ """Flat faces pointing down more than MAX_OVERHANG, not on the bed: bridges or support."""
+ s = part.val()
+ zmin, lim = s.BoundingBox().zmin, -math.sin(math.radians(MAX_OVERHANG))
+ return [f for f in s.Faces() if f.geomType() == "PLANE" and f.normalAt().z < lim and f.Center().z > zmin + 0.01]
+```
-- Printable parts go out as STL or 3MF, one file per part: `soma export "Lid" --format 3mf`. References are not printed.
+Curved faces (holes, fillets underneath) are not covered: check them in the viewer. Export each printable part as STL or
+3MF: `soma export "Lid" --format 3mf`. References are not printed.
diff --git a/app/resources/skills/baugruppen.md b/app/resources/skills/baugruppen.md
new file mode 100644
index 0000000..4218ac2
--- /dev/null
+++ b/app/resources/skills/baugruppen.md
@@ -0,0 +1,54 @@
+---
+title: Baugruppen und Bewegung
+name: Assemblies and motion
+summary: Teile in Einbaulage aus gemeinsamen Bezügen, Schnittstellen nur einmal definiert, Montierbarkeit, bewegliche Teile über den ganzen Weg prüfen ({{motion_gap}} mm Abstand), Stückliste.
+order: 24
+category: Konstruktionswissen
+default: off
+topics: Bezüge und Einbaulage; Schnittstellen; Montierbarkeit; Bewegliche Teile; Stückliste
+var motion_gap: 1 | mm | Mindestabstand bewegter Teile | 0..20
+---
+# Skill: Assemblies and motion
+
+The user set the minimum gap between moving parts in the app: `MOTION_GAP = {{motion_gap}}`. It applies unless the
+user says otherwise in the chat or in `NOTES.md`.
+
+## Positions
+
+- One coordinate system for the whole model, origin at the main mounting face or axis.
+- Each part is built in its own frame by a function, then placed with `.translate()` and `.rotate()`.
+- Positions come from other parts, not from typed numbers: `LID_Z = BASE_H`, `shaft.translate((0, 0, BEARING_Z))`.
+- Register parts in their assembled position, one group per sub-assembly (`group="Drive"`).
+
+## Interfaces
+
+Define every interface once and use it for both sides: one list `HOLES = [(x, y), ...]` for the bracket and the plate,
+one constant for a shaft diameter, used for the shaft and (plus clearance) for the bore. Then both sides change
+together.
+
+## Assembly
+
+- Every part goes in along a free path, in an order you can name. For more than three parts, write the order into
+ `NOTES.md`.
+- Every screw is reachable with its tool when the parts around it are in place.
+- No part is trapped: nothing is enclosed that has to go in later.
+
+## Moving parts
+
+- The position of a moving part is a constant (`LID_ANGLE = 0`, `SLIDE_TRAVEL = 0`) with its range in a comment. The
+ model shows the normal position.
+- Check the whole range, at least both end positions and the middle:
+
+```python
+for a in (0, 45, 90): # range of LID_ANGLE
+ moved = lid.rotate((0, HINGE_Y, HINGE_Z), (1, HINGE_Y, HINGE_Z), a)
+ print(a, base.intersect(moved).val().Volume(), base.val().distance(moved.val()))
+```
+
+The volume must be 0, the distance at least `MOTION_GAP`, except where parts are meant to touch (pin, guide). Remove
+the output afterwards.
+
+## Parts list
+
+A table in `NOTES.md`: part, count, material or process, and for purchased parts size and length. Update it with every
+new part.
diff --git a/app/resources/skills/blech.md b/app/resources/skills/blech.md
new file mode 100644
index 0000000..80f4098
--- /dev/null
+++ b/app/resources/skills/blech.md
@@ -0,0 +1,55 @@
+---
+title: Blech
+name: Sheet metal
+summary: {{material}}, {{thickness}} mm, Innenradius {{bend_radius}} mm: Biegungen modellieren, Schenkel, Freistiche, Abstände zur Biegung, Abwicklung mit K-Faktor {{k_factor}}.
+order: 14
+category: Fertigungsverfahren
+default: off
+topics: Material und Dicke; Biegungen modellieren; Schenkel, Löcher, Freistiche; Abwicklung; Gewinde und Verbindungen
+var material: steel | | Material | steel=Stahl (DC01), stainless steel=Edelstahl, aluminium=Aluminium
+var thickness: 1.5 | mm | Blechdicke | 0.3..10
+var bend_radius: 1.5 | mm | Innenradius der Biegung | 0..30
+var k_factor: 0.4 | | K-Faktor | 0.2..0.5
+---
+# Skill: Sheet metal
+
+The parts are cut and bent from sheet metal: **{{material}}**. The values apply unless the user says otherwise in the
+chat or in `NOTES.md`. Constants at the top: `T = {{thickness}}` (thickness), `R = {{bend_radius}}` (inner bend radius),
+`K = {{k_factor}}` (K-factor). R at least T, for aluminium at least 1.5 × T (ask for the alloy).
+
+## Modeling bends
+
+CadQuery has no sheet metal tools. Build the flanges as boxes of thickness T, join them and round the bend: inner edge
+R, outer edge R + T. The thickness then stays T in the bend. Example, an L-bracket with outer sizes A (along X), B
+(along Z) and width W:
+
+```python
+a = cq.Workplane("XY").box(A, W, T, centered=(False, True, False))
+b = cq.Workplane("XY").box(T, W, B, centered=(False, True, False))
+part = (a.union(b)
+ .edges(cq.selectors.NearestToPointSelector((T, 0, T))).fillet(R)
+ .edges(cq.selectors.NearestToPointSelector((0, 0, 0))).fillet(R + T))
+```
+
+## Rules
+
+- Constant thickness T everywhere, the same radius R for all bends, preferably 90°.
+- Flanges at least 4 × T + R long (outside size).
+- Holes at least T in diameter, at least 2 × T from an edge and 2.5 × T + R from a bend, otherwise they deform.
+- A bend that ends inside the sheet needs a relief notch: T wide, R + T deep. Where two flanges meet at a corner,
+ leave a gap of at least T.
+- Bent dimensions vary by about ±0.5 mm and ±1°: precise hole patterns on one flange, not across a bend.
+
+## Flat pattern
+
+- Flat length = straight parts + for each bend `angle / 180 × π × (R + K × T)`. For 90° bends, the straight part of a
+ flange is its outside size − (R + T) per bend. Write the flat size into `NOTES.md`.
+- Most sheet metal services unfold the STEP themselves: ask the user. If a DXF is needed: constant `FLAT = False`, with
+ `FLAT = True` the flat blank is registered lying on XY instead of the bent part. Set it, `soma build`,
+ `soma export "Bracket" --format dxf`, set it back, build again. Note the bend lines in `NOTES.md`.
+
+## Threads and joints
+
+- Tapped holes only if T is at least 3 thread pitches (M3 1.5 mm, M4 2.1 mm, M5 2.4 mm). Otherwise press-in nuts or
+ rivet nuts: note the type in `NOTES.md`.
+- Join sheets with screws, rivets or tabs and slots. Welding only if the user asks for it.
diff --git a/app/resources/skills/cadquery.md b/app/resources/skills/cadquery.md
new file mode 100644
index 0000000..39032c4
--- /dev/null
+++ b/app/resources/skills/cadquery.md
@@ -0,0 +1,51 @@
+---
+title: Sauber modellieren (CadQuery)
+name: Clean CadQuery modeling
+summary: Parameter oben, ein Teil je Funktion, feste Reihenfolge der Schritte, robuste Selektoren, typische Fehler vermeiden, jedes Teil prüfen.
+order: 2
+category: Arbeitsweise
+default: on
+topics: Parameter und Aufbau; Reihenfolge der Schritte; Selektoren; Typische Fehler; Jedes Teil prüfen
+---
+# Skill: Clean CadQuery modeling
+
+## Parameters and structure
+
+- Base dimensions are named constants at the top, everything else is derived (`INNER_W = WIDTH - 2 * WALL`). Never
+ type the same number twice.
+- One function per part (`def make_lid(): ... return lid`), the `add_part` calls at the end of `model.py`. Move parts
+ into `parts/` when `model.py` grows beyond about 200 lines.
+- Build each part around a sensible origin (mounting face on XY, symmetric parts centered), then place it with
+ `.translate()` and `.rotate()`.
+
+## Order of operations
+
+1. Base solid: `box`, `extrude`, `revolve`.
+2. Additions and cuts: bosses, pockets, openings.
+3. Holes: `hole`, `cboreHole`, `cskHole`, many at once with `pushPoints`.
+4. Fillets and chamfers last, only on edges you selected precisely.
+
+## Selectors
+
+- Select while the part is still simple and check the count: `assert body.edges("|Z").size() == 4`.
+- On complex parts use `.tag("name")` and `workplaneFromTagged("name")` instead of long selector chains.
+- One specific edge or face: `cq.selectors.NearestToPointSelector((x, y, z))`.
+
+## Typical errors
+
+- Fillet fails (`StdFail_NotDone`, `command not done`): radius too large for the adjacent faces. Use a smaller radius
+ or fewer edges at once.
+- Cutting tools that end exactly on a face leave skins or fail: let them run through by at least 0.1 mm. Bodies that
+ are joined overlap a little instead of touching.
+- Many single cuts in a loop are slow: one tool with `pushPoints`, or union the tools first.
+- No helical threads: model the hole (clearance hole or tap drill) and name the thread in a comment.
+
+## Check every part
+
+```python
+s = part.val()
+assert s.isValid() and len(part.solids().vals()) == 1
+bb = s.BoundingBox() # compare bb.xlen, bb.ylen, bb.zlen with the intended size
+```
+
+Several solids where you expect one: the pieces do not overlap where they should be joined.
diff --git a/app/resources/skills/cnc.md b/app/resources/skills/cnc.md
new file mode 100644
index 0000000..38dbd28
--- /dev/null
+++ b/app/resources/skills/cnc.md
@@ -0,0 +1,53 @@
+---
+title: CNC-Fräsen und Drehen
+name: CNC milling and turning
+summary: {{material}}, kleinster Fräser Ø {{tool_d}} mm, {{axes}}: Innenradien, Taschentiefen, Zugänglichkeit, Bohrungen und Gewinde, Drehteile.
+order: 12
+category: Fertigungsverfahren
+default: off
+topics: Material und Maschine; Innenecken und Taschen; Zugänglichkeit und Aufspannungen; Wände, Bohrungen, Gewinde; Drehteile; Angaben für die Fertigung
+var material: aluminium | | Material | aluminium=Aluminium, steel=Stahl, stainless steel=Edelstahl, brass=Messing, POM=POM, plastic=anderer Kunststoff
+var tool_d: 6 | mm | Kleinster Fräser Ø | 0.5..25
+var axes: 3 | | Maschine | 3=3-Achs, 3+2=3+2-Achs (5 Seiten), 5=5-Achs simultan
+---
+# Skill: CNC milling and turning
+
+The user set these values in the app. They apply unless the user says otherwise in the chat or in `NOTES.md`:
+material **{{material}}**, smallest end mill Ø {{tool_d}} mm, machine with **{{axes}}** axes. Constants at the top:
+`TOOL_D = {{tool_d}}`, `INNER_R = TOOL_D / 2 + 0.2`.
+
+## Inner corners and pockets
+
+- Vertical inner corners cannot be sharp: radius at least `INNER_R`, and at least a third of the pocket depth.
+ Pocket: `.sketch().rect(w, h).vertices().fillet(INNER_R).finalize().cutBlind(-depth)`.
+- A square part that must fit into a pocket: relief holes in the corners (dogbones).
+- Pockets at most 4 × their width deep.
+
+## Access and setups
+
+- "3": everything is machined from the top, or from the bottom after flipping the part. No undercuts, no angled holes.
+ "3+2": five sides and angled holes. "5": also free-form surfaces.
+- Put most features on one side. Each extra side is another setup: say how many the part needs.
+
+## Walls, holes, threads
+
+- Walls at least 1 mm in metal, 1.5 mm in plastics, at most 10 × as high as thick.
+- Holes in standard drill sizes (whole and half millimetres), at most 4 × d deep. Blind holes end in a 118° drill point,
+ about 0.3 × d deeper than the cylinder: leave material for it.
+- Tapped holes: tap drill = d − pitch (M3 2.5, M4 3.3, M5 4.2, M6 5.0, M8 6.8). Thread depth 1.5 × d, 2 × d in
+ aluminium and plastics. Drill 0.5 × d deeper than the thread.
+- Break outer edges with a 0.3 to 0.5 mm chamfer. Outer fillets only where they matter.
+
+## Turned parts
+
+- Model rotational parts with `revolve` of a profile around the axis. Diameters from round bar stock.
+- Inner corners at shoulders get the tool radius (0.4 mm), or an undercut (DIN 509) where a mating part has to sit flat
+ against the shoulder. Chamfer the ends 0.5 × 45°.
+
+## Information for the shop
+
+- STEP files carry no threads, fits or surface finish: list them in `NOTES.md` (thread and depth, fit, which faces
+ matter). Everything else: general tolerance ISO 2768-m.
+- Choose thicknesses from standard plate or bar stock (5, 6, 8, 10, 12, 15, 20 mm).
+- Check before you finish: every inner vertical corner has at least `INNER_R`, every feature is reachable with the
+ machine.
diff --git a/app/resources/skills/festigkeit.md b/app/resources/skills/festigkeit.md
new file mode 100644
index 0000000..8967c5f
--- /dev/null
+++ b/app/resources/skills/festigkeit.md
@@ -0,0 +1,58 @@
+---
+title: Festigkeit und Steifigkeit
+name: Strength and stiffness
+summary: Gestaltungsregeln ohne Simulation: Kerben vermeiden, Rippen statt Masse, kurzer Kraftfluss, Überschlagsrechnung mit Sicherheit {{safety}}, Werkstoffwerte, Gewicht.
+order: 23
+category: Konstruktionswissen
+default: off
+topics: Gestaltungsregeln; Überschlagsrechnung; Werkstoffwerte; Gewicht
+var safety: 2 | | Sicherheitsfaktor | 1..10
+---
+# Skill: Strength and stiffness
+
+No simulation: design for strength with rules and a rough calculation. Safety factor set by the user in the app:
+`SAFETY = {{safety}}`. For parts that carry people, hang overhead or lift loads, say clearly that a real calculation and
+a test are needed.
+
+## Design rules
+
+- Inner corners in the load path get a radius of at least half the wall, at least 1 mm. Sharp corners are where parts
+ break.
+- Even walls. Change thickness gradually (taper about 1:3).
+- Stiffness grows with the cube of the height: make a beam taller, not thicker. L, U and box sections, ribs and edges
+ turned up are much stiffer than flat plates. Closed boxes resist twisting.
+- Ribs: about 0.6 × the wall thick, up to 3 × the wall high, with a fillet at the base.
+- Short, direct load paths. Bosses and mounting points are tied to walls with ribs, not free-standing.
+- Holes and cut-outs where stress is low: near the middle of a bent beam, not at its edges or corners.
+- Printed parts are weaker across the layers (FDM: about half).
+
+## Rough calculation
+
+When the user names a load: cantilever with force F at the free end, length L, rectangular section b × h (N, mm, MPa):
+
+- Stress `6 × F × L / (b × h²)`, at most strength / `SAFETY`.
+- Deflection `4 × F × L³ / (E × b × h³)`.
+
+Put the numbers into the report and into `NOTES.md`.
+
+## Material values (rough)
+
+Strength: tensile strength for plastics and wood, yield strength for metals.
+
+| Material | E (MPa) | Strength (MPa) | Density (g/cm³) |
+|---|---|---|---|
+| PLA, printed | 3500 | 45, across layers 20 | 1.24 |
+| PETG, printed | 2000 | 40, across layers 20 | 1.27 |
+| ABS / ASA, printed | 2000 | 30, across layers 15 | 1.05 |
+| PA (nylon) | 1500 | 50 | 1.14 |
+| POM | 3000 | 60 | 1.41 |
+| Acrylic (PMMA) | 3200 | 60, brittle | 1.19 |
+| Plywood (birch) | 8000 | 40 | 0.70 |
+| Aluminium 6082 | 70000 | 250 | 2.70 |
+| Steel S235 | 210000 | 235 | 7.85 |
+| Stainless steel 1.4301 | 200000 | 210 | 7.90 |
+
+## Weight
+
+`mass_g = part.val().Volume() / 1000 * DENSITY` (volume in mm³, density in g/cm³). Printed parts weigh less because of
+the infill.
diff --git a/app/resources/skills/gehaeuse.md b/app/resources/skills/gehaeuse.md
deleted file mode 100644
index aeb8091..0000000
--- a/app/resources/skills/gehaeuse.md
+++ /dev/null
@@ -1,61 +0,0 @@
----
-title: Gehäusebau
-name: Enclosure design
-summary: Gehäuse um eine Platine oder ein Gerät: Wand {{wall}} mm, Deckel mit Falz, Abstand zur Referenz, Dome für {{screw}}-Schrauben, Ausschnitte, Belüftung.
-order: 30
-topics: Aufbau aus Unterteil, Deckel und Referenz; Maße für Wand, Boden und Abstand; Dome für die Platine; Ausschnitte, Belüftung, Kabel; Prüfungen vor dem Abschluss
-var wall: 2 | mm | Wandstärke | 0.5..20
-var floor: 2 | mm | Boden und Deckel | 0.5..20
-var gap: 1 | mm | Abstand zur Referenz | 0..50
-var headroom: 2 | mm | Luft über dem höchsten Bauteil | 0..100
-var lid: lip | | Deckel | lip=mit Falz, screwed=flach und verschraubt
-var lid_clearance: 0.25 | mm | Spiel Deckel zu Unterteil je Seite | 0..2
-var screw: M3 | | Schrauben | M2, M2.5, M3, M4, M5
-var edge_radius: 1.5 | mm | Außenkanten gerundet | 0..20
-var opening_clearance: 0.5 | mm | Spiel an Ausschnitten je Seite | 0..5
----
-# Skill: Enclosure design
-
-Build enclosures around a circuit board or another part the user brought.
-
-## Structure
-
-- Separate parts for base and lid (more if needed), in one group: `add_part("Base", base, group="Enclosure")`,
- `add_part("Lid", lid, group="Enclosure")`.
-- The board or device stays a reference (`role="reference"`, usually loaded with `import_assembly`). Never change or
- export it.
-- Derive positions from the reference instead of typing numbers: `asm.toCompound().BoundingBox()` for an assembly,
- `shape.val().BoundingBox()` for a single shape. Write the key dimensions of the reference into `NOTES.md`.
-- Constants at the top: `WALL = {{wall}}`, `FLOOR = {{floor}}`, `GAP = {{gap}}` (reference to wall),
- `HEADROOM = {{headroom}}`, `LID_CLEARANCE = {{lid_clearance}}`, `SCREW = "{{screw}}"`.
-
-## Dimensions
-
-The user set these values in the app. They apply unless the user says otherwise in the chat or in `NOTES.md`.
-
-- Wall {{wall}} mm, floor and lid {{floor}} mm. Inner corner radius at least the wall thickness, outer edges rounded
- {{edge_radius}} mm.
-- At least {{gap}} mm between the reference and every inner wall, {{headroom}} mm above the tallest component.
-- Lid style: **{{lid}}**. "lip": the lid has a lip 1.5 to 2 mm high that reaches into the base. "screwed": a flat lid
- held by screws into the standoffs or extra bosses in the corners. Either way {{lid_clearance}} mm clearance per side
- between lid and base.
-
-## Mounting the board
-
-- Standoffs under the mounting holes of the board for {{screw}} screws: outer Ø about 2.2 × the screw size, hole for a
- heat-set insert or a tap drill, high enough that the lowest component on the underside clears the floor by 1 mm.
-- The hole positions must match the reference exactly. Take them from the reference and check them with a measurement.
-
-## Openings
-
-- Cutouts for connectors, buttons, LEDs and displays come from the position of the part in the reference, plus
- {{opening_clearance}} mm clearance per side (more for plugs with molded housings).
-- Ventilation: slots 1.5 to 2 mm wide with webs of at least 2 mm, not where liquid could drip in.
-- Cable entry: a hole or slot with rounded edges, optionally with a strain relief.
-
-## Checks before you finish
-
-- No part may intersect the reference or another part: `base.intersect(board).val().Volume()` is 0 for every pair that
- matters (for an assembly use `board = asm.toCompound()`).
-- The lid can be removed: no undercuts in the direction it comes off.
-- Tell the user how the enclosure goes together: which screws, how many, what length.
diff --git a/app/resources/skills/harz-pulver.md b/app/resources/skills/harz-pulver.md
new file mode 100644
index 0000000..d8ba988
--- /dev/null
+++ b/app/resources/skills/harz-pulver.md
@@ -0,0 +1,47 @@
+---
+title: 3D-Druck Harz und Pulver (SLA, SLS)
+name: Resin and powder 3D printing (SLA, SLS, MJF)
+summary: {{process}}: Wände ab {{min_wall}} mm, Spiel {{clearance}} mm je Seite, Hohlkörper mit Ablauflöchern, Ausrichtung und Stützen.
+order: 11
+category: Fertigungsverfahren
+default: off
+topics: Verfahren: {{process}}; Wände und Details; Hohlkörper; Ausrichtung und Stützen; Spiel und Gewinde; Prüfen und Export
+var process: SLA | | Verfahren | SLA=Harz (SLA, DLP), SLS=Pulver (SLS, MJF)
+var min_wall: 1 | mm | Mindestwand | 0.3..10
+var clearance: 0.2 | mm | Spiel je Seite (Gleitpassung) | 0..2
+---
+# Skill: Resin and powder 3D printing
+
+Process set by the user in the app: **{{process}}**. "SLA" means resin printers (SLA, DLP, MSLA), "SLS" powder bed
+printers (SLS, MJF). The values apply unless the user says otherwise in the chat or in `NOTES.md`. Constants at the
+top: `MIN_WALL = {{min_wall}}`, `CLEARANCE = {{clearance}}`.
+
+## Walls and details
+
+- Walls at least {{min_wall}} mm, free-standing thin features (fins, pins) at least twice that.
+- Holes below about 1 mm (SLA) or 2 mm (SLS) close up. Embossed and engraved details at least 0.5 mm.
+- Thick solid blocks waste material, crack (SLA) or warp (SLS): hollow them out or keep walls even.
+
+## Hollow parts
+
+- Every cavity needs at least two escape holes (air in, resin or powder out): SLA at least Ø 3.5 mm, SLS at least Ø 5 mm.
+- Closed cavities without holes trap resin or powder: avoid them or say so.
+
+## Orientation and support
+
+- SLA: parts print tilted on supports, which leave marks. Say which faces must stay clean. Hollow shapes that open
+ towards the build platform (cups) cause suction: give them a vent hole. Desktop printers are small: ask for the build
+ volume when a part is larger than about 100 mm.
+- SLS: no supports, any orientation, overhangs are free. Parts can be printed inside each other.
+
+## Fits and threads
+
+- Sliding or turning: {{clearance}} mm per side. Parts printed moving inside each other: at least 0.5 mm gap, so resin
+ or powder can get out.
+- Threads from M6 can be printed. Smaller: model the tap drill and tap the hole, or use inserts.
+- Standard resins are brittle: no snap fits and no press fits, unless the user names a tough resin.
+
+## Checks before you finish
+
+- Every cavity has its escape holes, no wall is below {{min_wall}} mm (section view in the app, or measure).
+- Export each part as STL or 3MF: `soma export "Lid" --format 3mf`. References are not printed.
diff --git a/app/resources/skills/konstruktionsablauf.md b/app/resources/skills/konstruktionsablauf.md
new file mode 100644
index 0000000..07cc777
--- /dev/null
+++ b/app/resources/skills/konstruktionsablauf.md
@@ -0,0 +1,46 @@
+---
+title: Konstruktionsablauf
+name: Design workflow
+summary: Erst Anforderungen klären, dann vom Groben ins Feine, in kleinen Schritten, mit kurzem Bericht. Fehlende Angaben: {{ask}}. Detailgrad: {{detail}}.
+order: 1
+category: Arbeitsweise
+default: on
+topics: Anforderungen klären; Vom Groben ins Feine; Kleine Schritte; Bericht am Ende
+var ask: ask | | Fehlende Angaben | ask=erst fragen, assume=annehmen und notieren
+var detail: prototype | | Detailgrad | concept=Konzept, prototype=Prototyp, production=fertigungsreif
+---
+# Skill: Design workflow
+
+The user set these values in the app. They apply unless the user says otherwise in the chat or in `NOTES.md`.
+
+## Before you model
+
+- Find out: what the part does, where it sits and what it touches, size limits, loads, environment (heat, water,
+ outdoors), how it is made and how many.
+- Interfaces first: sizes of things the part must fit (devices, screws, mounting holes) come from the user, a datasheet
+ or a file in `inputs/`, never from memory.
+- Missing information: **{{ask}}**. "ask": ask before you model, at most five short questions at once. "assume": choose
+ sensible values, mark them as assumptions and go on.
+- Write requirements and assumptions into `NOTES.md` under `## Requirements`, one line each, assumptions marked
+ `(assumed)`.
+
+## Coarse to fine
+
+1. Envelope and interfaces: main volumes, mounting faces, holes, mating dimensions.
+2. Function: walls, openings, moving parts, fits.
+3. Details: fillets, chamfers, text. Only when the shape is accepted.
+
+Level of detail: **{{detail}}**. "concept": main shapes only, no fillets or small holes. "prototype": functional and
+buildable, fits and holes correct, few cosmetic details. "production": complete, edges broken, all checks of the active
+skills done, files exported.
+
+## Small steps
+
+- One change at a time: change, `soma build`, check, commit. Do not rewrite the model for a small change.
+- A wish that conflicts with `NOTES.md`: say so and ask which one applies.
+- A dimension the user cares about is never guessed. Ask.
+
+## Report
+
+After each step, three to six lines: main dimensions, what changed, assumptions, what the user should check (for
+example a test print of a fit), open questions.
diff --git a/app/resources/skills/laser.md b/app/resources/skills/laser.md
new file mode 100644
index 0000000..ed68b3d
--- /dev/null
+++ b/app/resources/skills/laser.md
@@ -0,0 +1,49 @@
+---
+title: Laserschneiden
+name: Laser cutting
+summary: Teile aus {{material}}, {{thickness}} mm: Steckverbindungen mit Schnittbreite {{kerf}} mm, Mindeststege, Zusammenbau in 3D, DXF je Platte.
+order: 13
+category: Fertigungsverfahren
+default: off
+topics: Material und Plattenstärke; Schnittbreite und Steckverbindungen; Stege, Löcher, Ecken; Aufbau im Modell; Prüfen und Export als DXF
+var material: plywood | | Material | plywood=Sperrholz, MDF=MDF, acrylic=Acryl (PMMA), cardboard=Karton
+var thickness: 3 | mm | Plattenstärke | 0.5..25
+var kerf: 0.15 | mm | Schnittbreite | 0..1
+---
+# Skill: Laser cutting
+
+The parts are cut by a laser from flat sheets of **{{material}}**, {{thickness}} mm thick. The values apply unless the
+user says otherwise in the chat or in `NOTES.md`. Constants at the top: `THICKNESS = {{thickness}}`, `KERF = {{kerf}}`.
+Real sheets differ from nominal (plywood "3 mm" is often 2.8 to 3.2 mm): ask the user to measure when fits matter.
+
+## Kerf and joints
+
+- The laser burns away `KERF` along every cut: holes and slots come out `KERF` wider, outlines and tabs `KERF` smaller.
+ Ask whether the laser compensates this already. If it does, model nominal sizes.
+- Snug slot for a plate: `THICKNESS - KERF` wide. Slip fit: 0.1 mm more.
+- Finger joints and tabs: draw the fingers `KERF` wider and the gaps `KERF` narrower than nominal.
+- Acrylic cracks under press fits: slip fit plus glue or screws. Wood and MDF take press fits.
+- Screwed joints: T-slot with a captive nut in the plate that the screw enters.
+
+## Webs, holes, corners
+
+- Webs between cuts and distances to the edge at least 1.5 × `THICKNESS`, never below 2 mm.
+- Holes at least `THICKNESS` in diameter.
+- Acrylic: inner corners with 0.5 mm radius against cracks. Sharp inner corners are fine in wood.
+
+## In the model
+
+- One part per plate. A function builds it lying flat on XY (an extruded 2D profile, thickness along Z), then it is
+ rotated and moved into the assembly.
+- Constant `FLAT = False` at the top. With `FLAT = True`, `model.py` registers the plates flat on XY next to each other
+ instead of assembled. `soma export` writes a DXF from a section through the middle of the part, so it only works on
+ flat plates.
+- Engravings (lines, text) are not in the cut DXF: list them in `NOTES.md` or ask how the user's laser takes them.
+
+## Checks and export
+
+- Plates that are not joined do not intersect: `a.intersect(b).val().Volume()` is 0. Joined plates overlap only by the
+ kerf allowance.
+- Every plate fits the sheet or laser bed: ask for its size when a part is longer than 300 mm.
+- DXF files: set `FLAT = True`, `soma build`, `soma export "Side" --format dxf` for each plate, then `FLAT = False` and
+ build again.
diff --git a/app/resources/skills/normteile.md b/app/resources/skills/normteile.md
new file mode 100644
index 0000000..0f683db
--- /dev/null
+++ b/app/resources/skills/normteile.md
@@ -0,0 +1,53 @@
+---
+title: Normteile
+name: Standard parts
+summary: Maße von Schrauben, Muttern, Scheiben, Kugellagern, Passstiften und Alu-Profilen, Mutternfallen, Normteile im Modell.
+order: 22
+category: Konstruktionswissen
+default: off
+topics: Schrauben, Muttern, Scheiben; Mutternfallen; Kugellager; Passstifte und Profile; Normteile im Modell
+---
+# Skill: Standard parts
+
+Nominal sizes in mm. Real parts vary: if the user has the parts, ask them to measure what matters. Other purchased
+parts (motors, switches, displays): never guess, ask for a datasheet or a STEP file.
+
+## Screws, nuts, washers
+
+| Thread | Pitch | Socket head ISO 4762 Ø × height | Hex key | Countersunk ISO 10642 head Ø | Nut ISO 4032 across flats × height | Washer ISO 7089 Ø × thickness |
+|---|---|---|---|---|---|---|
+| M2 | 0.4 | 3.8 × 2 | 1.5 | – | 4 × 1.6 | 5 × 0.3 |
+| M2.5 | 0.45 | 4.5 × 2.5 | 2 | – | 5 × 2 | 6 × 0.5 |
+| M3 | 0.5 | 5.5 × 3 | 2.5 | 6.7 | 5.5 × 2.4 | 7 × 0.5 |
+| M4 | 0.7 | 7 × 4 | 3 | 9.0 | 7 × 3.2 | 9 × 0.8 |
+| M5 | 0.8 | 8.5 × 5 | 4 | 11.2 | 8 × 4.7 | 10 × 1 |
+| M6 | 1 | 10 × 6 | 5 | 13.4 | 10 × 5.2 | 12 × 1.6 |
+| M8 | 1.25 | 13 × 8 | 6 | 17.9 | 13 × 6.8 | 16 × 1.6 |
+
+## Nut traps
+
+`polygon()` takes the diameter across the corners, not across the flats. Hexagonal pocket for a nut with across flats
+`AF`, corners pointing along X, depth nut height + 0.2 mm:
+
+```python
+.polygon(6, (AF + 2 * CLEARANCE) / math.cos(math.radians(30))).cutBlind(-(NUT_H + 0.2))
+```
+
+## Ball bearings (d × D × width)
+
+- 623: 3 × 10 × 4, 624: 4 × 13 × 5, 625: 5 × 16 × 5, 626: 6 × 19 × 6, 608: 8 × 22 × 7, 688: 8 × 16 × 5.
+- 6000: 10 × 26 × 8, 6001: 12 × 28 × 8, 6002: 15 × 32 × 9, 6200: 10 × 30 × 9, 6201: 12 × 32 × 10.
+- Shoulders: on the shaft about d + 0.2 × (D − d), in the housing about D − 0.2 × (D − d).
+- Machined seats: housing H7, shaft k6. Printed seats: start with D and adjust after a test print.
+
+## Pins and profiles
+
+- Dowel pins ISO 8734 (m6): Ø 2, 3, 4, 5, 6, 8 mm, lengths 6, 8, 10, 12, 16, 20 mm and more. Holes H7.
+- Aluminium extrusions, typical: 2020 slot 6 with M5, 3030 slot 8 with M6, 4040 slot 8 with M8. Systems differ: ask
+ which one.
+
+## In the model
+
+Purchased parts may be modeled simplified (screw: head and shank without thread, bearing: a ring) with
+`group="Hardware"` and `role="reference"`: visible and checked for collisions, but not exported. List them in the
+parts list in `NOTES.md`.
diff --git a/app/resources/skills/toleranzen.md b/app/resources/skills/toleranzen.md
index d717618..b0fb5c9 100644
--- a/app/resources/skills/toleranzen.md
+++ b/app/resources/skills/toleranzen.md
@@ -3,11 +3,12 @@ title: Toleranzen und Passungen
name: Tolerances and fits
summary: Spiel als benannte Konstanten, Kollisionsprüfung im Code, Durchgangs- und Kernlöcher, Senkungen für Zylinderschrauben, ISO-Passungen.
order: 20
-topics: Fertigung: {{process}}; Spiel als benannte Konstanten; Kollisionen und Abstände im Code prüfen; Durchgangslöcher ({{hole_fit}}) und Kernlöcher; Senkungen für Zylinderschrauben; ISO-Passungen für gefertigte Teile; Laser- und Blechteile
+category: Konstruktionswissen
+default: off
+topics: Fertigung: {{process}}; Spiel als benannte Konstanten; Kollisionen und Abstände im Code prüfen; Durchgangslöcher ({{hole_fit}}) und Kernlöcher; Senkungen für Zylinderschrauben; ISO-Passungen für gefertigte Teile
var process: unknown | | Fertigung | unknown=noch offen (Agent fragt), 3D printing=3D-Druck, CNC milling=CNC-Fräsen, laser cutting=Laserschneiden, sheet metal=Blech
var hole_fit: medium | | Durchgangslöcher nach ISO 273 | fine=fein, medium=mittel, coarse=grob
var min_gap: 0.2 | mm | Mindestabstand zwischen Teilen | 0..5
-var kerf: 0.15 | mm | Spiel für Laserteile je Seite | 0..1
---
# Skill: Tolerances and fits
@@ -16,25 +17,25 @@ Every real part deviates from its nominal size. Design so that parts still fit w
## General rules
- Manufacturing process set by the user in the app: **{{process}}**. If it is "unknown" and `NOTES.md` does not say how
- the parts are made (3D printing, CNC milling, laser cutting, sheet metal), ask. The clearances depend on it.
-- Put every clearance, fit and allowance into a named constant at the top of `model.py` (`SCREW_CLEARANCE`, `LID_GAP`).
- Never hide them in expressions.
-- Mating faces never share the exact same coordinate: leave a defined gap, or a defined overlap for a press fit.
+ the parts are made, ask: the clearances depend on it. An active skill for the process has more specific values, they
+ take precedence over this one.
+- Every clearance, fit and allowance is a named constant at the top of `model.py` (`SCREW_CLEARANCE`, `LID_GAP`), never
+ hidden in expressions.
+- Mating faces never share the exact same coordinate: a defined gap, or a defined overlap for a press fit.
- Parts that must not touch keep at least {{min_gap}} mm distance (`MIN_GAP = {{min_gap}}`).
- Dimension from the functional faces: a hole follows the part it has to meet, not an arbitrary outer edge.
-- After building, check the critical gaps (measure them or compute them, see below) and tell the user the values.
+- Tight tolerances only where they matter. Everything else: general tolerance ISO 2768-m.
## Checking clearances in code
-- Interference: `a.intersect(b).val().Volume()` must be (close to) 0 for parts that must not touch, and for a part and
- a reference (`role="reference"`).
-- Smallest gap between two shapes in mm: `a.val().distance(b.val())`, at least {{min_gap}} mm.
-- Print such checks only while you work on them and remove the debug output afterwards.
+- Interference: `a.intersect(b).val().Volume()` is (close to) 0 for parts that must not touch, also for a part and a
+ reference (`role="reference"`).
+- Smallest gap in mm: `a.val().distance(b.val())`, at least {{min_gap}} mm.
+- Tell the user the critical gaps. Remove the debug output afterwards.
## Holes for metric screws
-Clearance holes after ISO 273 and tap drills (core holes) for coarse threads, in mm. The user chose the **{{hole_fit}}**
-column. For printed parts the 3D printing skill adds to these values.
+Clearance holes after ISO 273 and tap drills for coarse threads, in mm. The user chose the **{{hole_fit}}** column.
| Thread | Fine | Medium | Coarse | Tap drill |
|---|---|---|---|---|
@@ -48,18 +49,12 @@ column. For printed parts the 3D printing skill adds to these values.
## Counterbores for socket head screws
-For ISO 4762 (DIN 912) screws, so that the head sits flush. Values in mm, with some room around the head. If the exact
-standard matters, say which values you used.
+ISO 4762 (DIN 912), head flush, with some room around it:
-| Thread | Head Ø | Counterbore Ø | Depth |
-|---|---|---|---|
-| M2 | 3.8 | 4.4 | 2.4 |
-| M2.5 | 4.5 | 5.5 | 2.9 |
-| M3 | 5.5 | 6.5 | 3.4 |
-| M4 | 7.0 | 8.0 | 4.4 |
-| M5 | 8.5 | 10.0 | 5.4 |
-| M6 | 10.0 | 11.0 | 6.4 |
-| M8 | 13.0 | 15.0 | 8.6 |
+| Thread | M2 | M2.5 | M3 | M4 | M5 | M6 | M8 |
+|---|---|---|---|---|---|---|---|
+| Counterbore Ø | 4.4 | 5.5 | 6.5 | 8.0 | 10.0 | 11.0 | 15.0 |
+| Depth | 2.4 | 2.9 | 3.4 | 4.4 | 5.4 | 6.4 | 8.6 |
In CadQuery: `.cboreHole(diameter, cboreDiameter, cboreDepth)`. Countersunk screws (ISO 10642, 90°):
`.cskHole(diameter, cskDiameter, 90)`.
@@ -67,9 +62,5 @@ In CadQuery: `.cboreHole(diameter, cboreDiameter, cboreDepth)`. Countersunk scre
## Fits for machined parts (ISO 286)
- Shaft turning or sliding in a hole: H7/g6. Located, assembled by hand: H7/h6. Press fit: H7/p6.
-- Model the nominal size. Write the fit as a comment next to the constant and in `NOTES.md` (`BORE = 8 # H7`). Do not
- build the tolerance band into the geometry.
-
-## Laser-cut and sheet parts
-
-- Slots and tabs: {{kerf}} mm clearance per side (`KERF_CLEARANCE = {{kerf}}`). Keep the material thickness as a constant.
+- Model the nominal size and write the fit as a comment and in `NOTES.md` (`BORE = 8 # H7`). Do not build the
+ tolerance band into the geometry.
diff --git a/app/resources/skills/verbindungen.md b/app/resources/skills/verbindungen.md
new file mode 100644
index 0000000..018c4fb
--- /dev/null
+++ b/app/resources/skills/verbindungen.md
@@ -0,0 +1,45 @@
+---
+title: Verbindungen
+name: Joints and fasteners
+summary: Schrauben (bevorzugt {{screw}}) mit Einschraubtiefe und Randabstand, Schnapphaken, Scharniere, Stifte und Formschluss, Magnete, Kleben.
+order: 21
+category: Konstruktionswissen
+default: off
+topics: Schrauben; Schnapphaken; Scharniere; Stifte und Formschluss; Magnete und Kleben
+var screw: M3 | | Bevorzugte Schraube | M2, M2.5, M3, M4, M5, M6, M8
+---
+# Skill: Joints and fasteners
+
+The user set the preferred screw size in the app. It applies unless the user says otherwise in the chat or in
+`NOTES.md`. Clearances for sliding fits come from the active process or tolerances skill.
+
+## Screws
+
+- Prefer **{{screw}}** and as few different sizes as possible. Larger only where the load needs it.
+- Thread engagement: 1.5 × d in steel and brass, 2 × d in aluminium, 2.5 × d in plastics.
+- Hole centre at least 1.5 × d from an edge, 2 × d in plastics.
+- Free line along the screw axis for the screwdriver or hex key, also when the other parts are already mounted.
+- Standard lengths (ISO 4762): 4, 5, 6, 8, 10, 12, 16, 20, 25, 30, 35, 40 mm. Choose one, then design around it.
+- Every screw, nut and insert goes into the parts list in `NOTES.md`: size, length, count.
+
+## Snap fits
+
+- Cantilever hook: length L at least 5 × the thickness t at the root, root fillet about 0.5 × t.
+- Hook depth at most `0.67 × e × L² / t`. Allowed strain e: PLA 1 %, PETG and ABS 2 %, PA, POM and PP 4 %.
+- Lead-in slope about 30°. Retaining face square (permanent) or at 45° (can be opened again).
+
+## Hinges
+
+- Pin hinge: pin at least Ø 3 mm. A screw or steel pin is stronger than a printed pin.
+- Living hinges only in PP or PE, 0.3 to 0.5 mm thick.
+
+## Pins and positive locking
+
+- Alignment with two dowel pins: one in a round hole, the other in a slot, so the parts are not over-constrained.
+- Parts that look alike go together only one way: an off-centre pin or tab.
+- Sliding joints (dovetail, T-slot): sliding fit clearance per side, chamfer at the entry.
+
+## Magnets and glue
+
+- Magnet pockets: magnet Ø + 0.1 to 0.2 mm, glue the magnets in. Note the polarity in `NOTES.md`.
+- Glued joints: gap 0.1 to 0.2 mm, large faces, loaded in shear, not in peel.