Интегриране на РепРап в Blender

From RepRap
Revision as of 10:12, 1 February 2012 by Radoslav (talk | contribs)
Jump to: navigation, search

Това е първият ми опит за интегриране на РепРап в Blender.
За целта ще използваме последната версия на Blender [1], PySerial [2] и Printrun [3].

Необходим софтуер:

1. Blender 3.61
2. pyserial (инсталация за python3)

Хардуер:
1. RepRap Prusa с инсталиран Sprinter [4] firmware.

Последователност в Blender:

Примерна връзка на репрап в Блендер:

import sys
import bpy
import time
# Define path for pyserial here:
PySerialPath = '/usr/local/lib/python3.2/dist-packages'
allPath = sys.path
# testPathLength = len(testPath)

addPySerial = True
 
for path in allPath: 
# checks if the paths already exists    
    if PySerialPath in path:
        addPySerial = False
     
# add pyserial path         
if addPySerial: 
    sys.path.append(PySerialPath)
    print('PySerial added to path.')

>>> from serial import Serial
>>> port = '/dev/ttyACM0'
>>> port
'/dev/ttyACM0'
>>> baud = 115200
>>> pesho = Serial(port, baud, timeout = 5)
>>> pesho.write("G91")
Traceback (most recent call last):
  File "<blender_console>", line 1, in <module>
  File "/usr/local/lib/python3.2/dist-packages/serial/serialposix.py", line 475, in write
    n = os.write(self.fd, d)
TypeError: 'str' does not support the buffer interface
>>> pesho.write(bytes("G91\n","ascii"))
4
>>> pesho.write(bytes("G1 X5\n","ascii"))
6
>>> pesho.write(bytes("G1 X5\n","ascii"))
6
>>> pesho.write(bytes("G1 X5\n","ascii"))
6
>>> pesho.write(bytes("G1 X-5\n","ascii"))
7 
>>> 
>>> pesho.write(bytes("G1 X-5\n","ascii"))
7 
>>> pesho.close()