Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
kurse:efcomputergrafik:kw48 [2019/11/28 07:47] Ivo Blöchliger [Umgang mit Inkscape] |
kurse:efcomputergrafik:kw48 [2019/12/04 11:48] (current) Ivo Blöchliger [Text-Analyse mit Python] |
||
---|---|---|---|
Line 112: | Line 112: | ||
* Shift-Ctrl-C: | * Shift-Ctrl-C: | ||
* Ctrl-K: Combine (mehrere Pfade in einen Pfad zusammenfassen). | * Ctrl-K: Combine (mehrere Pfade in einen Pfad zusammenfassen). | ||
- | |||
- | ===== Text-Analyse mit Python ===== | ||
- | === Datei einlesen === | ||
- | Von https:// | ||
- | <code python> | ||
- | with open(' | ||
- | content = content_file.read() | ||
- | </ | ||
- | === Text finden === | ||
- | https:// | ||
- | <code python> | ||
- | position = content.find("< | ||
- | if (position!=-1): | ||
- | # tu was damit | ||
- | </ | ||
- | |||
- | === Text Analyse === | ||
- | Ist der Path-String einmal gefunden, geht es darum, diesen zu analysieren. Als erster Schritt soll dieser nach Leerschlägen aufgeteilt werden: | ||
- | <code python> | ||
- | txt = "foo bar baz boo" | ||
- | items = txt.split(" | ||
- | </ | ||
- | |||
- | === Convertierung in Zahlen === | ||
- | <code python> | ||
- | zahl = float(" | ||
- | </ | ||
- | |||
- | ===== G-Code für den Plotter ===== | ||
- | Der Nullpunkt befindet sich bei den Radien $r_1=r_2=1445$ (in mm). Pro Motorschritt verändern sich die Radien um $\approx 0.0157029$ (mm). Die Motoren haben einen Abstand von 1930 mm. | ||
- | |||
- | Der G-Code bezieht sich direkt auf die Motorenschritte (was eigentlich gerade nicht der Sinn von G-Code ist). | ||
- | |||
- | Nur G1 (lineare Interpolation) ist implementiert: | ||
- | * G1 X-400 Y800 (Gehe zur absoluten Position -400 Schritte (Motor links) und +800 Schritte (Motor rechts). | ||
- | * G1 Z0 (Stift hoch, nicht zeichnen) | ||
- | * G1 Z1 (Stift runter, zeichnen) | ||
- | Nach jedem Kommando muss auf ein ' | ||