예제 #1
0
def test_load_save_file(gcode_file):
    base, ext = os.path.splitext(gcode_file)
    out = f"{base}.out.{ext}"

    prog = gcode.GCode(file=gcode_file)
    prog.name = "Test Program"
    prog.save(out)
    prog2 = gcode.GCode(file=out)

    print("Original")
    print(prog)
    print("Reloaded")
    print(prog2)
예제 #2
0
def init(**kwargs):
    prog = gcode.GCode(**kwargs)
    prog.G21()
    prog.G90()
    prog.G92(X=0, Y=0)
    prog.G1(F=200)
    prog.G0(F=200)
    return prog
예제 #3
0
파일: tests.py 프로젝트: aaronpickard/JENGA
import block as brick
import path_to_wall
import gcode
import os
import my_utils

my_block = brick.Block()
my_path = path_to_wall.Basic()
my_code = gcode.GCode()


def test1():
    """
    :return: none; produces output to show motion of end effector from neutral to pickup to putdown points
    """
    print("Test 1")
    my_code.print_comment("INSTRUCTION SET BEGINS")
    my_code.print_comment("Instruction set initialization")
    my_code.set_units()
    # my_code.set_output_file(output_file)
    neutral = my_code.neutral_point
    pickup = [-80, 0, 0]
    my_path.load_pickup(pickup[0], pickup[1], pickup[2])
    my_code.set_feed_rate(20)
    my_code.set_tether_length()
    putdown = [0, 0, 0]
    my_path.load_putdown(putdown[0], putdown[1], putdown[2])

    i = 0
    my_code.pickup_brick(pickup)
    my_code.move_vertical(pickup, my_code.separation_height)
예제 #4
0
def test_load_file(gcode_file):
    prog = gcode.GCode(file="circle.ngc")
    print(prog)
예제 #5
0
def test_add_list():
    prog = gcode.GCode()
    prog.G0(X=0, Y=0)
    prog2 = ["G1X10Y10Z0", "G1X20Y20Z0"]
    print(prog + prog2)
예제 #6
0
def test_add_str():
    prog = gcode.GCode()
    prog.G0(X=0, Y=0)
    prog2 = "G1X10Y10Z0"
    print(prog + prog2)
예제 #7
0
def test_add_gcode():
    prog = gcode.GCode()
    prog.G0(X=0, Y=0)
    prog2 = gcode.GCode()
    prog2.G0(X=10, Y=10)
    print(prog + prog2)
예제 #8
0
def test_G0():
    prog = gcode.GCode()
    prog.G0(X=0, Y=0, Z=0)
    assert "G0" in str(prog)
    assert " " not in str(prog)
예제 #9
0
def test_gcode():
    prog = gcode.GCode()
    prog.G0(X=0, Y=0, Z=0)
    print(prog)
예제 #10
0
def gcode_program():
    yield gcode.GCode()
예제 #11
0
"""
Aaron Pickard
ajp2235
Spring 2019
path_to_wall.py
This file details a basic path planning algorithm for the construction of a wall.
This file supports Project JENGA, a final project in the Spring 2019 semester of
MEIE 4810 Introduction to Human Spaceflight at Columbia University.
"""

import gcode
import block
import os
import my_utils as util

g = gcode.GCode()
brick = block.Block()


class Basic(object):
    """
    Workspace of 2m on each side
    We'll use an origin point in the center (gcode will play nice with negative coordinates)
    """
    def __init__(self):
        self.x = 0  # enables user to "manually" direct motion of the assembly
        self.y = 0
        self.z = 0

    def load_pickup(self, x, y, z):
        """
예제 #12
0
def test_04_row3(cnc):
    prog = gcode.GCode(machine=cnc)
    prog.G90()
    prog.G0(X=0, Y=20)
    prog.run()
    cnc.reset()