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: Skill Plasmaschneiden

Kai-Jungsthoefela0081713ad6a
diff --git a/app/resources/skills/plasma.md b/app/resources/skills/plasma.md
new file mode 100644
index 0000000..54e92c9
--- /dev/null
+++ b/app/resources/skills/plasma.md
@@ -0,0 +1,91 @@
+---
+title: Plasma cutting
+name: Plasma cutting
+summary: {{material}}, {{thickness}} mm, kerf {{kerf}} mm: holes at least {{min_hole}} mm, no falling islands, webs, heat distortion, tab and slot for welding, one DXF per plate.
+order: 15
+category: Manufacturing
+default: on-demand
+when: parts will be cut from metal plate on a CNC plasma table
+topics: Material and plate; Kerf and accuracy; Holes; Islands, text and webs; Heat and edges; Tab and slot for welding; Structure in the model; Checks and export as DXF
+var material: mild steel | | Material | mild steel=Mild steel, stainless steel=Stainless steel, aluminium=Aluminium
+var thickness: 3 | mm | Plate thickness | 0.5..50
+var kerf: 1.5 | mm | Kerf | 0.5..5
+var min_hole: 5 | mm | Smallest hole that is cut | 1..50
+---
+# Skill: Plasma cutting
+
+The parts are cut by a CNC plasma torch from **{{material}}** plate, {{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}}`,
+`MIN_HOLE = {{min_hole}}`. Plasma only cuts metal. Plastic or wood: the laser cutting or CNC skill.
+
+## Kerf and accuracy
+
+- The torch removes about `KERF` along every cut (1 to 2 mm on air plasma, depending on amperage and nozzle). The CAM
+ program (SheetCam, Fusion, the table software) almost always offsets the path by half the kerf. Model nominal sizes
+ and ask the user to confirm the kerf setting in their CAM. Only if they say it does not compensate, add `KERF / 2` to
+ every outline and subtract it from every hole.
+- Expect ±0.5 mm on a hobby table. Fits tighter than that (bearing seats, dowel holes, threads) are drilled, reamed or
+ machined after cutting: cut them undersized or not at all and write it in `NOTES.md`.
+- The arc lags behind the torch: outer corners come out slightly rounded and inner corners get a radius of about
+ `KERF / 2`. A tab that has to sit in a slot needs a 1 mm chamfer on its corners, or the slot corners need a relief.
+
+## Holes
+
+- Holes below `MIN_HOLE` (and below 1.5 × `THICKNESS` on air plasma) come out tapered, oval or not at all: the pierce
+ and lead-in need room. Leave them out of the cut part, keep their centers in `NOTES.md` (or as a small cut mark if the
+ table can mark), and drill them.
+- Holes that get a thread: cut them smaller than the tap drill, or not at all, then drill and tap. The cut edge is
+ hardened by the heat, a tap breaks in it.
+- Clearance holes for screws: cut 0.5 mm over the ISO 273 medium size, the hole is narrower at the bottom of the plate.
+
+## Islands, text and webs
+
+- Every closed cutout drops whatever is inside it. Text: the insides of A, B, D, O, P, Q, R, 0, 4, 6, 8, 9 fall out.
+ Use a stencil font or add bridges at least 1.5 × `THICKNESS` wide that join the insides to the plate.
+- Text and fine details: strokes at least 1.5 × `THICKNESS` and at least 3 mm wide, letters at least 10 × `THICKNESS`
+ high. Smaller details burn away.
+- Webs between cuts and distances to the edge at least 1.5 × `THICKNESS`, never below 3 mm. Thinner webs warp and
+ melt.
+- Slots at least 1.5 × `THICKNESS` wide, otherwise the arc fills them up.
+
+## Heat and edges
+
+- Long narrow parts bend from the heat (length over 20 × width): make them wider or warn the user. Many cutouts
+ close together in one plate warp it too: spread them or leave more material between them.
+- The bottom edge has dross that is ground off, and the cut faces are 1 to 3° off square. Faces that have to be square
+ or exact are machined afterwards: note them in `NOTES.md`.
+- Bending after cutting: follow the sheet metal skill for radii and distances to the bend. Holes that end up close
+ to a bend are better drilled after bending.
+
+## Tab and slot for welding
+
+Plasma parts are often welded. Tabs and slots locate the plates so the assembly needs no fixture:
+
+- Slot: `THICKNESS + 0.5` mm wide, 0.5 mm longer than the tab. The tab is `THICKNESS` to 2 × `THICKNESS` long and
+ sticks out by `THICKNESS` (room for a fillet weld) or ends flush (ground after welding).
+- At least two tabs per joint, at least 3 × `THICKNESS` from the ends of the edge, and the slot keeps the web rule
+ above from every edge.
+- Corners of the tab chamfered (see the arc lag above), the slot ends square.
+- Ask before adding weld preparation (bevels): most small parts are welded with a plain fillet.
+
+## 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.
+- Drill positions, bend lines, threads and machined faces go into `NOTES.md` per plate, they are not in the cut DXF.
+
+## Checks and export
+
+- Each plate is one piece: `len(plate.solids().vals()) == 1`. More than one solid means an island falls out (see text
+ above).
+- Holes: `[2 * e.radius() for e in plate.edges("%CIRCLE").vals() if e.IsClosed()]` are all at least `MIN_HOLE`,
+ smaller ones are listed for drilling instead.
+- Plates that are not welded together do not intersect: `a.intersect(b).val().Volume()` is 0. Tabs overlap their slot
+ plate only inside the slot.
+- Every plate fits the table and the plate stock: ask for the size when a part is longer than 1000 mm (common tables
+ and sheets: 1220 × 1220, 1250 × 2500, 1500 × 3000 mm).
+- DXF files: set `FLAT = True`, `soma build`, `soma export "Side" --format dxf` for each plate, then `FLAT = False` and
+ build again. Tell the user the DXF is in mm and that the CAM program must add the kerf offset and lead-ins.
diff --git a/app/resources/skills/tolerances.md b/app/resources/skills/tolerances.md
index 561acae..96b5070 100644
--- a/app/resources/skills/tolerances.md
+++ b/app/resources/skills/tolerances.md
@@ -7,7 +7,7 @@ category: Design knowledge
default: on-demand
when: parts must fit together: clearances, holes for screws, sliding or press fits
topics: Manufacturing: {{process}}; Clearances as named constants; Checking interference and gaps in code; Clearance holes ({{hole_fit}}) and tap drills; Counterbores for socket head screws; ISO fits for machined parts
-var process: unknown | | Manufacturing | unknown=not decided yet (agent asks), 3D printing=3D printing, CNC milling=CNC milling, laser cutting=Laser cutting, sheet metal=Sheet metal
+var process: unknown | | Manufacturing | unknown=not decided yet (agent asks), 3D printing=3D printing, CNC milling=CNC milling, laser cutting=Laser cutting, plasma cutting=Plasma cutting, sheet metal=Sheet metal
var hole_fit: medium | | Clearance holes to ISO 273 | fine=fine, medium=medium, coarse=coarse
var min_gap: 0.2 | mm | Minimum gap between parts | 0..5
---
diff --git a/app/test/skills.mjs b/app/test/skills.mjs
index a72e364..5ad0b7f 100644
--- a/app/test/skills.mjs
+++ b/app/test/skills.mjs
@@ -60,13 +60,13 @@ try {
/** Die beiden Listen des Abschnitts: Immer vor „Read when relevant“, Bei Bedarf danach. */
const always = () => (block() ?? '').split('### Read when relevant')[0];
const demand = () => (block() ?? '').split('### Read when relevant')[1] ?? '';
- const DEMAND_NEW = 'cadquery-scripts,shell-environment,soma-app,3d-printing,resin-powder,cnc,laser,sheet-metal,tolerances,joints,strength,assemblies,analysis,animation,fem,drawings';
+ const DEMAND_NEW = 'cadquery-scripts,shell-environment,soma-app,3d-printing,resin-powder,cnc,laser,sheet-metal,plasma,tolerances,joints,strength,assemblies,analysis,animation,fem,drawings';
// 1) Panel: die mitgelieferten Skills nach Kategorien und `order`
await ev(() => document.querySelector('#rail [data-panel="skills"]').click());
await waitFor('Skills geladen', () => window.__t.skills().skills.length >= 3, 10000);
let s = await st();
- const ORDER = 'design-workflow,cadquery,parametric,cadquery-scripts,shell-environment,soma-app,3d-printing,resin-powder,cnc,laser,sheet-metal,tolerances,joints,standard-parts,strength,assemblies,analysis,animation,fem,drawings';
+ const ORDER = 'design-workflow,cadquery,parametric,cadquery-scripts,shell-environment,soma-app,3d-printing,resin-powder,cnc,laser,sheet-metal,plasma,tolerances,joints,standard-parts,strength,assemblies,analysis,animation,fem,drawings';
const heads = await ev(() => [...document.querySelectorAll('#skills-list .sk-cat')].map((h) => h.textContent).join(','));
check('Panel „Skills": Überschriften Way of working, Manufacturing, Design knowledge, Check and present, darunter die Skills nach `order`',
s.skills.map((x) => x.id).join(',') === ORDER && heads === 'Way of working,Manufacturing,Design knowledge,Check and present'
@@ -92,7 +92,7 @@ try {
&& always().includes('- `.soma/skills/parametric.md`: Parametric models') && !always().includes('3d-printing')
&& demand().includes('- `.soma/skills/3d-printing.md`: 3D printing (FDM). Read when the parts will be 3D printed on a filament printer (FDM).')
&& DEMAND_NEW.split(',').every((id) => demand().includes(`.soma/skills/${id}.md`))
- && (await g('ls-files', '.soma/skills')).split('\n').length === 20
+ && (await g('ls-files', '.soma/skills')).split('\n').length === 21
&& (await ev(() => window.__t.saveState())).dirtyFiles === 0, `${String((await ev(() => window.__t.saveState())).dirtyFiles)} | ${String(block()).slice(0, 200)}`);
// Anleitung (E83): Skill „Using the app“ bei Bedarf, Bilder in .soma/help/ (nicht im Verlauf), Hilfe-Fenster aus derselben Quelle
const helpPngs = fs.readdirSync(path.join(APP, 'resources', 'help')).filter((n) => n.endsWith('.png'));
@@ -375,12 +375,12 @@ try {
const fdm2 = fs.readFileSync(path.join(p2.dir, '.soma', 'skills', '3d-printing.md'), 'utf8');
const ka2 = fs.readFileSync(path.join(p2.dir, '.soma', 'skills', 'design-workflow.md'), 'utf8');
check('Neues Modell nach der Vorgabe: immer Sauber modellieren, Parametrik, 3D-Druck, Normteile, Laser aus, Konstruktionsablauf bei Bedarf, Standardwerte statt 55° und PETG',
- JSON.stringify(pj2.skills) === '["cadquery","parametric","3d-printing","standard-parts"]' && pj2.skills_on_demand.join(',') === 'design-workflow,cadquery-scripts,shell-environment,soma-app,resin-powder,cnc,sheet-metal,tolerances,joints,strength,assemblies,analysis,animation,fem,drawings'
+ JSON.stringify(pj2.skills) === '["cadquery","parametric","3d-printing","standard-parts"]' && pj2.skills_on_demand.join(',') === 'design-workflow,cadquery-scripts,shell-environment,soma-app,resin-powder,cnc,sheet-metal,plasma,tolerances,joints,strength,assemblies,analysis,animation,fem,drawings'
&& !pj2.skill_settings && fdm2.includes('Overhangs up to 45°') && fdm2.includes('| Material | PLA |') && !fdm2.includes('On demand') && ka2.includes('> **On demand:**')
&& !fs.existsSync(path.join(p2.dir, '.soma', 'skills', 'laser.md'))
&& norm(fs.readFileSync(path.join(p2.dir, 'AGENTS.md'), 'utf8')).includes('- `.soma/skills/3d-printing.md`: 3D printing (FDM)\n'), JSON.stringify(pj2));
await waitFor('Speicherstand neu', () => window.__t.saveState() && !window.__t.saveState().unsaved, 10000).catch(() => {});
- check('Neues Modell: Skills im Startcommit, nichts ungespeichert', (await exec(['ls-files', '.soma/skills'], p2.dir)).stdout.trim().split('\n').length === 19
+ check('Neues Modell: Skills im Startcommit, nichts ungespeichert', (await exec(['ls-files', '.soma/skills'], p2.dir)).stdout.trim().split('\n').length === 20
&& (await ev(() => window.__t.saveState())).dirtyFiles === 0, String((await ev(() => window.__t.saveState())).dirtyFiles));
// 11) Einstellungen (E78): eigene Skills anlegen, mitgelieferte bearbeiten und zurücksetzen, löschen, importieren
@@ -401,7 +401,7 @@ try {
await ev(() => document.querySelector('#st-nav [data-sec="skills"]').click());
await waitFor('Reiter Skills', () => window.__t.settings().section === 'skills' && window.__t.settings().skills.length >= 19, 10000);
let us = await ust();
- check('Einstellungen: alle mitgelieferten Skills nach Kategorien, keiner gewählt, Hintergrund gesperrt', us.skills.length === 20 && us.skills.every((s) => s.source === 'builtin') && us.selected === null
+ check('Einstellungen: alle mitgelieferten Skills nach Kategorien, keiner gewählt, Hintergrund gesperrt', us.skills.length === 21 && us.skills.every((s) => s.source === 'builtin') && us.selected === null
&& us.list.includes('3D printing (FDM)') && /way of working/i.test(us.list) && await ev(() => {
// Echte Klicks: Das Fenster selbst darf nicht gesperrt sein, der Knopf liegt oben (Treffertest)
const b = document.getElementById('btn-st-new').getBoundingClientRect();
diff --git a/app/test/unit.mjs b/app/test/unit.mjs
index 21cd95b..7d9feb6 100644
--- a/app/test/unit.mjs
+++ b/app/test/unit.mjs
@@ -200,10 +200,10 @@ try {
const SKD = { bundled: path.join(APP, 'resources', 'skills'), user: path.join(tmp, 'keine-eigenen-skills') };
const dm = defaultModes(SKD, {});
check('Neue Modelle: ohne Vorgabe des Nutzers Arbeitsweise (mit Parametrik) und Normteile immer, alle übrigen bei Bedarf', dm.always.join(',') === 'design-workflow,cadquery,parametric,standard-parts'
- && dm.demand.join(',') === 'cadquery-scripts,shell-environment,soma-app,3d-printing,resin-powder,cnc,laser,sheet-metal,tolerances,joints,strength,assemblies,analysis,animation,fem,drawings', JSON.stringify(dm));
+ && dm.demand.join(',') === 'cadquery-scripts,shell-environment,soma-app,3d-printing,resin-powder,cnc,laser,sheet-metal,plasma,tolerances,joints,strength,assemblies,analysis,animation,fem,drawings', JSON.stringify(dm));
const dm2 = defaultModes(SKD, { 'design-workflow': 'demand', tolerances: 'always', '3d-printing': 'always', laser: 'off' });
check('Neue Modelle: Vorgabe des Nutzers geht vor, in der Reihenfolge des Panels, „Aus“ fehlt ganz', dm2.always.join(',') === 'cadquery,parametric,3d-printing,tolerances,standard-parts'
- && dm2.demand.join(',') === 'design-workflow,cadquery-scripts,shell-environment,soma-app,resin-powder,cnc,sheet-metal,joints,strength,assemblies,analysis,animation,fem,drawings', JSON.stringify(dm2));
+ && dm2.demand.join(',') === 'design-workflow,cadquery-scripts,shell-environment,soma-app,resin-powder,cnc,sheet-metal,plasma,joints,strength,assemblies,analysis,animation,fem,drawings', JSON.stringify(dm2));
// Bei Bedarf (E55): Hinweis unter der ersten Überschrift, Werte als Standard der App, vom Nutzer gesetzte mit Namen
const rd = renderSkill(SRC, {}, 'demand');
check('Bei Bedarf: Hinweis direkt unter der Überschrift, mit Leerzeilen, Werte als Standard der App, NOTES.md', rd.includes('# Skill\n\n> **On demand:**')