On Tue, 2010-03-23 at 09:47 +0100, Bernhard Kubicek wrote: > The last week I was busy writing a c++ class that to some extend > interprets gcode. > Using this class, a general filter application was created. This than > can be a template for other filters. > However I am not completly finished yet. > Missing is interpretation of [blabla], just using it and doing > [-[blabla]] for a flip is working. > Variables and loops are not interpreted yet. > The "knive delay" compensation is also working already for entry and > exit moves, however to compensate in arc movements and intermediate > corners is something I still need to think about. > Conversion from relative to absolute movements is working also. > Curently the filters uses command line parameters to access it, > "filter scale 10, filter flipX, filter knive 0.5, filter rotate 45". > However, at some stage I want to create a gui (probably qt) that gives > the bounding box, so you select align left,right,..., to e.g. 0,0 and > specify the operations more nicely, with default settings wether N* > shall be ignored, XYZ Machine limit warnings and stuff. This should > perfectly work with the filter menu concept by Jeff. > > However I ran into some problems with general scaling operations. When > multiplying all coordinates by large factors( e.g. 25.4 for mm->inch) > also the arc radiuses and I and Js, axis complains that the radius is > to some very small extend different. > I even tried to recalculate the J values by geometric operations based > on the old and new position and the i. > Also outputting more decimal digits did not solve things, at least in > my feable first attempt. > > How are the conditions in axis or emc, so that an arc can be > interpreted sucessfully? Are there any pre-made solutions or methods > on how to scale an gcode arc? > Maybe it could make sense to change the required radius accuracy to > the number of decimal places in the gcode. > > If there is some more time, I will also need to split an arc into > segments, to have independent x and y scaling. Is there a way of doing > this, without slowing the trajectory planner, e.g. by specifying that > it may be allowed to round small-angled "corners" it the moves, or > using G0 with a lower "Jog-speed" for cutting)? > > > > greetings, > Bernhard The code for arcs is in ..........rs274ngc/interp_arc.cc
I believe it is G64.1 P nnn that allows for blending between segments. P is a tolerance and even 0.001 can make quite a difference in machining speeds. HTH Dave > > > > On Tue, Mar 16, 2010 at 10:35 PM, Bernhard Kubicek > <[email protected]> wrote: > I posted some ugly hacked filters in the forum: > > http://www.linuxcnc.org/component/option,com_kunena/Itemid,20/func,view/catid,38/id,2288/limit,6/limitstart,6/lang,english/#2326 > they might not be working perfectly, but its a start. > > > > On 3/14/2010 11:09 PM, Dave wrote: > I really like this idea and want to patch my system > and try this > out.... I think the concept adds a lot of flexibility > to EMC2. > > This seems like a useful addition as it moves the > "filters" idea further > along. > > Dave (Dave911 on the IRC) > > On 3/14/2010 10:55 AM, Jeff Epler wrote: > > this feature is inspired by Bernhard Kubicek's > work on a similar > feature. Any number of filters may be listed > in the inifile as > [FILTER]PROGRAM=. These work similarly to > extension-based filters, > except that the user chooses them explicitly > from the menu to apply > them to the already-loaded file. > --- > This seems like a good idea. What do you > think of this approach? > > share/axis/tcl/axis.tcl | 8 > +++++- > src/emc/usr_intf/axis/scripts/axis.py | 41 > +++++++++++++++++++++++++++++++++ > 2 files changed, 48 insertions(+), 1 > deletions(-) > > diff --git a/share/axis/tcl/axis.tcl > b/share/axis/tcl/axis.tcl > index 24f0174..89caac6 100644 > --- a/share/axis/tcl/axis.tcl > +++ b/share/axis/tcl/axis.tcl > @@ -26,6 +26,8 @@ menu .menu.file \ > -tearoff 0 > menu .menu.file.recent \ > -tearoff 0 > +menu .menu.file.filters \ > + -tearoff 0 > menu .menu.machine \ > -tearoff 0 > menu .menu.machine.home \ > @@ -54,6 +56,10 @@ setup_menu_accel .menu.file > end [_ "Recent _Files"] > -command edit_program > setup_menu_accel .menu.file end [_ > "_Edit..."] > > +.menu.file add cascade \ > + -menu .menu.file.filters > +setup_menu_accel .menu.file end [_ "F_ilter"] > + > .menu.file add command \ > -accelerator [_ "Ctrl-R"] \ > -command reload_file > @@ -1880,7 +1886,7 @@ proc update_state {args} > { > relief {$task_state == $STATE_ON} > .toolbar.machine_power > > state {$interp_state == $INTERP_IDLE&& > $taskfile != ""} \ > - .toolbar.reload {.menu.file > "_Reload"} > + .toolbar.reload {.menu.file > "_Reload"} {.menu.file "F_ilter"} > state {$taskfile != ""} \ > .toolbar.reload {.menu.file "_Save > gcode as..."} > state {$interp_state == $INTERP_IDLE&& > $taskfile != ""&& $::has_editor} \ > diff --git > a/src/emc/usr_intf/axis/scripts/axis.py > b/src/emc/usr_intf/axis/scripts/axis.py > index 702307f..da97406 100755 > --- a/src/emc/usr_intf/axis/scripts/axis.py > +++ b/src/emc/usr_intf/axis/scripts/axis.py > @@ -1203,6 +1203,7 @@ widgets = > nf.Widgets(root_window, > > ("menu_view", Menu, ".menu.view"), > ("menu_file", Menu, ".menu.file"), > + ("menu_filters", Menu, > ".menu.file.filters"), > ("menu_machine", Menu, ".menu.machine"), > ("menu_touchoff", Menu, > ".menu.machine.touchoff"), > > @@ -2407,6 +2408,28 @@ class > TclCommands(nf.TclCommands): > else: > add_recent_file(f) > > + def filter_gcode(program): > + global loaded_file > + if not loaded_file: return > + if get_filter(loaded_file): > + srcfile = os.path.join(tempdir, > os.path.basename(loaded_file)) > + else: > + srcfile = loaded_file > + outfile = > tempfile.NamedTemporaryFile( > + suffix="ngc", dir=tempdir, > delete=False) > + exitcode, stderr = > filter_program(program, srcfile, outfile.name) > + if exitcode: > + root_window.tk.call("nf_dialog", > (".error", "-ext", stderr), > + _("Filter failed"), > + _("The program > %(program)r exited with code %(code)d. " > + "Any error messages it > produced are shown below:") > + % {'program': > program, 'code': exitcode}, > + "error",0,_("OK")) > + return > + dest = os.path.join(tempdir, > os.path.basename(loaded_file)) > + os.rename(outfile.name, dest) > + open_file_guts(dest, True, False) > + > commands = TclCommands(root_window) > > vars = nf.Variables(root_window, > @@ -2778,6 +2801,23 @@ update_ms = int(1000 * > float(inifile.find("DISPLAY","CYCLE_TIME") or > 0.020)) > > > widgets.unhomemenu.add_command(command=commands.unhome_all_axes) > root_window.tk.call("setup_menu_accel", > widgets.unhomemenu, "end", _("Unhome All > Axes")) > > +filters = inifile.findall("FILTER", > "PROGRAM") > +for f in filters: > + if ";" in f: > + p, t = f.split(";", 1) > + else: > + p = t = f > + p = p.strip() > + t = t.strip() > + > > widgets.menu_filters.add_command(command=("filter_gcode", p), label=t) > + try: > + > root_window.tk.call("setup_menu_accel", > ".menu.file.filters", "end", t) > + except Tkinter.TclError: > + # The inifile has an invalid string, > such as "Bogus_". Rather than > + # punishing the user by refusing to > start, skip the accelerator > + # set-up logic > + pass > + > s = emc.stat(); > s.poll() > statfail=0 > > > > > ------------------------------------------------------------------------------ > Download Intel® Parallel Studio Eval > Try the new software tools for yourself. Speed > compiling, find bugs > proactively, and fine-tune applications for parallel > performance. > See why Intel Parallel Studio got high marks during > beta. > http://p.sf.net/sfu/intel-sw-dev > _______________________________________________ > Emc-developers mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/emc-developers > > > > > ------------------------------------------------------------------------------ > Download Intel® Parallel Studio Eval > Try the new software tools for yourself. Speed compiling, find bugs > proactively, and fine-tune applications for parallel performance. > See why Intel Parallel Studio got high marks during beta. > http://p.sf.net/sfu/intel-sw-dev > _______________________________________________ Emc-developers mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/emc-developers ------------------------------------------------------------------------------ Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev _______________________________________________ Emc-developers mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/emc-developers
