Difference between USER_M_PATH and nc_files path

More
24 Feb 2016 00:15 #70546 by nicokid
Hi,
What is the difference in the use of a path in USER_M_PATH than the nc_files standard path?
In both I can specify user defined functions (M100-M199), is it right? Or these directories are used to do different things?

Nicola.

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

More
25 Feb 2016 13:30 #70614 by andypugh
You can use both. The idea is that you can keep your M-code subroutines somewhere out of the way where they are safe from over-zealous tidying-up.

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

More
25 Feb 2016 15:23 #70623 by dgarrett
Note that USER_M_PATH specifies a _list_ of directories that are searched
for executable files with names like M1xx.

Ref: linuxcnc.org/docs/2.7/html/config/ini-config.html
USER_M_PATH = myfuncs:/tmp/mcodes:experimentalmcodes - Specifies a list of colon (:) separated directories for user defined functions. Directories are specified relative to the current directory for the ini file or as absolute paths. The list must contain no intervening whitespace.

A search is made for each possible user defined function, typically (M100-M199). The search order is:

    [DISPLAY]PROGRAM_PREFIX (if specified)

    If [DISPLAY]PROGRAM_PREFIX is not specified, search the default location: nc_files

    Then search each directory in the list [RS274NGC]USER_M_PATH

    The first executable M1xx found in the search is used for each M1xx.

The 'nc_files' mentioned is a bit confusing.

The search list begins at [DISPLAY]PROGRAM_PREFIX which is conventionally set
to the directory ~/linuxcnc/nc_files by programs like pncconf and stepconf or
when a configuration is copied to a user directory using the config picker.
These programs typically create this directory if it does not exist.

The seldom-used 'default location: nc_files' specifies a subdirectory named
'nc_files' in the configuration directory that contains ini file. This
subdirectory must exist to be usable in the path search.

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

More
25 Feb 2016 15:46 #70625 by nicokid
As you know I have changed stepconf to add the configuration interface for the HALUI section of the ini file. Eventually I would like to fully configure my cnc machine 'stepcraft 840' using only stepconf. So I need to add even 'USER_M_PATH' under RS274NGC section in accordance with the specifications in this forum: www.stepcraft-systems.com/forum/software...allation-einrichtung. Another issue is the use of HALFILE and POSTGUI_HALFILE, but I check this later :) .
So you think is best to use USER_M_PATH for custom commands?
Nicola.

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

More
25 Feb 2016 23:29 #70647 by nicokid

Note that USER_M_PATH specifies a _list_ of directories that are searched
for executable files with names like M1xx.


Ok this is clear. :)

The 'nc_files' mentioned is a bit confusing.

The search list begins at [DISPLAY]PROGRAM_PREFIX which is conventionally set
to the directory ~/linuxcnc/nc_files by programs like pncconf and stepconf or
when a configuration is copied to a user directory using the config picker.
These programs typically create this directory if it does not exist.

The seldom-used 'default location: nc_files' specifies a subdirectory named
'nc_files' in the configuration directory that contains ini file. This
subdirectory must exist to be usable in the path search.


This is for me more confused than before. :blink:
The ini file is under ~/linuxcnc/configs not under ~/linuxcnc/nc_files. I do not understand.

Nicola.

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

More
26 Feb 2016 11:00 #70666 by andypugh

This is for me more confused than before. :blink:
The ini file is under ~/linuxcnc/configs not under ~/linuxcnc/nc_files. I do not understand.


What Dewey is saying (as I read it) is that there is a default location that is searched second:

~/linuxcnc/configs/my_config/nc_files

This is where you can put config-specific M-files, if you wish to.

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

More
26 Feb 2016 11:42 #70668 by nicokid

~/linuxcnc/configs/my_config/nc_files

This is where you can put config-specific M-files, if you wish to.


Uhmm... indeed my own USER_M_PATH path points to ~/linuxcnc/configs/stepcraft-840/mcode.
So if I change the name of directory mcode in nc_files I can avoid setting the USER_M_PATH parameter in .ini file?

Thanks, Nicola.

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

More
26 Feb 2016 11:46 #70669 by andypugh

So if I change the name of directory mcode in nc_files I can avoid setting the USER_M_PATH parameter in .ini file?


That is the way I read what Dewey posted. It is a simple experiment to find out :-)
The following user(s) said Thank You: nicokid

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

More
26 Feb 2016 17:33 #70678 by nicokid
I did some tests :)

This does not work:
~/linuxcnc/configs/my_config/nc_files

I can put my files with M codes (like M100) in this directory:
~/linuxcnc/nc_files
that can be changed by setting PROGRAM_PREFIX parameters.

or

I can setting USER_M_PATH parameter, for example:
USER_M_PATH = nc_files
Then I can put my M files under:
~/linuxcnc/configs/my_config/nc_files

In the end I think that the directory ~/linuxcnc /nc_files is for all ini configuration, while the directory specified by USER_M_PATH is just for one ini configuration (~/linuxcnc/configs/my_config/nc_files).

Nicola.

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

More
27 Feb 2016 00:40 - 27 Feb 2016 00:42 #70693 by dgarrett
The attached demo illustrates USER_M_PATH usage.
The config directory is named 'demo'.
The config directory also contains subdirectories named
d1,d2,d3, and nc_files.

The two included ini files (demo1.ini, demo2.ini) use a minimal
axis gui simulation configuration to access a simple gcode starup
file named demo.ngc

The demo1.ini config specifies:
[DISPLAY]
PROGRAM_PREFIX = ./d1
...
[RS274NGC]
USER_M_PATH= ./d2:./d3:./nc_files
...

The demo2.ini config removes (comments out) the PROGRAM_PREFIX:
[DISPLAY]
#PROGRAM_PREFIX=./d1
...
[RS274NGC]
USER_M_PATH= ./d2:./d3:./nc_files
...


Each subdirectory contains simple M1NN files to
identify their usage by encoding the value of the
motion.analog-in-00 pin which is read in the gcode file
named demo.ngc using the m66 cmd which populates the
variable #5399
$ cat d1/M111
#!/bin/bash
halcmd setp motion.analog-in-00 1.111  # 1.xxx for dir d1
$ cat d2/M111
#!/bin/bash
halcmd setp motion.analog-in-00 2.111  # 2.xxx for dir d2
# ... etc.
$ cat nc_files/M111
#!/bin/bash
halcmd setp motion.analog-in-00 0.111  # 0.xxx for dir nc_files
[code]

Note that there are several files with the same name to
illustrate how the search works:
[code]
├── d1
│   └── M111
├── d2
│   ├── M111
│   └── M112
├── d3
│   ├── M111
│   ├── M112
│   └── M113
├── nc_files
    └── M111

To try:
  mkdir /tmp/demo       # make a test directory
  cd    /tmp/demo       # work in that directory
  wget https://forum.linuxcnc.org/media/kunena/attachments/512/mpath_demo.zip
  unzip mpath_demo.zip  # extract archive
  linuxcnc demo1.ini &  # try demo1
  # F1 (clear Estop)
  # F2 (machine On)
  # R  (run included program named demo.ngc)
  # menu/Exit

  linuxcnc demo2.ini & # repeat for demo2



Attachments:
Last edit: 27 Feb 2016 00:42 by dgarrett.
The following user(s) said Thank You: nicokid

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

Time to create page: 0.217 seconds
Powered by Kunena Forum