Hello Guest it is March 29, 2024, 09:44:13 AM

Author Topic: How to get the current subroutine file name?  (Read 14046 times)

0 Members and 1 Guest are viewing this topic.

Re: How to get the current subroutine file name?
« Reply #10 on: July 18, 2010, 12:35:07 PM »
Message(filename)

fname= "c:\Mach3/subroutines/99999.nc"
Message(fname) ' this will display the fname to the screen

'I can display the filename
'And see how to assign a variable, display it.
'But don't see how I can set/change the filename from within VB

Offline BR549

*
  •  6,965 6,965
    • View Profile
Re: How to get the current subroutine file name?
« Reply #11 on: July 18, 2010, 01:51:31 PM »
Name Statement
Name oldname As newname
Changes the name of a directory or a file.
The parameters oldname and newname are strings that can optionally
contain a path.
Related Topics: Kill, ChDir

Page 104 of the Cypress manual (;-)
Re: How to get the current subroutine file name?
« Reply #12 on: July 18, 2010, 02:36:16 PM »
I had tried that but with no luck, I get three different error messages. depending on what I attempt

Dim oldname,newname As String
message(filename)
oldname = "c:\mach3\gcode\airfoil.tap"
newname = "c:\mach3\gcode\tt.txt"
newname = "tt.txt"

'Name filename As newname 'path/file access error
message(filename)

Name oldname As newname 'Cannot create a file when that file already exists
message(filename)

'commented out the oldname variable
Name oldname As newname 'The system cannot find the path specified
message(filename)

Offline BR549

*
  •  6,965 6,965
    • View Profile
Re: How to get the current subroutine file name?
« Reply #13 on: July 18, 2010, 03:32:34 PM »
Name "C:\mach3\gcode\drawing1.tap" As "c:\mach3\gcode\drawing11.tap"

BuggyWhipper style (;-)


NOTE: IF you are trying to rename a loaded file then you are going to have to do it a different way. IF you try it straight up you are probable going to CORRUPT mach in a big way.

TO do it, get current file name, get current line#, close file, rename file, reload newfilename,  goto line#

(;-)  BUT WHY do it at all ????
« Last Edit: July 18, 2010, 03:45:05 PM by BR549 »

Offline BR549

*
  •  6,965 6,965
    • View Profile
Re: How to get the current subroutine file name?
« Reply #14 on: July 18, 2010, 03:58:19 PM »
Not to worry, I just checked Art fixed the old problem. Mach will not let you rename the current loaded file(;-)
Re: How to get the current subroutine file name?
« Reply #15 on: July 18, 2010, 04:14:42 PM »
Did you try it? I had tried it and never had any luck with or without the BuggyWhip.

My use is create a nightly script that calls up programs in a sequence. each program has its own fixture offset. The table is filled with multiple different parts to be machined. As it finishes one part it calls up the next. I'm into the lights out production shop. I sleep better knowing I'm making money.

Offline BR549

*
  •  6,965 6,965
    • View Profile
Re: How to get the current subroutine file name?
« Reply #16 on: July 18, 2010, 05:27:01 PM »
YEP it works here. I would not have said anything IF I had not tried it to be sure(;-). Too many things change when you are not looking.

Your lights out approach is not new. You can build a  macro with a param call to load the next program based on the param call, then CYcle start the new program.

Just do not end with a M30 but end with the Callingmacro  say    M549 P Nextprogram. Then instead of ending the program the macro can take control then close the current file , load the param called new file and cycle start the machine to run. Then add the macro call to the end of that file and on and on all night long .

Just a thought,(;-)

Offline BR549

*
  •  6,965 6,965
    • View Profile
Re: How to get the current subroutine file name?
« Reply #17 on: July 18, 2010, 06:10:06 PM »
I think the best approach would be sub calls, Just remember to add the M99 to the end of the file and REMOVE or deactivate any M30's

(tonights run)
M98 "File1"
M98 "File2"
M98 "File3"
etc
etc
etc
m30
%
Re: How to get the current subroutine file name?
« Reply #18 on: July 18, 2010, 06:22:52 PM »
Sorry, I guess I am confused:
Name "C:\mach3\gcode\drawing1.tap" As "c:\mach3\gcode\drawing11.tap"
This renames a files name!
:???
I was asking how to load a new gcode file from VB (or a plugin if need be)
My wish is not to have to edit files to suit the subroutine calls if t all possible

Offline BR549

*
  •  6,965 6,965
    • View Profile
Re: How to get the current subroutine file name?
« Reply #19 on: July 18, 2010, 07:23:56 PM »
Might want to download the manuals(;-)

loadrun("c:\mach3\gcode\roadrunner.tap")