Preparation for the self-construction of a carousel changer

More
17 Jun 2022 18:09 #245338 by mgm
Ok I already have a M6 remap for my two additional spindles and for tool measurement.
Adding the change position there should not be a problem.
There you could use the current X position to determine the change position either left or right from the center, which way is the shorter.

I have only found the short entry in the section of the ini explanation via the FILTER.
Is there something more detailed or still some comprehensible examples?

 

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

More
18 Jun 2022 00:40 #245368 by andypugh
It's a bit simple, but there is a filter here: forum.linuxcnc.org/38-general-linuxcnc-q...p-code-f-code#213692

I am sure I did a fuller answer and more complex filter somewhat recently, but failed to find it.

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

More
19 Jun 2022 10:52 #245425 by mgm
I have tried the example from the wiki page
linuxcnc.org/docs/2.6/html/config/ini_co...l#sub:FILTER-Section
for the filter into my simulation, unfortunately without success.
Only error messages came up!

one error message was
Near line 4 in /tmp/tempwJ84Lc/axis.ngc:
Real number expected, but no characters found

When setting up in the ini I had the following problems:
which name has the file, how is the file extension, where must it be stored ... and how it must be included in the FILTER section.

I have pasted this together:
[FILTER]
PROGRAM_EXTENSION = .png, .gif, .jpg Greyscale Depth Image
PROGRAM_EXTENSION = .py Python Script
PROGRAM_EXTENSION = .nc,.tap G-Code File
PROGRAM_EXTENSION = .ngc g-code after custom Script
png = image-to-gcode
gif = image-to-gcode
jpg = image-to-gcode
py = python
ngc = python /home/mgm/linuxcnc/nc_files/env.py

Apparently I lack basic knowledge of how to work with python.


 

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

More
21 Jun 2022 23:06 #245563 by andypugh

[FILTER-Section]ngc = python /home/mgm/linuxcnc/nc_files/env.py


if env.py is your script then I don't think that you want the "python" in there. That file should start with #! python, and that is what tells the OS what to use as an interpreter.

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

More
22 Jun 2022 12:13 #245589 by mgm
sorry, but i don't get it ....

This is the file with the code:
#! /usr/bin/env python

import sys

def main(argv):

  openfile = open(argv[0], 'r')
  file_in = openfile.readlines()
  openfile.close()

  file_out = []
  for line in file_in:
    # print line
    if line.find('Z') != -1:
      words = line.rstrip('\n')
      words = words.split(' ')
      newword = ''
      for i in words:
        if i[0] == 'Z':
          newword = 'W'+ i[1:]
      if len(newword) > 0:
        words.append(newword)
        newline = ' '.join(words)
        file_out.append(newline)
    else:
      file_out.append(line)
  for item in file_out:
    print "%s" % item

if __name__ == "__main__":
   main(sys.argv[1:])
if I understand correctly the filename is env.py
This file is located in the directory:
" /urs/bin/ "
I want that when a ngc file is loaded the program env.py runs.

What must be the entry in the filter section?
 

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

More
22 Jun 2022 12:39 #245591 by phillc54

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

More
26 Jun 2022 12:37 - 26 Jun 2022 12:41 #245915 by mgm
I am at a loss, I just can't get the file to be pasted!
I am too stupid!
I have the filter program in the directory:
nc_files/
The filename of the program is:
w_achse.py
The content of the file is above!

If I now start LCNC I get the error: the file can not be found!
 

This is the entry of the ini:
[FILTER]
PROGRAM_EXTENSION = .png,.gif,.jpg Greyscale Depth Image
PROGRAM_EXTENSION = .py Python Script
PROGRAM_EXTENSION = .nc,.tap,.ngc G-Code File
png = image-to-gcode
gif = image-to-gcode
jpg = image-to-gcode
py = python
ngc = ./nc_files/w_achse.py

[RS274NGC]
PARAMETER_FILE = linuxcnc.var
SUBROUTINE_PATH   = ../../nc_files/ngcgui_lib:../../nc_files/ngcgui_lib/utilitysubs
USER_M_PATH       = ../../nc_files/ngcgui_lib/mfiles


How to do it right?
In which directory must w-axis.py be located?
Is the file header correct?
Attachments:
Last edit: 26 Jun 2022 12:41 by mgm.

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

More
26 Jun 2022 12:58 #245917 by tommylight
Check the file permissions and make sure it is executable.

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

More
26 Jun 2022 13:10 - 26 Jun 2022 13:10 #245919 by phillc54
Also check the file path, it could possibly be: ../../nc_files/w_achse.py
Last edit: 26 Jun 2022 13:10 by phillc54.

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

More
26 Jun 2022 13:33 - 26 Jun 2022 13:34 #245921 by mgm
Thanks Phillip that was it
the correct path is: ../../nc_files/w_axis.py

You made my day!
Last edit: 26 Jun 2022 13:34 by mgm.

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

Time to create page: 0.182 seconds
Powered by Kunena Forum