Compatibility with Lantek and other high-end software
- santy
- Offline
- Premium Member
Less
More
- Posts: 116
- Thank you received: 10
04 Aug 2023 20:02 #276931
by santy
Compatibility with Lantek and other high-end software was created by santy
Hello
I've posted in general linux cnc about modifying lantek post processor to support qtplasmac or other linuxcnc interfaces.
I've came across two lantek versions which export a gcode in different ways, like the files posted in attachment.
The price will, probably be very expensive to create a dedicated post-processor, but the already exported gcode could be modified.
The idea by user rodw, would be to modify qtplasmac filter, in order to automatically modify these files to add the material number, and the qtplasmac supported commands.
these machines used to be made with dc motors on Z axis, but now use stepper motors.
M3 on qtplasmac handles all pierce operations so it should be fairly simple to modify these files, even with a python script, to be usable in linuxcnc, right?
I've posted in general linux cnc about modifying lantek post processor to support qtplasmac or other linuxcnc interfaces.
I've came across two lantek versions which export a gcode in different ways, like the files posted in attachment.
The price will, probably be very expensive to create a dedicated post-processor, but the already exported gcode could be modified.
The idea by user rodw, would be to modify qtplasmac filter, in order to automatically modify these files to add the material number, and the qtplasmac supported commands.
these machines used to be made with dc motors on Z axis, but now use stepper motors.
M3 on qtplasmac handles all pierce operations so it should be fairly simple to modify these files, even with a python script, to be usable in linuxcnc, right?
Please Log in or Create an account to join the conversation.
- rodw
- Online
- Platinum Member
Less
More
- Posts: 10738
- Thank you received: 3541
04 Aug 2023 22:44 #276942
by rodw
Replied by rodw on topic Compatibility with Lantek and other high-end software
Actually, what I was proposing was some kind of plugin interface to the QTplasmac filter that allowed an input file to be converted on the fly to support qtplasmac's requirements.
This could be quite cool as it would let QTplasmac to be driven by high end nesting systems that do not have postprocessor support or an affordable way to obtain a customised post processor.
This could be quite cool as it would let QTplasmac to be driven by high end nesting systems that do not have postprocessor support or an affordable way to obtain a customised post processor.
Please Log in or Create an account to join the conversation.
- phillc54
- Offline
- Platinum Member
Less
More
- Posts: 5698
- Thank you received: 2081
05 Aug 2023 08:19 #276978
by phillc54
Replied by phillc54 on topic Compatibility with Lantek and other high-end software
I have done some experimental work on the filter and it is relatively easy to call in a python script from the config directory and enable custom filtering by either additional procedures or overriding existing procedures.There are some issues with the posted ngc files though:
The attached file is gcodeLantekJM.txt roughly converted with a custom filter, with the above noted arc issues.
I am happy to push a test branch if you want to experiment.
- 100x100rectangle.txt - has quite a few codes unknown to LinuxCNC, you would need to resolve what they did on the particular machine they were written for.
- gcodeLantekJM.txt - has issues with the arcs, the first two give the error "Radius to end of arc differs from radius to start", I didn't try any others.
The attached file is gcodeLantekJM.txt roughly converted with a custom filter, with the above noted arc issues.
I am happy to push a test branch if you want to experiment.
The following user(s) said Thank You: rodw
Please Log in or Create an account to join the conversation.
- santy
- Offline
- Premium Member
Less
More
- Posts: 116
- Thank you received: 10
05 Aug 2023 11:37 #276994
by santy
Replied by santy on topic Compatibility with Lantek and other high-end software
hey phillc,
I'm writing a python script that will remove all G41 M21, G40 M20 entries and replace them with typical arc start and arc end... also remove all N(xx) number of line entries, and imprint the initial conditions on the file.
What do you need to do to correct the arcs? I'm not sure i understand.
Also, do you put this to get the kerf width right after every M3 command automatically? G41.1 D#<_hal[plasmac.kerf-width]>
Could you share the script you used to get that code? I'm going to test it on the qtplasmac next monday
I'm writing a python script that will remove all G41 M21, G40 M20 entries and replace them with typical arc start and arc end... also remove all N(xx) number of line entries, and imprint the initial conditions on the file.
What do you need to do to correct the arcs? I'm not sure i understand.
Also, do you put this to get the kerf width right after every M3 command automatically? G41.1 D#<_hal[plasmac.kerf-width]>
Could you share the script you used to get that code? I'm going to test it on the qtplasmac next monday
Please Log in or Create an account to join the conversation.
- phillc54
- Offline
- Platinum Member
Less
More
- Posts: 5698
- Thank you received: 2081
05 Aug 2023 11:49 #276995
by phillc54
Replied by phillc54 on topic Compatibility with Lantek and other high-end software
The arcs possibly have incorrect I or K values. I maxed out CENTER_ARC_RADIUS_TOLERANCE_MM in the RS274 section of the ini file and it didn’t help.
The G41.1 line replaces the G41 lines, if you remove them then the cut size will be incorrect as there will not be any cutter compensation.
The script I used can only be used in association with the existing filter that has been modified to call the script.
The G41.1 line replaces the G41 lines, if you remove them then the cut size will be incorrect as there will not be any cutter compensation.
The script I used can only be used in association with the existing filter that has been modified to call the script.
The following user(s) said Thank You: rodw
Please Log in or Create an account to join the conversation.
- rodw
- Online
- Platinum Member
Less
More
- Posts: 10738
- Thank you received: 3541
05 Aug 2023 12:47 #276999
by rodw
Replied by rodw on topic Compatibility with Lantek and other high-end software
Could Lantek be configured to do kerf compensation in the post processor? Sheetcam and Fusion 360 support this sso you would expect high end software would also.
Please Log in or Create an account to join the conversation.
- santy
- Offline
- Premium Member
Less
More
- Posts: 116
- Thank you received: 10
05 Aug 2023 13:46 #277003
by santy
Replied by santy on topic Compatibility with Lantek and other high-end software
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.
This is the code i wrote to transform lantek code into qtplasmac code. its not yet finished and needs a lot of tweaking.
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.
- phillc54
- Offline
- Platinum Member
Less
More
- Posts: 5698
- Thank you received: 2081
06 Aug 2023 01:09 #277075
by phillc54
Replied by phillc54 on topic Compatibility with Lantek and other high-end software
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.
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.
The following user(s) said Thank You: rodw
Please Log in or Create an account to join the conversation.
- phillc54
- Offline
- Platinum Member
Less
More
- Posts: 5698
- Thank you received: 2081
09 Aug 2023 00:18 #277382
by phillc54
Replied by phillc54 on topic Compatibility with Lantek and other high-end software
Custom G-code filter extensions is now available:
linuxcnc.org/docs/2.9/html/plasma/qtplas...custom_g_code_filter
linuxcnc.org/docs/2.9/html/plasma/qtplas...custom_g_code_filter
Please Log in or Create an account to join the conversation.
- rodw
- Online
- Platinum Member
Less
More
- Posts: 10738
- Thank you received: 3541
09 Aug 2023 01:07 #277386
by rodw
Awesome work Phil!
Replied by rodw on topic Compatibility with Lantek and other high-end software
QTplasmac continues to push ahead of the commercial competition. Who has ever heard of a CNC machine correcting the Gcode it gets?Custom G-code filter extensions is now available:
linuxcnc.org/docs/2.9/html/plasma/qtplas...custom_g_code_filter
Awesome work Phil!
Please Log in or Create an account to join the conversation.
Moderators: snowgoer540
Time to create page: 0.112 seconds