first commit
This commit is contained in:
85
.gitignore
vendored
Normal file
85
.gitignore
vendored
Normal file
@@ -0,0 +1,85 @@
|
|||||||
|
# Byte-compiled / optimized / DLL files
|
||||||
|
__pycache__/
|
||||||
|
*.py[cod]
|
||||||
|
*$py.class
|
||||||
|
|
||||||
|
# C extensions
|
||||||
|
*.so
|
||||||
|
|
||||||
|
# Distribution / packaging
|
||||||
|
.Python
|
||||||
|
build/
|
||||||
|
develop-eggs/
|
||||||
|
dist/
|
||||||
|
downloads/
|
||||||
|
eggs/
|
||||||
|
.eggs/
|
||||||
|
lib/
|
||||||
|
lib64/
|
||||||
|
parts/
|
||||||
|
sdist/
|
||||||
|
var/
|
||||||
|
wheels/
|
||||||
|
*.egg-info/
|
||||||
|
.installed.cfg
|
||||||
|
*.egg
|
||||||
|
MANIFEST
|
||||||
|
|
||||||
|
# Virtual environment directories
|
||||||
|
env/
|
||||||
|
venv/
|
||||||
|
ENV/
|
||||||
|
.env/
|
||||||
|
.enfv/
|
||||||
|
.pyenv/
|
||||||
|
.pyenv-version
|
||||||
|
.python-version
|
||||||
|
|
||||||
|
# Pyenv specific
|
||||||
|
.python-version
|
||||||
|
|
||||||
|
# Pyenv-virtualenv
|
||||||
|
.enfv/
|
||||||
|
|
||||||
|
# IPython and Jupyter
|
||||||
|
.ipynb_checkpoints
|
||||||
|
profile_default/
|
||||||
|
ipython_config.py
|
||||||
|
|
||||||
|
# Log files
|
||||||
|
*.log
|
||||||
|
|
||||||
|
# Unit test / coverage reports
|
||||||
|
htmlcov/
|
||||||
|
.tox/
|
||||||
|
.coverage
|
||||||
|
.coverage.*
|
||||||
|
.cache
|
||||||
|
.pytest_cache/
|
||||||
|
nosetests.xml
|
||||||
|
coverage.xml
|
||||||
|
*.cover
|
||||||
|
.hypothesis/
|
||||||
|
|
||||||
|
# Translations
|
||||||
|
*.mo
|
||||||
|
*.pot
|
||||||
|
|
||||||
|
# Django stuff:
|
||||||
|
*.log
|
||||||
|
local_settings.py
|
||||||
|
db.sqlite3
|
||||||
|
|
||||||
|
# VS Code settings
|
||||||
|
.vscode/
|
||||||
|
|
||||||
|
# PyCharm
|
||||||
|
.idea/
|
||||||
|
|
||||||
|
# Ignore the enfv folder’s virtual environment (if it exists)
|
||||||
|
enfv/
|
||||||
|
|
||||||
|
# Ignore other common environment folder names
|
||||||
|
env/
|
||||||
|
venv/
|
||||||
|
ENV/
|
||||||
32
main.py
Normal file
32
main.py
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
import time
|
||||||
|
import bambulabs_api as bl
|
||||||
|
|
||||||
|
IP = '192.168.0.24'
|
||||||
|
SERIAL = '0309DA542101636'
|
||||||
|
ACCESS_CODE = '24679559'
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
print('Starting bambulabs_api example')
|
||||||
|
print('Connecting to BambuLab 3D printer')
|
||||||
|
print(f'IP: {IP}')
|
||||||
|
print(f'Serial: {SERIAL}')
|
||||||
|
print(f'Access Code: {ACCESS_CODE}')
|
||||||
|
|
||||||
|
# Create a new instance of the API
|
||||||
|
printer = bl.Printer(IP, ACCESS_CODE, SERIAL)
|
||||||
|
|
||||||
|
# Connect to the BambuLab 3D printer
|
||||||
|
printer.connect()
|
||||||
|
|
||||||
|
time.sleep(2)
|
||||||
|
|
||||||
|
# Get the printer status
|
||||||
|
status = printer.get_state()
|
||||||
|
print(f'Printer status: {status}')
|
||||||
|
rem_time = printer.get_time()
|
||||||
|
print(f'Remaining time {rem_time}')
|
||||||
|
percent = printer.get_percentage()
|
||||||
|
print(f'Remaining time {rem_time}')
|
||||||
|
|
||||||
|
# Disconnect from the Bambulabs 3D printer
|
||||||
|
printer.disconnect()
|
||||||
Reference in New Issue
Block a user