File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- from DuetWebAPI import DuetWebAPI
1+ from . DuetWebAPI import DuetWebAPI
Original file line number Diff line number Diff line change 11# DuetWebAPI
2- Python interface to Duet RepRap V2 or V3 firmware.
2+ Python interface to Duet RepRap V2 or V3 firmware via Http REST API .
33
44* Works over IP network.
55* Does not support passwords on the printer.
@@ -10,12 +10,8 @@ Python interface to Duet RepRap V2 or V3 firmware.
1010 as long as they continue V2 V3 abstractaion.
1111
1212# Install
13- * Download the DuetWebAPI.py script.
14- * Or ``` git clone https://github.com/lukeslaboratory/DuetWebAPI ```
15-
16- * Place it in the directory of the script that is going to include it
17- * Or in any directory in the python library path,
18- * Or create a symbolic link ``` ln -s ../DuetWebAPI/DuetWebAPI.py DuetWebAPI.py ```
13+ * add ` "git+https://github.com/AndyEveritt/DuetWebAPI.git@master#egg=duetwebapi" ` to ` requirements.txt `
14+ * ` pip install -r requirements.txt `
1915
2016# Usage
21- * See 'testDWA .py' for examples.
17+ * See 'examples .py' for examples.
Original file line number Diff line number Diff line change 1+ #!/usr/bin/env python3
2+ import DuetWebAPI as DWA
3+ import json
4+
5+ # Test cases
6+
7+ D100 = DWA .DuetWebAPI ('http://192.168.7.100' )
8+ D101 = DWA .DuetWebAPI ('http://192.168.7.101' )
9+ D127 = DWA .DuetWebAPI ('http://127.0.0.1' )
10+
11+ print ("Printer Type D100 is " ,D100 .printerType ())
12+ print ("Printer Type D101 is " ,D101 .printerType ())
13+ print ("Printer Type D127 is " ,D127 .printerType ())
14+
15+ print ("D100 coordinates are" ,D100 .getCoords ())
16+ d = D101 .getCoords ()
17+ print ("D101 coordinates are" ,d )
18+ print ("D101 X axis is " ,d ['X' ])
19+
20+ print ("D100 numExtruders " ,D100 .getNumExtruders ())
21+ print ("D101 numExtruders " ,D101 .getNumExtruders ())
22+
23+ print ("D100 numTools " ,D100 .getNumTools ())
24+ print ("D101 numTools " ,D101 .getNumTools ())
25+
26+ print ("D100 length of config.g " ,len (D100 .getFilenamed ('/sys/config.g' )))
27+ print ("D101 length of config.g " ,len (D101 .getFilenamed ('/sys/config.g' )))
28+
29+
30+ D101 .gCode ("G91 G1 X0.5 G90" )
You can’t perform that action at this time.
0 commit comments