A head scratcher for me

More
18 Nov 2022 12:17 #257029 by slidinghawk
Replied by slidinghawk on topic A head scratcher for me
Thank you. Understood how to do it. figured out how to write g-code. It takes the speed prescribed in the filter Feedrate=1 . But you can not make it so that he would take the initial speed from the g-code (Feedrate = 250.0000) ?

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

More
18 Nov 2022 13:26 #257035 by tommylight
Replied by tommylight on topic A head scratcher for me
@slidinghawk
Please do not change the title when replying, it makes it really hard to find the topic and follow what has been answered.
Thank you.

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

More
18 Nov 2022 14:11 #257038 by andypugh
Replied by andypugh on topic A head scratcher for me
It should be reading the feedrate from the file:
    Ff = re.match(r".*F\s*([\d\.,]+)", line)
    if Ff:
        Fn = re.match(r".*(?=( F|F))", line)

 ...

    if Ff:
        feedrate = float(Ff.group(1))

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

More
20 Nov 2022 02:01 #257138 by mmccoo
Replied by mmccoo on topic A head scratcher for me
So I encountered the same problem and the script, with some modifications did the trick for me. In this thread, I found two other versions by Andy and Alex.

Some stuff that I fixed in my version:
Andy's didn't do any thing with rapids/G00
Both didn't parse negative coords correctly
Alex's didn't handle XYUV correctly in calculating distances. My version may not handle other letter configurations
My version fixed these, though I may have broken things for non-XYUV
I also added some output comments for debuggability:
(XYdist=5.0 UVdist=272.5 1/F93*60=81.75 seconds)
G01 X0.000 Y20.244 U267.500 V20.244 F0.733945


My version is attached.

:-)
Miles
Attachments:
The following user(s) said Thank You: tommylight, aleksamc

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

More
21 Nov 2022 13:20 - 21 Nov 2022 13:21 #257216 by andypugh
Replied by andypugh on topic A head scratcher for me

Andy's didn't do any thing with rapids/G00


What does it need to do with rapids?

Both didn't parse negative coords correctly


But that's rather embarrassing. The regex should be ([\d,.+-]) to accept digits, signs and both decimal point variants.
Last edit: 21 Nov 2022 13:21 by andypugh.

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

More
21 Nov 2022 21:21 #257261 by mmccoo
Replied by mmccoo on topic A head scratcher for me
What does it need to do with rapids?

It should not delete them. :-) Not particularly important. mine only had a very short one at the beginning.

The the regex, a friend told me a joke recently.
My program had a bug that was easily fixed with a regex.
Now it has two problems.

I like putting backslashes on . + and -. Kudos for supporting the German style decimals (using commas). I've always thought that is kinda goofy.

unless you intended to support numbers like 1,000,000 though I don't know that that would be valid gcode.

I'll stop rambling
Miles

 

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

More
22 Nov 2022 11:29 - 22 Nov 2022 11:32 #257320 by andypugh
Replied by andypugh on topic A head scratcher for me

I like putting backslashes on . + and -. 


 
It is absolutely necessary to escape -, I had forgotten that. Otherwise it defines a range of characters, in the example above it simply doesn't match - but if it had been written [\d.,-+] it would be matching anything bettween , and +. It does no harm to escape the others and might be wise for compatibility with future parsers.

I like to test my Regexes at regexr.com
Here is an example of eccentrically written G-code and the expression needed to parse it. 
regexr.com/72ujt

 
Last edit: 22 Nov 2022 11:32 by andypugh.

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

More
16 Nov 2023 05:43 #285579 by blazini36
Replied by blazini36 on topic A head scratcher for me
I just ran into this issue. I previously only used my 4th to do gears with hand written subroutines.

I setup the script mmccoo posted as I assumed it was the last best version. It doesn't actually work, not with the output from FreeCAD or at least not with an XYZA machine. All of the G93s are overridden by G94s. Anyone know how to fix it? Files are attached, had to cut them down to attach here.

Also, I setup the PROGRAM_EXTENSION for an extension .ngcrot. Gmoccapy's file browser will not pick this up. Not sure if something is coded into Gmoccapy to only accept .ngc or what. I had to start LinuxCNC with the file to get it to load.

 

File Attachment:

File Name: OP2.txt
File Size:186 KB

 

File Attachment:

File Name: OP2_conv.txt
File Size:303 KB
Attachments:

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

More
16 Nov 2023 10:09 #285596 by andypugh
Replied by andypugh on topic A head scratcher for me
I don't know for sure that Gmoccapy supports filter files. It might be an Axis feauture.

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

More
16 Nov 2023 16:08 #285628 by blazini36
Replied by blazini36 on topic A head scratcher for me
Any idea what's up with the G94/93 output? I realized the Gcode from Freecad is only working with ~7deg on the A axis which is weird but hopefully I can get that fixed cuz I can't find any other 4th axis CAM that runs on Linux

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

Time to create page: 0.111 seconds
Powered by Kunena Forum