A head scratcher for me

More
11 Nov 2018 17:53 #120452 by rcKeith
Replied by rcKeith on topic A head scratcher for me
Hi Andy
Changing the XY to UV plane made no difference still went fast on the UV axis. Damn.

Keith

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

More
12 Nov 2018 11:40 #120484 by andypugh
Replied by andypugh on topic A head scratcher for me
Pity, though it was more a hope than an expectation that changing plane would help.

What does the first few lines of your G-code look like?

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

More
12 Nov 2018 15:07 #120491 by rcKeith
Replied by rcKeith on topic A head scratcher for me
Hi Andy

Here's the wing g-code for the left with UV on the big side attached is the full file. Here the first 30 or so lines

%
; Begin Header section
;hawk outer wing section
; root on left
G21
;UV plane selected
G17.1
G90
; End Header section
F 75.0000
; Switch On Hot wire
M3
; Go Home
G00 U 0.0000 V 0.0000 X 0.0000 Y 0.0000
; Go X Home
G00 U 0.0000 V 47.0717 X 0.0000 Y 17.2227
; Approaching Airfoil trailing edge
G01 U 0.0883 V 47.0717 X -0.0061 Y 17.2227 F 75.0000
; Begin Airfoil contour
G01 U 10.0376 V 47.0171 X 9.8755 Y 18.9244
G01 U 10.4867 V 47.0297 X 9.9371 Y 18.9339
G01 U 10.9357 V 47.0422 X 9.9987 Y 18.9434
G01 U 11.3846 V 47.0547 X 10.0604 Y 18.9530
G01 U 11.8335 V 47.0673 X 10.1220 Y 18.9625
G01 U 12.2822 V 47.0799 X 10.1836 Y 18.9717
G01 U 12.7309 V 47.0921 X 10.2452 Y 18.9809
G01 U 13.1796 V 47.1038 X 10.3068 Y 18.9901
G01 U 13.6281 V 47.1156 X 10.3684 Y 18.9993
G01 U 14.0766 V 47.1274 X 10.4300 Y 19.0085
G01 U 14.5250 V 47.1392 X 10.4916 Y 19.0176
G01 U 14.9734 V 47.1506 X 10.5532 Y 19.0268
G01 U 15.4217 V 47.1615 X 10.6148 Y 19.0362
G01 U 15.8699 V 47.1724 X 10.6763 Y 19.0456
G01 U 16.3181 V 47.1829 X 10.7378 Y 19.0552
G01 U 16.7662 V 47.1933 X 10.7994 Y 19.0647
G01 U 17.2142 V 47.2036 X 10.8609 Y 19.0742
G01 U 17.6621 V 47.2139 X 10.9224 Y 19.0838
G01 U 18.1100 V 47.2242 X 10.9839 Y 19.0934
Attachments:

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

More
12 Nov 2018 15:20 #120494 by andypugh
Replied by andypugh on topic A head scratcher for me
OK, my suggestion is that you set up LinuxCNC to run a filter on the G-code file that converts the file from G94 to G93.

The filter would compare the distances in the XY and UV planes and use the largest to calculate a G93 feed rate.

How is your Python? (I am willing to have a go, but I am at work at the moment so can't do it until later)

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

More
12 Nov 2018 21:44 #120513 by rcKeith
Replied by rcKeith on topic A head scratcher for me
Hi Andy
I've done a bit in Python but I not sure how I'd caluclate the feed rate. If you can point me in the right direction then I can have a go.

Thanks for your help

Keith

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

More
13 Nov 2018 02:21 #120524 by andypugh
Replied by andypugh on topic A head scratcher for me
I have run out of time tonight, but this is close.

In the INI file add this to the [FILTER] section
PROGRAM_EXTENSION = .foam foam
foam = /home/{YOUR USERNAME}/linuxcnc/filter.py

Now save this at that path as filter.py
#! /usr/bin/python

import re
import sys
import math

infile = sys.argv[1]

f = open(infile, 'r')

feedrate = 1

X = 0.0
Y = 0.0
U = 0.0
V = 0.0
oldX = X
oldY = Y
oldU = U
oldV = V


for line in f:
    Ff = re.match(r".*F\s*([\d\.,]+)", line)
    Xf = re.match(r".*X\s*([\d\.,]+)", line)
    Yf = re.match(r".*Y\s*([\d\.,]+)", line)
    Uf = re.match(r".*U\s*([\d\.,]+)", line)
    Vf = re.match(r".*V\s*([\d\.,]+)", line)
    G1f = re.match(r".*G\s*0*1\D", line)

    if Xf:
        X = float(Xf.group(1))
    if Yf:
        Y = float(Yf.group(1))
    if Uf: 
        U = float(Uf.group(1))
    if Vf: 
        V = float(Vf.group(1))

    hXY = math.sqrt((oldX-X)**2 + (oldY-Y)**2)
    hUV = math.sqrt((oldU-U)**2 + (oldV-V)**2)

    if hXY > hUV and hXY != 0:
        F93 = float(feedrate / hXY)
    elif hUV != 0:
        F93 = float(feedrate / hUV)

    if Ff:
        feedrate = float(Ff.group(1))
        print "( feedrate = %f)" % feedrate
        print "G93"
    elif G1f:
        print "%s F%f" % (line.rstrip(), F93)
    else:
        print line.rstrip()
        
    oldX = X
    oldY = Y
    oldU = U
    oldV = V

print "M2"

Now any gcode file with a .foam extension will run through that filter, example output:



It probably needs work, I am not sure that my G93 feedrate calculation is correct, but the structure is there.
Attachments:
The following user(s) said Thank You: aleksamc

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

More
13 Nov 2018 13:29 #120535 by rcKeith
Replied by rcKeith on topic A head scratcher for me
Hi Andy

Thank you so much that awesome. I'll give it a try and let you know. Looks a nice peice of code

Keith

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

More
16 Nov 2018 10:59 #120826 by rcKeith
Replied by rcKeith on topic A head scratcher for me
Hi Andy
Just tested on the machine and it works fantastic. Thank you so much. You're a wizard.

Keith

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

More
01 Jun 2020 19:32 #169702 by aleksamc
Replied by aleksamc on topic A head scratcher for me
I try to use your filter.py, andypugh but get error Permission denied.
I have another thread for this topic Slow work of rotary axis

Can you help me in this?
I have verion 2.7.15 and axes x,y,z,a.

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

More
01 Jun 2020 20:08 #169709 by rcKeith
Replied by rcKeith on topic A head scratcher for me
Can you do some screenshots of where you have the filter.py installed? and your ini file.
Keith

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

Time to create page: 0.192 seconds
Powered by Kunena Forum