Any way to get gcode file path.

This is where you talk about Macros, show examples of your macro scripting and SHARE handy segments of script code as examples.

Any way to get gcode file path.

Postby beefy » Fri Dec 29, 2017 4:39 am

Do we have any function that returns the full file path of the currently loaded gcode file.

All I can find is this function:

Function: string Getgcodefilename( void )
Description: This function returns the current loaded g-code filename as a string.
Example: string val = exec.Getgcodefilename();

It doesn't mention returning the full file path so I'm assuming it only returns the bare gcode file name.
beefy
 
Posts: 169
Joined: Mon Sep 05, 2016 10:34 am

Re: Any way to get gcode file path.

Postby dezsoe » Fri Dec 29, 2017 8:35 am

You can use System.IO.Path.GetDirectoryName(exec.Getgcodefilename()) and System.IO.Path.GetFileName(exec.Getgcodefilename()) functions, but I can't see why do you need them. The exec.Getgcodefilename() returns the filename with the full path. (Did you try it? :))
dezsoe
 
Posts: 388
Joined: Sun Mar 12, 2017 4:41 pm
Location: Csörög, Hungary

Re: Any way to get gcode file path.

Postby beefy » Fri Dec 29, 2017 2:23 pm

Thanks Dezsoe.

We were having a family night and I was haunting some forums so didn't get a chance to try it, and thought I'd ask. I'm glad I didn't try it because if I did I wouldn't have learned those 2 tricks from you :D

I may not need those 2 tricks you've shown me, but I'm still happy to learn about them :)

Cheers,

Keith.
beefy
 
Posts: 169
Joined: Mon Sep 05, 2016 10:34 am


Return to Macros

Who is online

Users browsing this forum: No registered users and 1 guest