Compatibility with Lantek and other high-end software

More
3 years 2 months ago #277003 by santy
I'm trying to fix the problem but the main issue will be the kerf. i don't mind if holes eventually go at the same speed, but the kerf and the direction for which it will be compensated (outside or inside cut) will end up being a problem. Any ideas?

This is the code i wrote to transform lantek code into qtplasmac code. its not yet finished and needs a lot of tweaking.
Code:
def convert_gcode(source_filename, target_filename, material_number): with open(source_filename, 'r') as source_file: lines = source_file.readlines() stripped_lines = [line.split(' ', 1)[1].strip() if ' ' in line else line.strip() for line in lines] with open(target_filename, 'w') as target_file: for i in range(len(stripped_lines)): line = stripped_lines[i] if 'G40' in line and 'M20' in stripped_lines[i + 1]: target_file.write('M3 $0 S1\n') i += 1 # Skip the next line (M20) elif 'M21' in line and 'G41' in stripped_lines[i + 1]: target_file.write('M5 $0\n') i += 1 # Skip the next line (G41) else: target_file.write(line.replace('N', '').replace('392', '').replace('53', '') + '\n') if __name__ == '__main__': source_filename = 'source_gcode.gcode' target_filename = 'target_gcode.gcode' convert_gcode(source_filename, target_filename) def remove_g41_m20(source_filename, target_filename): with open(source_filename, 'r') as source_file: lines = source_file.readlines() with open(target_filename, 'w') as target_file: for line in lines: if not line.startswith('G41') and not line.startswith('M20'): target_file.write(line) if __name__ == '__main__': target_filename = 'target_gcode.gcode' cleaned_filename = 'cleaned_gcode.gcode' remove_g41_m20(target_filename, cleaned_filename) def remove_and_append(input_filename, output_filename): with open(input_filename, 'r') as input_file, open(output_filename, 'w') as output_file: for line in input_file: stripped_line = line.strip() if not (stripped_line.startswith('M190') or stripped_line.startswith('M2')): output_file.write(line) output_file.write('M30\n') def add_preamble_to_file(input_filename, output_filename): preamble = """\ G21 (units: metric) G40 (cutter compensation: off) G90 (distance mode: absolute) M52 P1 (adaptive feed: on) M65 P2 (enable THC) M65 P3 (enable torch) M68 E3 Q0 (velocity 100%) G64 P0.254 Q0.025 (tracking tolerances: 0.254mm) ;end pre-amble ; ;begin material setup T0 M6 (select plasma tool) G43 H0 (apply tool offsets) (o=0,kw=2, ph=4, pd=0.3, ch=2, fr=2000, th=0, cv=99, pe=0, jh=0, jd=0) F#<_hal[plasmac.cut-feed-rate]> """ with open(input_filename, 'r') as input_file, open(output_filename, 'w') as output_file: output_file.write(preamble) for line in input_file: output_file.write(line) if __name__ == '__main__': final_filename = 'final_gcode.gcode' updated_filename = 'updated_gcode.gcode' add_preamble_to_file(final_filename, updated_filename) def convert_gcode_with_material(): return None

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

More
3 years 2 months ago #277075 by phillc54
Attached is a patch for qtplasmac_gcode.py and a copy of custom_filter.py that would go in your config directory.
Once the filter is patched and LinuxCNC loaded then you can edit custom_filter.py at will and reload the ngc file without needing to restart LinuxCNC.
 
Attachments:
The following user(s) said Thank You: rodw

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

More
3 years 2 months ago #277382 by phillc54
Custom G-code filter extensions is now available:
linuxcnc.org/docs/2.9/html/plasma/qtplas...custom_g_code_filter

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

More
3 years 2 months ago #277386 by rodw

Custom G-code filter extensions is now available:
linuxcnc.org/docs/2.9/html/plasma/qtplas...custom_g_code_filter
QTplasmac continues to push ahead of the commercial competition. Who has ever heard of a CNC machine correcting the Gcode it gets?
Awesome work Phil!

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

More
3 years 2 months ago - 3 years 2 months ago #279392 by santy
My current question is, how can i ensure that when filtering the gcode generated by Lantek, the Kerf width compensation is automatically made like it occurs in QTplasmac Conversational. In image 1, we have the code generated by Conversational for cutting an identical geometry as shown in image 2, wich represents the code generated by Lantek. Te objective is for this filter to adjust the Kerf width compensation, just as it happens in Conversational. Im using the custom_filter.py.
Attachments:
Last edit: 3 years 2 months ago by santy.

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

More
3 years 2 months ago #279423 by santy
I managed to make a py script that converts the code. I print the M190 PXXX with the material number i want, and it runs as a separate program.
of course, the program just adds the right offsets for the kerfs, and replaces the "G" moves and adds the kerf based on hal parameter. All good.

The problem is the G03 moves. Lantek exports this arcs with some error in the arcs and i get: radius to end of arc differs from radius to start linuxcnc


What could be the problem?
Here is a sample of ALMOST zero problems: (The error i get is always the same)
Code:
M66 P3 L3 Q1 M190 P1 G21 G64P0.25 G40 G49 G80 G90 G92.1 G94 G97 (preamble) f#<_hal[plasmac.cut-feed-rate]> G00 X22.5 Y-1186.4 m3 $0 s1 G41.1 D#<_hal[plasmac.kerf-width]> G01 X17.61 Y-1189.88 G03 X26.745 Y-1182.155 I1186.6133363484503 J-1186.6133363484503 G03 X19.02 Y-1191.29 I1186.6133363484503 J-1186.6133363484503 G01 X22.5 Y-1186.4 G40 m5 $0 G00 X22.5 Y-998.9 m3 $0 s1 G41.1 D#<_hal[plasmac.kerf-width]> G01 X17.61 Y-1002.38 G03 X26.745 Y-994.655 I999.1533716101848 J-999.1533716101848 G03 X19.02 Y-1003.79 I999.1533716101848 J-999.1533716101848 G01 X22.5 Y-998.9 G40 m5 $0 G00 X215.535 Y-945.15 m3 $0 s1 G41.1 D#<_hal[plasmac.kerf-width]> G01 X210.645 Y-948.63 G03 X219.775 Y-940.905 I969.4141832699787 J-969.4141832699787 G03 X212.05 Y-950.04 I969.4141832699787 J-969.4141832699787 G01 X215.535 Y-945.15 G40 m5 $0 G00 X215.535 Y-1107.65 m3 $0 s1 G41.1 D#<_hal[plasmac.kerf-width]> G01 X210.645 Y-1111.13 G03 X219.775 Y-1103.405 I1128.4253890820607 J-1128.4253890820607 G03 X212.05 Y-1112.54 I1128.4253890820607 J-1128.4253890820607 G01 X215.535 Y-1107.65 G40 m5 $0

Is there any way to merge the arcs or add a line before/after that will enable me to remove this difference?


I tried to mess with some INI parameters such as:
ARC_BLEND_ENABLE = 1
ARC_BLEND_FALLBACK_ENABLE = 0
ARC_BLEND_OPTIMIZATION_DEPTH = 50
ARC_BLEND_GAP_CYCLES = 4
ARC_BLEND_RAMP_FREQ = 100

is this the right approach? I had zero success (always the same errors)
Isn't there a way to allow more %relative error and just merge the lines?


 
Attachments:

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

Moderators: snowgoer540
Time to create page: 0.171 seconds
Powered by Kunena Forum