Skip to content

Commit 161e4bf

Browse files
MadGapunclaude
andcommitted
Q2: rampe_feed ueber Toolpath-Serialisierung erhalten (Roundtrip-Fix)
_serialize_toolpath/_deserialize_toolpath haben das neue Bewegung.rampe_feed weggelassen -> per-Op absoluter Rampen-Vorschub ging auf dem Frontend-Roundtrip verloren (nur der Endpoint-Faktor wirkte). Feld jetzt in beiden Richtungen durchgereicht. +1 API-Test (F900 aus rampe_feed im G-code). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent aa6ca43 commit 161e4bf

2 files changed

Lines changed: 27 additions & 0 deletions

File tree

backend/camwosa/api/endpoints/operations.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,7 @@ def _serialize_toolpath(tp) -> dict:
348348
"x": b.x, "y": b.y, "z": b.z,
349349
"feed": b.feed, "i": b.i, "j": b.j,
350350
"kommentar": b.kommentar,
351+
"rampe_feed": b.rampe_feed, # Q2: Rampen-Feed ueber Roundtrip erhalten
351352
}
352353
for b in tp.bewegungen
353354
],
@@ -375,6 +376,7 @@ def _deserialize_toolpath(daten: dict):
375376
feed=b.get("feed"),
376377
i=b.get("i"), j=b.get("j"),
377378
kommentar=b.get("kommentar", ""),
379+
rampe_feed=b.get("rampe_feed"), # Q2
378380
)
379381
for b in daten["bewegungen"]
380382
],

backend/tests/api/test_zeit_und_trace_api.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,3 +216,28 @@ def test_rampe_erzeugt_schraegen_einstieg(self, client):
216216
})
217217
assert rv.status_code == 200, rv.get_json()
218218
assert "Rampen-Eintauchen" in rv.get_json()["gcode"]
219+
220+
221+
class TestQ2RampeFeedRoundtrip:
222+
"""Q2: rampe_feed ueberlebt Serialize/Deserialize + wirkt im /postprocess."""
223+
224+
def test_rampe_feed_aus_bewegung_im_gcode(self, client):
225+
m = client.get("/api/machines/").get_json()
226+
t = client.get("/api/tools/").get_json()
227+
tp = {
228+
"operation_id": "op", "operation_typ": "kontur", "werkzeug_id": t[0]["id"],
229+
"spindel_rpm": 18000, "sicherheitshoehe": 5, "kommentar": "", "metadaten": {},
230+
"bewegungen": [
231+
{"typ": "eilgang", "x": 0, "y": 0, "z": 5},
232+
{"typ": "plunge", "x": 0, "y": 0, "z": -2, "feed": 300, "rampe_feed": 900},
233+
{"typ": "linear", "x": 80, "y": 0, "z": -2, "feed": 800},
234+
{"typ": "eilgang", "x": 0, "y": 0, "z": 5},
235+
],
236+
}
237+
rv = client.post("/api/operations/postprocess", json={
238+
"maschine_id": m[0]["id"], "werkzeug_id": t[0]["id"], "toolpaths": [tp],
239+
"rampe_eintauchen": True, "rampen_winkel_grad": 5,
240+
})
241+
assert rv.status_code == 200, rv.get_json()
242+
# Rampen-Segmente bekommen den schnelleren Feed 900 (aus rampe_feed)
243+
assert "F900" in rv.get_json()["gcode"]

0 commit comments

Comments
 (0)