Exemple #1
0
def _read():
    global running
    while running:
        point = scanner.read()
        if point is not None:
            x, y, z = point
            publish('point.cloud', json.dumps({"x": x, "y": y, "z": z}))
Exemple #2
0
 def buildBegin(self,filename,params):
     self.building = True
     print filename
     model=self.slicer.parseSVG(filename)
     t = threading.Thread(target=self.buildLoop, args=(model,params))
     t.daemon = True
     t.start()
     publish('printStarted','Build began')
     return "Begin printing"
Exemple #3
0
def buildTest():
    test_stl_path = os.path.join(os.getcwd(), 'test', 'test.stl')
    print test_stl_path
    with open(test_stl_path, 'w') as file_:
        import base64
        file_.write(base64.b64decode(content))
        sunrise.slicer.file_to_svg(test_stl_path, 50)
        response = name + " successfully sliced"
        loaded = True
        publish('sliced', 'File sliced')
        return response
def buildTest():
    test_stl_path=os.path.join(os.getcwd(),'test','test.stl')
    print test_stl_path
    with open(test_stl_path, 'w') as file_:
        import base64
        file_.write(base64.b64decode(content))
        sunrise.slicer.file_to_svg(test_stl_path,50)
        response = name + " successfully sliced"
        loaded=True
        publish('sliced','File sliced')
        return response
Exemple #5
0
 def buildLoop(self,model,params):
     self.projector.init_display()
     for layer in model:
         if not self.building:
             break
         publish('printingLayer',len(layer))
         self.projector.expose(layer)
         time.sleep(params['exposeTime'])
         self.projector.blank()
         self.mechComm.moveAxis(self.buildAxis,3,200)
         self.mechComm.moveAxis(self.buildAxis,-2.95,200)
         time.sleep(params['blankTime'])
     self.mechComm.moveAxis(self.buildAxis,20,200)
     publish('printFinished',"Build finished")
     return False
Exemple #6
0
def sliceFile(name='name', content='content'):
    global loaded
    try:
        os.mkdir('temp')
    except Exception:
        pass
    temp_stl_path = os.path.join(os.getcwd(), 'temp', 'loaded.stl')
    print temp_stl_path
    with open(temp_stl_path, 'w') as file_:
        import base64
        file_.write(base64.b64decode(content))
        sunrise.slicer.file_to_svg(temp_stl_path, 50)
        response = name + " successfully sliced"
        loaded = True
        publish('sliced', 'File sliced')
        return response
def sliceFile(name='name', content='content'):
    global loaded
    try:
        os.mkdir('temp')
    except Exception:
        pass
    temp_stl_path=os.path.join(os.getcwd(),'temp','loaded.stl')
    print temp_stl_path
    with open(temp_stl_path, 'w') as file_:
        import base64
        file_.write(base64.b64decode(content))
        sunrise.slicer.file_to_svg(temp_stl_path,50)
        response = name + " successfully sliced"
        loaded=True
        publish('sliced','File sliced')
        return response
Exemple #8
0
def add(a=0, b=1.2, c=False, d={"item": True}, l=[1, 2, 3]):
    """Add a + b"""
    publish('event.add', '{0} + {1}'.format(a, b))
    return a + b
def pub():
    publish('event', 1234)
Exemple #10
0
def sub(a=0, b=3, text="text"):
    """Subtract a - b"""
    publish('event.sub', '{0} - {1}'.format(a, b))
    return a - b
Exemple #11
0
def add(a=0, b=1.2, c=False, d={"item": True}, l=[1, 2, 3]):
    """Add a + b"""
    publish('event.add', '{0} + {1}'.format(a, b))
    return a + b
Exemple #12
0
def _start():
    global running
    while running:
        print("Hello, world!")
        publish('event.hello', "Hello, world!")
        time.sleep(3)
Exemple #13
0
def sub(a=0, b=3, text="text"):
    """Subtract a - b"""
    publish('event.sub', '{0} - {1}'.format(a, b))
    return a - b
Exemple #14
0
def test0():
    "Publish an event"
    publish("event", {"v": 3.14})
Exemple #15
0
def test0():
    "Publish an event"
    publish('event', {'v': 3.14})
def _start():
    global running
    while running:
        print("Hello, world!")
        publish('event.hello', "Hello, world!")
        time.sleep(3)
Exemple #17
0
def pub():
    publish('event', 1234)