Compare commits

...

17 commits

Author SHA1 Message Date
Jeff Epler
396de85ee2 fix for emc2 HEAD 2006-03-10 01:52:56 +00:00
Jeff Epler
6acd92f289 1.1.3 release 2006-03-10 00:57:23 +00:00
Jeff Epler
c8e58eb731 bump version number 2006-03-06 16:34:33 +00:00
Jeff Epler
c75d22d333 make axis work with emc2 head. I think it will still work with TESTING, bdi4emc, and emc1 but it needs to be tested. 2006-03-06 16:33:44 +00:00
Jeff Epler
ec3dcc3b9d version bump 2006-02-14 13:38:42 +00:00
Jeff Epler
895c270a64 use librs274.a instead of rs274.o for emc2, to match changes in their CVS 2006-01-27 19:42:34 +00:00
Jeff Epler
87776bfd36 change version number to 1.1.1 2006-01-20 13:30:45 +00:00
Jeff Epler
c52551089a bump version number 2006-01-11 23:49:28 +00:00
Jeff Epler
bbb22e1c96 merge the 'puppy.ngc' fix from HEAD 2006-01-11 23:48:50 +00:00
Chris Radek
0e4d3bcc21 a shameful "fix" for emc's interpreter sometimes returning out-of-date
line (sequence) numbers for errors.
2006-01-10 02:36:50 +00:00
Jeff Epler
607c4c9b46 bump to 1.1.1rc3 2006-01-10 02:02:30 +00:00
Jeff Epler
551e6f9327 When I checked the error lists, I was using an 2004 version of the file from
emc2.  In fact, the error lists do differ in an incompatible way.  Therefore,
we've decided to backport the fix from AXIS head instead.  This is the better
fix overall, but one we avoided at first because it was more invasive.
2006-01-10 02:01:50 +00:00
Jeff Epler
0c3137e969 brown paper bag 2006-01-10 00:34:34 +00:00
Jeff Epler
570d58a432 bump version number to 1.1.1rc1 2006-01-10 00:14:36 +00:00
Jeff Epler
4a35a41662 sync error list from emc2 CVS, fixing the bug report
https://sourceforge.net/tracker/?func=detail&atid=106744&aid=1396537&group_id=6744
for the stable release version of AXIS.

I inspected the error list by eye, and found that the low-numbered errors
which are shared by emc1 and emc2 matched, so this list should work for any
version of emc.
2006-01-10 00:11:19 +00:00
Jeff Epler
eb2da9e7f5 Some systems have a different version of bwidget installed already. Fiddling
with auto_path didn't solve the problem, but requiring a specific bwidget
version did.  Now, axis may use the bundled copy of bwidget, or some other
installed copy, but it should always get one that is version 1.7.

This fixed a problem that <cncuser> reported to me on IRC.
2006-01-08 17:14:05 +00:00
Jeff Epler
248c9a4c05 fix the bug described by Colin Wildsmith: clicking on scrollbar buttons would take global grab but never give it up. not using my fancy scrollbars fixes this 2006-01-03 16:51:25 +00:00
6 changed files with 1510 additions and 322 deletions

View file

@ -358,6 +358,7 @@ void SET_MOTION_OUTPUT_VALUE(int index, double value) {}
void TURN_PROBE_ON() {}
void TURN_PROBE_OFF() {}
void STRAIGHT_PROBE(double x, double y, double z, double a, double b, double c) {}
double GET_EXTERNAL_MOTION_CONTROL_TOLERANCE() { return 0.1; }
double GET_EXTERNAL_PROBE_POSITION_X() { return 0.0; }
double GET_EXTERNAL_PROBE_POSITION_Y() { return 0.0; }
double GET_EXTERNAL_PROBE_POSITION_Z() { return 0.0; }
@ -406,6 +407,7 @@ void SET_FEED_REFERENCE(int ref) {}
int GET_EXTERNAL_QUEUE_EMPTY() { return true; }
CANON_DIRECTION GET_EXTERNAL_SPINDLE() { return 0; }
int GET_EXTERNAL_TOOL_SLOT() { return 0; }
int GET_EXTERNAL_SELECTED_TOOL_SLOT() { return 0; }
double GET_EXTERNAL_FEED_RATE() { return 0; }
double GET_EXTERNAL_TRAVERSE_RATE() { return 0; }
int GET_EXTERNAL_FLOOD() { return 0; }
@ -447,6 +449,7 @@ double GET_EXTERNAL_LENGTH_UNITS() {
USER_DEFINED_FUNCTION_TYPE USER_DEFINED_FUNCTION[USER_DEFINED_FUNCTION_NUM];
CANON_MOTION_MODE motion_mode;
void SET_MOTION_CONTROL_MODE(CANON_MOTION_MODE mode, double tolerance) { motion_mode = mode; }
void SET_MOTION_CONTROL_MODE(CANON_MOTION_MODE mode) { motion_mode = mode; }
CANON_MOTION_MODE GET_EXTERNAL_MOTION_CONTROL_MODE() { return motion_mode; }
@ -477,8 +480,30 @@ PyObject *parse_file(PyObject *self, PyObject *args) {
return retval;
}
extern char * _rs274ngc_errors[];
static int maxerror = -1;
static int find_maxerror(void) {
int i=0;
for(;;i++) {
if(!_rs274ngc_errors[i] || !strcmp(_rs274ngc_errors[i], "The End"))
return i;
}
}
static PyObject *rs274_strerror(PyObject *s, PyObject *o) {
int err;
if(!PyArg_ParseTuple(o, "i", &err)) return NULL;
if(err < 0 || err >= maxerror) {
return PyString_FromString("Error number out of range");
}
return PyString_FromString(_rs274ngc_errors[err]);
}
PyMethodDef gcode_methods[] = {
{"parse", (PyCFunction)parse_file, METH_VARARGS, "Parse a G-Code file"},
{"strerror", (PyCFunction)rs274_strerror, METH_VARARGS, "Convert a numeric error to a string"},
{NULL}
};
@ -488,4 +513,7 @@ initgcode(void) {
"Interface to EMC rs274ngc interpreter");
PyType_Ready(&LineCodeType);
PyModule_AddObject(m, "linecode", (PyObject*)&LineCodeType);
maxerror = find_maxerror();
PyObject_SetAttrString(m, "RS274NGC_MAX_ERROR", PyInt_FromLong(maxerror));
PyObject_SetAttrString(m, "RS274NGC_MIN_ERROR", PyInt_FromLong(3)); // XXX
}

View file

@ -112,11 +112,10 @@ def start(r):
source_lib_tcl(r, "combobox.tcl")
source_lib_tcl(r, "dialog.tcl")
source_lib_tcl(r, "sb.tcl"); r.tk.call("sb::install")
source_lib_tcl(r, "rb.tcl"); r.tk.call("rb::install")
source_lib_tcl(r, "cb.tcl"); r.tk.call("cb::install")
r.tk.call("package", "require", "BWidget")
r.tk.call("package", "require", "BWidget", "1.7")
r.tk.call("namespace", "import", "combobox::combobox")
# vim:ts=8:sts=4:et:

View file

@ -15,206 +15,6 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
errorlist = {
0: "RS274NGC_OK",
1: "RS274NGC_EXIT",
2: "RS274NGC_EXECUTE_FINISH",
3: _("Unexpected end of file"),
4: _("Internal error: A file is already open"),
5: _("All axes missing with G92"),
6: _("All axes missing with motion code"),
7: _("Arc radius too small to reach endpoint"),
8: _("Argument to ACOS out of range"),
9: _("Argument to ASIN out of range"),
10: _("Division by zero"),
11: _("Attempt to raise negative number to non-integer power"),
12: _("Bad character"),
13: _("Non-digit found where integer expected"),
14: _("Unexpected character found where +, -, . or digit expected"),
15: _("Internal error: NCE_BUG_BAD_G_CODE_MODAL_GROUP_0"),
16: _("Internal error: NCE_BUG_CODE_NOT_G0_OR_G1"),
17: _("Internal error: NCE_BUG_CODE_NOT_G17_G18_OR_G19"),
18: _("Internal error: NCE_BUG_CODE_NOT_G20_OR_G21"),
19: _("Internal error: NCE_BUG_CODE_NOT_G28_OR_G30"),
20: _("Internal error: NCE_BUG_CODE_NOT_G2_OR_G3"),
21: _("Internal error: NCE_BUG_CODE_NOT_G40_G41_OR_G42"),
22: _("Internal error: NCE_BUG_CODE_NOT_G43_OR_G49"),
23: _("Internal error: NCE_BUG_CODE_NOT_G4_G10_G28_G30_G53_OR_G92_SERIES"),
24: _("Internal error: NCE_BUG_CODE_NOT_G61_G61_1_OR_G64"),
25: _("Internal error: NCE_BUG_CODE_NOT_G90_OR_G91"),
26: _("Internal error: NCE_BUG_CODE_NOT_G93_OR_G94"),
27: _("Internal error: NCE_BUG_CODE_NOT_G98_OR_G99"),
28: _("Internal error: NCE_BUG_CODE_NOT_IN_G92_SERIES"),
29: _("Internal error: NCE_BUG_CODE_NOT_IN_RANGE_G54_TO_G593"),
30: _("Internal error: NCE_BUG_CODE_NOT_M0_M1_M2_M30_M60"),
31: _("Internal error: NCE_BUG_DISTANCE_MODE_NOT_G90_OR_G91"),
32: _("Internal error: NCE_BUG_FUNCTION_SHOULD_NOT_HAVE_BEEN_CALLED"),
33: _("Internal error: NCE_BUG_IN_TOOL_RADIUS_COMP"),
34: _("Internal error: NCE_BUG_PLANE_NOT_XY_YZ_OR_XZ"),
35: _("Internal error: NCE_BUG_SIDE_NOT_RIGHT_OR_LEFT"),
36: _("Internal error: NCE_BUG_UNKNOWN_MOTION_CODE"),
37: _("Internal error: NCE_BUG_UNKNOWN_OPERATION"),
38: _("Cannot change axis offsets with cutter radius compensation"),
39: _("Cannot change units with cutter radius compensation"),
40: _("Internal error: NCE_CANNOT_CREATE_BACKUP_FILE"),
41: _("Cannot do G1 with zero feed rate"),
42: _("Cannot do zero repeats of a cycle"),
43: _("Cannot do arc with zero feed rate"),
44: _("Cannot move rotary axes while probing"),
45: _("Internal error: NCE_CANNOT_OPEN_BACKUP_FILE"),
46: _("Internal error: NCE_CANNOT_OPEN_VARIABLE_FILE"),
47: _("Cannot probe in inverse time feed mode"),
48: _("Cannot probe with cutter radius compensation"),
49: _("Cannot probe with zero feed rate"),
50: _("Cannot put a B in a canned cycle"),
51: _("Cannot put a C in a canned cycle"),
52: _("Cannot put an A in a canned cycle"),
53: _("Cannot turn cutter radius compensation on when out of XY plane (G17)"),
54: _("Cannot turn cutter radius on when it is already on"),
55: _("Cannot put an A word here"),
56: _("Cannot use axis values with G80"),
57: _("Cannot use an axis word without a G code that uses them"),
58: _("Cannot put a B word here"),
59: _("Cannot put a C word here"),
60: _("Cannot use G28 or G30 with cutter radius compensation"),
61: _("Cannot use G53 with incremental mode"),
62: _("Cannot use G53 with cutter compensation"),
63: _("Cannot use two G codes that use axis words"),
64: _("Cannot use XZ plane with cutter radius compensation"),
65: _("Cannot use YZ plane with cutter radius compensation"),
66: _("Line too long"),
67: _("Cannot have concave corners with cutter radius compensation"),
68: _("Parameter 5220 (work coordinate system index) out of range"),
69: _("Cannot start and end an R-format arc at the same place"),
70: _("Arc would result in gouging with cutter radius compensation"),
71: _("Cannot put a D word here (requires G41 or G42)"),
72: _("Dwell time required with G4"),
73: _("Dwell time required with G82"),
74: _("Dwell time required with G86"),
75: _("Dwell time required with G88"),
76: _("Dwell time required with G89"),
77: _("Equal sign missing in parameter setting"),
78: _("F word required with inverse time arc move"),
79: _("F word required with inverse time G1 move"),
80: _("File ended with no percent sign"),
81: _("File ended with no percent sign or program end"),
82: _("Internal error: NCE_FILE_NAME_TOO_LONG"),
83: _("Internal error: NCE_FILE_NOT_OPEN"),
84: _("G code out of range"),
85: _("Cannot put a H word here (requires G43)"),
86: _("Cannot put an I word here (invalid plane)"),
87: _("I word required with G87"),
88: _("Cannot put an I word here (Only G2, G3, G87)"),
89: _("Cannot put a J word here (invalid plane)"),
90: _("J word reqired with G87"),
91: _("Cannot put a J word here (Only G2, G3, G87)"),
92: _("Cannot put a K word here (invalid plane)"),
93: _("K word required with G87"),
94: _("Cannot put a K word here (Only G2, G3, G87)"),
95: _("L word requires canned cycle or G10"),
96: _("Left bracket missing after slash with ATAN"),
97: _("Left bracket missing after unary operation"),
98: _("Line number greater than 99999"),
99: _("NCE_LINE_WITH_G10_DOES_NOT_HAVE_L2"),
100: _("M code out of range (Must not be greater than 199)"),
101: _("R word and I/J/K words may not appear together for an arc"),
102: _("Multiple A words on line"),
103: _("Multiple B words on line"),
104: _("Multiple C words on line"),
105: _("Multiple D words on line"),
106: _("Multiple F words on line"),
107: _("Multiple H words on line"),
108: _("Multiple I words on line"),
109: _("Multiple J words on line"),
110: _("Multiple K words on line"),
111: _("Multiple L words on line"),
112: _("Multiple P words on line"),
113: _("Multiple Q words on line"),
114: _("Multiple R words on line"),
115: _("Multiple S words on line"),
116: _("Multiple T words on line"),
117: _("Multiple X words on line"),
118: _("Multiple Y words on line"),
119: _("Multiple Z words on line"),
120: _("Must use G0 or G1 with G53"),
121: _("Negative argument to SQRT"),
122: _("Negative D word tool radius index used"),
123: _("Negative F word used"),
124: _("Negative G word used"),
125: _("Negative H word tool length offset index used"),
126: _("Negative L word used"),
127: _("Negative M code used"),
128: _("Negative or zero Q value used"),
129: _("Negative P word used"),
130: _("Negative spindle speed used"),
131: _("Negative tool ID used"),
132: _("Nested comment found"),
133: _("No characters found when reading real value"),
134: _("No digits found where real number should be"),
135: _("Non-integer value found where integer required"),
136: _("Internal error: NCE_NULL_MISSING_AFTER_NEWLINE"),
137: _("Offset index missing"),
138: _("P must be an integer with G10 L2"),
139: _("P out of range with G10 L2"),
140: _("P word with no G4, G10, G82, G86, G88, or G89"),
141: _("Internal error: NCE_PARAMETER_FILE_OUT_OF_ORDER"),
142: _("Parameter number out of range"),
143: _("Q word missing with G83"),
144: _("Q word without G83"),
145: _("Internal error: NCE_QUEUE_IS_NOT_EMPTY_AFTER_PROBING"),
146: _("R clearance plane unspecified in canned cycle"),
147: _("Arc center unspecified (No R, I, J, or K words)"),
148: _("R less than X in canned cycle in YZ plane"),
149: _("R less than Y in canned cycle in XZ plane"),
150: _("R less than Z in canned cycle in YX plane"),
151: _("R word with G-code that does not use it"),
152: _("Distance from center of arc to endpoints differs"),
153: _("Arc radius too small to reach end point"),
154: _("Required parameter missing"),
155: _("Tool slot number too large"),
156: _("Slash missing after first ATAN argument"),
157: _("Spindle not turning clockwise in G84"),
158: _("Spindle not turning in G86"),
159: _("Spindle not turning in G87"),
160: _("Spindle not turning in G88"),
161: _("Non-number found where number expected (\"scanf()\" failed)"),
162: _("Start point too close to probe point"),
163: _("Too many M codes on line"),
164: _("Too length offset index too big"),
165: _("Index in tool table file too large"),
166: _("Tool radius index too big"),
167: _("Tool radius must be less than arc radius with cutter compensation"),
168: _("Two G codes from same modal group"),
169: _("Two M codes from same modal group"),
170: _("Unable to open file"),
171: _("Unclosed comment"),
172: _("Unclosed expression"),
173: _("Unknown G code"),
174: _("Unknown M code"),
175: _("Unknown operation"),
176: _("Unknown operation name starting with A"),
177: _("Unknown operation name starting with M"),
178: _("Unknown operation name starting with O"),
179: _("Unknown operation name starting with X"),
180: _("Unknown word starting with A"),
181: _("Unknown word starting with C"),
182: _("Unknown word starting with E"),
183: _("Unknown word starting with F"),
184: _("Unknown word starting with L"),
185: _("Unknown word starting with R"),
186: _("Unknown word starting with S"),
187: _("Unknown word starting with T"),
188: _("Unknown word where unary operation could be"),
189: _("X and Y words missing for arc in XY plane"),
190: _("X and Z words missing for arc in XZ plane"),
191: _("X value unspecified in YZ plane in a canned cycle"),
192: _("X, Y, and Z words all missing with g38.2"),
193: _("Y and Z words missing for arc in YZ plane"),
194: _("Y value unspecified in XZ plane in a canned cycle"),
195: _("Z value unspecified in XY plane in a canned cycle"),
196: _("Zero or negative argument to LN"),
197: _("Zero radius arc"),
# 197: _("RS274NGC_MAX_ERROR")
}
RS274NGC_MIN_ERROR=3
RS274NGC_MAX_ERROR=197
from gcode import strerror, RS274NGC_MAX_ERROR, RS274NGC_MIN_ERROR
errorlist = dict([(i, strerror(i)) for i in range(RS274NGC_MAX_ERROR)])
del strerror

View file

@ -20,8 +20,6 @@
from __future__ import generators
import gettext; gettext.install("axis")
import string
__version__ = string.split('$Revision$')[1]
__date__ = string.join(string.split('$Date$')[1:3], ' ')
@ -57,12 +55,12 @@ from hershey import Hershey
import rs274.options
root_window = Tkinter.Tk(className="Axis")
rs274.options.install(root_window)
import nf; nf.start(root_window); nf.makecommand(root_window, "_", _)
import nf; nf.start(root_window)
import gcode
try:
root_window.tk.call("proc", "_", "s", "set s")
nf.source_lib_tcl(root_window,"axis.nf")
nf.source_lib_tcl(root_window,"axis.tcl")
except TclError:
print root_window.tk.call("set", "errorInfo")
@ -91,54 +89,54 @@ if sys.version_info <= (2,3):
def install_help(app):
help1 = [
("F1", _("Emergency stop")),
("F2", _("Turn machine on")),
("F1", "Emergency stop"),
("F2", "Turn machine on"),
("", ""),
("X, `", _("Activate first axis")),
("Y, 1", _("Activate second axis")),
("Z, 2", _("Activate third axis")),
("A, 3", _("Activate fourth axis")),
(" 4", _("Activate fifth axis")),
(" 5", _("Activate sixth axis")),
("I", _("Select jog increment")),
("C", _("Continuous jog")),
("Home", _("Send active axis home")),
("Shift-Home", _("Set G54 offset for active axis")),
("Left, Right", _("Jog first axis")),
("Up, Down", _("Jog second axis")),
("Pg Up, Pg Dn", _("Jog third axis")),
("[, ]", _("Jog fourth axis")),
("X, `", "Activate first axis"),
("Y, 1", "Activate second axis"),
("Z, 2", "Activate third axis"),
("A, 3", "Activate fourth axis"),
(" 4", "Activate fifth axis"),
(" 5", "Activate sixth axis"),
("I", "Select jog increment"),
("C", "Continuous jog"),
("Home", "Send active axis home"),
("Shift-Home", "Set G54 offset for active axis"),
("Left, Right", "Jog first axis"),
("Up, Down", "Jog second axis"),
("Pg Up, Pg Dn", "Jog third axis"),
("[, ]", "Jog fourth axis"),
("", ""),
(_("Left Button"), _("Pan view or select line")),
(_("Shift+Left Button"), _("Rotate view")),
(_("Right Button"), _("Zoom view")),
(_("Wheel Button"), _("Rotate view")),
(_("Rotate Wheel"), _("Zoom view")),
("Left Button", "Pan view or select line"),
("Shift+Left Button", "Rotate view"),
("Right Button", "Zoom view"),
("Wheel Button", "Rotate view"),
("Rotate Wheel", "Zoom view"),
]
help2 = [
("F3", _("Manual control")),
("F5", _("Code entry (MDI)")),
("L", _("Override Limits")),
("F3", "Manual control"),
("F5", "Code entry (MDI)"),
("L", "Override Limits"),
("", ""),
("O", _("Open program")),
("R", _("Run program")),
("T", _("Step program")),
("P", _("Pause program")),
("S", _("Resume program")),
("ESC", _("Stop program")),
("O", "Open program"),
("R", "Run program"),
("T", "Step program"),
("P", "Pause program"),
("S", "Resume program"),
("ESC", "Stop program"),
("", ""),
("F7", _("Toggle mist")),
("F8", _("Toggle flood")),
("F7", "Toggle mist"),
("F8", "Toggle flood"),
("", ""),
("B", _("Spindle brake off")),
("Shift-B", _("Spindle brake on")),
("F9", _("Turn spindle clockwise")),
("F10", _("Turn spindle counterclockwise")),
("F11", _("Turn spindle more slowly")),
("F12", _("Turn spindle more quickly")),
("B", "Spindle brake off"),
("Shift-B", "Spindle brake on"),
("F9", "Turn spindle clockwise"),
("F10", "Turn spindle counterclockwise"),
("F11", "Turn spindle more slowly"),
("F12", "Turn spindle more quickly"),
("", ""),
("Control-K", _("Clear live plot")),
("V", _("Cycle among preset views")),
("Control-K", "Clear live plot"),
("V", "Cycle among preset views"),
]
assert len(help1) >= len(help2)
@ -317,7 +315,7 @@ class MyOpengl(Opengl):
glMatrixMode(GL_PROJECTION)
glLoadIdentity()
gluPerspective(self.fovy, float(w)/float(h), self.near, self.far)
gluPerspective(self.fovy, float(w)/float(h), self.near, self.far + self.distance)
gluLookAt(0, 0, self.distance,
0, 0, 0,
@ -355,7 +353,7 @@ class MyOpengl(Opengl):
l = k * h / w
glOrtho(-k, k, -l, l, -1000, 1000.)
gluLookAt(0, 0, self.distance,
gluLookAt(0, 0, 1,
0, 0, 0,
0., 1., 0.)
glMatrixMode(GL_MODELVIEW)
@ -631,7 +629,7 @@ class LivePlotter:
kind, text = error
if kind in (emc.NML_ERROR, emc.OPERATOR_ERROR):
root_window.tk.call("nf_dialog", ".error",
_("AXIS error"), text, "error",0,_("OK"))
"AXIS error", text, "error",0,"OK")
else: # TEXT, DISPLAY
# This gives time for the "interpreter is paused" state to
# reach us. Typically a message is followed by a pause
@ -639,7 +637,7 @@ class LivePlotter:
for i in range(4):
self.stat.poll()
result = root_window.tk.call("nf_dialog", ".error",
_("AXIS error"), text, "info", 0, _("OK"))
"AXIS error", text, "info", 0, "OK")
self.after = self.win.after(20, self.update)
if program_start_line_last == -1 or \
@ -693,12 +691,12 @@ class LivePlotter:
current_tool = [i for i in self.stat.tool_table
if i[0] == self.stat.tool_in_spindle]
if self.stat.tool_in_spindle == 0:
vupdate(vars.tool, _("No tool"))
vupdate(vars.tool, "No tool")
elif current_tool == []:
vupdate(vars.tool, _("Unknown tool %d") % self.stat.tool_in_spindle)
vupdate(vars.tool, "Unknown tool %d" % self.stat.tool_in_spindle)
else:
vupdate(vars.tool,
_("Tool %d, offset %g, radius %g") % current_tool[0])
"Tool %d, offset %g, radius %g" % current_tool[0])
active_codes = []
for i in self.stat.gcodes[1:]:
if i == -1: continue
@ -779,9 +777,9 @@ def open_file_guts(f, filtered = False):
result = os.system("%s < %s > %s" % (program_filter, f, tempfile))
if result:
root_window.tk.call("nf_dialog", ".error",
_("Program_filter %r failed") % program_filter,
_("Exit code %d") % result,
"error",0,_("OK"))
"Program_filter %r failed" % program_filter,
"Exit code %d" % result,
"error",0,"OK")
return
return open_file_guts(tempfile, True)
@ -831,11 +829,11 @@ def open_file_guts(f, filtered = False):
result, seq = gcode.parse(f, canon)
print "parse result", result
if result >= rs274.RS274NGC_MIN_ERROR:
error_str = rs274.errorlist.get(result, _("Unknown error %s") % result)
error_str = rs274.errorlist.get(result, "Unknown error %s" % result)
root_window.tk.call("nf_dialog", ".error",
"G-Code error in %s" % os.path.basename(f),
"On line %d of %s:\n%s" % (seq+1, f, error_str),
"error",0,_("OK"))
"Near line %d of %s:\n%s" % (seq+1, f, error_str),
"error",0,"OK")
t.configure(state="disabled")
@ -899,12 +897,10 @@ vars.show_extents.set(1)
tabs_mdi = str(root_window.tk.call("set", "_tabs_mdi"))
tabs_manual = str(root_window.tk.call("set", "_tabs_manual"))
pane_top = str(root_window.tk.call("set", "pane_top"))
pane_bottom = str(root_window.tk.call("set", "pane_bottom"))
widgets = nf.Widgets(root_window,
("menu_view", Menu, ".menu.view"),
("text", Text, pane_bottom + ".t.text"),
("preview_frame", Frame, pane_top + ".preview"),
("text", Text, ".t.text"),
("preview_frame", Frame, ".preview"),
("mdi_history", Text, tabs_mdi + ".history"),
("code_text", Text, tabs_mdi + ".gcodes"),
@ -932,7 +928,7 @@ widgets = nf.Widgets(root_window,
("view_y", Button, ".toolbar.view_y"),
("view_p", Button, ".toolbar.view_p"),
("feedoverride", Scale, pane_top + ".feedoverride.foscale"),
("feedoverride", Scale, ".feedoverride.foscale"),
)
def activate_axis(i, force=0):
@ -949,12 +945,12 @@ def set_first_line(lineno):
def jogspeed_continuous():
widgets.jogspeed.configure(editable=1)
widgets.jogspeed.delete(0, "end")
widgets.jogspeed.insert("end", _("Continuous"))
widgets.jogspeed.insert("end", "Continuous")
widgets.jogspeed.configure(editable=0)
def jogspeed_incremental():
jogspeed = widgets.jogspeed.get()
if jogspeed == _("Continuous") or jogspeed == "0.0001":
if jogspeed == "Continuous" or jogspeed == "0.0001":
newjogspeed = 0.1
else:
newjogspeed = float(jogspeed) / 10
@ -1141,7 +1137,7 @@ class TclCommands(nf.TclCommands):
global open_directory
f = root_window.tk.call("tk_getOpenFile", "-initialdir", open_directory,
"-defaultextension", ".ngc",
"-filetypes", _("{{rs274ngc files} {.ngc}} {{All files} *}"))
"-filetypes", "{{rs274ngc files} {.ngc}} {{All files} *}")
if not f: return
o.set_highlight_line(None)
f = str(f)
@ -1176,16 +1172,16 @@ class TclCommands(nf.TclCommands):
if o.g:
for i in range(3):
if o.g.min_extents[i] < machine_limit_min[i]:
warnings.append(_("Program exceeds machine minimum on axis %s") % axisnames[i])
warnings.append("Program exceeds machine minimum on axis %s" % axisnames[i])
if o.g.max_extents[i] > machine_limit_max[i]:
warnings.append(_("Program exceeds machine maximum on axis %s") % axisnames[i])
warnings.append("Program exceeds machine maximum on axis %s" % axisnames[i])
if warnings:
text = "\n".join(warnings)
r = int(root_window.tk.call("nf_dialog", ".error",
_("Program exceeds machine limits"),
"Program exceeds machine limits",
text,
"warning",
1, _("Run Anyway"), _("Cancel")))
1, "Run Anyway", "Cancel"))
if r: return
global program_start_line, program_start_line_last
global program_start_line, program_start_line_last
@ -1419,7 +1415,7 @@ def jog_on(a, b):
jog_after[a] = None
return
jogspeed = widgets.jogspeed.get()
if jogspeed != _("Continuous"):
if jogspeed != "Continuous":
s.poll()
if s.state != 1: return
jogspeed = float(jogspeed)
@ -1506,7 +1502,7 @@ if len(sys.argv) > 1 and sys.argv[1] == '-ini':
machine_limit_max[a] = float(inifile.find(section, "MAX_LIMIT")) / unit
del sys.argv[1:3]
else:
widgets.menu_view.entryconfigure(_("Show EMC Status"), state="disabled")
widgets.menu_view.entryconfigure("Show EMC Status", state="disabled")
opts, args = getopt.getopt(sys.argv[1:], 'd:')
for i in range(len(axisnames), 6):
@ -1521,8 +1517,8 @@ o = MyOpengl(widgets.preview_frame, width=400, height=300, double=1, depth=1)
o.last_line = 1
o.pack(fill="both", expand=1)
root_window.bind("<Key-F3>", pane_top + ".tabs raise manual")
root_window.bind("<Key-F5>", pane_top + ".tabs raise mdi")
root_window.bind("<Key-F3>", ".tabs raise manual")
root_window.bind("<Key-F5>", ".tabs raise mdi")
init()

View file

@ -27,14 +27,11 @@ from build_scripts import *
from togl_setup import get_togl_flags
from emc_setup import *
import distutils.command.install
from distutils.command.install_data import install_data
from distutils.util import convert_path
name="axis"
version="1.1"
version="1.1.3"
DOCDIR="share/doc/%s-%s" % (name, version)
SHAREDIR="share/%s" % (name)
LOCALEDIR="share/locale"
emcroot = os.path.abspath(os.getenv("EMCROOT", None) or find_emc_root())
if emcroot is None:
@ -98,8 +95,7 @@ elif is_emc2:
'-DNEW_INTERPRETER',
'-Wl,-rpath,%s' %
os.path.join(emcroot, "lib"),
os.path.join(emcroot, "src", ".tmp", "rs274.o"),
'-lnml', '-lm', '-lstdc++',
'-lrs274', '-lnml', '-lm', '-lstdc++',
]
)
@ -222,39 +218,6 @@ if simple_install:
else:
ext_modules = [emc, togl, gcode, minigl]
class install_data(install_data):
def run(self):
self.mkpath(self.install_dir)
for f in self.data_files:
dir = convert_path(f[0])
if not os.path.isabs(dir):
dir = os.path.join(self.install_dir, dir)
elif self.root:
dir = change_root(self.root, dir)
self.mkpath(dir)
if f[1] == []:
# If there are no files listed, the user must be
# trying to create an empty directory, so add the
# directory to the list of output files.
self.outfiles.append(dir)
else:
# Copy files, adding them to the list of output files.
for data in f[1]:
if isinstance(data, str):
dest = dir
else:
dest = os.path.join(dir, data[1])
data = data[0]
dest = convert_path(dest)
(out, _) = self.copy_file(data, dest)
self.outfiles.append(out)
def lang(f): return os.path.splitext(os.path.basename(f))[0]
i18n = [(os.path.join(LOCALEDIR,lang(f),"LC_MESSAGES"), [(f, "axis.mo")])
for f in glob("i18n/??.mo") + glob("i18n/??_??.mo")]
print i18n
setup(name=name, version=version,
description="AXIS front-end for emc",
author="Jeff Epler", author_email="jepler@unpythonic.net",
@ -263,10 +226,9 @@ setup(name=name, version=version,
scripts={WINDOWED('axis'): 'scripts/axis.py',
TERMINAL('emctop'): 'scripts/emctop.py',
TERMINAL('mdi'): 'scripts/mdi.py'},
cmdclass = {
'build_scripts': build_scripts,
'install_data': install_data},
cmdclass = {'build_scripts': build_scripts},
data_files = [(os.path.join(SHAREDIR, "tcl"), glob("tcl/*.tcl")),
(os.path.join(SHAREDIR, "tcl"), glob("tcl/axis.nf")),
(os.path.join(SHAREDIR, "tcl"), glob("thirdparty/*.tcl")),
(os.path.join(SHAREDIR, "tcl/bwidget"),
glob("thirdparty/bwidget/*.tcl")),
@ -280,7 +242,7 @@ setup(name=name, version=version,
(os.path.join(SHAREDIR, "images"), glob("images/*.xbm")),
(DOCDIR, ["COPYING", "README", "BUGS",
"thirdparty/bwidget/LICENSE.txt",
"thirdparty/LICENSE-Togl"])] + i18n,
"thirdparty/LICENSE-Togl"])],
ext_modules = ext_modules,
url="http://axis.unpythonic.net/",
license="GPL",

1403
tcl/axis.nf Normal file

File diff suppressed because it is too large Load diff