Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
P
Printrun
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
machinery
Printrun
Commits
6dff5776
Commit
6dff5776
authored
Jan 09, 2012
by
Kliment Yanev
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'experimental' of github.com:kliment/Printrun into experimental
parents
7dc1eb79
e8daa864
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
1319 additions
and
1226 deletions
+1319
-1226
de.po
locale/de/LC_MESSAGES/de.po
+386
-387
pronterface.mo
locale/de/LC_MESSAGES/pronterface.mo
+0
-0
pronterface.pot
locale/pronterface.pot
+214
-159
plater.py
plater.py
+234
-233
pronterface.py
pronterface.py
+65
-37
stlview.py
stlview.py
+420
-410
No files found.
locale/de/LC_MESSAGES/de.po
View file @
6dff5776
...
@@ -5,628 +5,627 @@
...
@@ -5,628 +5,627 @@
msgid ""
msgid ""
msgstr ""
msgstr ""
"Project-Id-Version: Pronterface jm1\n"
"Project-Id-Version: Pronterface jm1\n"
"POT-Creation-Date: 201
1-09-06 16:31+0100
\n"
"POT-Creation-Date: 201
2-01-09 10:00+CET
\n"
"PO-Revision-Date: 201
1-09-06 16:31
+0100\n"
"PO-Revision-Date: 201
2-01-09 10:30
+0100\n"
"Last-Translator:
Jonathan Marsden <jmarsden@fastmail.fm
>\n"
"Last-Translator:
Christian Metzen <metzench@ccux-linux.de
>\n"
"Language-Team: DE <LL@li.org>\n"
"Language-Team: DE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: \n"
"Generated-By: pygettext.py 1.5\n"
"Generated-By: pygettext.py 1.5\n"
#: pronterface.py:1
0
#: pronterface.py:1
5
msgid "WX is not installed. This program requires WX to run."
msgid "WX is not installed. This program requires WX to run."
msgstr "WX ist nicht installiert. Dieses Programm erfordert WX zu laufen."
msgstr "WX ist nicht installiert. Dieses Programm erfordert WX zum Starten."
#: pronterface.py:60
msgid "Printer Interface"
msgstr "Druckerschnittstelle"
#: pronterface.py:72
msgid "X+100"
msgstr ""
#: pronterface.py:73
msgid "X+10"
msgstr ""
#: pronterface.py:74
#: pronterface.py:65
msgid "X+1"
msgid ""
msgstr ""
"Dimensions of Build Platform\n"
" & optional offset of origin\n"
"\n"
"Examples:\n"
" XXXxYYY\n"
" XXX,YYY,ZZZ\n"
" XXXxYYYxZZZ+OffX+OffY+OffZ"
msgstr ""
"Abmessungen der Bauplattform\n"
" & optional Versatz vom Ausgangspunkt\n"
"\n"
"Beispiel:\n"
" XXXxYYY\n"
" XXX,YYY,ZZZ\n"
" XXXxYYYxZZZ+OffX+OffY+OffZ"
#: pronterface.py:66
msgid "Last Set Temperature for the Heated Print Bed"
msgstr "Letzte gesetzte Temperatur für das Heizbett"
#: pronterface.py:67
msgid "Folder of last opened file"
msgstr "Verzeichniss der zuletzt geöffneten Datei"
#: pronterface.py:68
msgid "Last Temperature of the Hot End"
msgstr "Letzte Hotend Temperatur"
#: pronterface.py:69
msgid "Width of Extrusion in Preview (default: 0.5)"
msgstr "Vorschaubreite der Extrudierung (Vorgabe: 0.5)"
#: pronterface.py:70
msgid "Fine Grid Spacing (default: 10)"
msgstr "Feiner Rasterabstand (Vorgabe: 10)"
#: pronterface.py:71
msgid "Coarse Grid Spacing (default: 50)"
msgstr "Grober Rasterabstand (Vorgabe: 50)"
#: pronterface.py:75
#: pronterface.py:75
msgid "X+0.1"
msgid "Printer Interface"
msgstr ""
msgstr "Printer Interface"
#: pronterface.py:76
msgid "HomeX"
msgstr "XHeimkehren"
#: pronterface.py:77
msgid "X-0.1"
msgstr ""
#: pronterface.py:78
msgid "X-1"
msgstr ""
#: pronterface.py:79
msgid "X-10"
msgstr ""
#: pronterface.py:80
msgid "X-100"
msgstr ""
#: pronterface.py:81
msgid "Y+100"
msgstr ""
#: pronterface.py:82
msgid "Y+10"
msgstr ""
#: pronterface.py:83
msgid "Y+1"
msgstr ""
#: pronterface.py:84
msgid "Y+0.1"
msgstr ""
#: pronterface.py:85
msgid "HomeY"
msgstr "YHeimkehren"
#: pronterface.py:86
msgid "Y-0.1"
msgstr ""
#: pronterface.py:87
msgid "Y-1"
msgstr ""
#: pronterface.py:88
msgid "Y-10"
msgstr ""
#: pronterface.py:89
msgid "Y-100"
msgstr ""
#: pronterface.py:9
0
#: pronterface.py:9
1
msgid "Motors off"
msgid "Motors off"
msgstr "Motoren aus"
msgstr "Motoren aus"
#: pronterface.py:91
msgid "Z+10"
msgstr ""
#: pronterface.py:92
#: pronterface.py:92
msgid "Z+1"
msgstr ""
#: pronterface.py:93
msgid "Z+0.1"
msgstr ""
#: pronterface.py:94
msgid "HomeZ"
msgstr "ZHeimkehren"
#: pronterface.py:95
msgid "Z-0.1"
msgstr ""
#: pronterface.py:96
msgid "Z-1"
msgstr ""
#: pronterface.py:97
msgid "Z-10"
msgstr ""
#: pronterface.py:98
msgid "Home"
msgstr "Heimkehren"
#: pronterface.py:99
msgid "Check temp"
msgid "Check temp"
msgstr "Temperatur prüfen"
msgstr "Temperatur prüfen"
#: pronterface.py:
100
#: pronterface.py:
93
msgid "Extrude"
msgid "Extrude"
msgstr ""
msgstr "
Extrudieren
"
#: pronterface.py:
101
#: pronterface.py:
94
msgid "Reverse"
msgid "Reverse"
msgstr "Umkehren"
msgstr "Umkehren"
#: pronterface.py:11
7
#: pronterface.py:11
2
msgid ""
msgid ""
"# I moved all your custom buttons into .pronsolerc.\n"
"# I moved all your custom buttons into .pronsolerc.\n"
"# Please don't add them here any more.\n"
"# Please don't add them here any more.\n"
"# Backup of your old buttons is in custombtn.old\n"
"# Backup of your old buttons is in custombtn.old\n"
msgstr ""
msgstr ""
"# Alle individuellen Buttons in .pronsolerc eingetragen.\n"
"# Bitte fügen Sie sie hier nicht mehr ein.\n"
"# Backup Ihrer alten Buttons befindet sich in custombtn.old\n"
#: pronterface.py:1
22
#: pronterface.py:1
17
msgid "Note!!! You have specified custom buttons in both custombtn.txt and .pronsolerc"
msgid "Note!!! You have specified custom buttons in both custombtn.txt and .pronsolerc"
msgstr "
Beachten! Sie haben benutzerdefinierte Schaltflächen
in custombtn.txt und .pronsolerc angegeben"
msgstr "
Achtung! Sie haben benutzerdefinierte Buttons
in custombtn.txt und .pronsolerc angegeben"
#: pronterface.py:1
23
#: pronterface.py:1
18
msgid "Ignoring custombtn.txt. Remove all current buttons to revert to custombtn.txt"
msgid "Ignoring custombtn.txt. Remove all current buttons to revert to custombtn.txt"
msgstr "Ignoriere
n custombtn.txt. Zur Nutzung custombtn.txt wieder entfernen alle gängigen Tast
en"
msgstr "Ignoriere
custombtn.txt. Alle aktuellen Buttons entfernen um wieder zu custombtn.txt zurückzukehr
en"
#: pronterface.py:146
#: pronterface.py:146
#: pronterface.py:4
34
#: pronterface.py:4
92
#: pronterface.py:
971
#: pronterface.py:
1297
#: pronterface.py:1
020
#: pronterface.py:1
351
#: pronterface.py:1
134
#: pronterface.py:1
473
#: pronterface.py:1
161
#: pronterface.py:1
507
#: pronterface.py:1
175
#: pronterface.py:1
522
msgid "Print"
msgid "Print"
msgstr "Drucken"
msgstr "Drucken"
#: pronterface.py:150
#: pronterface.py:150
msgid "Printer is now online"
msgid "Printer is now online
.
"
msgstr "Drucker
wird jetzt online
"
msgstr "Drucker
ist jetzt Online.
"
#: pronterface.py:
199
#: pronterface.py:
210
msgid "Setting hotend temperature to "
msgid "Setting hotend temperature to "
msgstr "
Einstellen h
otend Temperatur auf "
msgstr "
Setze H
otend Temperatur auf "
#: pronterface.py:
199
#: pronterface.py:
210
#: pronterface.py:2
20
#: pronterface.py:2
46
msgid " degrees Celsius."
msgid " degrees Celsius."
msgstr " Grad Celsius."
msgstr " Grad Celsius."
#: pronterface.py:2
03
#: pronterface.py:2
29
#: pronterface.py:2
2
4
#: pronterface.py:2
6
4
msgid "Printer is not online."
msgid "Printer is not online."
msgstr "Drucker
wird
nicht online."
msgstr "Drucker
ist
nicht online."
#: pronterface.py:2
05
#: pronterface.py:2
31
msgid "You cannot set negative temperatures. To turn the hotend off entirely, set its temperature to 0."
msgid "You cannot set negative temperatures. To turn the hotend off entirely, set its temperature to 0."
msgstr "Sie können keine negativen Temperaturen einstellen. Um d
en hotend ganz auszushalten, einstellen Sie die Temperatur auf 0
"
msgstr "Sie können keine negativen Temperaturen einstellen. Um d
as Hotend ganz auszuschalten, Temperatur auf 0 setzen.
"
#: pronterface.py:207
#: pronterface.py:246
#: pronterface.py:228
msgid "You must enter a temperature."
msgstr "Sie müssen eine Temperatur eingeben."
#: pronterface.py:220
msgid "Setting bed temperature to "
msgid "Setting bed temperature to "
msgstr "
Bett-Temperatur eingestellt:
"
msgstr "
Setze Heizbett Temperatur auf
"
#: pronterface.py:2
2
6
#: pronterface.py:2
6
6
msgid "You cannot set negative temperatures. To turn the bed off entirely, set its temperature to 0."
msgid "You cannot set negative temperatures. To turn the bed off entirely, set its temperature to 0."
msgstr "Sie können keine negativen Temperaturen einstellen. Um d
en Bett ganz auszushalten, einstellen Sie die Temperatur auf 0
"
msgstr "Sie können keine negativen Temperaturen einstellen. Um d
as Heizbett ganz auszuschalten, Temperatur auf 0 setzen.
"
#: pronterface.py:243
#: pronterface.py:268
msgid "You must enter a temperature."
msgstr "Sie müssen eine Temperatur eingeben."
#: pronterface.py:283
msgid "Do you want to erase the macro?"
msgid "Do you want to erase the macro?"
msgstr "Möchten Sie das Makro löschen?"
msgstr "Möchten Sie das Makro löschen?"
#: pronterface.py:2
4
7
#: pronterface.py:2
8
7
msgid "Cancelled."
msgid "Cancelled."
msgstr "Abge
sagt
."
msgstr "Abge
brochen
."
#: pronterface.py:277
#: pronterface.py:317
msgid " Opens file"
msgstr " Öffnet eine Datei"
#: pronterface.py:317
msgid "&Open..."
msgid "&Open..."
msgstr "&Öffnen..."
msgstr "&Öffnen..."
#: pronterface.py:
277
#: pronterface.py:
318
msgid "
Opens
file"
msgid "
Edit open
file"
msgstr "
Öffnet eine Datei
"
msgstr "
Offene Datei bearbeiten
"
#: pronterface.py:
27
8
#: pronterface.py:
31
8
msgid "&Edit..."
msgid "&Edit..."
msgstr "&Bearbeiten..."
msgstr "&Bearbeiten..."
#: pronterface.py:
278
#: pronterface.py:
319
msgid "
Edit open fi
le"
msgid "
Clear output conso
le"
msgstr "
Datei bearbeit
en"
msgstr "
Ausgabe Konsole leer
en"
#: pronterface.py:
27
9
#: pronterface.py:
31
9
msgid "
E&xit
"
msgid "
Clear console
"
msgstr "
Verlass
en"
msgstr "
Konsole leer
en"
#: pronterface.py:
279
#: pronterface.py:
320
msgid " Closes the Window"
msgid " Closes the Window"
msgstr "
schließ
t das Fenster"
msgstr "
Schliess
t das Fenster"
#: pronterface.py:280
#: pronterface.py:320
msgid "E&xit"
msgstr "&Verlassen"
#: pronterface.py:321
msgid "&File"
msgid "&File"
msgstr ""
msgstr "
&Datei
"
#: pronterface.py:
285
#: pronterface.py:
326
msgid "&Macros"
msgid "&Macros"
msgstr "&Makros"
msgstr "&Makros"
#: pronterface.py:
286
#: pronterface.py:
327
msgid "<&New...>"
msgid "<&New...>"
msgstr "<&Neu...>"
msgstr "<&Neu...>"
#: pronterface.py:287
#: pronterface.py:328
msgid "&Options"
msgstr "&Optionen"
#: pronterface.py:287
msgid " Options dialog"
msgid " Options dialog"
msgstr " Optionen-Dialog"
msgstr " Optionen Dialog"
#: pronterface.py:289
msgid "SFACT Settings"
msgstr "SFACT Einstellungen"
#: pronterface.py:
289
#: pronterface.py:
328
msgid "
Adjust SFACT setting
s"
msgid "
&Option
s"
msgstr "
SFACT Einstellungen anpass
en"
msgstr "
&Option
en"
#: pronterface.py:
292
#: pronterface.py:
330
msgid "
SFACT Quick S
ettings"
msgid "
Adjust slicing s
ettings"
msgstr "
SFACT schnelle Einstellung
en"
msgstr "
Slicing Einstellungen anpass
en"
#: pronterface.py:
292
#: pronterface.py:
330
msgid "
Quickly adjust SFACT settings for active profile
"
msgid "
Slicing Settings
"
msgstr "
SFACT Einstellungen für aktive Profil schnell anpass
en"
msgstr "
Slicing Einstellung
en"
#: pronterface.py:
295
#: pronterface.py:
337
msgid "&Settings"
msgid "&Settings"
msgstr "&Einstellungen"
msgstr "&Einstellungen"
#: pronterface.py:3
11
#: pronterface.py:3
53
msgid "Enter macro name"
msgid "Enter macro name"
msgstr "Makro
n
ame eingeben"
msgstr "Makro
N
ame eingeben"
#: pronterface.py:3
14
#: pronterface.py:3
56
msgid "Macro name:"
msgid "Macro name:"
msgstr "Makro
n
ame:"
msgstr "Makro
N
ame:"
#: pronterface.py:3
17
#: pronterface.py:3
59
msgid "Ok"
msgid "Ok"
msgstr ""
msgstr "
Ok
"
#: pronterface.py:321
#: pronterface.py:363
#: pronterface.py:1197
#: pronterface.py:1308
#: pronterface.py:1565
msgid "Cancel"
msgid "Cancel"
msgstr "Absagen"
msgstr "Abbrechen"
#: pronterface.py:339
msgid "Name '"
msgstr ""
#: pronterface.py:3
39
#: pronterface.py:3
81
msgid "' is being used by built-in command"
msgid "' is being used by built-in command"
msgstr ""
msgstr "' wird durch eingebautes Kommando genutzt"
#: pronterface.py:381
msgid "Name '"
msgstr "Name '"
#: pronterface.py:3
42
#: pronterface.py:3
84
msgid "Macro name may contain only alphanumeric symbols and underscores"
msgid "Macro name may contain only alphanumeric symbols and underscores"
msgstr ""
msgstr "
Makro Name darf nur alphanumerische Zeichen und Unterstriche enthalten
"
#: pronterface.py:
375
#: pronterface.py:
433
msgid "Port
:
"
msgid "Port"
msgstr ""
msgstr "
Port:
"
#: pronterface.py:
397
#: pronterface.py:
452
msgid "Connect"
msgid "Connect"
msgstr "Verbinden"
msgstr "Verbinden"
#: pronterface.py:
399
#: pronterface.py:
454
msgid "Connect to the printer"
msgid "Connect to the printer"
msgstr "Drucker Verbinden"
msgstr "Drucker Verbinden"
#: pronterface.py:401
#: pronterface.py:456
msgid "Disconnect"
msgstr "Trennen"
#: pronterface.py:405
msgid "Reset"
msgid "Reset"
msgstr "Zurücksetzen"
msgstr "Zurücksetzen"
#: pronterface.py:4
08
#: pronterface.py:4
59
#: pronterface.py:
592
#: pronterface.py:
733
msgid "Mini mode"
msgid "Mini mode"
msgstr "Mini-Modus"
msgstr "Mini-Modus"
#: pronterface.py:414
#: pronterface.py:470
msgid ""
msgid "Monitor Printer"
"Monitor\n"
msgstr "Drucker überwachen"
"printer"
msgstr ""
"Drucker\n"
"überwachen"
#: pronterface.py:4
23
#: pronterface.py:4
81
msgid "Load file"
msgid "Load file"
msgstr "Datei laden"
msgstr "Datei laden"
#: pronterface.py:4
26
#: pronterface.py:4
84
msgid "
SD Upload
"
msgid "
Compose
"
msgstr "
SD hochlad
en"
msgstr "
Zusammenstell
en"
#: pronterface.py:4
30
#: pronterface.py:4
88
msgid "SD
Print
"
msgid "SD"
msgstr "SD
Drucken
"
msgstr "SD"
#: pronterface.py:4
38
#: pronterface.py:4
96
#: pronterface.py:1
021
#: pronterface.py:1
352
#: pronterface.py:1
061
#: pronterface.py:1
397
#: pronterface.py:1
109
#: pronterface.py:1
447
#: pronterface.py:1
133
#: pronterface.py:1
472
#: pronterface.py:1
160
#: pronterface.py:1
506
#: pronterface.py:1
174
#: pronterface.py:1
521
msgid "Pause"
msgid "Pause"
msgstr ""
msgstr "
Pause
"
#: pronterface.py:
452
#: pronterface.py:
509
msgid "Send"
msgid "Send"
msgstr "Senden"
msgstr "Senden"
#: pronterface.py:
460
#: pronterface.py:
517
#: pronterface.py:
5
18
#: pronterface.py:
6
18
msgid "mm/min"
msgid "mm/min"
msgstr ""
msgstr "
mm/min
"
#: pronterface.py:
462
#: pronterface.py:
519
msgid "XY:"
msgid "XY:"
msgstr ""
msgstr "
XY:
"
#: pronterface.py:
464
#: pronterface.py:
521
msgid "Z:"
msgid "Z:"
msgstr ""
msgstr "
Z:
"
#: pronterface.py:
481
#: pronterface.py:
544
msgid "Heater:"
msgid "Heater:"
msgstr "Heizung:"
msgstr "Heizelement:"
#: pronterface.py:547
#: pronterface.py:567
msgid "Off"
msgstr "Aus"
#: pronterface.py:
48
9
#: pronterface.py:
55
9
#: pronterface.py:5
01
#: pronterface.py:5
79
msgid "Set"
msgid "Set"
msgstr ""
msgstr "
Einstellen
"
#: pronterface.py:
493
#: pronterface.py:
564
msgid "Bed:"
msgid "Bed:"
msgstr "
Bett
"
msgstr "
Heizbett:
"
#: pronterface.py:
5
12
#: pronterface.py:
6
12
msgid "mm"
msgid "mm"
msgstr ""
msgstr "
mm
"
#: pronterface.py:
551
#: pronterface.py:
659
#: pronterface.py:
846
#: pronterface.py:
1161
#: pronterface.py:1
055
#: pronterface.py:1
391
msgid "Not connected to printer."
msgid "Not connected to printer."
msgstr "Keine Verbindung zum Drucker."
msgstr "Keine Verbindung zum Drucker."
#: pronterface.py:599
#: pronterface.py:688
msgid "SD Upload"
msgstr "SD Laden"
#: pronterface.py:692
msgid "SD Print"
msgstr "SD Drucken"
#: pronterface.py:740
msgid "Full mode"
msgid "Full mode"
msgstr "voll-Modus"
msgstr "Voll-Modus"
#: pronterface.py:765
msgid "Execute command: "
msgstr "Kommando ausführen:"
#: pronterface.py:776
msgid "click to add new custom button"
msgstr "Individuellen Button hinzufügen"
#: pronterface.py:
637
#: pronterface.py:
795
msgid "Defines custom button. Usage: button <num> \"title\" [/c \"colour\"] command"
msgid "Defines custom button. Usage: button <num> \"title\" [/c \"colour\"] command"
msgstr ""
msgstr "
Definiert einen individuellen Button. Nutzung: button <num> \"title\" [/c \"colour\"] command
"
#: pronterface.py:
659
#: pronterface.py:
817
msgid "Custom button number should be between 0 and 63"
msgid "Custom button number should be between 0 and 63"
msgstr ""
msgstr "
Nummer des individuellen Button sollte zwischen 0 und 63 sein.
"
#: pronterface.py:749
#: pronterface.py:909
#, python-format
msgid "Edit custom button '%s'"
msgid "Edit custom button '%s'"
msgstr ""
msgstr "
Individuellen Button '%s' bearbeiten
"
#: pronterface.py:
75
1
#: pronterface.py:
91
1
msgid "Move left <<"
msgid "Move left <<"
msgstr ""
msgstr "
Links bewegen <<
"
#: pronterface.py:
75
4
#: pronterface.py:
91
4
msgid "Move right >>"
msgid "Move right >>"
msgstr ""
msgstr "
Rechts bewegen >>
"
#: pronterface.py:758
#: pronterface.py:918
#, python-format
msgid "Remove custom button '%s'"
msgid "Remove custom button '%s'"
msgstr ""
msgstr "
Individuellen Button '%s' entfernen
"
#: pronterface.py:
76
1
#: pronterface.py:
92
1
msgid "Add custom button"
msgid "Add custom button"
msgstr ""
msgstr "
Individuellen Button hinzufuegen
"
#: pronterface.py:
77
6
#: pronterface.py:
106
6
msgid "event object missing"
msgid "event object missing"
msgstr ""
msgstr "
Ereigniss Objekt fehlt
"
#: pronterface.py:
80
4
#: pronterface.py:
109
4
msgid "Invalid period given."
msgid "Invalid period given."
msgstr ""
msgstr "
Ungültiger Abschnitt angegeben.
"
#: pronterface.py:
80
7
#: pronterface.py:
109
7
msgid "Monitoring printer."
msgid "Monitoring printer."
msgstr ""
msgstr "
Überwache Drucker.
"
#: pronterface.py:
80
9
#: pronterface.py:
109
9
msgid "Done monitoring."
msgid "Done monitoring."
msgstr ""
msgstr "
Überwachung abgeschlossen.
"
#: pronterface.py:
828
#: pronterface.py:
1121
msgid "Printer is online. "
msgid "Printer is online. "
msgstr ""
msgstr "
Drucker ist online.
"
#: pronterface.py:
830
#: pronterface.py:
1123
#: pronterface.py:
969
#: pronterface.py:
1295
#: pronterface.py:1
019
#: pronterface.py:1
350
msgid "Loaded "
msgid "Loaded "
msgstr ""
msgstr "Geladen"
#: pronterface.py:833
msgid "Hotend"
msgstr ""
#: pronterface.py:
833
#: pronterface.py:
1126
msgid "Bed"
msgid "Bed"
msgstr "
B
ett"
msgstr "
Heizb
ett"
#: pronterface.py:836
#: pronterface.py:1126
#, python-format
msgid "Hotend"
msgstr "Hotend"
#: pronterface.py:1135
msgid " SD printing:%04.2f %%"
msgid " SD printing:%04.2f %%"
msgstr ""
msgstr "
SD Drucken:%04.2f %%
"
#: pronterface.py:838
#: pronterface.py:1138
#, python-format
msgid " Printing:%04.2f %% |"
msgid " Printing:%04.2f %%"
msgstr " Drucken:%04.2f %% |"
msgstr ""
#: pronterface.py:1139
msgid " Line# "
msgstr "Zeile#"
#: pronterface.py:1139
msgid " lines |"
msgstr " Zeilen |"
#: pronterface.py:1139
msgid "of "
msgstr "von"
#: pronterface.py:1144
msgid " Est: "
msgstr " Erw:"
#: pronterface.py:1145
msgid " of: "
msgstr " von: "
#: pronterface.py:892
#: pronterface.py:1146
msgid " Remaining | "
msgstr " Verbleibend | "
#: pronterface.py:1147
msgid " Z: %0.2f mm"
msgstr " Z: %0.2f mm"
#: pronterface.py:1211
msgid "Opening file failed."
msgid "Opening file failed."
msgstr ""
msgstr "
Datei öffnen fehlgeschlagen.
"
#: pronterface.py:
898
#: pronterface.py:
1217
msgid "Starting print"
msgid "Starting print"
msgstr ""
msgstr "
Starte Druck
"
#: pronterface.py:921
#: pronterface.py:1240
msgid "Select the file to print"
msgstr ""
#: pronterface.py:921
msgid "Pick SD file"
msgid "Pick SD file"
msgstr ""
msgstr "
Wähle SD Datei
"
#: pronterface.py:
949
#: pronterface.py:
1240
msgid "S
keinforge execution failed.
"
msgid "S
elect the file to print
"
msgstr ""
msgstr "
Wähle Druckdatei
"
#: pronterface.py:
956
#: pronterface.py:
1275
msgid "
Skeining...
"
msgid "
Failed to execute slicing software:
"
msgstr ""
msgstr "
Fehler beim Ausführen der Slicing Software:
"
#: pronterface.py:969
#: pronterface.py:1282
#: pronterface.py:1019
msgid "Slicing..."
#, python-format
msgstr "Slicing..."
#: pronterface.py:1295
#: pronterface.py:1350
msgid ", %d lines"
msgid ", %d lines"
msgstr ""
msgstr "
, %d Zeilen
"
#: pronterface.py:
978
#: pronterface.py:
1302
msgid "
Skeining
"
msgid "
Load File
"
msgstr ""
msgstr "
Datei laden
"
#: pronterface.py:980
#: pronterface.py:1309
msgid ""
msgid "Slicing "
"Skeinforge not found. \n"
msgstr "Slicing"
"Please copy Skeinforge into a directory named \"skeinforge\" in the same directory as this file."
msgstr ""
#: pronterface.py:
999
#: pronterface.py:
1328
msgid "Open file to print"
msgid "Open file to print"
msgstr "
Zu druckenden Datei öffnen
"
msgstr "
Öffne zu druckende Datei
"
#: pronterface.py:1
000
#: pronterface.py:1
329
msgid "
STL and GCODE files (;*.gcode;*.g;*.stl;*.STL
;)"
msgid "
OBJ, STL, and GCODE files (;*.gcode;*.gco;*.g;*.stl;*.STL;*.obj;*.OBJ
;)"
msgstr ""
msgstr "
OBJ,STL und GCODE Dateien (;*.gcode;*.gco;*.g;*.stl;*.STL;*.obj;*.OBJ;)
"
#: pronterface.py:1
007
#: pronterface.py:1
336
msgid "File not found!"
msgid "File not found!"
msgstr ""
msgstr "
Datei nicht gefunden!
"
#: pronterface.py:1
029
#: pronterface.py:1
360
msgid "mm of filament used in this print\n"
msgid "mm of filament used in this print\n"
msgstr ""
msgstr "mm Filament in Druck genutzt\n"
#: pronterface.py:1030
#: pronterface.py:1031
#: pronterface.py:1032
msgid "the print goes from"
msgstr ""
#: pronterface.py:1030
#: pronterface.py:1031
#: pronterface.py:1032
msgid "mm to"
msgstr ""
#: pronterface.py:1
030
#: pronterface.py:1
361
msgid ""
msgid ""
"mm in X\n"
"mm in X\n"
"and is"
"and is"
msgstr ""
msgstr ""
"mm in X\n"
"und ist"
#: pronterface.py:1
030
#: pronterface.py:1
361
#: pronterface.py:1
031
#: pronterface.py:1
362
msgid "mm wide\n"
msgid "mm wide\n"
msgstr ""
msgstr "
mm breit\n
"
#: pronterface.py:1031
#: pronterface.py:1361
#: pronterface.py:1362
#: pronterface.py:1363
msgid "mm to"
msgstr "mm bis"
#: pronterface.py:1361
#: pronterface.py:1362
#: pronterface.py:1363
msgid "the print goes from"
msgstr "Der Druck verläuft von"
#: pronterface.py:1362
msgid ""
msgid ""
"mm in Y\n"
"mm in Y\n"
"and is"
"and is"
msgstr ""
msgstr ""
"mm in Y\n"
"und ist"
#: pronterface.py:1363
msgid "mm high\n"
msgstr "mm hoch\n"
#: pronterface.py:1
032
#: pronterface.py:1
363
msgid ""
msgid ""
"mm in Z\n"
"mm in Z\n"
"and is"
"and is"
msgstr ""
msgstr ""
"mm in Z\n"
"und ist"
#: pronterface.py:1
032
#: pronterface.py:1
364
msgid "
mm high\n
"
msgid "
Estimated duration (pessimistic):
"
msgstr ""
msgstr "
Geschätze Dauer (pessimistisch):
"
#: pronterface.py:1
052
#: pronterface.py:1
388
msgid "No file loaded. Please use load first."
msgid "No file loaded. Please use load first."
msgstr ""
msgstr "
Keine Datei geladen. Benutze zuerst laden.
"
#: pronterface.py:1
063
#: pronterface.py:1
399
msgid "Restart"
msgid "Restart"
msgstr "Neustart"
msgstr "Neustart"
#: pronterface.py:1
067
#: pronterface.py:1
403
msgid "File upload complete"
msgid "File upload complete"
msgstr ""
msgstr "
Datei Upload komplett
"
#: pronterface.py:1
086
#: pronterface.py:1
422
msgid "Pick SD filename"
msgid "Pick SD filename"
msgstr ""
msgstr "
Wähle SD Dateiname
"
#: pronterface.py:1102
#: pronterface.py:1430
msgid "Paused."
msgstr "Pausiert."
#: pronterface.py:1440
msgid "Resume"
msgid "Resume"
msgstr ""
msgstr "Fortsetzen"
#: pronterface.py:1456
msgid "Connecting..."
msgstr "Verbinde..."
#: pronterface.py:1168
#: pronterface.py:1487
msgid "Disconnected."
msgstr "Getrennt."
#: pronterface.py:1514
msgid "Reset."
msgstr "Zurücksetzen."
#: pronterface.py:1515
msgid "Are you sure you want to reset the printer?"
msgid "Are you sure you want to reset the printer?"
msgstr "Möchten Sie
wirklich, der Drucker Zurückzu
setzen?"
msgstr "Möchten Sie
den Drucker wirklich zurück
setzen?"
#: pronterface.py:1
168
#: pronterface.py:1
515
msgid "Reset?"
msgid "Reset?"
msgstr "Zurücksetzen?"
msgstr "Zurücksetzen?"
#: pronterface.py:1
193
#: pronterface.py:1
561
msgid "Save"
msgid "Save"
msgstr ""
msgstr "
Speichern
"
#: pronterface.py:1
248
#: pronterface.py:1
619
msgid "Edit settings"
msgid "Edit settings"
msgstr "Einstellungen bearbeiten"
msgstr "Einstellungen bearbeiten"
#: pronterface.py:1
250
#: pronterface.py:1
621
msgid "Defaults"
msgid "Defaults"
msgstr "Standardwerte"
msgstr "Standardwerte"
#: pronterface.py:1
272
#: pronterface.py:1
647
msgid "Custom button"
msgid "Custom button"
msgstr ""
msgstr "
Individueller Button
"
#: pronterface.py:1
280
#: pronterface.py:1
652
msgid "Button title"
msgid "Button title"
msgstr ""
msgstr "
Button Titel
"
#: pronterface.py:1
283
#: pronterface.py:1
655
msgid "Command"
msgid "Command"
msgstr ""
msgstr "
Kommando
"
#: pronterface.py:1
292
#: pronterface.py:1
664
msgid "Color"
msgid "Color"
msgstr "Farbe"
msgstr "Farbe"
#~ msgid "&Print"
#~ msgstr "&Drucken"
locale/de/LC_MESSAGES/pronterface.mo
View file @
6dff5776
No preview for this file type
locale/pronterface.pot
View file @
6dff5776
#
Pronterface Message Catalog Template
#
SOME DESCRIPTIVE TITLE.
# Copyright (C)
2011 Jonathan Marsden
# Copyright (C)
YEAR ORGANIZATION
#
Jonathan Marsden <jmarsden@fastmail.fm>, 2011
.
#
FIRST AUTHOR <EMAIL@ADDRESS>, YEAR
.
#
#
msgid ""
msgid ""
msgstr ""
msgstr ""
"Project-Id-Version: P
ronterface jm1
\n"
"Project-Id-Version: P
ACKAGE VERSION
\n"
"POT-Creation-Date: 201
1-08-06 13:27+PD
T\n"
"POT-Creation-Date: 201
2-01-09 10:00+CE
T\n"
"PO-Revision-Date:
2011-08-06 13:27+PDT
\n"
"PO-Revision-Date:
YEAR-MO-DA HO:MI+ZONE
\n"
"Last-Translator:
Jonathan Marsden <jmarsden@fastmail.fm
>\n"
"Last-Translator:
FULL NAME <EMAIL@ADDRESS
>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=
UTF-8
\n"
"Content-Type: text/plain; charset=
CHARSET
\n"
"Content-Transfer-Encoding:
UTF-8
\n"
"Content-Transfer-Encoding:
ENCODING
\n"
"Generated-By: pygettext.py 1.5\n"
"Generated-By: pygettext.py 1.5\n"
...
@@ -19,519 +19,574 @@ msgstr ""
...
@@ -19,519 +19,574 @@ msgstr ""
msgid "WX is not installed. This program requires WX to run."
msgid "WX is not installed. This program requires WX to run."
msgstr ""
msgstr ""
#: pronterface.py:65
msgid ""
"Dimensions of Build Platform\n"
" & optional offset of origin\n"
"\n"
"Examples:\n"
" XXXxYYY\n"
" XXX,YYY,ZZZ\n"
" XXXxYYYxZZZ+OffX+OffY+OffZ"
msgstr ""
#: pronterface.py:66
msgid "Last Set Temperature for the Heated Print Bed"
msgstr ""
#: pronterface.py:67
#: pronterface.py:67
msgid "Folder of last opened file"
msgstr ""
#: pronterface.py:68
msgid "Last Temperature of the Hot End"
msgstr ""
#: pronterface.py:69
msgid "Width of Extrusion in Preview (default: 0.5)"
msgstr ""
#: pronterface.py:70
msgid "Fine Grid Spacing (default: 10)"
msgstr ""
#: pronterface.py:71
msgid "Coarse Grid Spacing (default: 50)"
msgstr ""
#: pronterface.py:75
msgid "Printer Interface"
msgid "Printer Interface"
msgstr ""
msgstr ""
#: pronterface.py:
80
#: pronterface.py:
91
msgid "Motors off"
msgid "Motors off"
msgstr ""
msgstr ""
#: pronterface.py:
81
#: pronterface.py:
92
msgid "Check temp"
msgid "Check temp"
msgstr ""
msgstr ""
#: pronterface.py:
82
#: pronterface.py:
93
msgid "Extrude"
msgid "Extrude"
msgstr ""
msgstr ""
#: pronterface.py:
83
#: pronterface.py:
94
msgid "Reverse"
msgid "Reverse"
msgstr ""
msgstr ""
#: pronterface.py:
99
#: pronterface.py:
112
msgid ""
msgid ""
"# I moved all your custom buttons into .pronsolerc.\n"
"# I moved all your custom buttons into .pronsolerc.\n"
"# Please don't add them here any more.\n"
"# Please don't add them here any more.\n"
"# Backup of your old buttons is in custombtn.old\n"
"# Backup of your old buttons is in custombtn.old\n"
msgstr ""
msgstr ""
#: pronterface.py:1
04
#: pronterface.py:1
17
msgid "Note!!! You have specified custom buttons in both custombtn.txt and .pronsolerc"
msgid "Note!!! You have specified custom buttons in both custombtn.txt and .pronsolerc"
msgstr ""
msgstr ""
#: pronterface.py:1
05
#: pronterface.py:1
18
msgid "Ignoring custombtn.txt. Remove all current buttons to revert to custombtn.txt"
msgid "Ignoring custombtn.txt. Remove all current buttons to revert to custombtn.txt"
msgstr ""
msgstr ""
#: pronterface.py:1
30 pronterface.py:476 pronterface.py:1228
#: pronterface.py:1
46 pronterface.py:492 pronterface.py:1297
#: pronterface.py:1
279 pronterface.py:1396 pronterface.py:1428
#: pronterface.py:1
351 pronterface.py:1473 pronterface.py:1507
#: pronterface.py:1
443
#: pronterface.py:1
522
msgid "Print"
msgid "Print"
msgstr ""
msgstr ""
#: pronterface.py:1
34
#: pronterface.py:1
50
msgid "Printer is now online."
msgid "Printer is now online."
msgstr ""
msgstr ""
#: pronterface.py:
188
#: pronterface.py:
210
msgid "Setting hotend temperature to "
msgid "Setting hotend temperature to "
msgstr ""
msgstr ""
#: pronterface.py:
188 pronterface.py:224
#: pronterface.py:
210 pronterface.py:246
msgid " degrees Celsius."
msgid " degrees Celsius."
msgstr ""
msgstr ""
#: pronterface.py:2
07 pronterface.py:242
#: pronterface.py:2
29 pronterface.py:264
msgid "Printer is not online."
msgid "Printer is not online."
msgstr ""
msgstr ""
#: pronterface.py:2
09
#: pronterface.py:2
31
msgid "You cannot set negative temperatures. To turn the hotend off entirely, set its temperature to 0."
msgid "You cannot set negative temperatures. To turn the hotend off entirely, set its temperature to 0."
msgstr ""
msgstr ""
#: pronterface.py:2
24
#: pronterface.py:2
46
msgid "Setting bed temperature to "
msgid "Setting bed temperature to "
msgstr ""
msgstr ""
#: pronterface.py:2
44
#: pronterface.py:2
66
msgid "You cannot set negative temperatures. To turn the bed off entirely, set its temperature to 0."
msgid "You cannot set negative temperatures. To turn the bed off entirely, set its temperature to 0."
msgstr ""
msgstr ""
#: pronterface.py:2
46
#: pronterface.py:2
68
msgid "You must enter a temperature."
msgid "You must enter a temperature."
msgstr ""
msgstr ""
#: pronterface.py:2
61
#: pronterface.py:2
83
msgid "Do you want to erase the macro?"
msgid "Do you want to erase the macro?"
msgstr ""
msgstr ""
#: pronterface.py:2
65
#: pronterface.py:2
87
msgid "Cancelled."
msgid "Cancelled."
msgstr ""
msgstr ""
#: pronterface.py:
295
#: pronterface.py:
317
msgid " Opens file"
msgid " Opens file"
msgstr ""
msgstr ""
#: pronterface.py:
295
#: pronterface.py:
317
msgid "&Open..."
msgid "&Open..."
msgstr ""
msgstr ""
#: pronterface.py:
296
#: pronterface.py:
318
msgid " Edit open file"
msgid " Edit open file"
msgstr ""
msgstr ""
#: pronterface.py:
296
#: pronterface.py:
318
msgid "&Edit..."
msgid "&Edit..."
msgstr ""
msgstr ""
#: pronterface.py:
297
#: pronterface.py:
319
msgid " Clear output console"
msgid " Clear output console"
msgstr ""
msgstr ""
#: pronterface.py:
297
#: pronterface.py:
319
msgid "Clear console"
msgid "Clear console"
msgstr ""
msgstr ""
#: pronterface.py:
298
#: pronterface.py:
320
msgid " Closes the Window"
msgid " Closes the Window"
msgstr ""
msgstr ""
#: pronterface.py:
298
#: pronterface.py:
320
msgid "E&xit"
msgid "E&xit"
msgstr ""
msgstr ""
#: pronterface.py:
299
#: pronterface.py:
321
msgid "&File"
msgid "&File"
msgstr ""
msgstr ""
#: pronterface.py:3
04
#: pronterface.py:3
26
msgid "&Macros"
msgid "&Macros"
msgstr ""
msgstr ""
#: pronterface.py:3
05
#: pronterface.py:3
27
msgid "<&New...>"
msgid "<&New...>"
msgstr ""
msgstr ""
#: pronterface.py:3
06
#: pronterface.py:3
28
msgid " Options dialog"
msgid " Options dialog"
msgstr ""
msgstr ""
#: pronterface.py:3
06
#: pronterface.py:3
28
msgid "&Options"
msgid "&Options"
msgstr ""
msgstr ""
#: pronterface.py:308
#: pronterface.py:330
msgid " Adjust SFACT settings"
msgid " Adjust slicing settings"
msgstr ""
#: pronterface.py:308
msgid "SFACT Settings"
msgstr ""
msgstr ""
#: pronterface.py:3
11
#: pronterface.py:3
30
msgid "
Quickly adjust SFACT settings for active profile
"
msgid "
Slicing Settings
"
msgstr ""
msgstr ""
#: pronterface.py:311
#: pronterface.py:337
msgid "SFACT Quick Settings"
msgstr ""
#: pronterface.py:315
msgid "&Settings"
msgid "&Settings"
msgstr ""
msgstr ""
#: pronterface.py:3
31
#: pronterface.py:3
53
msgid "Enter macro name"
msgid "Enter macro name"
msgstr ""
msgstr ""
#: pronterface.py:3
34
#: pronterface.py:3
56
msgid "Macro name:"
msgid "Macro name:"
msgstr ""
msgstr ""
#: pronterface.py:3
37
#: pronterface.py:3
59
msgid "Ok"
msgid "Ok"
msgstr ""
msgstr ""
#: pronterface.py:3
41 pronterface.py:14
65
#: pronterface.py:3
63 pronterface.py:1308 pronterface.py:15
65
msgid "Cancel"
msgid "Cancel"
msgstr ""
msgstr ""
#: pronterface.py:3
59
#: pronterface.py:3
81
msgid "' is being used by built-in command"
msgid "' is being used by built-in command"
msgstr ""
msgstr ""
#: pronterface.py:3
59
#: pronterface.py:3
81
msgid "Name '"
msgid "Name '"
msgstr ""
msgstr ""
#: pronterface.py:3
62
#: pronterface.py:3
84
msgid "Macro name may contain only alphanumeric symbols and underscores"
msgid "Macro name may contain only alphanumeric symbols and underscores"
msgstr ""
msgstr ""
#: pronterface.py:4
11
#: pronterface.py:4
33
msgid "Port"
msgid "Port"
msgstr ""
msgstr ""
#: pronterface.py:4
30
#: pronterface.py:4
52
msgid "Connect"
msgid "Connect"
msgstr ""
msgstr ""
#: pronterface.py:4
32
#: pronterface.py:4
54
msgid "Connect to the printer"
msgid "Connect to the printer"
msgstr ""
msgstr ""
#: pronterface.py:434
#: pronterface.py:456
msgid "Disconnect"
msgstr ""
#: pronterface.py:438
msgid "Reset"
msgid "Reset"
msgstr ""
msgstr ""
#: pronterface.py:4
41 pronterface.py:687
#: pronterface.py:4
59 pronterface.py:733
msgid "Mini mode"
msgid "Mini mode"
msgstr ""
msgstr ""
#: pronterface.py:455
#: pronterface.py:470
msgid ""
msgid "Monitor Printer"
"Monitor\n"
"printer"
msgstr ""
msgstr ""
#: pronterface.py:4
65
#: pronterface.py:4
81
msgid "Load file"
msgid "Load file"
msgstr ""
msgstr ""
#: pronterface.py:4
68
#: pronterface.py:4
84
msgid "
SD Upload
"
msgid "
Compose
"
msgstr ""
msgstr ""
#: pronterface.py:4
72
#: pronterface.py:4
88
msgid "SD
Print
"
msgid "SD"
msgstr ""
msgstr ""
#: pronterface.py:4
80 pronterface.py:1280 pronterface.py:1321
#: pronterface.py:4
96 pronterface.py:1352 pronterface.py:1397
#: pronterface.py:1
370 pronterface.py:1395 pronterface.py:1427
#: pronterface.py:1
447 pronterface.py:1472 pronterface.py:1506
#: pronterface.py:1
442
#: pronterface.py:1
521
msgid "Pause"
msgid "Pause"
msgstr ""
msgstr ""
#: pronterface.py:
494
#: pronterface.py:
509
msgid "Send"
msgid "Send"
msgstr ""
msgstr ""
#: pronterface.py:5
02 pronterface.py:603
#: pronterface.py:5
17 pronterface.py:618
msgid "mm/min"
msgid "mm/min"
msgstr ""
msgstr ""
#: pronterface.py:5
04
#: pronterface.py:5
19
msgid "XY:"
msgid "XY:"
msgstr ""
msgstr ""
#: pronterface.py:5
06
#: pronterface.py:5
21
msgid "Z:"
msgid "Z:"
msgstr ""
msgstr ""
#: pronterface.py:5
29
#: pronterface.py:5
44
msgid "Heater:"
msgid "Heater:"
msgstr ""
msgstr ""
#: pronterface.py:5
32 pronterface.py:552
#: pronterface.py:5
47 pronterface.py:567
msgid "Off"
msgid "Off"
msgstr ""
msgstr ""
#: pronterface.py:5
44 pronterface.py:564
#: pronterface.py:5
59 pronterface.py:579
msgid "Set"
msgid "Set"
msgstr ""
msgstr ""
#: pronterface.py:5
49
#: pronterface.py:5
64
msgid "Bed:"
msgid "Bed:"
msgstr ""
msgstr ""
#: pronterface.py:
597
#: pronterface.py:
612
msgid "mm"
msgid "mm"
msgstr ""
msgstr ""
#: pronterface.py:6
36 pronterface.py:1099 pronterface.py:1315
#: pronterface.py:6
59 pronterface.py:1161 pronterface.py:1391
msgid "Not connected to printer."
msgid "Not connected to printer."
msgstr ""
msgstr ""
#: pronterface.py:694
#: pronterface.py:688
msgid "SD Upload"
msgstr ""
#: pronterface.py:692
msgid "SD Print"
msgstr ""
#: pronterface.py:740
msgid "Full mode"
msgid "Full mode"
msgstr ""
msgstr ""
#: pronterface.py:7
19
#: pronterface.py:7
65
msgid "Execute command: "
msgid "Execute command: "
msgstr ""
msgstr ""
#: pronterface.py:7
30
#: pronterface.py:7
76
msgid "click to add new custom button"
msgid "click to add new custom button"
msgstr ""
msgstr ""
#: pronterface.py:7
51
#: pronterface.py:7
95
msgid "Defines custom button. Usage: button <num> \"title\" [/c \"colour\"] command"
msgid "Defines custom button. Usage: button <num> \"title\" [/c \"colour\"] command"
msgstr ""
msgstr ""
#: pronterface.py:
773
#: pronterface.py:
817
msgid "Custom button number should be between 0 and 63"
msgid "Custom button number should be between 0 and 63"
msgstr ""
msgstr ""
#: pronterface.py:
865
#: pronterface.py:
909
msgid "Edit custom button '%s'"
msgid "Edit custom button '%s'"
msgstr ""
msgstr ""
#: pronterface.py:
867
#: pronterface.py:
911
msgid "Move left <<"
msgid "Move left <<"
msgstr ""
msgstr ""
#: pronterface.py:
870
#: pronterface.py:
914
msgid "Move right >>"
msgid "Move right >>"
msgstr ""
msgstr ""
#: pronterface.py:
874
#: pronterface.py:
918
msgid "Remove custom button '%s'"
msgid "Remove custom button '%s'"
msgstr ""
msgstr ""
#: pronterface.py:
877
#: pronterface.py:
921
msgid "Add custom button"
msgid "Add custom button"
msgstr ""
msgstr ""
#: pronterface.py:10
22
#: pronterface.py:10
66
msgid "event object missing"
msgid "event object missing"
msgstr ""
msgstr ""
#: pronterface.py:10
50
#: pronterface.py:10
94
msgid "Invalid period given."
msgid "Invalid period given."
msgstr ""
msgstr ""
#: pronterface.py:10
53
#: pronterface.py:10
97
msgid "Monitoring printer."
msgid "Monitoring printer."
msgstr ""
msgstr ""
#: pronterface.py:10
55
#: pronterface.py:10
99
msgid "Done monitoring."
msgid "Done monitoring."
msgstr ""
msgstr ""
#: pronterface.py:1
077
#: pronterface.py:1
121
msgid "Printer is online. "
msgid "Printer is online. "
msgstr ""
msgstr ""
#: pronterface.py:1
079 pronterface.py:1226 pronterface.py:1278
#: pronterface.py:1
123 pronterface.py:1295 pronterface.py:1350
msgid "Loaded "
msgid "Loaded "
msgstr ""
msgstr ""
#: pronterface.py:1
082
#: pronterface.py:1
126
msgid "Bed"
msgid "Bed"
msgstr ""
msgstr ""
#: pronterface.py:1
082
#: pronterface.py:1
126
msgid "Hotend"
msgid "Hotend"
msgstr ""
msgstr ""
#: pronterface.py:1
089
#: pronterface.py:1
135
msgid " SD printing:%04.2f %%"
msgid " SD printing:%04.2f %%"
msgstr ""
msgstr ""
#: pronterface.py:1091
#: pronterface.py:1138
msgid " Printing:%04.2f %%"
msgid " Printing:%04.2f %% |"
msgstr ""
#: pronterface.py:1139
msgid " Line# "
msgstr ""
#: pronterface.py:1139
msgid " lines |"
msgstr ""
#: pronterface.py:1139
msgid "of "
msgstr ""
#: pronterface.py:1144
msgid " Est: "
msgstr ""
#: pronterface.py:1145
msgid " of: "
msgstr ""
#: pronterface.py:1146
msgid " Remaining | "
msgstr ""
msgstr ""
#: pronterface.py:1149
#: pronterface.py:1147
msgid " Z: %0.2f mm"
msgstr ""
#: pronterface.py:1211
msgid "Opening file failed."
msgid "Opening file failed."
msgstr ""
msgstr ""
#: pronterface.py:1
155
#: pronterface.py:1
217
msgid "Starting print"
msgid "Starting print"
msgstr ""
msgstr ""
#: pronterface.py:1
178
#: pronterface.py:1
240
msgid "Pick SD file"
msgid "Pick SD file"
msgstr ""
msgstr ""
#: pronterface.py:1
178
#: pronterface.py:1
240
msgid "Select the file to print"
msgid "Select the file to print"
msgstr ""
msgstr ""
#: pronterface.py:12
06
#: pronterface.py:12
75
msgid "
Skeinforge execution failed.
"
msgid "
Failed to execute slicing software:
"
msgstr ""
msgstr ""
#: pronterface.py:12
13
#: pronterface.py:12
82
msgid "S
kein
ing..."
msgid "S
lic
ing..."
msgstr ""
msgstr ""
#: pronterface.py:12
26 pronterface.py:1278
#: pronterface.py:12
95 pronterface.py:1350
msgid ", %d lines"
msgid ", %d lines"
msgstr ""
msgstr ""
#: pronterface.py:1
235
#: pronterface.py:1
302
msgid "
Skeining
"
msgid "
Load File
"
msgstr ""
msgstr ""
#: pronterface.py:1237
#: pronterface.py:1309
msgid ""
msgid "Slicing "
"Skeinforge not found. \n"
"Please copy Skeinforge into a directory named \"skeinforge\" in the same directory as this file."
msgstr ""
msgstr ""
#: pronterface.py:1
256
#: pronterface.py:1
328
msgid "Open file to print"
msgid "Open file to print"
msgstr ""
msgstr ""
#: pronterface.py:1
257
#: pronterface.py:1
329
msgid "OBJ, STL, and GCODE files (;*.gcode;*.gco;*.g;*.stl;*.STL;*.obj;*.OBJ;)"
msgid "OBJ, STL, and GCODE files (;*.gcode;*.gco;*.g;*.stl;*.STL;*.obj;*.OBJ;)"
msgstr ""
msgstr ""
#: pronterface.py:1
264
#: pronterface.py:1
336
msgid "File not found!"
msgid "File not found!"
msgstr ""
msgstr ""
#: pronterface.py:1
288
#: pronterface.py:1
360
msgid ""
msgid ""
"mm of filament used in this print\n"
"mm of filament used in this print\n"
msgstr ""
msgstr ""
#: pronterface.py:1
289
#: pronterface.py:1
361
msgid ""
msgid ""
"mm in X\n"
"mm in X\n"
"and is"
"and is"
msgstr ""
msgstr ""
#: pronterface.py:1
289 pronterface.py:1290
#: pronterface.py:1
361 pronterface.py:1362
msgid ""
msgid ""
"mm wide\n"
"mm wide\n"
msgstr ""
msgstr ""
#: pronterface.py:1
289 pronterface.py:1290 pronterface.py:1291
#: pronterface.py:1
361 pronterface.py:1362 pronterface.py:1363
msgid "mm to"
msgid "mm to"
msgstr ""
msgstr ""
#: pronterface.py:1
289 pronterface.py:1290 pronterface.py:1291
#: pronterface.py:1
361 pronterface.py:1362 pronterface.py:1363
msgid "the print goes from"
msgid "the print goes from"
msgstr ""
msgstr ""
#: pronterface.py:1
290
#: pronterface.py:1
362
msgid ""
msgid ""
"mm in Y\n"
"mm in Y\n"
"and is"
"and is"
msgstr ""
msgstr ""
#: pronterface.py:1
291
#: pronterface.py:1
363
msgid ""
msgid ""
"mm high\n"
"mm high\n"
msgstr ""
msgstr ""
#: pronterface.py:1
291
#: pronterface.py:1
363
msgid ""
msgid ""
"mm in Z\n"
"mm in Z\n"
"and is"
"and is"
msgstr ""
msgstr ""
#: pronterface.py:1
292
#: pronterface.py:1
364
msgid "Estimated duration (pessimistic): "
msgid "Estimated duration (pessimistic): "
msgstr ""
msgstr ""
#: pronterface.py:13
12
#: pronterface.py:13
88
msgid "No file loaded. Please use load first."
msgid "No file loaded. Please use load first."
msgstr ""
msgstr ""
#: pronterface.py:13
23
#: pronterface.py:13
99
msgid "Restart"
msgid "Restart"
msgstr ""
msgstr ""
#: pronterface.py:1
327
#: pronterface.py:1
403
msgid "File upload complete"
msgid "File upload complete"
msgstr ""
msgstr ""
#: pronterface.py:1
346
#: pronterface.py:1
422
msgid "Pick SD filename"
msgid "Pick SD filename"
msgstr ""
msgstr ""
#: pronterface.py:1
353
#: pronterface.py:1
430
msgid "Paused."
msgid "Paused."
msgstr ""
msgstr ""
#: pronterface.py:1
363
#: pronterface.py:1
440
msgid "Resume"
msgid "Resume"
msgstr ""
msgstr ""
#: pronterface.py:1
379
#: pronterface.py:1
456
msgid "Connecting..."
msgid "Connecting..."
msgstr ""
msgstr ""
#: pronterface.py:14
10
#: pronterface.py:14
87
msgid "Disconnected."
msgid "Disconnected."
msgstr ""
msgstr ""
#: pronterface.py:1
435
#: pronterface.py:1
514
msgid "Reset."
msgid "Reset."
msgstr ""
msgstr ""
#: pronterface.py:1
436
#: pronterface.py:1
515
msgid "Are you sure you want to reset the printer?"
msgid "Are you sure you want to reset the printer?"
msgstr ""
msgstr ""
#: pronterface.py:1
436
#: pronterface.py:1
515
msgid "Reset?"
msgid "Reset?"
msgstr ""
msgstr ""
#: pronterface.py:1
4
61
#: pronterface.py:1
5
61
msgid "Save"
msgid "Save"
msgstr ""
msgstr ""
#: pronterface.py:1
5
19
#: pronterface.py:1
6
19
msgid "Edit settings"
msgid "Edit settings"
msgstr ""
msgstr ""
#: pronterface.py:1
5
21
#: pronterface.py:1
6
21
msgid "Defaults"
msgid "Defaults"
msgstr ""
msgstr ""
#: pronterface.py:1
543
#: pronterface.py:1
647
msgid "Custom button"
msgid "Custom button"
msgstr ""
msgstr ""
#: pronterface.py:1
551
#: pronterface.py:1
652
msgid "Button title"
msgid "Button title"
msgstr ""
msgstr ""
#: pronterface.py:1
554
#: pronterface.py:1
655
msgid "Command"
msgid "Command"
msgstr ""
msgstr ""
#: pronterface.py:1
563
#: pronterface.py:1
664
msgid "Color"
msgid "Color"
msgstr ""
msgstr ""
plater.py
View file @
6dff5776
#!/usr/bin/env python
#!/usr/bin/env python
import
wx
,
time
,
random
,
threading
,
os
,
math
import
wx
import
stltool
import
time
import
random
import
threading
import
os
import
math
import
sys
import
sys
import
stltool
glview
=
False
glview
=
False
if
"-nogl"
not
in
sys
.
argv
:
if
"-nogl"
not
in
sys
.
argv
:
try
:
try
:
import
stlview
import
stlview
glview
=
True
glview
=
True
except
:
except
:
pass
pass
def
evalme
(
s
):
def
evalme
(
s
):
return
eval
(
s
[
s
.
find
(
"("
)
+
1
:
s
.
find
(
")"
)])
return
eval
(
s
[
s
.
find
(
"("
)
+
1
:
s
.
find
(
")"
)])
class
stlwrap
:
class
stlwrap
:
def
__init__
(
self
,
obj
,
name
=
None
):
def
__init__
(
self
,
obj
,
name
=
None
):
self
.
obj
=
obj
self
.
obj
=
obj
self
.
name
=
name
self
.
name
=
name
if
name
is
None
:
if
name
is
None
:
self
.
name
=
obj
.
name
self
.
name
=
obj
.
name
def
__repr__
(
self
):
def
__repr__
(
self
):
return
self
.
name
return
self
.
name
class
showstl
(
wx
.
Window
):
class
showstl
(
wx
.
Window
):
def
__init__
(
self
,
parent
,
size
,
pos
):
def
__init__
(
self
,
parent
,
size
,
pos
):
wx
.
Window
.
__init__
(
self
,
parent
,
size
=
size
,
pos
=
pos
)
wx
.
Window
.
__init__
(
self
,
parent
,
size
=
size
,
pos
=
pos
)
#self.SetBackgroundColour((0,
0,
0))
#self.SetBackgroundColour((0,
0,
0))
#wx.FutureCall(200,self.paint)
#wx.FutureCall(200,
self.paint)
self
.
i
=
0
self
.
i
=
0
self
.
parent
=
parent
self
.
parent
=
parent
self
.
previ
=
0
self
.
previ
=
0
self
.
Bind
(
wx
.
EVT_MOUSEWHEEL
,
self
.
rot
)
self
.
Bind
(
wx
.
EVT_MOUSEWHEEL
,
self
.
rot
)
self
.
Bind
(
wx
.
EVT_MOUSE_EVENTS
,
self
.
move
)
self
.
Bind
(
wx
.
EVT_MOUSE_EVENTS
,
self
.
move
)
self
.
Bind
(
wx
.
EVT_PAINT
,
self
.
repaint
)
self
.
Bind
(
wx
.
EVT_PAINT
,
self
.
repaint
)
self
.
Bind
(
wx
.
EVT_KEY_DOWN
,
self
.
keypress
)
self
.
Bind
(
wx
.
EVT_KEY_DOWN
,
self
.
keypress
)
#self.s
=stltool.stl("sphere.stl").scale([2,1,
1])
#self.s
= stltool.stl("sphere.stl").scale([2, 1,
1])
self
.
triggered
=
0
self
.
triggered
=
0
self
.
initpos
=
None
self
.
initpos
=
None
self
.
prevsel
=
-
1
self
.
prevsel
=
-
1
def
drawmodel
(
self
,
m
,
scale
):
def
drawmodel
(
self
,
m
,
scale
):
m
.
bitmap
=
wx
.
EmptyBitmap
(
800
,
800
,
32
)
m
.
bitmap
=
wx
.
EmptyBitmap
(
800
,
800
,
32
)
dc
=
wx
.
MemoryDC
()
dc
=
wx
.
MemoryDC
()
dc
.
SelectObject
(
m
.
bitmap
)
dc
.
SelectObject
(
m
.
bitmap
)
dc
.
SetBackground
(
wx
.
Brush
((
0
,
0
,
0
,
0
)))
dc
.
SetBackground
(
wx
.
Brush
((
0
,
0
,
0
,
0
)))
dc
.
SetBrush
(
wx
.
Brush
((
0
,
0
,
0
,
255
)))
dc
.
SetBrush
(
wx
.
Brush
((
0
,
0
,
0
,
255
)))
#dc.DrawRectangle(-1,
-1,10000,
10000)
#dc.DrawRectangle(-1,
-1, 10000,
10000)
dc
.
SetBrush
(
wx
.
Brush
(
wx
.
Colour
(
128
,
255
,
128
)))
dc
.
SetBrush
(
wx
.
Brush
(
wx
.
Colour
(
128
,
255
,
128
)))
dc
.
SetPen
(
wx
.
Pen
(
wx
.
Colour
(
128
,
128
,
128
)))
dc
.
SetPen
(
wx
.
Pen
(
wx
.
Colour
(
128
,
128
,
128
)))
#m.offsets
=[10,10,
0]
#m.offsets
= [10, 10,
0]
#print m.offsets,m.dims
#print m.offsets,
m.dims
for
i
in
m
.
facets
:
#random.sample(m.facets,min(100000,
len(m.facets))):
for
i
in
m
.
facets
:
# random.sample(m.facets, min(100000,
len(m.facets))):
dc
.
DrawPolygon
([
wx
.
Point
(
400
+
scale
*
p
[
0
],(
400
-
scale
*
p
[
1
]))
for
p
in
i
[
1
]])
dc
.
DrawPolygon
([
wx
.
Point
(
400
+
scale
*
p
[
0
],
(
400
-
scale
*
p
[
1
]))
for
p
in
i
[
1
]])
#if(time.time()-t)>5:
#if(time.time()-t)>5:
# break
# break
dc
.
SelectObject
(
wx
.
NullBitmap
)
dc
.
SelectObject
(
wx
.
NullBitmap
)
m
.
bitmap
.
SetMask
(
wx
.
Mask
(
m
.
bitmap
,
wx
.
Colour
(
0
,
0
,
0
,
255
)))
m
.
bitmap
.
SetMask
(
wx
.
Mask
(
m
.
bitmap
,
wx
.
Colour
(
0
,
0
,
0
,
255
)))
def
move_shape
(
self
,
delta
):
def
move_shape
(
self
,
delta
):
"""moves shape (selected in l, which is list ListBox of shapes)
"""moves shape (selected in l, which is list ListBox of shapes)
by an offset specified in tuple delta.
by an offset specified in tuple delta.
...
@@ -106,7 +110,7 @@ class showstl(wx.Window):
...
@@ -106,7 +110,7 @@ class showstl(wx.Window):
del
dc
del
dc
else
:
else
:
event
.
Skip
()
event
.
Skip
()
def
rotate_shape
(
self
,
angle
):
def
rotate_shape
(
self
,
angle
):
"""rotates acive shape
"""rotates acive shape
positive angle is clockwise
positive angle is clockwise
...
@@ -146,133 +150,134 @@ class showstl(wx.Window):
...
@@ -146,133 +150,134 @@ class showstl(wx.Window):
event
.
Skip
()
event
.
Skip
()
def
rotateafter
(
self
):
def
rotateafter
(
self
):
if
(
self
.
i
!=
self
.
previ
):
if
(
self
.
i
!=
self
.
previ
):
i
=
self
.
parent
.
l
.
GetSelection
()
i
=
self
.
parent
.
l
.
GetSelection
()
if
i
!=
wx
.
NOT_FOUND
:
if
i
!=
wx
.
NOT_FOUND
:
#o
=
self.models[self.l.GetItemText(i)].offsets
#o
=
self.models[self.l.GetItemText(i)].offsets
self
.
parent
.
models
[
self
.
parent
.
l
.
GetString
(
i
)]
.
rot
-=
5
*
(
self
.
i
-
self
.
previ
)
self
.
parent
.
models
[
self
.
parent
.
l
.
GetString
(
i
)]
.
rot
-=
5
*
(
self
.
i
-
self
.
previ
)
#self.models[self.l.GetItemText(i)].offsets
=
o
#self.models[self.l.GetItemText(i)].offsets
=
o
self
.
previ
=
self
.
i
self
.
previ
=
self
.
i
self
.
Refresh
()
self
.
Refresh
()
def
cr
(
self
):
def
cr
(
self
):
time
.
sleep
(
0.01
)
time
.
sleep
(
0.01
)
wx
.
CallAfter
(
self
.
rotateafter
)
wx
.
CallAfter
(
self
.
rotateafter
)
self
.
triggered
=
0
self
.
triggered
=
0
def
rot
(
self
,
event
):
def
rot
(
self
,
event
):
z
=
event
.
GetWheelRotation
()
z
=
event
.
GetWheelRotation
()
s
=
self
.
parent
.
l
.
GetSelection
()
s
=
self
.
parent
.
l
.
GetSelection
()
if
self
.
prevsel
!=
s
:
if
self
.
prevsel
!=
s
:
self
.
i
=
0
self
.
i
=
0
self
.
prevsel
=
s
self
.
prevsel
=
s
if
z
<
0
:
if
z
<
0
:
self
.
rotate_shape
(
-
1
)
self
.
rotate_shape
(
-
1
)
else
:
else
:
self
.
rotate_shape
(
1
)
self
.
rotate_shape
(
1
)
def
repaint
(
self
,
event
):
def
repaint
(
self
,
event
):
dc
=
wx
.
PaintDC
(
self
)
dc
=
wx
.
PaintDC
(
self
)
self
.
paint
(
dc
=
dc
)
self
.
paint
(
dc
=
dc
)
def
paint
(
self
,
coord1
=
"x"
,
coord2
=
"y"
,
dc
=
None
):
def
paint
(
self
,
coord1
=
"x"
,
coord2
=
"y"
,
dc
=
None
):
coords
=
{
"x"
:
0
,
"y"
:
1
,
"z"
:
2
}
coords
=
{
"x"
:
0
,
"y"
:
1
,
"z"
:
2
}
if
dc
is
None
:
if
dc
is
None
:
dc
=
wx
.
ClientDC
(
self
)
dc
=
wx
.
ClientDC
(
self
)
offset
=
[
0
,
0
]
offset
=
[
0
,
0
]
scale
=
2
scale
=
2
dc
.
SetPen
(
wx
.
Pen
(
wx
.
Colour
(
100
,
100
,
100
)))
dc
.
SetPen
(
wx
.
Pen
(
wx
.
Colour
(
100
,
100
,
100
)))
for
i
in
xrange
(
20
):
for
i
in
xrange
(
20
):
dc
.
DrawLine
(
0
,
i
*
scale
*
10
,
400
,
i
*
scale
*
10
)
dc
.
DrawLine
(
0
,
i
*
scale
*
10
,
400
,
i
*
scale
*
10
)
dc
.
DrawLine
(
i
*
scale
*
10
,
0
,
i
*
scale
*
10
,
400
)
dc
.
DrawLine
(
i
*
scale
*
10
,
0
,
i
*
scale
*
10
,
400
)
dc
.
SetPen
(
wx
.
Pen
(
wx
.
Colour
(
0
,
0
,
0
)))
dc
.
SetPen
(
wx
.
Pen
(
wx
.
Colour
(
0
,
0
,
0
)))
for
i
in
xrange
(
4
):
for
i
in
xrange
(
4
):
dc
.
DrawLine
(
0
,
i
*
scale
*
50
,
400
,
i
*
scale
*
50
)
dc
.
DrawLine
(
0
,
i
*
scale
*
50
,
400
,
i
*
scale
*
50
)
dc
.
DrawLine
(
i
*
scale
*
50
,
0
,
i
*
scale
*
50
,
400
)
dc
.
DrawLine
(
i
*
scale
*
50
,
0
,
i
*
scale
*
50
,
400
)
dc
.
SetBrush
(
wx
.
Brush
(
wx
.
Colour
(
128
,
255
,
128
)))
dc
.
SetBrush
(
wx
.
Brush
(
wx
.
Colour
(
128
,
255
,
128
)))
dc
.
SetPen
(
wx
.
Pen
(
wx
.
Colour
(
128
,
128
,
128
)))
dc
.
SetPen
(
wx
.
Pen
(
wx
.
Colour
(
128
,
128
,
128
)))
t
=
time
.
time
()
t
=
time
.
time
()
dcs
=
wx
.
MemoryDC
()
dcs
=
wx
.
MemoryDC
()
for
m
in
self
.
parent
.
models
.
values
():
for
m
in
self
.
parent
.
models
.
values
():
b
=
m
.
bitmap
b
=
m
.
bitmap
#print b
#print b
im
=
b
.
ConvertToImage
()
im
=
b
.
ConvertToImage
()
#print im
#print im
imgc
=
wx
.
Point
(
im
.
GetWidth
()
/
2
,
im
.
GetHeight
()
/
2
)
imgc
=
wx
.
Point
(
im
.
GetWidth
()
/
2
,
im
.
GetHeight
()
/
2
)
#print math.radians(5*(self.i-self.previ))
#print math.radians(5*(self.i-self.previ))
im
=
im
.
Rotate
(
math
.
radians
(
m
.
rot
),
imgc
,
0
)
im
=
im
.
Rotate
(
math
.
radians
(
m
.
rot
),
imgc
,
0
)
bm
=
wx
.
BitmapFromImage
(
im
)
bm
=
wx
.
BitmapFromImage
(
im
)
dcs
.
SelectObject
(
bm
)
dcs
.
SelectObject
(
bm
)
bsz
=
bm
.
GetSize
()
bsz
=
bm
.
GetSize
()
dc
.
Blit
(
scale
*
m
.
offsets
[
0
]
-
bsz
[
0
]
/
2
,
400
-
(
scale
*
m
.
offsets
[
1
]
+
bsz
[
1
]
/
2
),
bsz
[
0
],
bsz
[
1
],
dcs
,
0
,
0
,
useMask
=
1
)
dc
.
Blit
(
scale
*
m
.
offsets
[
0
]
-
bsz
[
0
]
/
2
,
400
-
(
scale
*
m
.
offsets
[
1
]
+
bsz
[
1
]
/
2
),
bsz
[
0
],
bsz
[
1
],
dcs
,
0
,
0
,
useMask
=
1
)
#for i in m.facets:#random.sample(m.facets,
min(100000,
len(m.facets))):
#for i in m.facets:#random.sample(m.facets,
min(100000,
len(m.facets))):
# dc.DrawPolygon([wx.Point(offset[0]+scale*m.offsets[0]+scale*p[0],400-(offset[1]+scale*m.offsets[1]+scale*p[1])) for p in i[1]])
# dc.DrawPolygon([wx.Point(offset[0]+scale*m.offsets[0]+scale*p[0],
400-(offset[1]+scale*m.offsets[1]+scale*p[1])) for p in i[1]])
#if(time.time()-t)>5:
#if(time.time()-t)>5:
# break
# break
del
dc
del
dc
#print time.time()-t
#print time.time()-t
#s.export()
#s.export()
class
stlwin
(
wx
.
Frame
):
class
stlwin
(
wx
.
Frame
):
def
__init__
(
self
,
size
=
(
800
,
580
),
callback
=
None
,
parent
=
None
):
def
__init__
(
self
,
size
=
(
800
,
580
),
callback
=
None
,
parent
=
None
):
wx
.
Frame
.
__init__
(
self
,
parent
,
title
=
"Plate building tool"
,
size
=
size
)
wx
.
Frame
.
__init__
(
self
,
parent
,
title
=
"Plate building tool"
,
size
=
size
)
self
.
SetIcon
(
wx
.
Icon
(
"plater.ico"
,
wx
.
BITMAP_TYPE_ICO
))
self
.
SetIcon
(
wx
.
Icon
(
"plater.ico"
,
wx
.
BITMAP_TYPE_ICO
))
self
.
mainsizer
=
wx
.
BoxSizer
(
wx
.
HORIZONTAL
)
self
.
mainsizer
=
wx
.
BoxSizer
(
wx
.
HORIZONTAL
)
self
.
panel
=
wx
.
Panel
(
self
,
-
1
,
size
=
(
150
,
600
),
pos
=
(
0
,
0
))
self
.
panel
=
wx
.
Panel
(
self
,
-
1
,
size
=
(
150
,
600
),
pos
=
(
0
,
0
))
self
.
panel
.
SetBackgroundColour
((
10
,
10
,
10
))
self
.
panel
.
SetBackgroundColour
((
10
,
10
,
10
))
self
.
l
=
wx
.
ListBox
(
self
.
panel
,
size
=
(
300
,
180
),
pos
=
(
0
,
30
))
self
.
l
=
wx
.
ListBox
(
self
.
panel
,
size
=
(
300
,
180
),
pos
=
(
0
,
30
))
self
.
cl
=
wx
.
Button
(
self
.
panel
,
label
=
"Clear"
,
pos
=
(
0
,
205
))
self
.
cl
=
wx
.
Button
(
self
.
panel
,
label
=
"Clear"
,
pos
=
(
0
,
205
))
self
.
lb
=
wx
.
Button
(
self
.
panel
,
label
=
"Load"
,
pos
=
(
0
,
0
))
self
.
lb
=
wx
.
Button
(
self
.
panel
,
label
=
"Load"
,
pos
=
(
0
,
0
))
if
(
callback
is
None
):
if
(
callback
is
None
):
self
.
eb
=
wx
.
Button
(
self
.
panel
,
label
=
"Export"
,
pos
=
(
100
,
0
))
self
.
eb
=
wx
.
Button
(
self
.
panel
,
label
=
"Export"
,
pos
=
(
100
,
0
))
self
.
eb
.
Bind
(
wx
.
EVT_BUTTON
,
self
.
export
)
self
.
eb
.
Bind
(
wx
.
EVT_BUTTON
,
self
.
export
)
else
:
else
:
self
.
eb
=
wx
.
Button
(
self
.
panel
,
label
=
"Done"
,
pos
=
(
100
,
0
))
self
.
eb
=
wx
.
Button
(
self
.
panel
,
label
=
"Done"
,
pos
=
(
100
,
0
))
self
.
eb
.
Bind
(
wx
.
EVT_BUTTON
,
lambda
e
:
self
.
done
(
e
,
callback
))
self
.
eb
.
Bind
(
wx
.
EVT_BUTTON
,
lambda
e
:
self
.
done
(
e
,
callback
))
self
.
eb
=
wx
.
Button
(
self
.
panel
,
label
=
"Cancel"
,
pos
=
(
200
,
0
))
self
.
eb
=
wx
.
Button
(
self
.
panel
,
label
=
"Cancel"
,
pos
=
(
200
,
0
))
self
.
eb
.
Bind
(
wx
.
EVT_BUTTON
,
lambda
e
:
self
.
Destroy
())
self
.
eb
.
Bind
(
wx
.
EVT_BUTTON
,
lambda
e
:
self
.
Destroy
())
self
.
sb
=
wx
.
Button
(
self
.
panel
,
label
=
"Snap to Z=0"
,
pos
=
(
00
,
255
))
self
.
sb
=
wx
.
Button
(
self
.
panel
,
label
=
"Snap to Z = 0"
,
pos
=
(
00
,
255
))
self
.
cb
=
wx
.
Button
(
self
.
panel
,
label
=
"Put at 100,100"
,
pos
=
(
0
,
280
))
self
.
cb
=
wx
.
Button
(
self
.
panel
,
label
=
"Put at 100, 100"
,
pos
=
(
0
,
280
))
self
.
db
=
wx
.
Button
(
self
.
panel
,
label
=
"Delete"
,
pos
=
(
0
,
305
))
self
.
db
=
wx
.
Button
(
self
.
panel
,
label
=
"Delete"
,
pos
=
(
0
,
305
))
self
.
ab
=
wx
.
Button
(
self
.
panel
,
label
=
"Auto"
,
pos
=
(
0
,
330
))
self
.
ab
=
wx
.
Button
(
self
.
panel
,
label
=
"Auto"
,
pos
=
(
0
,
330
))
self
.
cl
.
Bind
(
wx
.
EVT_BUTTON
,
self
.
clear
)
self
.
cl
.
Bind
(
wx
.
EVT_BUTTON
,
self
.
clear
)
self
.
lb
.
Bind
(
wx
.
EVT_BUTTON
,
self
.
right
)
self
.
lb
.
Bind
(
wx
.
EVT_BUTTON
,
self
.
right
)
self
.
sb
.
Bind
(
wx
.
EVT_BUTTON
,
self
.
snap
)
self
.
sb
.
Bind
(
wx
.
EVT_BUTTON
,
self
.
snap
)
self
.
cb
.
Bind
(
wx
.
EVT_BUTTON
,
self
.
center
)
self
.
cb
.
Bind
(
wx
.
EVT_BUTTON
,
self
.
center
)
self
.
db
.
Bind
(
wx
.
EVT_BUTTON
,
self
.
delete
)
self
.
db
.
Bind
(
wx
.
EVT_BUTTON
,
self
.
delete
)
self
.
ab
.
Bind
(
wx
.
EVT_BUTTON
,
self
.
autoplate
)
self
.
ab
.
Bind
(
wx
.
EVT_BUTTON
,
self
.
autoplate
)
self
.
basedir
=
"."
self
.
basedir
=
"."
self
.
models
=
{}
self
.
models
=
{}
self
.
SetBackgroundColour
((
10
,
10
,
10
))
self
.
SetBackgroundColour
((
10
,
10
,
10
))
self
.
mainsizer
.
Add
(
self
.
panel
)
self
.
mainsizer
.
Add
(
self
.
panel
)
#self.mainsizer.AddSpacer(10)
#self.mainsizer.AddSpacer(10)
if
glview
:
if
glview
:
self
.
s
=
stlview
.
TestGlPanel
(
self
,(
580
,
580
))
self
.
s
=
stlview
.
TestGlPanel
(
self
,
(
580
,
580
))
else
:
else
:
self
.
s
=
showstl
(
self
,(
580
,
580
),(
0
,
0
))
self
.
s
=
showstl
(
self
,
(
580
,
580
),
(
0
,
0
))
self
.
mainsizer
.
Add
(
self
.
s
,
1
,
wx
.
EXPAND
)
self
.
mainsizer
.
Add
(
self
.
s
,
1
,
wx
.
EXPAND
)
self
.
SetSizer
(
self
.
mainsizer
)
self
.
SetSizer
(
self
.
mainsizer
)
#self.mainsizer.Fit(self)
#self.mainsizer.Fit(self)
self
.
Layout
()
self
.
Layout
()
#self.SetClientSize(size)
#self.SetClientSize(size)
def
autoplate
(
self
,
event
):
def
autoplate
(
self
,
event
):
print
"Autoplating"
print
"Autoplating"
separation
=
2
separation
=
2
bedsize
=
[
200
,
200
,
100
]
bedsize
=
[
200
,
200
,
100
]
cursor
=
[
0
,
0
,
0
]
cursor
=
[
0
,
0
,
0
]
newrow
=
0
newrow
=
0
max
=
[
0
,
0
]
max
=
[
0
,
0
]
for
i
in
self
.
models
:
for
i
in
self
.
models
:
self
.
models
[
i
]
.
offsets
[
2
]
=-
1.0
*
self
.
models
[
i
]
.
dims
[
4
]
self
.
models
[
i
]
.
offsets
[
2
]
=
-
1.0
*
self
.
models
[
i
]
.
dims
[
4
]
x
=
abs
(
self
.
models
[
i
]
.
dims
[
0
]
-
self
.
models
[
i
]
.
dims
[
1
])
x
=
abs
(
self
.
models
[
i
]
.
dims
[
0
]
-
self
.
models
[
i
]
.
dims
[
1
])
y
=
abs
(
self
.
models
[
i
]
.
dims
[
2
]
-
self
.
models
[
i
]
.
dims
[
3
])
y
=
abs
(
self
.
models
[
i
]
.
dims
[
2
]
-
self
.
models
[
i
]
.
dims
[
3
])
centre
=
[
x
/
2
,
y
/
2
]
centre
=
[
x
/
2
,
y
/
2
]
centreoffset
=
[
self
.
models
[
i
]
.
dims
[
0
]
+
centre
[
0
],
self
.
models
[
i
]
.
dims
[
2
]
+
centre
[
1
]]
centreoffset
=
[
self
.
models
[
i
]
.
dims
[
0
]
+
centre
[
0
],
self
.
models
[
i
]
.
dims
[
2
]
+
centre
[
1
]]
if
(
cursor
[
0
]
+
x
+
separation
)
>=
bedsize
[
0
]:
if
(
cursor
[
0
]
+
x
+
separation
)
>=
bedsize
[
0
]:
cursor
[
0
]
=
0
cursor
[
0
]
=
0
cursor
[
1
]
+=
newrow
+
separation
cursor
[
1
]
+=
newrow
+
separation
newrow
=
0
newrow
=
0
if
(
newrow
==
0
)
or
(
newrow
<
y
):
if
(
newrow
==
0
)
or
(
newrow
<
y
):
newrow
=
y
newrow
=
y
...
@@ -280,103 +285,100 @@ class stlwin(wx.Frame):
...
@@ -280,103 +285,100 @@ class stlwin(wx.Frame):
# Good job, it confused the hell out of me.
# Good job, it confused the hell out of me.
self
.
models
[
i
]
.
offsets
[
0
]
=
cursor
[
0
]
+
centre
[
0
]
-
centreoffset
[
0
]
self
.
models
[
i
]
.
offsets
[
0
]
=
cursor
[
0
]
+
centre
[
0
]
-
centreoffset
[
0
]
self
.
models
[
i
]
.
offsets
[
1
]
=
cursor
[
1
]
+
centre
[
1
]
-
centreoffset
[
1
]
self
.
models
[
i
]
.
offsets
[
1
]
=
cursor
[
1
]
+
centre
[
1
]
-
centreoffset
[
1
]
if
(
max
[
0
]
==
0
)
or
(
max
[
0
]
<
(
cursor
[
0
]
+
x
)):
if
(
max
[
0
]
==
0
)
or
(
max
[
0
]
<
(
cursor
[
0
]
+
x
)):
max
[
0
]
=
cursor
[
0
]
+
x
max
[
0
]
=
cursor
[
0
]
+
x
if
(
max
[
1
]
==
0
)
or
(
max
[
1
]
<
(
cursor
[
1
]
+
x
)):
if
(
max
[
1
]
==
0
)
or
(
max
[
1
]
<
(
cursor
[
1
]
+
x
)):
max
[
1
]
=
cursor
[
1
]
+
x
max
[
1
]
=
cursor
[
1
]
+
x
cursor
[
0
]
+=
x
+
separation
cursor
[
0
]
+=
x
+
separation
if
(
cursor
[
1
]
+
y
)
>=
bedsize
[
1
]:
if
(
cursor
[
1
]
+
y
)
>=
bedsize
[
1
]:
print
"Bed full, sorry sir :("
print
"Bed full, sorry sir :("
self
.
Refresh
()
self
.
Refresh
()
return
return
centreoffset
=
[(
bedsize
[
0
]
-
max
[
0
])
/
2
,(
bedsize
[
1
]
-
max
[
1
])
/
2
]
centreoffset
=
[(
bedsize
[
0
]
-
max
[
0
])
/
2
,
(
bedsize
[
1
]
-
max
[
1
])
/
2
]
for
i
in
self
.
models
:
for
i
in
self
.
models
:
self
.
models
[
i
]
.
offsets
[
0
]
+=
centreoffset
[
0
]
self
.
models
[
i
]
.
offsets
[
0
]
+=
centreoffset
[
0
]
self
.
models
[
i
]
.
offsets
[
1
]
+=
centreoffset
[
1
]
self
.
models
[
i
]
.
offsets
[
1
]
+=
centreoffset
[
1
]
self
.
Refresh
()
self
.
Refresh
()
def
clear
(
self
,
event
):
def
clear
(
self
,
event
):
result
=
wx
.
MessageBox
(
'Are you sure you want to clear the grid? All unsaved changes will be lost.'
,
'Clear the grid?'
,
result
=
wx
.
MessageBox
(
'Are you sure you want to clear the grid? All unsaved changes will be lost.'
,
'Clear the grid?'
,
wx
.
YES_NO
|
wx
.
ICON_QUESTION
)
wx
.
YES_NO
|
wx
.
ICON_QUESTION
)
if
(
result
==
2
):
if
(
result
==
2
):
self
.
models
=
{}
self
.
models
=
{}
self
.
l
.
Clear
()
self
.
l
.
Clear
()
self
.
Refresh
()
self
.
Refresh
()
def
center
(
self
,
event
):
def
center
(
self
,
event
):
i
=
self
.
l
.
GetSelection
()
i
=
self
.
l
.
GetSelection
()
if
i
!=
-
1
:
if
i
!=
-
1
:
m
=
self
.
models
[
self
.
l
.
GetString
(
i
)]
m
=
self
.
models
[
self
.
l
.
GetString
(
i
)]
m
.
offsets
=
[
100
,
100
,
m
.
offsets
[
2
]]
m
.
offsets
=
[
100
,
100
,
m
.
offsets
[
2
]]
self
.
Refresh
()
self
.
Refresh
()
def
snap
(
self
,
event
):
def
snap
(
self
,
event
):
i
=
self
.
l
.
GetSelection
()
i
=
self
.
l
.
GetSelection
()
if
i
!=
-
1
:
if
i
!=
-
1
:
m
=
self
.
models
[
self
.
l
.
GetString
(
i
)]
m
=
self
.
models
[
self
.
l
.
GetString
(
i
)]
m
.
offsets
[
2
]
=-
1.0
*
min
(
m
.
facetsminz
)[
0
]
m
.
offsets
[
2
]
=
-
1.0
*
min
(
m
.
facetsminz
)[
0
]
#print m.offsets[2]
#print m.offsets[2]
self
.
Refresh
()
self
.
Refresh
()
def
delete
(
self
,
event
):
def
delete
(
self
,
event
):
i
=
self
.
l
.
GetSelection
()
i
=
self
.
l
.
GetSelection
()
if
i
!=
-
1
:
if
i
!=
-
1
:
del
self
.
models
[
self
.
l
.
GetString
(
i
)]
del
self
.
models
[
self
.
l
.
GetString
(
i
)]
self
.
l
.
Delete
(
i
)
self
.
l
.
Delete
(
i
)
self
.
l
.
Select
(
self
.
l
.
GetCount
()
-
1
)
self
.
l
.
Select
(
self
.
l
.
GetCount
()
-
1
)
self
.
Refresh
()
self
.
Refresh
()
def
done
(
self
,
event
,
cb
):
def
done
(
self
,
event
,
cb
):
import
os
,
time
try
:
try
:
os
.
mkdir
(
"tempstl"
)
os
.
mkdir
(
"tempstl"
)
except
:
except
:
pass
pass
name
=
"tempstl/"
+
str
(
int
(
time
.
time
())
%
10000
)
+
".stl"
name
=
"tempstl/"
+
str
(
int
(
time
.
time
())
%
10000
)
+
".stl"
self
.
writefiles
(
name
)
self
.
writefiles
(
name
)
if
cb
is
not
None
:
if
cb
is
not
None
:
cb
(
name
)
cb
(
name
)
self
.
Destroy
()
self
.
Destroy
()
def
export
(
self
,
event
):
def
export
(
self
,
event
):
dlg
=
wx
.
FileDialog
(
self
,
"Pick file to save to"
,
self
.
basedir
,
style
=
wx
.
FD_SAVE
)
dlg
=
wx
.
FileDialog
(
self
,
"Pick file to save to"
,
self
.
basedir
,
style
=
wx
.
FD_SAVE
)
dlg
.
SetWildcard
(
"STL files (;*.stl;)"
)
dlg
.
SetWildcard
(
"STL files (;*.stl;)"
)
if
(
dlg
.
ShowModal
()
==
wx
.
ID_OK
):
if
(
dlg
.
ShowModal
()
==
wx
.
ID_OK
):
name
=
dlg
.
GetPath
()
name
=
dlg
.
GetPath
()
self
.
writefiles
(
name
)
self
.
writefiles
(
name
)
def
writefiles
(
self
,
name
):
def
writefiles
(
self
,
name
):
sf
=
open
(
name
.
replace
(
"."
,
"_"
)
+
".scad"
,
"w"
)
sf
=
open
(
name
.
replace
(
"."
,
"_"
)
+
".scad"
,
"w"
)
facets
=
[]
facets
=
[]
for
i
in
self
.
models
.
values
():
for
i
in
self
.
models
.
values
():
r
=
i
.
rot
r
=
i
.
rot
o
=
i
.
offsets
o
=
i
.
offsets
sf
.
write
(
'translate([
%
s,
%
s,
%
s]) rotate([0,0,
%
s]) import_stl("
%
s");
\n
'
%
(
str
(
o
[
0
]),
str
(
o
[
1
]),
str
(
o
[
2
]),
r
,
os
.
path
.
split
(
i
.
filename
)[
1
]))
sf
.
write
(
'translate([
%
s,
%
s,
%
s]) rotate([0, 0,
%
s]) import_stl("
%
s");
\n
'
%
(
str
(
o
[
0
]),
str
(
o
[
1
]),
str
(
o
[
2
]),
r
,
os
.
path
.
split
(
i
.
filename
)[
1
]))
if
r
!=
0
:
if
r
!=
0
:
i
=
i
.
rotate
([
0
,
0
,
r
])
i
=
i
.
rotate
([
0
,
0
,
r
])
if
o
!=
[
0
,
0
,
0
]:
if
o
!=
[
0
,
0
,
0
]:
i
=
i
.
translate
([
o
[
0
],
o
[
1
],
o
[
2
]])
i
=
i
.
translate
([
o
[
0
],
o
[
1
],
o
[
2
]])
facets
+=
i
.
facets
facets
+=
i
.
facets
sf
.
close
()
sf
.
close
()
stltool
.
emitstl
(
name
,
facets
,
"plater_export"
)
stltool
.
emitstl
(
name
,
facets
,
"plater_export"
)
print
"wrote "
,
name
print
"wrote "
,
name
def
right
(
self
,
event
):
def
right
(
self
,
event
):
dlg
=
wx
.
FileDialog
(
self
,
"Pick file to load"
,
self
.
basedir
,
style
=
wx
.
FD_OPEN
|
wx
.
FD_FILE_MUST_EXIST
)
dlg
=
wx
.
FileDialog
(
self
,
"Pick file to load"
,
self
.
basedir
,
style
=
wx
.
FD_OPEN
|
wx
.
FD_FILE_MUST_EXIST
)
dlg
.
SetWildcard
(
"STL files (;*.stl;)|*.stl|OpenSCAD files (;*.scad;)|*.scad"
)
dlg
.
SetWildcard
(
"STL files (;*.stl;)|*.stl|OpenSCAD files (;*.scad;)|*.scad"
)
if
(
dlg
.
ShowModal
()
==
wx
.
ID_OK
):
if
(
dlg
.
ShowModal
()
==
wx
.
ID_OK
):
name
=
dlg
.
GetPath
()
name
=
dlg
.
GetPath
()
if
(
name
.
lower
()
.
endswith
(
".stl"
)):
if
(
name
.
lower
()
.
endswith
(
".stl"
)):
self
.
load_stl
(
event
,
name
)
self
.
load_stl
(
event
,
name
)
elif
(
name
.
lower
()
.
endswith
(
".scad"
)):
elif
(
name
.
lower
()
.
endswith
(
".scad"
)):
self
.
load_scad
(
event
,
name
)
self
.
load_scad
(
event
,
name
)
def
load_scad
(
self
,
event
,
name
):
def
load_scad
(
self
,
event
,
name
):
lf
=
open
(
name
)
lf
=
open
(
name
)
s
=
[
i
.
replace
(
"
\n
"
,
""
)
.
replace
(
"
\r
"
,
""
)
.
replace
(
";"
,
""
)
for
i
in
lf
if
"stl"
in
i
]
s
=
[
i
.
replace
(
"
\n
"
,
""
)
.
replace
(
"
\r
"
,
""
)
.
replace
(
";"
,
""
)
for
i
in
lf
if
"stl"
in
i
]
lf
.
close
()
lf
.
close
()
for
i
in
s
:
for
i
in
s
:
...
@@ -390,76 +392,75 @@ class stlwin(wx.Frame):
...
@@ -390,76 +392,75 @@ class stlwin(wx.Frame):
for
part
in
parts
:
for
part
in
parts
:
if
'import'
in
part
:
if
'import'
in
part
:
stl_file
=
evalme
(
part
)
stl_file
=
evalme
(
part
)
newname
=
os
.
path
.
split
(
stl_file
.
lower
())[
1
]
newname
=
os
.
path
.
split
(
stl_file
.
lower
())[
1
]
c
=
1
c
=
1
while
newname
in
self
.
models
:
while
newname
in
self
.
models
:
newname
=
os
.
path
.
split
(
stl_file
.
lower
())[
1
]
newname
=
os
.
path
.
split
(
stl_file
.
lower
())[
1
]
newname
=
newname
+
"(
%
d)"
%
c
newname
=
newname
+
"(
%
d)"
%
c
c
+=
1
c
+=
1
stl_path
=
os
.
path
.
join
(
os
.
path
.
split
(
name
)[
0
:
len
(
os
.
path
.
split
(
stl_file
))
-
1
])
stl_path
=
os
.
path
.
join
(
os
.
path
.
split
(
name
)[
0
:
len
(
os
.
path
.
split
(
stl_file
))
-
1
])
stl_full_path
=
os
.
path
.
join
(
stl_path
[
0
],
str
(
stl_file
))
stl_full_path
=
os
.
path
.
join
(
stl_path
[
0
],
str
(
stl_file
))
self
.
load_stl_into_model
(
stl_full_path
,
stl_file
,
translate_list
,
rotate_list
[
2
])
self
.
load_stl_into_model
(
stl_full_path
,
stl_file
,
translate_list
,
rotate_list
[
2
])
def
load_stl
(
self
,
event
,
name
):
def
load_stl
(
self
,
event
,
name
):
if
not
(
os
.
path
.
exists
(
name
)):
if
not
(
os
.
path
.
exists
(
name
)):
return
return
path
=
os
.
path
.
split
(
name
)[
0
]
path
=
os
.
path
.
split
(
name
)[
0
]
self
.
basedir
=
path
self
.
basedir
=
path
t
=
time
.
time
()
t
=
time
.
time
()
#print name
#print name
if
name
.
lower
()
.
endswith
(
".stl"
):
if
name
.
lower
()
.
endswith
(
".stl"
):
#Filter out the path, just show the STL filename.
#Filter out the path, just show the STL filename.
self
.
load_stl_into_model
(
name
,
name
)
self
.
load_stl_into_model
(
name
,
name
)
self
.
Refresh
()
self
.
Refresh
()
#print time.time()-t
#print time.time()-t
def
load_stl_into_model
(
self
,
path
,
name
,
offset
=
[
0
,
0
,
0
],
rotation
=
0
,
scale
=
[
1.0
,
1.0
,
1.0
]):
def
load_stl_into_model
(
self
,
path
,
name
,
offset
=
[
0
,
0
,
0
],
rotation
=
0
,
scale
=
[
1.0
,
1.0
,
1.0
]):
newname
=
os
.
path
.
split
(
name
.
lower
())[
1
]
newname
=
os
.
path
.
split
(
name
.
lower
())[
1
]
c
=
1
c
=
1
while
newname
in
self
.
models
:
while
newname
in
self
.
models
:
newname
=
os
.
path
.
split
(
name
.
lower
())[
1
]
newname
=
os
.
path
.
split
(
name
.
lower
())[
1
]
newname
=
newname
+
"(
%
d)"
%
c
newname
=
newname
+
"(
%
d)"
%
c
c
+=
1
c
+=
1
self
.
models
[
newname
]
=
stltool
.
stl
(
path
)
self
.
models
[
newname
]
=
stltool
.
stl
(
path
)
self
.
models
[
newname
]
.
offsets
=
offset
self
.
models
[
newname
]
.
offsets
=
offset
self
.
models
[
newname
]
.
rot
=
rotation
self
.
models
[
newname
]
.
rot
=
rotation
self
.
models
[
newname
]
.
scale
=
scale
self
.
models
[
newname
]
.
scale
=
scale
self
.
models
[
newname
]
.
filename
=
name
self
.
models
[
newname
]
.
filename
=
name
minx
,
miny
,
minz
,
maxx
,
maxy
,
maxz
=
(
10000
,
10000
,
10000
,
0
,
0
,
0
)
minx
,
miny
,
minz
,
maxx
,
maxy
,
maxz
=
(
10000
,
10000
,
10000
,
0
,
0
,
0
)
for
i
in
self
.
models
[
newname
]
.
facets
:
for
i
in
self
.
models
[
newname
]
.
facets
:
for
j
in
i
[
1
]:
for
j
in
i
[
1
]:
if
j
[
0
]
<
minx
:
if
j
[
0
]
<
minx
:
minx
=
j
[
0
]
minx
=
j
[
0
]
if
j
[
1
]
<
miny
:
if
j
[
1
]
<
miny
:
miny
=
j
[
1
]
miny
=
j
[
1
]
if
j
[
2
]
<
minz
:
if
j
[
2
]
<
minz
:
minz
=
j
[
2
]
minz
=
j
[
2
]
if
j
[
0
]
>
maxx
:
if
j
[
0
]
>
maxx
:
maxx
=
j
[
0
]
maxx
=
j
[
0
]
if
j
[
1
]
>
maxy
:
if
j
[
1
]
>
maxy
:
maxy
=
j
[
1
]
maxy
=
j
[
1
]
if
j
[
2
]
>
maxz
:
if
j
[
2
]
>
maxz
:
maxz
=
j
[
2
]
maxz
=
j
[
2
]
self
.
models
[
newname
]
.
dims
=
[
minx
,
maxx
,
miny
,
maxy
,
minz
,
maxz
]
self
.
models
[
newname
]
.
dims
=
[
minx
,
maxx
,
miny
,
maxy
,
minz
,
maxz
]
#if minx
<
0:
#if minx
<
0:
# self.models[newname].offsets[0]
=
-minx
# self.models[newname].offsets[0]
=
-minx
#if miny
<
0:
#if miny
<
0:
# self.models[newname].offsets[1]
=
-miny
# self.models[newname].offsets[1]
=
-miny
self
.
s
.
drawmodel
(
self
.
models
[
newname
],
2
)
self
.
s
.
drawmodel
(
self
.
models
[
newname
],
2
)
#print time.time()
-
t
#print time.time()
-
t
self
.
l
.
Append
(
newname
)
self
.
l
.
Append
(
newname
)
i
=
self
.
l
.
GetSelection
()
i
=
self
.
l
.
GetSelection
()
if
i
==
wx
.
NOT_FOUND
:
if
i
==
wx
.
NOT_FOUND
:
self
.
l
.
Select
(
0
)
self
.
l
.
Select
(
0
)
self
.
l
.
Select
(
self
.
l
.
GetCount
()
-
1
)
self
.
l
.
Select
(
self
.
l
.
GetCount
()
-
1
)
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
app
=
wx
.
App
(
False
)
app
=
wx
.
App
(
False
)
main
=
stlwin
()
main
=
stlwin
()
main
.
Show
()
main
.
Show
()
app
.
MainLoop
()
app
.
MainLoop
()
pronterface.py
View file @
6dff5776
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
# Set up Internationalization using gettext
# Set up Internationalization using gettext
# searching for installed locales on /usr/share; uses relative folder if not found (windows)
# searching for installed locales on /usr/share; uses relative folder if not found (windows)
import
os
,
gettext
,
Queue
import
os
,
gettext
,
Queue
,
re
if
os
.
path
.
exists
(
'/usr/share/pronterface/locale'
):
if
os
.
path
.
exists
(
'/usr/share/pronterface/locale'
):
gettext
.
install
(
'pronterface'
,
'/usr/share/pronterface/locale'
,
unicode
=
1
)
gettext
.
install
(
'pronterface'
,
'/usr/share/pronterface/locale'
,
unicode
=
1
)
...
@@ -77,6 +77,7 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
...
@@ -77,6 +77,7 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
self
.
panel
=
wx
.
Panel
(
self
,
-
1
,
size
=
size
)
self
.
panel
=
wx
.
Panel
(
self
,
-
1
,
size
=
size
)
self
.
statuscheck
=
False
self
.
statuscheck
=
False
self
.
capture_skip
=
[]
self
.
tempreport
=
""
self
.
tempreport
=
""
self
.
monitor
=
0
self
.
monitor
=
0
self
.
f
=
None
self
.
f
=
None
...
@@ -209,7 +210,7 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
...
@@ -209,7 +210,7 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
self
.
p
.
send_now
(
"M104 S"
+
l
)
self
.
p
.
send_now
(
"M104 S"
+
l
)
print
_
(
"Setting hotend temperature to "
),
f
,
_
(
" degrees Celsius."
)
print
_
(
"Setting hotend temperature to "
),
f
,
_
(
" degrees Celsius."
)
self
.
hsetpoint
=
f
self
.
hsetpoint
=
f
#self.
tgauge.SetTarget(int(f))
self
.
hot
tgauge
.
SetTarget
(
int
(
f
))
if
f
>
0
:
if
f
>
0
:
wx
.
CallAfter
(
self
.
htemp
.
SetValue
,
l
)
wx
.
CallAfter
(
self
.
htemp
.
SetValue
,
l
)
self
.
set
(
"last_temperature"
,
str
(
f
))
self
.
set
(
"last_temperature"
,
str
(
f
))
...
@@ -245,6 +246,7 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
...
@@ -245,6 +246,7 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
self
.
p
.
send_now
(
"M140 S"
+
l
)
self
.
p
.
send_now
(
"M140 S"
+
l
)
print
_
(
"Setting bed temperature to "
),
f
,
_
(
" degrees Celsius."
)
print
_
(
"Setting bed temperature to "
),
f
,
_
(
" degrees Celsius."
)
self
.
bsetpoint
=
f
self
.
bsetpoint
=
f
self
.
bedtgauge
.
SetTarget
(
int
(
f
))
if
f
>
0
:
if
f
>
0
:
wx
.
CallAfter
(
self
.
btemp
.
SetValue
,
l
)
wx
.
CallAfter
(
self
.
btemp
.
SetValue
,
l
)
self
.
set
(
"last_bed_temperature"
,
str
(
f
))
self
.
set
(
"last_bed_temperature"
,
str
(
f
))
...
@@ -294,6 +296,10 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
...
@@ -294,6 +296,10 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
pronsole
.
pronsole
.
start_macro
(
self
,
macro_name
,
old_macro_definition
)
pronsole
.
pronsole
.
start_macro
(
self
,
macro_name
,
old_macro_definition
)
def
catchprint
(
self
,
l
):
def
catchprint
(
self
,
l
):
for
pat
in
self
.
capture_skip
:
if
pat
.
match
(
l
):
self
.
capture_skip
.
remove
(
pat
)
return
wx
.
CallAfter
(
self
.
logbox
.
AppendText
,
l
)
wx
.
CallAfter
(
self
.
logbox
.
AppendText
,
l
)
def
scanserial
(
self
):
def
scanserial
(
self
):
...
@@ -458,13 +464,6 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
...
@@ -458,13 +464,6 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
uts
.
Add
(
self
.
resetbtn
)
uts
.
Add
(
self
.
resetbtn
)
self
.
minibtn
=
wx
.
Button
(
self
.
panel
,
-
1
,
_
(
"Mini mode"
))
self
.
minibtn
=
wx
.
Button
(
self
.
panel
,
-
1
,
_
(
"Mini mode"
))
self
.
minibtn
.
Bind
(
wx
.
EVT_BUTTON
,
self
.
toggleview
)
self
.
minibtn
.
Bind
(
wx
.
EVT_BUTTON
,
self
.
toggleview
)
#self.tgauge=TempGauge(self.panel,size=(300,24))
#def scroll_setpoint(e):
# if e.GetWheelRotation()>0:
# self.do_settemp(str(self.hsetpoint+1))
# elif e.GetWheelRotation()<0:
# self.do_settemp(str(max(0,self.hsetpoint-1)))
#self.tgauge.Bind(wx.EVT_MOUSEWHEEL,scroll_setpoint)
uts
.
Add
((
25
,
-
1
))
uts
.
Add
((
25
,
-
1
))
self
.
monitorbox
=
wx
.
CheckBox
(
self
.
panel
,
-
1
,
_
(
"Monitor Printer"
))
self
.
monitorbox
=
wx
.
CheckBox
(
self
.
panel
,
-
1
,
_
(
"Monitor Printer"
))
...
@@ -473,7 +472,6 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
...
@@ -473,7 +472,6 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
uts
.
Add
((
15
,
-
1
),
flag
=
wx
.
EXPAND
)
uts
.
Add
((
15
,
-
1
),
flag
=
wx
.
EXPAND
)
uts
.
Add
(
self
.
minibtn
,
0
,
wx
.
ALIGN_CENTER
)
uts
.
Add
(
self
.
minibtn
,
0
,
wx
.
ALIGN_CENTER
)
#uts.Add(self.tgauge)
#SECOND ROW
#SECOND ROW
ubs
=
self
.
upperbottomsizer
=
wx
.
BoxSizer
(
wx
.
HORIZONTAL
)
ubs
=
self
.
upperbottomsizer
=
wx
.
BoxSizer
(
wx
.
HORIZONTAL
)
...
@@ -579,7 +577,7 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
...
@@ -579,7 +577,7 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
self
.
setbbtn
=
wx
.
Button
(
self
.
panel
,
-
1
,
_
(
"Set"
),
size
=
(
38
,
-
1
))
self
.
setbbtn
=
wx
.
Button
(
self
.
panel
,
-
1
,
_
(
"Set"
),
size
=
(
38
,
-
1
))
self
.
setbbtn
.
Bind
(
wx
.
EVT_BUTTON
,
self
.
do_bedtemp
)
self
.
setbbtn
.
Bind
(
wx
.
EVT_BUTTON
,
self
.
do_bedtemp
)
self
.
printerControls
.
append
(
self
.
setbbtn
)
self
.
printerControls
.
append
(
self
.
setbbtn
)
lls
.
Add
(
self
.
setbbtn
,
pos
=
(
4
,
4
),
span
=
(
1
,
2
))
lls
.
Add
(
self
.
setbbtn
,
pos
=
(
4
,
4
),
span
=
(
1
,
1
))
self
.
btemp
.
SetValue
(
str
(
self
.
settings
.
last_bed_temperature
))
self
.
btemp
.
SetValue
(
str
(
self
.
settings
.
last_bed_temperature
))
self
.
htemp
.
SetValue
(
str
(
self
.
settings
.
last_temperature
))
self
.
htemp
.
SetValue
(
str
(
self
.
settings
.
last_temperature
))
...
@@ -603,7 +601,7 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
...
@@ -603,7 +601,7 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
#lls.Add(self.btemp,pos=(4,1),span=(1,3))
#lls.Add(self.btemp,pos=(4,1),span=(1,3))
#lls.Add(self.setbbtn,pos=(4,4),span=(1,2))
#lls.Add(self.setbbtn,pos=(4,4),span=(1,2))
self
.
tempdisp
=
wx
.
StaticText
(
self
.
panel
,
-
1
,
""
)
self
.
tempdisp
=
wx
.
StaticText
(
self
.
panel
,
-
1
,
""
)
lls
.
Add
(
self
.
tempdisp
,
pos
=
(
4
,
6
),
span
=
(
1
,
3
))
lls
.
Add
(
self
.
tempdisp
,
pos
=
(
4
,
5
),
span
=
(
1
,
3
))
self
.
edist
=
wx
.
SpinCtrl
(
self
.
panel
,
-
1
,
"5"
,
min
=
0
,
max
=
1000
,
size
=
(
60
,
-
1
))
self
.
edist
=
wx
.
SpinCtrl
(
self
.
panel
,
-
1
,
"5"
,
min
=
0
,
max
=
1000
,
size
=
(
60
,
-
1
))
self
.
edist
.
SetBackgroundColour
((
225
,
200
,
200
))
self
.
edist
.
SetBackgroundColour
((
225
,
200
,
200
))
...
@@ -622,17 +620,28 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
...
@@ -622,17 +620,28 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
self
.
zfeedc
.
SetForegroundColour
(
"black"
)
self
.
zfeedc
.
SetForegroundColour
(
"black"
)
# lls.Add((10,0),pos=(0,11),span=(1,1))
# lls.Add((10,0),pos=(0,11),span=(1,1))
self
.
hottgauge
=
TempGauge
(
self
.
panel
,
size
=
(
300
,
24
),
title
=
_
(
"Heater:"
),
maxval
=
230
)
lls
.
Add
(
self
.
hottgauge
,
pos
=
(
7
,
0
),
span
=
(
1
,
8
))
self
.
bedtgauge
=
TempGauge
(
self
.
panel
,
size
=
(
300
,
24
),
title
=
_
(
"Bed:"
),
maxval
=
130
)
lls
.
Add
(
self
.
bedtgauge
,
pos
=
(
8
,
0
),
span
=
(
1
,
8
))
#def scroll_setpoint(e):
# if e.GetWheelRotation()>0:
# self.do_settemp(str(self.hsetpoint+1))
# elif e.GetWheelRotation()<0:
# self.do_settemp(str(max(0,self.hsetpoint-1)))
#self.tgauge.Bind(wx.EVT_MOUSEWHEEL,scroll_setpoint)
self
.
gviz
=
gviz
.
gviz
(
self
.
panel
,(
300
,
300
),
self
.
gviz
=
gviz
.
gviz
(
self
.
panel
,(
300
,
300
),
build_dimensions
=
self
.
build_dimensions_list
,
build_dimensions
=
self
.
build_dimensions_list
,
grid
=
(
self
.
settings
.
preview_grid_step1
,
self
.
settings
.
preview_grid_step2
),
grid
=
(
self
.
settings
.
preview_grid_step1
,
self
.
settings
.
preview_grid_step2
),
extrusion_width
=
self
.
settings
.
preview_extrusion_width
)
extrusion_width
=
self
.
settings
.
preview_extrusion_width
)
self
.
gviz
.
showall
=
1
self
.
gviz
.
showall
=
1
#
try:
try
:
#
raise
""
#
import stlview
import
stlview
#
self.gwindow=stlview.GCFrame(None, wx.ID_ANY, 'Gcode view, shift to move view, mousewheel to set layer', size=(600,600))
self
.
gwindow
=
stlview
.
GCFrame
(
None
,
wx
.
ID_ANY
,
'Gcode view, shift to move view, mousewheel to set layer'
,
size
=
(
600
,
600
))
#
except:
except
:
self
.
gwindow
=
gviz
.
window
([],
self
.
gwindow
=
gviz
.
window
([],
build_dimensions
=
self
.
build_dimensions_list
,
build_dimensions
=
self
.
build_dimensions_list
,
grid
=
(
self
.
settings
.
preview_grid_step1
,
self
.
settings
.
preview_grid_step2
),
grid
=
(
self
.
settings
.
preview_grid_step1
,
self
.
settings
.
preview_grid_step2
),
extrusion_width
=
self
.
settings
.
preview_extrusion_width
)
extrusion_width
=
self
.
settings
.
preview_extrusion_width
)
...
@@ -1125,10 +1134,11 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
...
@@ -1125,10 +1134,11 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
pass
pass
string
+=
(
self
.
tempreport
.
replace
(
"
\r
"
,
""
)
.
replace
(
"T"
,
_
(
"Hotend"
))
.
replace
(
"B"
,
_
(
"Bed"
))
.
replace
(
"
\n
"
,
""
)
.
replace
(
"ok "
,
""
))
+
" "
string
+=
(
self
.
tempreport
.
replace
(
"
\r
"
,
""
)
.
replace
(
"T"
,
_
(
"Hotend"
))
.
replace
(
"B"
,
_
(
"Bed"
))
.
replace
(
"
\n
"
,
""
)
.
replace
(
"ok "
,
""
))
+
" "
wx
.
CallAfter
(
self
.
tempdisp
.
SetLabel
,
self
.
tempreport
.
strip
()
.
replace
(
"ok "
,
""
))
wx
.
CallAfter
(
self
.
tempdisp
.
SetLabel
,
self
.
tempreport
.
strip
()
.
replace
(
"ok "
,
""
))
#try:
try
:
# self.tgauge.SetValue(int(filter(lambda x:x.startswith("T:"),self.tempreport.split())[0].split(":")[1]))
self
.
hottgauge
.
SetValue
(
float
(
filter
(
lambda
x
:
x
.
startswith
(
"T:"
),
self
.
tempreport
.
split
())[
0
]
.
split
(
":"
)[
1
]))
#except:
self
.
bedtgauge
.
SetValue
(
float
(
filter
(
lambda
x
:
x
.
startswith
(
"B:"
),
self
.
tempreport
.
split
())[
0
]
.
split
(
":"
)[
1
]))
# pass
except
:
pass
fractioncomplete
=
0.0
fractioncomplete
=
0.0
if
self
.
sdprinting
:
if
self
.
sdprinting
:
fractioncomplete
=
float
(
self
.
percentdone
/
100.0
)
fractioncomplete
=
float
(
self
.
percentdone
/
100.0
)
...
@@ -1150,6 +1160,8 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
...
@@ -1150,6 +1160,8 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
if
(
self
.
monitor
and
self
.
p
.
online
):
if
(
self
.
monitor
and
self
.
p
.
online
):
if
self
.
sdprinting
:
if
self
.
sdprinting
:
self
.
p
.
send_now
(
"M27"
)
self
.
p
.
send_now
(
"M27"
)
self
.
capture_skip
.
append
(
re
.
compile
(
r"ok T:[\d\.]+( B:[\d\.]+)?( @:[\d\.]+)?\s*"
))
self
.
capture_skip
.
append
(
re
.
compile
(
r"\n"
))
self
.
p
.
send_now
(
"M105"
)
self
.
p
.
send_now
(
"M105"
)
time
.
sleep
(
self
.
monitor_interval
)
time
.
sleep
(
self
.
monitor_interval
)
while
not
self
.
sentlines
.
empty
():
while
not
self
.
sentlines
.
empty
():
...
@@ -1184,10 +1196,11 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
...
@@ -1184,10 +1196,11 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
if
"T:"
in
l
:
if
"T:"
in
l
:
self
.
tempreport
=
l
self
.
tempreport
=
l
wx
.
CallAfter
(
self
.
tempdisp
.
SetLabel
,
self
.
tempreport
.
strip
()
.
replace
(
"ok "
,
""
))
wx
.
CallAfter
(
self
.
tempdisp
.
SetLabel
,
self
.
tempreport
.
strip
()
.
replace
(
"ok "
,
""
))
#try:
try
:
# self.tgauge.SetValue(int(filter(lambda x:x.startswith("T:"),self.tempreport.split())[0].split(":")[1]))
self
.
hottgauge
.
SetValue
(
float
(
filter
(
lambda
x
:
x
.
startswith
(
"T:"
),
self
.
tempreport
.
split
())[
0
]
.
split
(
":"
)[
1
]))
#except:
self
.
bedtgauge
.
SetValue
(
float
(
filter
(
lambda
x
:
x
.
startswith
(
"B:"
),
self
.
tempreport
.
split
())[
0
]
.
split
(
":"
)[
1
]))
# pass
except
:
pass
tstring
=
l
.
rstrip
()
tstring
=
l
.
rstrip
()
#print tstring
#print tstring
if
(
tstring
!=
"ok"
):
if
(
tstring
!=
"ok"
):
...
@@ -1587,7 +1600,6 @@ class macroed(wx.Dialog):
...
@@ -1587,7 +1600,6 @@ class macroed(wx.Dialog):
def
close
(
self
,
ev
):
def
close
(
self
,
ev
):
self
.
Destroy
()
self
.
Destroy
()
def
unindent
(
self
,
text
):
def
unindent
(
self
,
text
):
import
re
self
.
indent_chars
=
text
[:
len
(
text
)
-
len
(
text
.
lstrip
())]
self
.
indent_chars
=
text
[:
len
(
text
)
-
len
(
text
.
lstrip
())]
if
len
(
self
.
indent_chars
)
==
0
:
if
len
(
self
.
indent_chars
)
==
0
:
self
.
indent_chars
=
" "
self
.
indent_chars
=
" "
...
@@ -1603,7 +1615,6 @@ class macroed(wx.Dialog):
...
@@ -1603,7 +1615,6 @@ class macroed(wx.Dialog):
unindented
+=
line
+
"
\n
"
unindented
+=
line
+
"
\n
"
return
unindented
return
unindented
def
reindent
(
self
,
text
):
def
reindent
(
self
,
text
):
import
re
lines
=
re
.
split
(
r"(?:\r\n?|\n)"
,
text
)
lines
=
re
.
split
(
r"(?:\r\n?|\n)"
,
text
)
if
len
(
lines
)
<=
1
:
if
len
(
lines
)
<=
1
:
return
text
return
text
...
@@ -1690,18 +1701,21 @@ class ButtonEdit(wx.Dialog):
...
@@ -1690,18 +1701,21 @@ class ButtonEdit(wx.Dialog):
self
.
name
.
SetValue
(
macro
)
self
.
name
.
SetValue
(
macro
)
class
TempGauge
(
wx
.
Panel
):
class
TempGauge
(
wx
.
Panel
):
def
__init__
(
self
,
parent
,
size
=
(
200
,
22
)):
def
__init__
(
self
,
parent
,
size
=
(
200
,
22
)
,
title
=
""
,
maxval
=
240
,
gaugeColour
=
None
):
wx
.
Panel
.
__init__
(
self
,
parent
,
-
1
,
size
=
size
)
wx
.
Panel
.
__init__
(
self
,
parent
,
-
1
,
size
=
size
)
self
.
Bind
(
wx
.
EVT_PAINT
,
self
.
paint
)
self
.
Bind
(
wx
.
EVT_PAINT
,
self
.
paint
)
self
.
SetBackgroundStyle
(
wx
.
BG_STYLE_CUSTOM
)
self
.
SetBackgroundStyle
(
wx
.
BG_STYLE_CUSTOM
)
self
.
width
,
self
.
height
=
size
self
.
width
,
self
.
height
=
size
self
.
title
=
title
self
.
max
=
maxval
self
.
gaugeColour
=
gaugeColour
self
.
value
=
0
self
.
value
=
0
self
.
setpoint
=
0
self
.
setpoint
=
0
self
.
recalc
()
self
.
recalc
()
def
recalc
(
self
):
def
recalc
(
self
):
self
.
max
=
max
(
int
(
self
.
setpoint
*
1.05
),
240
)
mmax
=
max
(
int
(
self
.
setpoint
*
1.05
),
self
.
max
)
self
.
scale
=
float
(
self
.
width
-
2
)
/
float
(
self
.
max
)
self
.
scale
=
float
(
self
.
width
-
2
)
/
float
(
m
max
)
self
.
ypt
=
int
(
self
.
scale
*
max
(
self
.
setpoint
,
40
))
self
.
ypt
=
max
(
16
,
int
(
self
.
scale
*
max
(
self
.
setpoint
,
self
.
max
/
6
)
))
def
SetValue
(
self
,
value
):
def
SetValue
(
self
,
value
):
self
.
value
=
value
self
.
value
=
value
wx
.
CallAfter
(
self
.
Refresh
)
wx
.
CallAfter
(
self
.
Refresh
)
...
@@ -1709,13 +1723,24 @@ class TempGauge(wx.Panel):
...
@@ -1709,13 +1723,24 @@ class TempGauge(wx.Panel):
self
.
setpoint
=
value
self
.
setpoint
=
value
self
.
recalc
()
self
.
recalc
()
wx
.
CallAfter
(
self
.
Refresh
)
wx
.
CallAfter
(
self
.
Refresh
)
def
interpolatedColour
(
self
,
val
,
vmin
,
vmid
,
vmax
,
cmin
,
cmid
,
cmax
):
if
val
<
vmin
:
return
cmin
if
val
>
vmax
:
return
cmax
if
val
<=
vmid
:
lo
,
hi
,
val
,
valhi
=
cmin
,
cmid
,
val
-
vmin
,
vmid
-
vmin
else
:
lo
,
hi
,
val
,
valhi
=
cmid
,
cmax
,
val
-
vmid
,
vmax
-
vmid
vv
=
float
(
val
)
/
valhi
rgb
=
lo
.
Red
()
+
(
hi
.
Red
()
-
lo
.
Red
())
*
vv
,
lo
.
Green
()
+
(
hi
.
Green
()
-
lo
.
Green
())
*
vv
,
lo
.
Blue
()
+
(
hi
.
Blue
()
-
lo
.
Blue
())
*
vv
rgb
=
map
(
lambda
x
:
x
*
0.8
,
rgb
)
return
wx
.
Colour
(
*
map
(
int
,
rgb
))
def
paint
(
self
,
ev
):
def
paint
(
self
,
ev
):
x0
,
y0
,
x1
,
y1
,
xE
,
yE
=
1
,
1
,
self
.
ypt
+
1
,
1
,
self
.
width
+
1
-
2
,
20
x0
,
y0
,
x1
,
y1
,
xE
,
yE
=
1
,
1
,
self
.
ypt
+
1
,
1
,
self
.
width
+
1
-
2
,
20
dc
=
wx
.
PaintDC
(
self
)
dc
=
wx
.
PaintDC
(
self
)
dc
.
SetBackground
(
wx
.
Brush
((
255
,
255
,
255
)))
dc
.
SetBackground
(
wx
.
Brush
((
255
,
255
,
255
)))
dc
.
Clear
()
dc
.
Clear
()
cold
,
medium
,
hot
=
wx
.
Colour
(
0
,
167
,
223
),
wx
.
Colour
(
239
,
233
,
119
),
wx
.
Colour
(
210
,
50.100
)
cold
,
medium
,
hot
=
wx
.
Colour
(
0
,
167
,
223
),
wx
.
Colour
(
239
,
233
,
119
),
wx
.
Colour
(
210
,
50.100
)
gauge1
,
gauge2
=
wx
.
Colour
(
255
,
255
,
210
),
wx
.
Colour
(
234
,
82
,
0
)
gauge1
,
gauge2
=
wx
.
Colour
(
255
,
255
,
210
),
(
self
.
gaugeColour
or
wx
.
Colour
(
234
,
82
,
0
)
)
shadow1
,
shadow2
=
wx
.
Colour
(
110
,
110
,
110
),
wx
.
Colour
(
255
,
255
,
255
)
shadow1
,
shadow2
=
wx
.
Colour
(
110
,
110
,
110
),
wx
.
Colour
(
255
,
255
,
255
)
gc
=
wx
.
GraphicsContext
.
Create
(
dc
)
gc
=
wx
.
GraphicsContext
.
Create
(
dc
)
# draw shadow first
# draw shadow first
...
@@ -1737,12 +1762,13 @@ class TempGauge(wx.Panel):
...
@@ -1737,12 +1762,13 @@ class TempGauge(wx.Panel):
gc
.
SetBrush
(
gc
.
CreateLinearGradientBrush
(
x1
-
2
,
y1
,
xE
,
y1
,
medium
,
hot
))
gc
.
SetBrush
(
gc
.
CreateLinearGradientBrush
(
x1
-
2
,
y1
,
xE
,
y1
,
medium
,
hot
))
gc
.
DrawRoundedRectangle
(
x1
-
2
,
y1
,
xE
-
x1
,
yE
,
6
)
gc
.
DrawRoundedRectangle
(
x1
-
2
,
y1
,
xE
-
x1
,
yE
,
6
)
# draw gauge
# draw gauge
gc
.
SetBrush
(
gc
.
CreateLinearGradientBrush
(
x0
,
y0
+
3
,
x0
,
y0
+
15
,
gauge1
,
gauge2
))
#gc.SetBrush(gc.CreateLinearGradientBrush(0,3,0,15,wx.Colour(255,255,255),wx.Colour(255,90,32)))
width
=
12
width
=
12
w1
=
y0
+
9
-
width
/
2
w1
=
y0
+
9
-
width
/
2
w2
=
w1
+
width
w2
=
w1
+
width
value
=
x0
+
max
(
10
,
min
(
self
.
width
+
1
-
2
,
int
(
self
.
value
*
self
.
scale
)))
value
=
x0
+
max
(
10
,
min
(
self
.
width
+
1
-
2
,
int
(
self
.
value
*
self
.
scale
)))
#gc.SetBrush(gc.CreateLinearGradientBrush(x0,y0+3,x0,y0+15,gauge1,gauge2))
#gc.SetBrush(gc.CreateLinearGradientBrush(0,3,0,15,wx.Colour(255,255,255),wx.Colour(255,90,32)))
gc
.
SetBrush
(
gc
.
CreateLinearGradientBrush
(
x0
,
y0
+
3
,
x0
,
y0
+
15
,
gauge1
,
self
.
interpolatedColour
(
value
,
x0
,
x1
,
xE
,
cold
,
medium
,
hot
)))
val_path
=
gc
.
CreatePath
()
val_path
=
gc
.
CreatePath
()
val_path
.
MoveToPoint
(
x0
,
w1
)
val_path
.
MoveToPoint
(
x0
,
w1
)
val_path
.
AddLineToPoint
(
value
,
w1
)
val_path
.
AddLineToPoint
(
value
,
w1
)
...
@@ -1768,9 +1794,11 @@ class TempGauge(wx.Panel):
...
@@ -1768,9 +1794,11 @@ class TempGauge(wx.Panel):
#gc.SetFont(gc.CreateFont(wx.Font(12,wx.FONTFAMILY_DEFAULT,wx.FONTSTYLE_NORMAL,wx.FONTWEIGHT_BOLD),wx.WHITE))
#gc.SetFont(gc.CreateFont(wx.Font(12,wx.FONTFAMILY_DEFAULT,wx.FONTSTYLE_NORMAL,wx.FONTWEIGHT_BOLD),wx.WHITE))
#gc.DrawText(text,29,-2)
#gc.DrawText(text,29,-2)
gc
.
SetFont
(
gc
.
CreateFont
(
wx
.
Font
(
10
,
wx
.
FONTFAMILY_DEFAULT
,
wx
.
FONTSTYLE_NORMAL
,
wx
.
FONTWEIGHT_BOLD
),
wx
.
WHITE
))
gc
.
SetFont
(
gc
.
CreateFont
(
wx
.
Font
(
10
,
wx
.
FONTFAMILY_DEFAULT
,
wx
.
FONTSTYLE_NORMAL
,
wx
.
FONTWEIGHT_BOLD
),
wx
.
WHITE
))
gc
.
DrawText
(
text
,
x0
+
31
,
y0
+
1
)
gc
.
DrawText
(
self
.
title
,
x0
+
19
,
y0
+
1
)
gc
.
DrawText
(
text
,
x0
+
153
,
y0
+
1
)
gc
.
SetFont
(
gc
.
CreateFont
(
wx
.
Font
(
10
,
wx
.
FONTFAMILY_DEFAULT
,
wx
.
FONTSTYLE_NORMAL
,
wx
.
FONTWEIGHT_BOLD
)))
gc
.
SetFont
(
gc
.
CreateFont
(
wx
.
Font
(
10
,
wx
.
FONTFAMILY_DEFAULT
,
wx
.
FONTSTYLE_NORMAL
,
wx
.
FONTWEIGHT_BOLD
)))
gc
.
DrawText
(
text
,
x0
+
30
,
y0
+
0
)
gc
.
DrawText
(
self
.
title
,
x0
+
18
,
y0
+
0
)
gc
.
DrawText
(
text
,
x0
+
152
,
y0
+
0
)
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
app
=
wx
.
App
(
False
)
app
=
wx
.
App
(
False
)
...
...
stlview.py
View file @
6dff5776
#!/usr/bin/python
#!/usr/bin/python
import
os
import
os
import
wx
,
math
,
stltool
import
math
import
stltool
import
wx
from
wx
import
glcanvas
from
wx
import
glcanvas
import
time
import
time
import
threading
import
threading
import
pyglet
import
pyglet
pyglet
.
options
[
'shadow_window'
]
=
False
pyglet
.
options
[
'shadow_window'
]
=
False
pyglet
.
options
[
'debug_gl'
]
=
False
pyglet
.
options
[
'debug_gl'
]
=
False
from
pyglet
import
gl
from
pyglet.gl
import
*
from
pyglet.gl
import
*
class
GLPanel
(
wx
.
Panel
):
class
GLPanel
(
wx
.
Panel
):
'''A simple class for using OpenGL with wxPython.'''
'''A simple class for using OpenGL with wxPython.'''
def
__init__
(
self
,
parent
,
id
,
pos
=
wx
.
DefaultPosition
,
def
__init__
(
self
,
parent
,
id
,
pos
=
wx
.
DefaultPosition
,
...
@@ -24,9 +25,9 @@ class GLPanel(wx.Panel):
...
@@ -24,9 +25,9 @@ class GLPanel(wx.Panel):
#init gl canvas data
#init gl canvas data
self
.
GLinitialized
=
False
self
.
GLinitialized
=
False
attribList
=
(
glcanvas
.
WX_GL_RGBA
,
# RGBA
attribList
=
(
glcanvas
.
WX_GL_RGBA
,
# RGBA
glcanvas
.
WX_GL_DOUBLEBUFFER
,
# Double Buffered
glcanvas
.
WX_GL_DOUBLEBUFFER
,
# Double Buffered
glcanvas
.
WX_GL_DEPTH_SIZE
,
24
)
# 24 bit
glcanvas
.
WX_GL_DEPTH_SIZE
,
24
)
# 24 bit
# Create the canvas
# Create the canvas
self
.
sizer
=
wx
.
BoxSizer
(
wx
.
HORIZONTAL
)
self
.
sizer
=
wx
.
BoxSizer
(
wx
.
HORIZONTAL
)
self
.
canvas
=
glcanvas
.
GLCanvas
(
self
,
attribList
=
attribList
)
self
.
canvas
=
glcanvas
.
GLCanvas
(
self
,
attribList
=
attribList
)
...
@@ -34,7 +35,7 @@ class GLPanel(wx.Panel):
...
@@ -34,7 +35,7 @@ class GLPanel(wx.Panel):
self
.
SetSizer
(
self
.
sizer
)
self
.
SetSizer
(
self
.
sizer
)
#self.sizer.Fit(self)
#self.sizer.Fit(self)
self
.
Layout
()
self
.
Layout
()
# bind events
# bind events
self
.
canvas
.
Bind
(
wx
.
EVT_ERASE_BACKGROUND
,
self
.
processEraseBackgroundEvent
)
self
.
canvas
.
Bind
(
wx
.
EVT_ERASE_BACKGROUND
,
self
.
processEraseBackgroundEvent
)
self
.
canvas
.
Bind
(
wx
.
EVT_SIZE
,
self
.
processSizeEvent
)
self
.
canvas
.
Bind
(
wx
.
EVT_SIZE
,
self
.
processSizeEvent
)
...
@@ -56,7 +57,7 @@ class GLPanel(wx.Panel):
...
@@ -56,7 +57,7 @@ class GLPanel(wx.Panel):
#==========================================================================
#==========================================================================
def
processEraseBackgroundEvent
(
self
,
event
):
def
processEraseBackgroundEvent
(
self
,
event
):
'''Process the erase background event.'''
'''Process the erase background event.'''
pass
# Do nothing, to avoid flashing on MSWin
pass
# Do nothing, to avoid flashing on MSWin
def
processSizeEvent
(
self
,
event
):
def
processSizeEvent
(
self
,
event
):
'''Process the resize event.'''
'''Process the resize event.'''
...
@@ -74,15 +75,15 @@ class GLPanel(wx.Panel):
...
@@ -74,15 +75,15 @@ class GLPanel(wx.Panel):
def
processPaintEvent
(
self
,
event
):
def
processPaintEvent
(
self
,
event
):
'''Process the drawing event.'''
'''Process the drawing event.'''
self
.
canvas
.
SetCurrent
()
self
.
canvas
.
SetCurrent
()
# This is a 'perfect' time to initialize OpenGL ... only if we need to
# This is a 'perfect' time to initialize OpenGL ... only if we need to
if
not
self
.
GLinitialized
:
if
not
self
.
GLinitialized
:
self
.
OnInitGL
()
self
.
OnInitGL
()
self
.
GLinitialized
=
True
self
.
GLinitialized
=
True
self
.
OnDraw
()
self
.
OnDraw
()
event
.
Skip
()
event
.
Skip
()
def
Destroy
(
self
):
def
Destroy
(
self
):
#clean up the pyglet OpenGL context
#clean up the pyglet OpenGL context
#self.pygletcontext.destroy()
#self.pygletcontext.destroy()
...
@@ -95,12 +96,12 @@ class GLPanel(wx.Panel):
...
@@ -95,12 +96,12 @@ class GLPanel(wx.Panel):
def
OnInitGL
(
self
):
def
OnInitGL
(
self
):
'''Initialize OpenGL for use in the window.'''
'''Initialize OpenGL for use in the window.'''
#create a pyglet context for this panel
#create a pyglet context for this panel
self
.
pmat
=
(
GLdouble
*
16
)()
self
.
pmat
=
(
GLdouble
*
16
)()
self
.
mvmat
=
(
GLdouble
*
16
)()
self
.
mvmat
=
(
GLdouble
*
16
)()
self
.
pygletcontext
=
Context
(
current_context
)
self
.
pygletcontext
=
Context
(
current_context
)
self
.
pygletcontext
.
set_current
()
self
.
pygletcontext
.
set_current
()
self
.
dist
=
1000
self
.
dist
=
1000
self
.
vpmat
=
None
self
.
vpmat
=
None
#normal gl init
#normal gl init
glClearColor
(
0
,
0
,
0
,
1
)
glClearColor
(
0
,
0
,
0
,
1
)
glColor3f
(
1
,
0
,
0
)
glColor3f
(
1
,
0
,
0
)
...
@@ -108,42 +109,40 @@ class GLPanel(wx.Panel):
...
@@ -108,42 +109,40 @@ class GLPanel(wx.Panel):
glEnable
(
GL_CULL_FACE
)
glEnable
(
GL_CULL_FACE
)
# Uncomment this line for a wireframe view
# Uncomment this line for a wireframe view
#glPolygonMode(GL_FRONT_AND_BACK, GL_LINE)
#glPolygonMode(GL_FRONT_AND_BACK, GL_LINE)
# Simple light setup. On Windows GL_LIGHT0 is enabled by default,
# Simple light setup. On Windows GL_LIGHT0 is enabled by default,
# but this is not the case on Linux or Mac, so remember to always
# but this is not the case on Linux or Mac, so remember to always
# include it.
# include it.
glEnable
(
GL_LIGHTING
)
glEnable
(
GL_LIGHTING
)
glEnable
(
GL_LIGHT0
)
glEnable
(
GL_LIGHT0
)
glEnable
(
GL_LIGHT1
)
glEnable
(
GL_LIGHT1
)
# Define a simple function to create ctypes arrays of floats:
# Define a simple function to create ctypes arrays of floats:
def
vec
(
*
args
):
def
vec
(
*
args
):
return
(
GLfloat
*
len
(
args
))(
*
args
)
return
(
GLfloat
*
len
(
args
))(
*
args
)
glLightfv
(
GL_LIGHT0
,
GL_POSITION
,
vec
(
.5
,
.5
,
1
,
0
))
glLightfv
(
GL_LIGHT0
,
GL_POSITION
,
vec
(
.5
,
.5
,
1
,
0
))
glLightfv
(
GL_LIGHT0
,
GL_SPECULAR
,
vec
(
.5
,
.5
,
1
,
1
))
glLightfv
(
GL_LIGHT0
,
GL_SPECULAR
,
vec
(
.5
,
.5
,
1
,
1
))
glLightfv
(
GL_LIGHT0
,
GL_DIFFUSE
,
vec
(
1
,
1
,
1
,
1
))
glLightfv
(
GL_LIGHT0
,
GL_DIFFUSE
,
vec
(
1
,
1
,
1
,
1
))
glLightfv
(
GL_LIGHT1
,
GL_POSITION
,
vec
(
1
,
0
,
.5
,
0
))
glLightfv
(
GL_LIGHT1
,
GL_POSITION
,
vec
(
1
,
0
,
.5
,
0
))
glLightfv
(
GL_LIGHT1
,
GL_DIFFUSE
,
vec
(
.5
,
.5
,
.5
,
1
))
glLightfv
(
GL_LIGHT1
,
GL_DIFFUSE
,
vec
(
.5
,
.5
,
.5
,
1
))
glLightfv
(
GL_LIGHT1
,
GL_SPECULAR
,
vec
(
1
,
1
,
1
,
1
))
glLightfv
(
GL_LIGHT1
,
GL_SPECULAR
,
vec
(
1
,
1
,
1
,
1
))
glMaterialfv
(
GL_FRONT_AND_BACK
,
GL_AMBIENT_AND_DIFFUSE
,
vec
(
0.5
,
0
,
0.3
,
1
))
glMaterialfv
(
GL_FRONT_AND_BACK
,
GL_AMBIENT_AND_DIFFUSE
,
vec
(
0.5
,
0
,
0.3
,
1
))
glMaterialfv
(
GL_FRONT_AND_BACK
,
GL_SPECULAR
,
vec
(
1
,
1
,
1
,
1
))
glMaterialfv
(
GL_FRONT_AND_BACK
,
GL_SPECULAR
,
vec
(
1
,
1
,
1
,
1
))
glMaterialf
(
GL_FRONT_AND_BACK
,
GL_SHININESS
,
50
)
glMaterialf
(
GL_FRONT_AND_BACK
,
GL_SHININESS
,
50
)
glMaterialfv
(
GL_FRONT_AND_BACK
,
GL_EMISSION
,
vec
(
0
,
0.1
,
0
,
0.9
))
glMaterialfv
(
GL_FRONT_AND_BACK
,
GL_EMISSION
,
vec
(
0
,
0.1
,
0
,
0.9
))
#create objects to draw
#create objects to draw
#self.create_objects()
#self.create_objects()
def
OnReshape
(
self
,
width
,
height
):
def
OnReshape
(
self
,
width
,
height
):
'''Reshape the OpenGL viewport based on the dimensions of the window.'''
'''Reshape the OpenGL viewport based on the dimensions of the window.'''
if
not
self
.
GLinitialized
:
if
not
self
.
GLinitialized
:
self
.
OnInitGL
()
self
.
OnInitGL
()
self
.
GLinitialized
=
True
self
.
GLinitialized
=
True
self
.
pmat
=
(
GLdouble
*
16
)()
self
.
pmat
=
(
GLdouble
*
16
)()
self
.
mvmat
=
(
GLdouble
*
16
)()
self
.
mvmat
=
(
GLdouble
*
16
)()
glViewport
(
0
,
0
,
width
,
height
)
glViewport
(
0
,
0
,
width
,
height
)
glMatrixMode
(
GL_PROJECTION
)
glMatrixMode
(
GL_PROJECTION
)
glLoadIdentity
()
glLoadIdentity
()
...
@@ -151,43 +150,43 @@ class GLPanel(wx.Panel):
...
@@ -151,43 +150,43 @@ class GLPanel(wx.Panel):
glMatrixMode
(
GL_MODELVIEW
)
glMatrixMode
(
GL_MODELVIEW
)
glLoadIdentity
()
glLoadIdentity
()
#pyglet stuff
#pyglet stuff
self
.
vpmat
=
(
GLint
*
4
)(
0
,
0
,
*
list
(
self
.
GetClientSize
()))
self
.
vpmat
=
(
GLint
*
4
)(
0
,
0
,
*
list
(
self
.
GetClientSize
()))
glGetDoublev
(
GL_PROJECTION_MATRIX
,
self
.
pmat
)
glGetDoublev
(
GL_PROJECTION_MATRIX
,
self
.
pmat
)
glGetDoublev
(
GL_MODELVIEW_MATRIX
,
self
.
mvmat
)
glGetDoublev
(
GL_MODELVIEW_MATRIX
,
self
.
mvmat
)
#glMatrixMode(GL_PROJECTION)
#glMatrixMode(GL_PROJECTION)
# Wrap text to the width of the window
# Wrap text to the width of the window
if
self
.
GLinitialized
:
if
self
.
GLinitialized
:
self
.
pygletcontext
.
set_current
()
self
.
pygletcontext
.
set_current
()
self
.
update_object_resize
()
self
.
update_object_resize
()
def
OnDraw
(
self
,
*
args
,
**
kwargs
):
def
OnDraw
(
self
,
*
args
,
**
kwargs
):
"""Draw the window."""
"""Draw the window."""
#clear the context
#clear the context
self
.
canvas
.
SetCurrent
()
self
.
canvas
.
SetCurrent
()
self
.
pygletcontext
.
set_current
()
self
.
pygletcontext
.
set_current
()
glClear
(
GL_COLOR_BUFFER_BIT
|
GL_DEPTH_BUFFER_BIT
)
glClear
(
GL_COLOR_BUFFER_BIT
|
GL_DEPTH_BUFFER_BIT
)
#draw objects
#draw objects
self
.
draw_objects
()
self
.
draw_objects
()
#update screen
#update screen
self
.
SwapBuffers
()
self
.
SwapBuffers
()
#==========================================================================
#==========================================================================
# To be implemented by a sub class
# To be implemented by a sub class
#==========================================================================
#==========================================================================
def
create_objects
(
self
):
def
create_objects
(
self
):
'''create opengl objects when opengl is initialized'''
'''create opengl objects when opengl is initialized'''
pass
pass
def
update_object_resize
(
self
):
def
update_object_resize
(
self
):
'''called when the window recieves only if opengl is initialized'''
'''called when the window recieves only if opengl is initialized'''
pass
pass
def
draw_objects
(
self
):
def
draw_objects
(
self
):
'''called in the middle of ondraw after the buffer has been cleared'''
'''called in the middle of ondraw after the buffer has been cleared'''
pass
pass
class
stlview
(
object
):
class
stlview
(
object
):
def
__init__
(
self
,
facets
,
batch
):
def
__init__
(
self
,
facets
,
batch
):
# Create the vertex and normal arrays.
# Create the vertex and normal arrays.
...
@@ -200,234 +199,249 @@ class stlview(object):
...
@@ -200,234 +199,249 @@ class stlview(object):
normals
.
extend
(
i
[
0
])
normals
.
extend
(
i
[
0
])
# Create a list of triangle indices.
# Create a list of triangle indices.
indices
=
range
(
3
*
len
(
facets
))
#
[[3*i,3*i+1,3*i+2] for i in xrange(len(facets))]
indices
=
range
(
3
*
len
(
facets
))
#
[[3*i,3*i+1,3*i+2] for i in xrange(len(facets))]
#print indices[:10]
#print indices[:10]
self
.
vertex_list
=
batch
.
add_indexed
(
len
(
vertices
)
//
3
,
self
.
vertex_list
=
batch
.
add_indexed
(
len
(
vertices
)
//
3
,
GL_TRIANGLES
,
GL_TRIANGLES
,
None
,
#
group,
None
,
#
group,
indices
,
indices
,
(
'v3f/static'
,
vertices
),
(
'v3f/static'
,
vertices
),
(
'n3f/static'
,
normals
))
(
'n3f/static'
,
normals
))
def
delete
(
self
):
def
delete
(
self
):
self
.
vertex_list
.
delete
()
self
.
vertex_list
.
delete
()
def
vdiff
(
v
,
o
):
return
[
x
[
0
]
-
x
[
1
]
for
x
in
zip
(
v
,
o
)]
def
vdiff
(
v
,
o
):
return
[
x
[
0
]
-
x
[
1
]
for
x
in
zip
(
v
,
o
)]
class
gcview
(
object
):
class
gcview
(
object
):
def
__init__
(
self
,
lines
,
batch
,
w
=
0.5
,
h
=
0.5
):
def
__init__
(
self
,
lines
,
batch
,
w
=
0.5
,
h
=
0.5
):
# Create the vertex and normal arrays.
# Create the vertex and normal arrays.
vertices
=
[]
vertices
=
[]
normals
=
[]
normals
=
[]
self
.
prev
=
[
0.001
,
0.001
,
0.001
,
0.001
]
self
.
prev
=
[
0.001
,
0.001
,
0.001
,
0.001
]
self
.
fline
=
1
self
.
fline
=
1
self
.
vlists
=
[]
self
.
vlists
=
[]
self
.
layers
=
{}
self
.
layers
=
{}
t0
=
time
.
time
()
t0
=
time
.
time
()
lines
=
[
self
.
transform
(
i
)
for
i
in
lines
]
lines
=
[
self
.
transform
(
i
)
for
i
in
lines
]
lines
=
[
i
for
i
in
lines
if
i
is
not
None
]
lines
=
[
i
for
i
in
lines
if
i
is
not
None
]
print
"transformed lines in
%
fs"
%
(
time
.
time
()
-
t0
)
print
"transformed lines in
%
fs"
%
(
time
.
time
()
-
t0
)
t0
=
time
.
time
()
t0
=
time
.
time
()
layertemp
=
{}
layertemp
=
{}
lasth
=
None
lasth
=
None
counter
=
0
counter
=
0
if
len
(
lines
)
==
0
:
if
len
(
lines
)
==
0
:
return
return
for
i
in
lines
:
for
i
in
lines
:
counter
+=
1
counter
+=
1
if
i
[
0
][
2
]
not
in
layertemp
:
if
i
[
0
][
2
]
not
in
layertemp
:
layertemp
[
i
[
0
][
2
]]
=
[[],
[]]
layertemp
[
i
[
0
][
2
]]
=
[[],
[]]
if
lasth
is
not
None
:
if
lasth
is
not
None
:
self
.
layers
[
lasth
]
=
pyglet
.
graphics
.
Batch
()
self
.
layers
[
lasth
]
=
pyglet
.
graphics
.
Batch
()
lt
=
layertemp
[
lasth
][
0
]
lt
=
layertemp
[
lasth
][
0
]
indices
=
range
(
len
(
layertemp
[
lasth
][
0
])
//
3
)
#
[[3*i,3*i+1,3*i+2] for i in xrange(len(facets))]
indices
=
range
(
len
(
layertemp
[
lasth
][
0
])
//
3
)
#
[[3*i,3*i+1,3*i+2] for i in xrange(len(facets))]
self
.
vlists
.
append
(
self
.
layers
[
lasth
]
.
add_indexed
(
len
(
layertemp
[
lasth
][
0
])
//
3
,
self
.
vlists
.
append
(
self
.
layers
[
lasth
]
.
add_indexed
(
len
(
layertemp
[
lasth
][
0
])
//
3
,
GL_TRIANGLES
,
GL_TRIANGLES
,
None
,
#
group,
None
,
#
group,
indices
,
indices
,
(
'v3f/static'
,
layertemp
[
lasth
][
0
]),
(
'v3f/static'
,
layertemp
[
lasth
][
0
]),
(
'n3f/static'
,
layertemp
[
lasth
][
1
])))
(
'n3f/static'
,
layertemp
[
lasth
][
1
])))
lasth
=
i
[
0
][
2
]
lasth
=
i
[
0
][
2
]
spoints
,
epoints
,
S
,
E
=
self
.
genline
(
i
,
h
,
w
)
spoints
,
epoints
,
S
,
E
=
self
.
genline
(
i
,
h
,
w
)
verticestoadd
=
[[
spoints
[(
j
+
1
)
%
8
],
epoints
[(
j
)
%
8
],
spoints
[
j
],
epoints
[
j
],
spoints
[(
j
+
1
)
%
8
],
epoints
[(
j
+
1
)
%
8
]]
for
j
in
xrange
(
8
)]
verticestoadd
=
[[
normalstoadd
=
[
map
(
vdiff
,
v
,[
S
,
E
,
S
,
E
,
S
,
E
])
for
v
in
verticestoadd
]
spoints
[(
j
+
1
)
%
8
],
v1
=
[]
epoints
[(
j
)
%
8
],
map
(
v1
.
extend
,
verticestoadd
)
spoints
[
j
],
v2
=
[]
epoints
[
j
],
map
(
v2
.
extend
,
v1
)
spoints
[(
j
+
1
)
%
8
],
n1
=
[]
epoints
[(
j
+
1
)
%
8
]
map
(
n1
.
extend
,
normalstoadd
)
]
for
j
in
xrange
(
8
)]
n2
=
[]
normalstoadd
=
[
map
(
vdiff
,
v
,
[
S
,
E
,
S
,
E
,
S
,
E
])
for
v
in
verticestoadd
]
map
(
n2
.
extend
,
n1
)
v1
=
[]
map
(
v1
.
extend
,
verticestoadd
)
layertemp
[
i
[
0
][
2
]][
0
]
+=
v2
v2
=
[]
vertices
+=
v2
map
(
v2
.
extend
,
v1
)
layertemp
[
i
[
0
][
2
]][
1
]
+=
n2
n1
=
[]
normals
+=
n2
map
(
n1
.
extend
,
normalstoadd
)
print
"appended lines in
%
fs"
%
(
time
.
time
()
-
t0
)
n2
=
[]
t0
=
time
.
time
()
map
(
n2
.
extend
,
n1
)
layertemp
[
i
[
0
][
2
]][
0
]
+=
v2
vertices
+=
v2
layertemp
[
i
[
0
][
2
]][
1
]
+=
n2
normals
+=
n2
print
"appended lines in
%
fs"
%
(
time
.
time
()
-
t0
)
t0
=
time
.
time
()
# Create a list of triangle indices.
# Create a list of triangle indices.
indices
=
range
(
3
*
16
*
len
(
lines
))
#
[[3*i,3*i+1,3*i+2] for i in xrange(len(facets))]
indices
=
range
(
3
*
16
*
len
(
lines
))
#
[[3*i,3*i+1,3*i+2] for i in xrange(len(facets))]
self
.
vlists
.
append
(
batch
.
add_indexed
(
len
(
vertices
)
//
3
,
self
.
vlists
.
append
(
batch
.
add_indexed
(
len
(
vertices
)
//
3
,
GL_TRIANGLES
,
GL_TRIANGLES
,
None
,
#
group,
None
,
#
group,
indices
,
indices
,
(
'v3f/static'
,
vertices
),
(
'v3f/static'
,
vertices
),
(
'n3f/static'
,
normals
)))
(
'n3f/static'
,
normals
)))
if
lasth
is
not
None
:
if
lasth
is
not
None
:
self
.
layers
[
lasth
]
=
pyglet
.
graphics
.
Batch
()
self
.
layers
[
lasth
]
=
pyglet
.
graphics
.
Batch
()
indices
=
range
(
len
(
layertemp
[
lasth
][
0
]))
#
[[3*i,3*i+1,3*i+2] for i in xrange(len(facets))]
indices
=
range
(
len
(
layertemp
[
lasth
][
0
]))
#
[[3*i,3*i+1,3*i+2] for i in xrange(len(facets))]
self
.
vlists
.
append
(
self
.
layers
[
lasth
]
.
add_indexed
(
len
(
layertemp
[
lasth
][
0
])
//
3
,
self
.
vlists
.
append
(
self
.
layers
[
lasth
]
.
add_indexed
(
len
(
layertemp
[
lasth
][
0
])
//
3
,
GL_TRIANGLES
,
GL_TRIANGLES
,
None
,
#
group,
None
,
#
group,
indices
,
indices
,
(
'v3f/static'
,
layertemp
[
lasth
][
0
]),
(
'v3f/static'
,
layertemp
[
lasth
][
0
]),
(
'n3f/static'
,
layertemp
[
lasth
][
1
])))
(
'n3f/static'
,
layertemp
[
lasth
][
1
])))
def
genline
(
self
,
i
,
h
,
w
):
def
genline
(
self
,
i
,
h
,
w
):
S
=
i
[
0
][:
3
]
S
=
i
[
0
][:
3
]
E
=
i
[
1
][:
3
]
E
=
i
[
1
][:
3
]
v
=
map
(
lambda
x
,
y
:
x
-
y
,
E
,
S
)
v
=
map
(
lambda
x
,
y
:
x
-
y
,
E
,
S
)
vlen
=
math
.
sqrt
(
float
(
sum
(
map
(
lambda
a
:
a
*
a
,
v
[:
3
]))))
vlen
=
math
.
sqrt
(
float
(
sum
(
map
(
lambda
a
:
a
*
a
,
v
[:
3
]))))
if
vlen
==
0
:
if
vlen
==
0
:
vlen
=
0.01
vlen
=
0.01
sq2
=
math
.
sqrt
(
2.0
)
/
2.0
sq2
=
math
.
sqrt
(
2.0
)
/
2.0
htw
=
float
(
h
)
/
w
htw
=
float
(
h
)
/
w
d
=
w
/
2.0
d
=
w
/
2.0
if
i
[
1
][
3
]
==
i
[
0
][
3
]:
if
i
[
1
][
3
]
==
i
[
0
][
3
]:
d
=
0.05
d
=
0.05
points
=
[[
d
,
0
,
0
],
points
=
[[
d
,
0
,
0
],
[
sq2
*
d
,
sq2
*
d
,
0
],
[
sq2
*
d
,
sq2
*
d
,
0
],
[
0
,
d
,
0
],
[
0
,
d
,
0
],
[
-
sq2
*
d
,
sq2
*
d
,
0
],
[
-
sq2
*
d
,
sq2
*
d
,
0
],
[
-
d
,
0
,
0
],
[
-
d
,
0
,
0
],
[
-
sq2
*
d
,
-
sq2
*
d
,
0
],
[
-
sq2
*
d
,
-
sq2
*
d
,
0
],
[
0
,
-
d
,
0
],
[
0
,
-
d
,
0
],
[
sq2
*
d
,
-
sq2
*
d
,
0
]
[
sq2
*
d
,
-
sq2
*
d
,
0
]
]
]
axis
=
stltool
.
cross
([
0
,
0
,
1
],
v
)
axis
=
stltool
.
cross
([
0
,
0
,
1
],
v
)
alen
=
math
.
sqrt
(
float
(
sum
(
map
(
lambda
a
:
a
*
a
,
v
[:
3
]))))
alen
=
math
.
sqrt
(
float
(
sum
(
map
(
lambda
a
:
a
*
a
,
v
[:
3
]))))
if
alen
>
0
:
if
alen
>
0
:
axis
=
map
(
lambda
m
:
m
/
alen
,
axis
)
axis
=
map
(
lambda
m
:
m
/
alen
,
axis
)
angle
=
math
.
acos
(
v
[
2
]
/
vlen
)
angle
=
math
.
acos
(
v
[
2
]
/
vlen
)
def
vrot
(
v
,
axis
,
angle
):
def
vrot
(
v
,
axis
,
angle
):
kxv
=
stltool
.
cross
(
axis
,
v
)
kxv
=
stltool
.
cross
(
axis
,
v
)
kdv
=
sum
(
map
(
lambda
x
,
y
:
x
*
y
,
axis
,
v
))
kdv
=
sum
(
map
(
lambda
x
,
y
:
x
*
y
,
axis
,
v
))
return
map
(
lambda
x
,
y
,
z
:
x
*
math
.
cos
(
angle
)
+
y
*
math
.
sin
(
angle
)
+
z
*
kdv
*
(
1.0
-
math
.
cos
(
angle
)),
v
,
kxv
,
axis
)
return
map
(
lambda
x
,
y
,
z
:
x
*
math
.
cos
(
angle
)
+
y
*
math
.
sin
(
angle
)
+
z
*
kdv
*
(
1.0
-
math
.
cos
(
angle
)),
v
,
kxv
,
axis
)
points
=
map
(
lambda
x
:
vrot
(
x
,
axis
,
angle
),
points
)
points
=
map
(
lambda
x
:[
x
[
0
],
x
[
1
],
htw
*
x
[
2
]],
points
)
points
=
map
(
lambda
x
:
vrot
(
x
,
axis
,
angle
),
points
)
points
=
map
(
lambda
x
:
[
x
[
0
],
x
[
1
],
htw
*
x
[
2
]],
points
)
def
vadd
(
v
,
o
):
return
map
(
sum
,
zip
(
v
,
o
))
def
vadd
(
v
,
o
):
spoints
=
map
(
lambda
x
:
vadd
(
S
,
x
),
points
)
return
map
(
sum
,
zip
(
v
,
o
))
epoints
=
map
(
lambda
x
:
vadd
(
E
,
x
),
points
)
spoints
=
map
(
lambda
x
:
vadd
(
S
,
x
),
points
)
return
spoints
,
epoints
,
S
,
E
epoints
=
map
(
lambda
x
:
vadd
(
E
,
x
),
points
)
return
spoints
,
epoints
,
S
,
E
def
transform
(
self
,
line
):
line
=
line
.
split
(
";"
)[
0
]
def
transform
(
self
,
line
):
cur
=
self
.
prev
[:]
line
=
line
.
split
(
";"
)[
0
]
if
len
(
line
)
>
0
:
cur
=
self
.
prev
[:]
if
len
(
line
)
>
0
:
if
"G1"
in
line
or
"G0"
in
line
or
"G92"
in
line
:
if
"G1"
in
line
or
"G0"
in
line
or
"G92"
in
line
:
if
(
"X"
in
line
):
if
(
"X"
in
line
):
cur
[
0
]
=
float
(
line
.
split
(
"X"
)[
1
]
.
split
(
" "
)[
0
])
cur
[
0
]
=
float
(
line
.
split
(
"X"
)[
1
]
.
split
(
" "
)[
0
])
if
(
"Y"
in
line
):
if
(
"Y"
in
line
):
cur
[
1
]
=
float
(
line
.
split
(
"Y"
)[
1
]
.
split
(
" "
)[
0
])
cur
[
1
]
=
float
(
line
.
split
(
"Y"
)[
1
]
.
split
(
" "
)[
0
])
if
(
"Z"
in
line
):
if
(
"Z"
in
line
):
cur
[
2
]
=
float
(
line
.
split
(
"Z"
)[
1
]
.
split
(
" "
)[
0
])
cur
[
2
]
=
float
(
line
.
split
(
"Z"
)[
1
]
.
split
(
" "
)[
0
])
if
(
"E"
in
line
):
if
(
"E"
in
line
):
cur
[
3
]
=
float
(
line
.
split
(
"E"
)[
1
]
.
split
(
" "
)[
0
])
cur
[
3
]
=
float
(
line
.
split
(
"E"
)[
1
]
.
split
(
" "
)[
0
])
if
self
.
prev
==
cur
:
if
self
.
prev
==
cur
:
return
None
return
None
if
self
.
fline
or
"G92"
in
line
:
if
self
.
fline
or
"G92"
in
line
:
self
.
prev
=
cur
self
.
prev
=
cur
self
.
fline
=
0
self
.
fline
=
0
return
None
return
None
else
:
else
:
r
=
[
self
.
prev
,
cur
]
r
=
[
self
.
prev
,
cur
]
self
.
prev
=
cur
self
.
prev
=
cur
return
r
return
r
def
delete
(
self
):
def
delete
(
self
):
for
i
in
self
.
vlists
:
for
i
in
self
.
vlists
:
i
.
delete
()
i
.
delete
()
self
.
vlists
=
[]
self
.
vlists
=
[]
def
trackball
(
p1x
,
p1y
,
p2x
,
p2y
,
r
):
def
trackball
(
p1x
,
p1y
,
p2x
,
p2y
,
r
):
TRACKBALLSIZE
=
r
TRACKBALLSIZE
=
r
#float a[3]; /* Axis of rotation */
#float a[3]; /* Axis of rotation */
#float phi; /* how much to rotate about axis */
#float phi; /* how much to rotate about axis */
#float p1[3], p2[3], d[3];
#float p1[3], p2[3], d[3];
#float t;
#float t;
if
(
p1x
==
p2x
and
p1y
==
p2y
):
if
(
p1x
==
p2x
and
p1y
==
p2y
):
return
[
0.0
,
0.0
,
0.0
,
1.0
]
return
[
0.0
,
0.0
,
0.0
,
1.0
]
p1
=
[
p1x
,
p1y
,
project_to_sphere
(
TRACKBALLSIZE
,
p1x
,
p1y
)]
p2
=
[
p2x
,
p2y
,
project_to_sphere
(
TRACKBALLSIZE
,
p2x
,
p2y
)]
a
=
stltool
.
cross
(
p2
,
p1
)
p1
=
[
p1x
,
p1y
,
project_to_sphere
(
TRACKBALLSIZE
,
p1x
,
p1y
)]
d
=
map
(
lambda
x
,
y
:
x
-
y
,
p1
,
p2
)
p2
=
[
p2x
,
p2y
,
project_to_sphere
(
TRACKBALLSIZE
,
p2x
,
p2y
)]
t
=
math
.
sqrt
(
sum
(
map
(
lambda
x
:
x
*
x
,
d
)))
/
(
2.0
*
TRACKBALLSIZE
)
a
=
stltool
.
cross
(
p2
,
p1
)
d
=
map
(
lambda
x
,
y
:
x
-
y
,
p1
,
p2
)
t
=
math
.
sqrt
(
sum
(
map
(
lambda
x
:
x
*
x
,
d
)))
/
(
2.0
*
TRACKBALLSIZE
)
if
(
t
>
1.0
):
t
=
1.0
if
(
t
>
1.0
):
if
(
t
<
-
1.0
):
t
=
-
1.0
t
=
1.0
if
(
t
<
-
1.0
):
t
=
-
1.0
phi
=
2.0
*
math
.
asin
(
t
)
phi
=
2.0
*
math
.
asin
(
t
)
return
axis_to_quat
(
a
,
phi
)
return
axis_to_quat
(
a
,
phi
)
def
vec
(
*
args
):
def
vec
(
*
args
):
return
(
GLfloat
*
len
(
args
))(
*
args
)
return
(
GLfloat
*
len
(
args
))(
*
args
)
def
axis_to_quat
(
a
,
phi
):
def
axis_to_quat
(
a
,
phi
):
#print a, phi
#print a, phi
lena
=
math
.
sqrt
(
sum
(
map
(
lambda
x
:
x
*
x
,
a
)))
lena
=
math
.
sqrt
(
sum
(
map
(
lambda
x
:
x
*
x
,
a
)))
q
=
map
(
lambda
x
:
x
*
(
1
/
lena
),
a
)
q
=
map
(
lambda
x
:
x
*
(
1
/
lena
),
a
)
q
=
map
(
lambda
x
:
x
*
math
.
sin
(
phi
/
2.0
),
q
)
q
=
map
(
lambda
x
:
x
*
math
.
sin
(
phi
/
2.0
),
q
)
q
.
append
(
math
.
cos
(
phi
/
2.0
))
q
.
append
(
math
.
cos
(
phi
/
2.0
))
return
q
return
q
def
build_rotmatrix
(
q
):
def
build_rotmatrix
(
q
):
m
=
(
GLdouble
*
16
)()
m
=
(
GLdouble
*
16
)()
m
[
0
]
=
1.0
-
2.0
*
(
q
[
1
]
*
q
[
1
]
+
q
[
2
]
*
q
[
2
])
m
[
0
]
=
1.0
-
2.0
*
(
q
[
1
]
*
q
[
1
]
+
q
[
2
]
*
q
[
2
])
m
[
1
]
=
2.0
*
(
q
[
0
]
*
q
[
1
]
-
q
[
2
]
*
q
[
3
])
;
m
[
1
]
=
2.0
*
(
q
[
0
]
*
q
[
1
]
-
q
[
2
]
*
q
[
3
])
m
[
2
]
=
2.0
*
(
q
[
2
]
*
q
[
0
]
+
q
[
1
]
*
q
[
3
])
;
m
[
2
]
=
2.0
*
(
q
[
2
]
*
q
[
0
]
+
q
[
1
]
*
q
[
3
])
m
[
3
]
=
0.0
;
m
[
3
]
=
0.0
m
[
4
]
=
2.0
*
(
q
[
0
]
*
q
[
1
]
+
q
[
2
]
*
q
[
3
])
;
m
[
4
]
=
2.0
*
(
q
[
0
]
*
q
[
1
]
+
q
[
2
]
*
q
[
3
])
m
[
5
]
=
1.0
-
2.0
*
(
q
[
2
]
*
q
[
2
]
+
q
[
0
]
*
q
[
0
]);
m
[
5
]
=
1.0
-
2.0
*
(
q
[
2
]
*
q
[
2
]
+
q
[
0
]
*
q
[
0
])
m
[
6
]
=
2.0
*
(
q
[
1
]
*
q
[
2
]
-
q
[
0
]
*
q
[
3
])
;
m
[
6
]
=
2.0
*
(
q
[
1
]
*
q
[
2
]
-
q
[
0
]
*
q
[
3
])
m
[
7
]
=
0.0
;
m
[
7
]
=
0.0
m
[
8
]
=
2.0
*
(
q
[
2
]
*
q
[
0
]
-
q
[
1
]
*
q
[
3
])
;
m
[
8
]
=
2.0
*
(
q
[
2
]
*
q
[
0
]
-
q
[
1
]
*
q
[
3
])
m
[
9
]
=
2.0
*
(
q
[
1
]
*
q
[
2
]
+
q
[
0
]
*
q
[
3
])
;
m
[
9
]
=
2.0
*
(
q
[
1
]
*
q
[
2
]
+
q
[
0
]
*
q
[
3
])
m
[
10
]
=
1.0
-
2.0
*
(
q
[
1
]
*
q
[
1
]
+
q
[
0
]
*
q
[
0
])
;
m
[
10
]
=
1.0
-
2.0
*
(
q
[
1
]
*
q
[
1
]
+
q
[
0
]
*
q
[
0
])
m
[
11
]
=
0.0
;
m
[
11
]
=
0.0
m
[
12
]
=
0.0
;
m
[
12
]
=
0.0
m
[
13
]
=
0.0
;
m
[
13
]
=
0.0
m
[
14
]
=
0.0
;
m
[
14
]
=
0.0
m
[
15
]
=
1.0
;
m
[
15
]
=
1.0
return
m
return
m
def
project_to_sphere
(
r
,
x
,
y
):
def
project_to_sphere
(
r
,
x
,
y
):
d
=
math
.
sqrt
(
x
*
x
+
y
*
y
)
d
=
math
.
sqrt
(
x
*
x
+
y
*
y
)
if
(
d
<
r
*
0.70710678118654752440
):
if
(
d
<
r
*
0.70710678118654752440
):
return
math
.
sqrt
(
r
*
r
-
d
*
d
)
return
math
.
sqrt
(
r
*
r
-
d
*
d
)
else
:
else
:
t
=
r
/
1.41421356237309504880
t
=
r
/
1.41421356237309504880
return
t
*
t
/
d
return
t
*
t
/
d
def
mulquat
(
q1
,
rq
):
def
mulquat
(
q1
,
rq
):
return
[
q1
[
3
]
*
rq
[
0
]
+
q1
[
0
]
*
rq
[
3
]
+
q1
[
1
]
*
rq
[
2
]
-
q1
[
2
]
*
rq
[
1
],
return
[
q1
[
3
]
*
rq
[
0
]
+
q1
[
0
]
*
rq
[
3
]
+
q1
[
1
]
*
rq
[
2
]
-
q1
[
2
]
*
rq
[
1
],
q1
[
3
]
*
rq
[
1
]
+
q1
[
1
]
*
rq
[
3
]
+
q1
[
2
]
*
rq
[
0
]
-
q1
[
0
]
*
rq
[
2
],
q1
[
3
]
*
rq
[
1
]
+
q1
[
1
]
*
rq
[
3
]
+
q1
[
2
]
*
rq
[
0
]
-
q1
[
0
]
*
rq
[
2
],
q1
[
3
]
*
rq
[
2
]
+
q1
[
2
]
*
rq
[
3
]
+
q1
[
0
]
*
rq
[
1
]
-
q1
[
1
]
*
rq
[
0
],
q1
[
3
]
*
rq
[
2
]
+
q1
[
2
]
*
rq
[
3
]
+
q1
[
0
]
*
rq
[
1
]
-
q1
[
1
]
*
rq
[
0
],
...
@@ -435,40 +449,39 @@ def mulquat(q1,rq):
...
@@ -435,40 +449,39 @@ def mulquat(q1,rq):
class
TestGlPanel
(
GLPanel
):
class
TestGlPanel
(
GLPanel
):
def
__init__
(
self
,
parent
,
size
,
id
=
wx
.
ID_ANY
,
):
def
__init__
(
self
,
parent
,
size
,
id
=
wx
.
ID_ANY
):
super
(
TestGlPanel
,
self
)
.
__init__
(
parent
,
id
,
wx
.
DefaultPosition
,
size
,
0
)
super
(
TestGlPanel
,
self
)
.
__init__
(
parent
,
id
,
wx
.
DefaultPosition
,
size
,
0
)
self
.
batches
=
[]
self
.
batches
=
[]
self
.
rot
=
0
self
.
rot
=
0
self
.
canvas
.
Bind
(
wx
.
EVT_MOUSE_EVENTS
,
self
.
move
)
self
.
canvas
.
Bind
(
wx
.
EVT_MOUSE_EVENTS
,
self
.
move
)
self
.
canvas
.
Bind
(
wx
.
EVT_LEFT_DCLICK
,
self
.
double
)
self
.
canvas
.
Bind
(
wx
.
EVT_LEFT_DCLICK
,
self
.
double
)
self
.
initialized
=
1
self
.
initialized
=
1
self
.
canvas
.
Bind
(
wx
.
EVT_MOUSEWHEEL
,
self
.
wheel
)
self
.
canvas
.
Bind
(
wx
.
EVT_MOUSEWHEEL
,
self
.
wheel
)
self
.
parent
=
parent
self
.
parent
=
parent
self
.
initpos
=
None
self
.
initpos
=
None
self
.
dist
=
200
self
.
dist
=
200
self
.
bedsize
=
[
200
,
200
]
self
.
bedsize
=
[
200
,
200
]
self
.
transv
=
[
0
,
0
,
-
self
.
dist
]
self
.
transv
=
[
0
,
0
,
-
self
.
dist
]
self
.
basequat
=
[
0
,
0
,
0
,
1
]
self
.
basequat
=
[
0
,
0
,
0
,
1
]
wx
.
CallAfter
(
self
.
forceresize
)
wx
.
CallAfter
(
self
.
forceresize
)
self
.
mousepos
=
[
0
,
0
]
self
.
mousepos
=
[
0
,
0
]
def
double
(
self
,
event
):
def
double
(
self
,
event
):
p
=
event
.
GetPositionTuple
()
p
=
event
.
GetPositionTuple
()
sz
=
self
.
GetClientSize
()
sz
=
self
.
GetClientSize
()
v
=
map
(
lambda
m
,
w
,
b
:
b
*
m
/
w
,
p
,
sz
,
self
.
bedsize
)
v
=
map
(
lambda
m
,
w
,
b
:
b
*
m
/
w
,
p
,
sz
,
self
.
bedsize
)
v
[
1
]
=
self
.
bedsize
[
1
]
-
v
[
1
]
v
[
1
]
=
self
.
bedsize
[
1
]
-
v
[
1
]
v
+=
[
300
]
v
+=
[
300
]
print
v
print
v
self
.
add_file
(
"../prusa/metric-prusa/x-end-idler.stl"
,
v
)
self
.
add_file
(
"../prusa/metric-prusa/x-end-idler.stl"
,
v
)
def
forceresize
(
self
):
def
forceresize
(
self
):
self
.
SetClientSize
((
self
.
GetClientSize
()[
0
],
self
.
GetClientSize
()[
1
]
+
1
))
self
.
SetClientSize
((
self
.
GetClientSize
()[
0
],
self
.
GetClientSize
()[
1
]
+
1
))
self
.
SetClientSize
((
self
.
GetClientSize
()[
0
],
self
.
GetClientSize
()[
1
]
-
1
))
self
.
SetClientSize
((
self
.
GetClientSize
()[
0
],
self
.
GetClientSize
()[
1
]
-
1
))
threading
.
Thread
(
target
=
self
.
update
)
.
start
()
threading
.
Thread
(
target
=
self
.
update
)
.
start
()
self
.
initialized
=
0
self
.
initialized
=
0
def
move_shape
(
self
,
delta
):
def
move_shape
(
self
,
delta
):
"""moves shape (selected in l, which is list ListBox of shapes)
"""moves shape (selected in l, which is list ListBox of shapes)
by an offset specified in tuple delta.
by an offset specified in tuple delta.
...
@@ -497,8 +510,8 @@ class TestGlPanel(GLPanel):
...
@@ -497,8 +510,8 @@ class TestGlPanel(GLPanel):
with shift move viewport
with shift move viewport
"""
"""
if
event
.
Dragging
()
and
event
.
LeftIsDown
():
if
event
.
Dragging
()
and
event
.
LeftIsDown
():
if
self
.
initpos
==
None
:
if
self
.
initpos
==
None
:
self
.
initpos
=
event
.
GetPositionTuple
()
self
.
initpos
=
event
.
GetPositionTuple
()
else
:
else
:
if
not
event
.
ShiftDown
():
if
not
event
.
ShiftDown
():
currentpos
=
event
.
GetPositionTuple
()
currentpos
=
event
.
GetPositionTuple
()
...
@@ -507,70 +520,69 @@ class TestGlPanel(GLPanel):
...
@@ -507,70 +520,69 @@ class TestGlPanel(GLPanel):
-
(
currentpos
[
1
]
-
self
.
initpos
[
1
])
-
(
currentpos
[
1
]
-
self
.
initpos
[
1
])
)
)
self
.
move_shape
(
delta
)
self
.
move_shape
(
delta
)
self
.
initpos
=
None
self
.
initpos
=
None
return
return
#print self.initpos
#print self.initpos
p1
=
self
.
initpos
p1
=
self
.
initpos
self
.
initpos
=
None
self
.
initpos
=
None
p2
=
event
.
GetPositionTuple
()
p2
=
event
.
GetPositionTuple
()
sz
=
self
.
GetClientSize
()
sz
=
self
.
GetClientSize
()
p1x
=
(
float
(
p1
[
0
])
-
sz
[
0
]
/
2
)
/
(
sz
[
0
]
/
2
)
p1x
=
(
float
(
p1
[
0
])
-
sz
[
0
]
/
2
)
/
(
sz
[
0
]
/
2
)
p1y
=-
(
float
(
p1
[
1
])
-
sz
[
1
]
/
2
)
/
(
sz
[
1
]
/
2
)
p1y
=
-
(
float
(
p1
[
1
])
-
sz
[
1
]
/
2
)
/
(
sz
[
1
]
/
2
)
p2x
=
(
float
(
p2
[
0
])
-
sz
[
0
]
/
2
)
/
(
sz
[
0
]
/
2
)
p2x
=
(
float
(
p2
[
0
])
-
sz
[
0
]
/
2
)
/
(
sz
[
0
]
/
2
)
p2y
=-
(
float
(
p2
[
1
])
-
sz
[
1
]
/
2
)
/
(
sz
[
1
]
/
2
)
p2y
=
-
(
float
(
p2
[
1
])
-
sz
[
1
]
/
2
)
/
(
sz
[
1
]
/
2
)
#print p1x,p1y,p2x,p2y
#print p1x,p1y,p2x,p2y
quat
=
trackball
(
p1x
,
p1y
,
p2x
,
p2y
,
-
self
.
transv
[
2
]
/
250.0
)
quat
=
trackball
(
p1x
,
p1y
,
p2x
,
p2y
,
-
self
.
transv
[
2
]
/
250.0
)
if
self
.
rot
:
if
self
.
rot
:
self
.
basequat
=
mulquat
(
self
.
basequat
,
quat
)
self
.
basequat
=
mulquat
(
self
.
basequat
,
quat
)
#else:
#else:
glGetDoublev
(
GL_MODELVIEW_MATRIX
,
self
.
mvmat
)
glGetDoublev
(
GL_MODELVIEW_MATRIX
,
self
.
mvmat
)
#self.basequat
=
quatx
#self.basequat
=
quatx
mat
=
build_rotmatrix
(
self
.
basequat
)
mat
=
build_rotmatrix
(
self
.
basequat
)
glLoadIdentity
()
glLoadIdentity
()
glTranslatef
(
self
.
transv
[
0
],
self
.
transv
[
1
],
0
)
glTranslatef
(
self
.
transv
[
0
],
self
.
transv
[
1
],
0
)
glTranslatef
(
0
,
0
,
self
.
transv
[
2
])
glTranslatef
(
0
,
0
,
self
.
transv
[
2
])
glMultMatrixd
(
mat
)
glMultMatrixd
(
mat
)
glGetDoublev
(
GL_MODELVIEW_MATRIX
,
self
.
mvmat
)
glGetDoublev
(
GL_MODELVIEW_MATRIX
,
self
.
mvmat
)
self
.
rot
=
1
self
.
rot
=
1
elif
event
.
ButtonUp
(
wx
.
MOUSE_BTN_LEFT
):
elif
event
.
ButtonUp
(
wx
.
MOUSE_BTN_LEFT
):
if
self
.
initpos
is
not
None
:
if
self
.
initpos
is
not
None
:
self
.
initpos
=
None
self
.
initpos
=
None
elif
event
.
ButtonUp
(
wx
.
MOUSE_BTN_RIGHT
):
elif
event
.
ButtonUp
(
wx
.
MOUSE_BTN_RIGHT
):
if
self
.
initpos
is
not
None
:
if
self
.
initpos
is
not
None
:
self
.
initpos
=
None
self
.
initpos
=
None
elif
event
.
Dragging
()
and
event
.
RightIsDown
()
and
event
.
ShiftDown
():
elif
event
.
Dragging
()
and
event
.
RightIsDown
()
and
event
.
ShiftDown
():
if
self
.
initpos
is
None
:
if
self
.
initpos
is
None
:
self
.
initpos
=
event
.
GetPositionTuple
()
self
.
initpos
=
event
.
GetPositionTuple
()
else
:
else
:
p1
=
self
.
initpos
p1
=
self
.
initpos
p2
=
event
.
GetPositionTuple
()
p2
=
event
.
GetPositionTuple
()
sz
=
self
.
GetClientSize
()
sz
=
self
.
GetClientSize
()
p1
=
list
(
p1
)
p1
=
list
(
p1
)
p2
=
list
(
p2
)
p2
=
list
(
p2
)
p1
[
1
]
*=
-
1
p1
[
1
]
*=
-
1
p2
[
1
]
*=
-
1
p2
[
1
]
*=
-
1
self
.
transv
=
map
(
lambda
x
,
y
,
z
,
c
:
c
-
self
.
dist
*
(
x
-
y
)
/
z
,
list
(
p1
)
+
[
0
],
list
(
p2
)
+
[
0
],
list
(
sz
)
+
[
1
],
self
.
transv
)
self
.
transv
=
map
(
lambda
x
,
y
,
z
,
c
:
c
-
self
.
dist
*
(
x
-
y
)
/
z
,
list
(
p1
)
+
[
0
],
list
(
p2
)
+
[
0
],
list
(
sz
)
+
[
1
],
self
.
transv
)
glLoadIdentity
()
glLoadIdentity
()
glTranslatef
(
self
.
transv
[
0
],
self
.
transv
[
1
],
0
)
glTranslatef
(
self
.
transv
[
0
],
self
.
transv
[
1
],
0
)
glTranslatef
(
0
,
0
,
self
.
transv
[
2
])
glTranslatef
(
0
,
0
,
self
.
transv
[
2
])
if
(
self
.
rot
):
if
(
self
.
rot
):
glMultMatrixd
(
build_rotmatrix
(
self
.
basequat
))
glMultMatrixd
(
build_rotmatrix
(
self
.
basequat
))
glGetDoublev
(
GL_MODELVIEW_MATRIX
,
self
.
mvmat
)
glGetDoublev
(
GL_MODELVIEW_MATRIX
,
self
.
mvmat
)
self
.
rot
=
1
self
.
rot
=
1
self
.
initpos
=
None
self
.
initpos
=
None
else
:
else
:
#mouse is moving without a button press
#mouse is moving without a button press
p
=
event
.
GetPositionTuple
()
p
=
event
.
GetPositionTuple
()
sz
=
self
.
GetClientSize
()
sz
=
self
.
GetClientSize
()
v
=
map
(
lambda
m
,
w
,
b
:
b
*
m
/
w
,
p
,
sz
,
self
.
bedsize
)
v
=
map
(
lambda
m
,
w
,
b
:
b
*
m
/
w
,
p
,
sz
,
self
.
bedsize
)
v
[
1
]
=
self
.
bedsize
[
1
]
-
v
[
1
]
v
[
1
]
=
self
.
bedsize
[
1
]
-
v
[
1
]
self
.
mousepos
=
v
self
.
mousepos
=
v
def
rotate_shape
(
self
,
angle
):
def
rotate_shape
(
self
,
angle
):
"""rotates acive shape
"""rotates acive shape
positive angle is clockwise
positive angle is clockwise
...
@@ -582,40 +594,40 @@ class TestGlPanel(GLPanel):
...
@@ -582,40 +594,40 @@ class TestGlPanel(GLPanel):
model
=
self
.
parent
.
models
[
name
]
model
=
self
.
parent
.
models
[
name
]
model
.
rot
+=
angle
model
.
rot
+=
angle
def
wheel
(
self
,
event
):
def
wheel
(
self
,
event
):
"""react to mouse wheel actions:
"""react to mouse wheel actions:
rotate object
rotate object
with shift zoom viewport
with shift zoom viewport
"""
"""
z
=
event
.
GetWheelRotation
()
z
=
event
.
GetWheelRotation
()
angle
=
10
angle
=
10
if
not
event
.
ShiftDown
():
if
not
event
.
ShiftDown
():
i
=
self
.
parent
.
l
.
GetSelection
()
i
=
self
.
parent
.
l
.
GetSelection
()
if
i
<
0
:
if
i
<
0
:
try
:
try
:
self
.
parent
.
setlayerindex
(
z
)
self
.
parent
.
setlayerindex
(
z
)
except
:
except
:
pass
pass
return
return
if
z
>
0
:
if
z
>
0
:
self
.
rotate_shape
(
angle
/
2
)
self
.
rotate_shape
(
angle
/
2
)
else
:
else
:
self
.
rotate_shape
(
-
angle
/
2
)
self
.
rotate_shape
(
-
angle
/
2
)
return
return
if
z
>
0
:
if
z
>
0
:
self
.
transv
[
2
]
+=
angle
self
.
transv
[
2
]
+=
angle
else
:
else
:
self
.
transv
[
2
]
-=
angle
self
.
transv
[
2
]
-=
angle
glLoadIdentity
()
glLoadIdentity
()
glTranslatef
(
*
self
.
transv
)
glTranslatef
(
*
self
.
transv
)
if
(
self
.
rot
):
if
(
self
.
rot
):
glMultMatrixd
(
build_rotmatrix
(
self
.
basequat
))
glMultMatrixd
(
build_rotmatrix
(
self
.
basequat
))
glGetDoublev
(
GL_MODELVIEW_MATRIX
,
self
.
mvmat
)
glGetDoublev
(
GL_MODELVIEW_MATRIX
,
self
.
mvmat
)
self
.
rot
=
1
self
.
rot
=
1
def
keypress
(
self
,
event
):
def
keypress
(
self
,
event
):
"""gets keypress events and moves/rotates acive shape"""
"""gets keypress events and moves/rotates acive shape"""
keycode
=
event
.
GetKeyCode
()
keycode
=
event
.
GetKeyCode
()
...
@@ -644,67 +656,65 @@ class TestGlPanel(GLPanel):
...
@@ -644,67 +656,65 @@ class TestGlPanel(GLPanel):
if
keycode
==
93
:
if
keycode
==
93
:
self
.
rotate_shape
(
angle
)
self
.
rotate_shape
(
angle
)
event
.
Skip
()
event
.
Skip
()
def
update
(
self
):
def
update
(
self
):
while
(
1
):
while
(
1
):
dt
=
0.05
dt
=
0.05
time
.
sleep
(
0.05
)
time
.
sleep
(
0.05
)
try
:
try
:
wx
.
CallAfter
(
self
.
Refresh
)
wx
.
CallAfter
(
self
.
Refresh
)
except
:
except
:
return
return
def
anim
(
self
,
obj
):
def
anim
(
self
,
obj
):
g
=
50
*
9.8
g
=
50
*
9.8
v
=
20
v
=
20
dt
=
0.05
dt
=
0.05
basepos
=
obj
.
offsets
[
2
]
basepos
=
obj
.
offsets
[
2
]
obj
.
offsets
[
2
]
+=
obj
.
animoffset
obj
.
offsets
[
2
]
+=
obj
.
animoffset
while
obj
.
offsets
[
2
]
>
-
1
:
while
obj
.
offsets
[
2
]
>
-
1
:
time
.
sleep
(
dt
)
time
.
sleep
(
dt
)
obj
.
offsets
[
2
]
-=
v
*
dt
obj
.
offsets
[
2
]
-=
v
*
dt
v
+=
g
*
dt
v
+=
g
*
dt
if
(
obj
.
offsets
[
2
]
<
0
):
if
(
obj
.
offsets
[
2
]
<
0
):
obj
.
scale
[
2
]
*=
1
-
3
*
dt
obj
.
scale
[
2
]
*=
1
-
3
*
dt
#return
#return
v
=
v
/
4
v
=
v
/
4
while
obj
.
offsets
[
2
]
<
basepos
:
while
obj
.
offsets
[
2
]
<
basepos
:
time
.
sleep
(
dt
)
time
.
sleep
(
dt
)
obj
.
offsets
[
2
]
+=
v
*
dt
obj
.
offsets
[
2
]
+=
v
*
dt
v
-=
g
*
dt
v
-=
g
*
dt
obj
.
scale
[
2
]
*=
1
+
5
*
dt
obj
.
scale
[
2
]
*=
1
+
5
*
dt
obj
.
scale
[
2
]
=
1.0
obj
.
scale
[
2
]
=
1.0
def
create_objects
(
self
):
def
create_objects
(
self
):
'''create opengl objects when opengl is initialized'''
'''create opengl objects when opengl is initialized'''
self
.
initialized
=
1
self
.
initialized
=
1
wx
.
CallAfter
(
self
.
Refresh
)
wx
.
CallAfter
(
self
.
Refresh
)
def
drawmodel
(
self
,
m
,
n
):
def
drawmodel
(
self
,
m
,
n
):
batch
=
pyglet
.
graphics
.
Batch
()
batch
=
pyglet
.
graphics
.
Batch
()
stl
=
stlview
(
m
.
facets
,
batch
=
batch
)
stl
=
stlview
(
m
.
facets
,
batch
=
batch
)
m
.
batch
=
batch
m
.
batch
=
batch
m
.
animoffset
=
300
m
.
animoffset
=
300
#print m
#print m
#threading.Thread(target
=self.anim,args=(m,
)).start()
#threading.Thread(target
= self.anim, args = (m,
)).start()
wx
.
CallAfter
(
self
.
Refresh
)
wx
.
CallAfter
(
self
.
Refresh
)
def
update_object_resize
(
self
):
def
update_object_resize
(
self
):
'''called when the window recieves only if opengl is initialized'''
'''called when the window recieves only if opengl is initialized'''
pass
pass
def
draw_objects
(
self
):
def
draw_objects
(
self
):
'''called in the middle of ondraw after the buffer has been cleared'''
'''called in the middle of ondraw after the buffer has been cleared'''
if
self
.
vpmat
is
None
:
if
self
.
vpmat
is
None
:
return
return
if
not
self
.
initialized
:
if
not
self
.
initialized
:
self
.
create_objects
()
self
.
create_objects
()
#glLoadIdentity()
#glLoadIdentity()
#print list(self.pmat)
#print list(self.pmat)
if
self
.
rot
==
1
:
if
self
.
rot
==
1
:
glLoadIdentity
()
glLoadIdentity
()
glMultMatrixd
(
self
.
mvmat
)
glMultMatrixd
(
self
.
mvmat
)
else
:
else
:
...
@@ -712,74 +722,74 @@ class TestGlPanel(GLPanel):
...
@@ -712,74 +722,74 @@ class TestGlPanel(GLPanel):
glTranslatef
(
*
self
.
transv
)
glTranslatef
(
*
self
.
transv
)
glMaterialfv
(
GL_FRONT_AND_BACK
,
GL_AMBIENT_AND_DIFFUSE
,
vec
(
0.2
,
0.2
,
0.2
,
1
))
glMaterialfv
(
GL_FRONT_AND_BACK
,
GL_AMBIENT_AND_DIFFUSE
,
vec
(
0.2
,
0.2
,
0.2
,
1
))
glBegin
(
GL_LINES
)
glBegin
(
GL_LINES
)
glNormal3f
(
0
,
0
,
1
)
glNormal3f
(
0
,
0
,
1
)
rows
=
10
rows
=
10
cols
=
10
cols
=
10
zheight
=
50
zheight
=
50
for
i
in
xrange
(
-
rows
,
rows
+
1
):
for
i
in
xrange
(
-
rows
,
rows
+
1
):
if
i
%
5
==
0
:
if
i
%
5
==
0
:
glMaterialfv
(
GL_FRONT_AND_BACK
,
GL_AMBIENT_AND_DIFFUSE
,
vec
(
0.6
,
0.6
,
0.6
,
1
))
glMaterialfv
(
GL_FRONT_AND_BACK
,
GL_AMBIENT_AND_DIFFUSE
,
vec
(
0.6
,
0.6
,
0.6
,
1
))
else
:
else
:
glMaterialfv
(
GL_FRONT_AND_BACK
,
GL_AMBIENT_AND_DIFFUSE
,
vec
(
0.2
,
0.2
,
0.2
,
1
))
glMaterialfv
(
GL_FRONT_AND_BACK
,
GL_AMBIENT_AND_DIFFUSE
,
vec
(
0.2
,
0.2
,
0.2
,
1
))
glVertex3f
(
10
*-
cols
,
10
*
i
,
0
)
glVertex3f
(
10
*
-
cols
,
10
*
i
,
0
)
glVertex3f
(
10
*
cols
,
10
*
i
,
0
)
glVertex3f
(
10
*
cols
,
10
*
i
,
0
)
for
i
in
xrange
(
-
cols
,
cols
+
1
):
for
i
in
xrange
(
-
cols
,
cols
+
1
):
if
i
%
5
==
0
:
if
i
%
5
==
0
:
glMaterialfv
(
GL_FRONT_AND_BACK
,
GL_AMBIENT_AND_DIFFUSE
,
vec
(
0.6
,
0.6
,
0.6
,
1
))
glMaterialfv
(
GL_FRONT_AND_BACK
,
GL_AMBIENT_AND_DIFFUSE
,
vec
(
0.6
,
0.6
,
0.6
,
1
))
else
:
else
:
glMaterialfv
(
GL_FRONT_AND_BACK
,
GL_AMBIENT_AND_DIFFUSE
,
vec
(
0.2
,
0.2
,
0.2
,
1
))
glMaterialfv
(
GL_FRONT_AND_BACK
,
GL_AMBIENT_AND_DIFFUSE
,
vec
(
0.2
,
0.2
,
0.2
,
1
))
glVertex3f
(
10
*
i
,
10
*-
rows
,
0
)
glVertex3f
(
10
*
i
,
10
*
-
rows
,
0
)
glVertex3f
(
10
*
i
,
10
*
rows
,
0
)
glVertex3f
(
10
*
i
,
10
*
rows
,
0
)
glMaterialfv
(
GL_FRONT_AND_BACK
,
GL_AMBIENT_AND_DIFFUSE
,
vec
(
0.6
,
0.6
,
0.6
,
1
))
glMaterialfv
(
GL_FRONT_AND_BACK
,
GL_AMBIENT_AND_DIFFUSE
,
vec
(
0.6
,
0.6
,
0.6
,
1
))
glVertex3f
(
10
*-
cols
,
10
*-
rows
,
0
)
glVertex3f
(
10
*
-
cols
,
10
*
-
rows
,
0
)
glVertex3f
(
10
*-
cols
,
10
*-
rows
,
zheight
)
glVertex3f
(
10
*
-
cols
,
10
*
-
rows
,
zheight
)
glVertex3f
(
10
*
cols
,
10
*
rows
,
0
)
glVertex3f
(
10
*
cols
,
10
*
rows
,
0
)
glVertex3f
(
10
*
cols
,
10
*
rows
,
zheight
)
glVertex3f
(
10
*
cols
,
10
*
rows
,
zheight
)
glVertex3f
(
10
*
cols
,
10
*-
rows
,
0
)
glVertex3f
(
10
*
cols
,
10
*
-
rows
,
0
)
glVertex3f
(
10
*
cols
,
10
*-
rows
,
zheight
)
glVertex3f
(
10
*
cols
,
10
*
-
rows
,
zheight
)
glVertex3f
(
10
*-
cols
,
10
*
rows
,
0
)
glVertex3f
(
10
*
-
cols
,
10
*
rows
,
0
)
glVertex3f
(
10
*-
cols
,
10
*
rows
,
zheight
)
glVertex3f
(
10
*
-
cols
,
10
*
rows
,
zheight
)
glVertex3f
(
10
*-
cols
,
10
*
rows
,
zheight
)
glVertex3f
(
10
*
-
cols
,
10
*
rows
,
zheight
)
glVertex3f
(
10
*
cols
,
10
*
rows
,
zheight
)
glVertex3f
(
10
*
cols
,
10
*
rows
,
zheight
)
glVertex3f
(
10
*
cols
,
10
*
rows
,
zheight
)
glVertex3f
(
10
*
cols
,
10
*
rows
,
zheight
)
glVertex3f
(
10
*
cols
,
10
*-
rows
,
zheight
)
glVertex3f
(
10
*
cols
,
10
*
-
rows
,
zheight
)
glVertex3f
(
10
*
cols
,
10
*-
rows
,
zheight
)
glVertex3f
(
10
*
cols
,
10
*
-
rows
,
zheight
)
glVertex3f
(
10
*-
cols
,
10
*-
rows
,
zheight
)
glVertex3f
(
10
*
-
cols
,
10
*
-
rows
,
zheight
)
glVertex3f
(
10
*-
cols
,
10
*-
rows
,
zheight
)
glVertex3f
(
10
*
-
cols
,
10
*
-
rows
,
zheight
)
glVertex3f
(
10
*-
cols
,
10
*
rows
,
zheight
)
glVertex3f
(
10
*
-
cols
,
10
*
rows
,
zheight
)
glEnd
()
glEnd
()
glPushMatrix
()
glPushMatrix
()
glTranslatef
(
self
.
mousepos
[
0
]
-
self
.
bedsize
[
0
]
/
2
,
self
.
mousepos
[
1
]
-
self
.
bedsize
[
1
]
/
2
,
0
)
glTranslatef
(
self
.
mousepos
[
0
]
-
self
.
bedsize
[
0
]
/
2
,
self
.
mousepos
[
1
]
-
self
.
bedsize
[
1
]
/
2
,
0
)
glBegin
(
GL_TRIANGLES
)
glBegin
(
GL_TRIANGLES
)
glMaterialfv
(
GL_FRONT_AND_BACK
,
GL_AMBIENT_AND_DIFFUSE
,
vec
(
1
,
0
,
0
,
1
))
glMaterialfv
(
GL_FRONT_AND_BACK
,
GL_AMBIENT_AND_DIFFUSE
,
vec
(
1
,
0
,
0
,
1
))
glNormal3f
(
0
,
0
,
1
)
glNormal3f
(
0
,
0
,
1
)
glVertex3f
(
2
,
2
,
0
)
glVertex3f
(
2
,
2
,
0
)
glVertex3f
(
-
2
,
2
,
0
)
glVertex3f
(
-
2
,
2
,
0
)
glVertex3f
(
-
2
,
-
2
,
0
)
glVertex3f
(
-
2
,
-
2
,
0
)
glVertex3f
(
2
,
-
2
,
0
)
glVertex3f
(
2
,
-
2
,
0
)
glVertex3f
(
2
,
2
,
0
)
glVertex3f
(
2
,
2
,
0
)
glVertex3f
(
-
2
,
-
2
,
0
)
glVertex3f
(
-
2
,
-
2
,
0
)
glEnd
()
glEnd
()
glMaterialfv
(
GL_FRONT_AND_BACK
,
GL_AMBIENT_AND_DIFFUSE
,
vec
(
0.3
,
0.7
,
0.5
,
1
))
glMaterialfv
(
GL_FRONT_AND_BACK
,
GL_AMBIENT_AND_DIFFUSE
,
vec
(
0.3
,
0.7
,
0.5
,
1
))
#glTranslatef(0,
40,
0)
#glTranslatef(0,
40,
0)
glPopMatrix
()
glPopMatrix
()
glPushMatrix
()
glPushMatrix
()
glTranslatef
(
-
100
,
-
100
,
0
)
glTranslatef
(
-
100
,
-
100
,
0
)
for
i
in
self
.
parent
.
models
.
values
():
for
i
in
self
.
parent
.
models
.
values
():
glPushMatrix
()
glPushMatrix
()
glTranslatef
(
*
(
i
.
offsets
))
glTranslatef
(
*
(
i
.
offsets
))
glRotatef
(
i
.
rot
,
0.0
,
0.0
,
1.0
)
glRotatef
(
i
.
rot
,
0.0
,
0.0
,
1.0
)
glScalef
(
*
i
.
scale
)
glScalef
(
*
i
.
scale
)
try
:
try
:
if
i
.
curlayer
in
i
.
gc
.
layers
:
if
i
.
curlayer
in
i
.
gc
.
layers
:
glMaterialfv
(
GL_FRONT_AND_BACK
,
GL_AMBIENT_AND_DIFFUSE
,
vec
(
0.13
,
0.37
,
0.25
,
1
))
glMaterialfv
(
GL_FRONT_AND_BACK
,
GL_AMBIENT_AND_DIFFUSE
,
vec
(
0.13
,
0.37
,
0.25
,
1
))
[
i
.
gc
.
layers
[
j
]
.
draw
()
for
j
in
i
.
gc
.
layers
.
keys
()
if
j
<
i
.
curlayer
]
[
i
.
gc
.
layers
[
j
]
.
draw
()
for
j
in
i
.
gc
.
layers
.
keys
()
if
j
<
i
.
curlayer
]
glMaterialfv
(
GL_FRONT_AND_BACK
,
GL_AMBIENT_AND_DIFFUSE
,
vec
(
0.5
,
0.6
,
0.9
,
1
))
glMaterialfv
(
GL_FRONT_AND_BACK
,
GL_AMBIENT_AND_DIFFUSE
,
vec
(
0.5
,
0.6
,
0.9
,
1
))
b
=
i
.
gc
.
layers
[
i
.
curlayer
]
b
=
i
.
gc
.
layers
[
i
.
curlayer
]
b
.
draw
()
b
.
draw
()
else
:
else
:
i
.
batch
.
draw
()
i
.
batch
.
draw
()
...
@@ -788,69 +798,69 @@ class TestGlPanel(GLPanel):
...
@@ -788,69 +798,69 @@ class TestGlPanel(GLPanel):
glPopMatrix
()
glPopMatrix
()
glPopMatrix
()
glPopMatrix
()
#print "drawn batch"
#print "drawn batch"
class
GCFrame
(
wx
.
Frame
):
class
GCFrame
(
wx
.
Frame
):
'''A simple class for using OpenGL with wxPython.'''
'''A simple class for using OpenGL with wxPython.'''
def
__init__
(
self
,
parent
,
ID
,
title
,
pos
=
wx
.
DefaultPosition
,
def
__init__
(
self
,
parent
,
ID
,
title
,
pos
=
wx
.
DefaultPosition
,
size
=
wx
.
DefaultSize
,
style
=
wx
.
DEFAULT_FRAME_STYLE
):
size
=
wx
.
DefaultSize
,
style
=
wx
.
DEFAULT_FRAME_STYLE
):
super
(
GCFrame
,
self
)
.
__init__
(
parent
,
ID
,
title
,
pos
,
(
size
[
0
]
+
150
,
size
[
1
]),
style
)
super
(
GCFrame
,
self
)
.
__init__
(
parent
,
ID
,
title
,
pos
,
(
size
[
0
]
+
150
,
size
[
1
]),
style
)
class
d
:
class
d
:
def
GetSelection
(
self
):
def
GetSelection
(
self
):
return
-
1
return
wx
.
NOT_FOUND
self
.
p
=
self
self
.
p
=
self
m
=
d
()
m
=
d
()
m
.
offsets
=
[
0
,
0
,
0
]
m
.
offsets
=
[
0
,
0
,
0
]
m
.
rot
=
0
m
.
rot
=
0
m
.
curlayer
=
0.0
m
.
curlayer
=
0.0
m
.
scale
=
[
1.
,
1.
,
1.
]
m
.
scale
=
[
1.0
,
1.0
,
1.0
]
m
.
batch
=
pyglet
.
graphics
.
Batch
()
m
.
batch
=
pyglet
.
graphics
.
Batch
()
m
.
gc
=
gcview
([],
batch
=
m
.
batch
)
m
.
gc
=
gcview
([],
batch
=
m
.
batch
)
self
.
models
=
{
""
:
m
}
self
.
models
=
{
""
:
m
}
self
.
l
=
d
()
self
.
l
=
d
()
self
.
modelindex
=
0
self
.
modelindex
=
0
self
.
GLPanel1
=
TestGlPanel
(
self
,
size
)
self
.
GLPanel1
=
TestGlPanel
(
self
,
size
)
def
addfile
(
self
,
gcode
=
[]):
def
addfile
(
self
,
gcode
=
[]):
self
.
models
[
""
]
.
gc
.
delete
()
self
.
models
[
""
]
.
gc
.
delete
()
self
.
models
[
""
]
.
gc
=
gcview
(
gcode
,
batch
=
self
.
models
[
""
]
.
batch
)
self
.
models
[
""
]
.
gc
=
gcview
(
gcode
,
batch
=
self
.
models
[
""
]
.
batch
)
def
clear
(
self
):
def
clear
(
self
):
self
.
models
[
""
]
.
gc
.
delete
()
self
.
models
[
""
]
.
gc
.
delete
()
self
.
models
[
""
]
.
gc
=
gcview
([],
batch
=
self
.
models
[
""
]
.
batch
)
self
.
models
[
""
]
.
gc
=
gcview
([],
batch
=
self
.
models
[
""
]
.
batch
)
def
Show
(
self
,
arg
=
True
):
def
Show
(
self
,
arg
=
True
):
wx
.
Frame
.
Show
(
self
,
arg
)
wx
.
Frame
.
Show
(
self
,
arg
)
self
.
SetClientSize
((
self
.
GetClientSize
()[
0
],
self
.
GetClientSize
()[
1
]
+
1
))
self
.
SetClientSize
((
self
.
GetClientSize
()[
0
],
self
.
GetClientSize
()[
1
]
+
1
))
self
.
SetClientSize
((
self
.
GetClientSize
()[
0
],
self
.
GetClientSize
()[
1
]
-
1
))
self
.
SetClientSize
((
self
.
GetClientSize
()[
0
],
self
.
GetClientSize
()[
1
]
-
1
))
self
.
Refresh
()
self
.
Refresh
()
wx
.
FutureCall
(
500
,
self
.
GLPanel1
.
forceresize
)
wx
.
FutureCall
(
500
,
self
.
GLPanel1
.
forceresize
)
#threading.Thread(target=self.update).start()
#threading.Thread(target = self.update).start()
#self.initialized=0
#self.initialized = 0
def
setlayerindex
(
self
,
z
):
m
=
self
.
models
[
""
]
def
setlayerindex
(
self
,
z
):
mlk
=
sorted
(
m
.
gc
.
layers
.
keys
())
m
=
self
.
models
[
""
]
if
z
>
0
and
self
.
modelindex
<
len
(
mlk
)
-
1
:
mlk
=
sorted
(
m
.
gc
.
layers
.
keys
())
self
.
modelindex
+=
1
if
z
>
0
and
self
.
modelindex
<
len
(
mlk
)
-
1
:
if
z
<
0
and
self
.
modelindex
>
0
:
self
.
modelindex
+=
1
self
.
modelindex
-=
1
if
z
<
0
and
self
.
modelindex
>
0
:
m
.
curlayer
=
mlk
[
self
.
modelindex
]
self
.
modelindex
-=
1
wx
.
CallAfter
(
self
.
SetTitle
,
"Gcode view, shift to move. Layer
%
d, Z =
%
f"
%
(
self
.
modelindex
,
m
.
curlayer
))
m
.
curlayer
=
mlk
[
self
.
modelindex
]
wx
.
CallAfter
(
self
.
SetTitle
,
"Gcode view, shift to move. Layer
%
d, Z=
%
f"
%
(
self
.
modelindex
,
m
.
curlayer
))
def
main
():
def
main
():
app
=
wx
.
App
(
redirect
=
False
)
app
=
wx
.
App
(
redirect
=
False
)
frame
=
GCFrame
(
None
,
wx
.
ID_ANY
,
'Gcode view, shift to move view, mousewheel to set layer'
,
size
=
(
400
,
400
))
frame
=
GCFrame
(
None
,
wx
.
ID_ANY
,
'Gcode view, shift to move view, mousewheel to set layer'
,
size
=
(
400
,
400
))
frame
.
addfile
(
list
(
open
(
"carriage dump_export.gcode"
)))
frame
.
addfile
(
list
(
open
(
"carriage dump_export.gcode"
)))
#frame = wx.Frame(None, -1, "GL Window", size=(400,400))
#frame = wx.Frame(None, -1, "GL Window", size=(400,
400))
#panel = TestGlPanel(frame)
#panel = TestGlPanel(frame)
#frame.Show(True)
#frame.Show(True)
#app.MainLoop()
#app.MainLoop()
app
.
Destroy
()
app
.
Destroy
()
if
__name__
==
"__main__"
:
if
__name__
==
"__main__"
:
import
cProfile
import
cProfile
print
cProfile
.
run
(
"main()"
)
print
cProfile
.
run
(
"main()"
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment