A head scratcher for me

More
3 years 11 months ago #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 to join the conversation.

More
3 years 11 months ago #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 to join the conversation.

More
3 years 11 months ago #257038 by andypugh
Replied by andypugh on topic A head scratcher for me
It should be reading the feedrate from the file:
Code:
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 to join the conversation.

More
3 years 11 months ago #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:
Code:
(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

Please Log in to join the conversation.

More
3 years 11 months ago #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.

Please Log in to join the conversation.

More
3 years 11 months ago #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 to join the conversation.

More
3 years 11 months ago #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

 

Please Log in to join the conversation.

More
2 years 11 months ago #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.

 

Attachment not found


 

Attachment not found

Please Log in to join the conversation.

More
2 years 11 months ago #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 to join the conversation.

More
2 years 11 months ago #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 to join the conversation.

Time to create page: 0.085 seconds
Powered by Kunena Forum