automated change nc-program possible ?

More
20 Jan 2013 18:58 #28861 by wbeppler
hi,

i search for a solution to change the nc-prog during automated engrave.

i need to grave a type-number followed with date and incremented counter.

i think about generate all letters a-z and 0-9 in some small nc-progs like a.nc, b.nc, ...

then when a user touch the buttons (best in axis) made in py i want to copy (for example)
like "hello" copy h.nc+e.nc+l.nc+l.nc+o.nc summary.nc

now i want to load this programm automated.

if this is possible i want to expand this to copy date and counter subroutine-nc-programms too

or is it better to code it in the nc direct ? calling sub-programs ?

WHO HAS ANY IDEA ?

thanks

wolfgang :-)

###########################
Elektronik u. Softwareentwicklung
###########################
Wolftec GmbH
Wolfgang Beppler
Kratellen 23
DE-78355 Hohenfels-Kalkofen
This email address is being protected from spambots. You need JavaScript enabled to view it.
############################

Please Log in or Create an account to join the conversation.

More
20 Jan 2013 20:28 #28864 by BigJohnT
What your looking for is a ngcgui like concatenation functionality without the variable part.

Another possibility might be to pass numbers to a subroutine that would call numbered subs in the order that you passed the numbers. I think you would have to use the python interface to do this.
this could be a MDI
o<myname> call [23] [31] [25] [4]

do a loop calling each subroutine until you run out of parameters.

John
The following user(s) said Thank You: wbeppler

Please Log in or Create an account to join the conversation.

More
20 Jan 2013 20:39 #28865 by awallin
True-type tracer can generate G-code for fonts on the fly:
timeguy.com/cradek/truetype

I have a modified version of truetype-tracer in C++ with python bindings:
github.com/aewallin/truetype-tracer

If you want V-carving paths you could use my OpenVoronoi project:
github.com/aewallin/openvoronoi
There is an example of how a python script can be used as a "filter" in AXIS. You just open this py-file in AXIS and it generates g-code on the fly:
github.com/aewallin/linuxcnc-scripts
the output looks like this:
github.com/aewallin/linuxcnc-scripts/blo...edial_screenshot.png

All of this is pretty experimental and in development so you will likely have to do some python and/or c++ hacking yourself to get it to work.
It would be fairly easy to make a simple Python GUI for generating G-code for a fixed text + an increasing serial-number or time/date-stamp etc.

Anders

Please Log in or Create an account to join the conversation.

More
20 Jan 2013 21:08 #28868 by wbeppler
hi and thanks !

i think this nearly what i need. today i can not test it because the machine is in the office.

i will try in next days, if i need help can i contact you ? (if i get the job it's payed!!!)

best regards

wolfgang :-)

###########################
Elektronik u. Softwareentwicklung
###########################
Wolftec GmbH
Wolfgang Beppler
Kratellen 23
DE-78355 Hohenfels-Kalkofen
This email address is being protected from spambots. You need JavaScript enabled to view it.
############################

Please Log in or Create an account to join the conversation.

More
21 Jan 2013 00:11 - 21 Jan 2013 23:06 #28879 by ArcEye
Hi

Another possibility, can never have too many choices!

A while back I re-wrote Lawrence Glaisters engrave-11.py, to engrave multiple lines with optional indents etc.
wiki.linuxcnc.org/cgi-bin/wiki.pl?Simple...t_Engraving_Software

In the process I converted it into a command-line program. This makes it ripe for use with a script to generate the engraving code and output it to Axis

Below is an example bash script called serial-engrave, just relies upon a file called serial-num which holds the current serial number and is incremented at each use
It takes one command line parameter, which is the path of the file to output to and then load into Axis.
#!/bin/bash

    if [ ! $# -ge 1 ]; then
	 echo "Usage: serial-engrave filename"
    exit 1
    fi
   
    value=$(</usr/local/conf/serial-num)
    line="engrave-lines.py -S0.4 -s0.5 -0Workpiece-Serial$value"
    load="axis-remote $1"
    $line > $1
    ((value++))
    echo $value > /usr/local/conf/serial-num
    $load
              
exit 0

and the result is



regards
Attachments:
Last edit: 21 Jan 2013 23:06 by ArcEye.

Please Log in or Create an account to join the conversation.

More
21 Jan 2013 19:01 #28913 by wbeppler
hi thanks !!!!

i think this is a realy good kind to begin my project.
i had a look to Lawrence Glaister interface, its nearly like my spezification.

if i increment the number by a external job and reload in axis (automated), is ist possible to start the programm without user who press any button ? automated (sorry my english ist not so good)

thanks for this great information

wolfgang :-)

###########################
Elektronik u. Softwareentwicklung
###########################
Wolftec GmbH
Wolfgang Beppler
Kratellen 23
DE-78355 Hohenfels-Kalkofen
This email address is being protected from spambots. You need JavaScript enabled to view it.
############################

Please Log in or Create an account to join the conversation.

More
21 Jan 2013 19:56 - 21 Jan 2013 19:57 #28915 by ArcEye
Hi

Yes it is possible, but you need to understand how potentially dangerous it could be.

The Axis hack below automatically runs any program which is loaded remotely, so does not affect normal file loads.
The code is a direct lift from the run_task() function lower down the file, but as it was not defined yet it was easier just to copy the code in.

It is at about line 1886 of axis (but my copy is already heavily hacked so that may be out)
    def remote (cmd,arg=""):
        if cmd == "clear_live_plot":
            commands.clear_live_plot()
            return ""
        if running():
            return _("axis cannot accept remote command while running")
        if cmd == "open_file_name":
            commands.open_file_name(arg)
## hacked to automatically run when a file is loaded remotely
            global program_start_line, program_start_line_last
            program_start_line_last = program_start_line;
            ensure_mode(linuxcnc.MODE_AUTO)
            c.auto(linuxcnc.AUTO_RUN, program_start_line)
            program_start_line = 0
            t.tag_remove("ignored", "0.0", "end")
            o.set_highlight_line(None)
## end hack            
        elif cmd == "send_mdi_command":
            commands.send_mdi_command(arg)
        elif cmd == "reload_file":
            commands.reload_file()
        elif cmd == "destroy":
            root_window.tk.call("destroy", ".")
        return ""

This is most definitely not warranted fit for anything and may cause damage and/or injury if not used in carefully controlled circumstances.
You need to load the files by hand and run them normally to ensure that everything behaves as expected before attempting to use this to automate the program run.

regards
Last edit: 21 Jan 2013 19:57 by ArcEye.
The following user(s) said Thank You: wbeppler

Please Log in or Create an account to join the conversation.

More
21 Jan 2013 22:55 #28920 by ArcEye
Hi Again

Have come to a more elegant and safer solution on the same lines.

I have added a --run / -R switch to axis-remote. This passes the command run_command to Axis which in turn runs the currently loaded file.

You can still run automatically via a script, it just requires a specific axis-remote --run command after the required file has been loaded.
Prevents any issues regards giving one command and getting two actions, which makes me happier with it

Axis hack is now
    def remote (cmd,arg=""):
        if cmd == "clear_live_plot":
            commands.clear_live_plot()
            return ""
        if running():
            return _("axis cannot accept remote command while running")
        if cmd == "open_file_name":
            commands.open_file_name(arg)
##  Added
        elif cmd == "run_command":
            global program_start_line, program_start_line_last
            program_start_line_last = program_start_line;
            ensure_mode(linuxcnc.MODE_AUTO)
            c.auto(linuxcnc.AUTO_RUN, program_start_line)
            program_start_line = 0
            t.tag_remove("ignored", "0.0", "end")
            o.set_highlight_line(None)
##            
        elif cmd == "send_mdi_command":
            commands.send_mdi_command(arg)
        elif cmd == "reload_file":
            commands.reload_file()
        elif cmd == "destroy":
            root_window.tk.call("destroy", ".")
        return ""

and the modified copy of axis-remote is below

regards


File Attachment:

File Name: axis-remote.zip
File Size:1 KB
Attachments:
The following user(s) said Thank You: wbeppler

Please Log in or Create an account to join the conversation.

More
22 Jan 2013 02:37 #28928 by wbeppler
wow !

people of this forum are fast !
today i did first steps in learning more about the background of emc2 and axis and ...and...and...gcode....

so i need some time to try all the solutions, but now i know that the project i hope to get as job, is possible to realize with emc2

my next step is to make a input-field for the text (axis-frontend) an generate from there the nc-program.

my questions:
how can i give the var's (like serial-number to engrave) from axis into my g-code as #1 or so? (stupid question for most, i know, but i search for one example)
how can i send a var (this my text) as parameter to a external program ?

thanks ! it makes fun to work here :-)

###########################
Elektronik u. Softwareentwicklung
###########################
Wolftec GmbH
Wolfgang Beppler
Kratellen 23
DE-78355 Hohenfels-Kalkofen
This email address is being protected from spambots. You need JavaScript enabled to view it.
############################

Please Log in or Create an account to join the conversation.

Time to create page: 0.151 seconds
Powered by Kunena Forum