sin1002a / CNC_Test_0429

reading g-code file and send to machine
0 stars 0 forks source link

0429_v1 #2

Open sin1002a opened 6 years ago

sin1002a commented 6 years ago

-- coding: utf-8 --/

import sys import serial import time

Arduino communication port setting

ser = serial.Serial(

port='COM9',

baudrate=9600)

G-Code File Open

f = open("E:\test1.ngc", "r")

line = f.readline() while not line == "( LAYER: 0 )\n" : print("not yet:"), line = f.readline() if not line: break print(line),

while True: line = f.readline() if not line: break print(line), f.close()

sin1002a commented 6 years ago

(Generated with: DXF2GCODE, Version: Py3.6.2 PyQt5.9, Date: $Date: Mon Sep 25 13:57:11 2017 +0200 $) (Created from file: C:/Users/sin10/Desktop/test1.dxf) (Output format description: G-CODE for LinuxCNC) (Time: Sat Apr 28 23:36:01 2018) G21 (Units in millimeters) G90 (Absolute programming) G64 (Default cutting) G17 (XY plane) G40 (Cancel radius comp.) G49 (Cancel length comp.) G0 Z 15.000

( LAYER: 0 ) T1 M6 S6000

( SHAPE Nr: 0 ) G0 X -20.000 Y -20.000 M3 M8 G0 Z 3.000 F150 G1 Z -1.500 F400 G1 X -20.000 Y 20.000 G1 X 20.000 Y 20.000 G1 X 20.000 Y -20.000 G1 X -20.000 Y -20.000 F150 G1 Z -3.000 F400 G1 X -20.000 Y 20.000 G1 X 20.000 Y 20.000 G1 X 20.000 Y -20.000 G1 X -20.000 Y -20.000 F150 G1 Z 3.000 G0 Z 15.000 M9 M5 G0 X 0.000 Y 0.000 M2 (Program end)