opens on the last created file
- CrazyPenguin
- Offline
- New Member
-
Less
More
- Posts: 16
- Thank you received: 0
08 Apr 2011 12:01 #8700
by CrazyPenguin
opens on the last created file was created by CrazyPenguin
Hello, my name is Sebastian.-
I'm using a EMC2.4.6, and i need to open the editor on the last created ngc file.-
The question is: Is posible to make this?
thanks.-
Sebastian A. Rial
I'm using a EMC2.4.6, and i need to open the editor on the last created ngc file.-
The question is: Is posible to make this?
thanks.-
Sebastian A. Rial
Please Log in or Create an account to join the conversation.
08 Apr 2011 13:37 - 13 Feb 2017 20:26 #8705
by BigJohnT
Replied by BigJohnT on topic Re:opens on the last created file
Axis uses the OPEN_FILE variable in the [DISPLAY] section of the ini file to load a file at start up.
www.linuxcnc.org/docview/html/config_ini_config.html#sub:[DISPLAY]-section
I'm not sure how you might change this but it would be a useful option to have.
I also see that Axis does "remember" the last x files loaded up like some programs do. I would think that would be the place to start in modifying the code. Just thinking out loud here...
Oh, and to answer your question yes it is possible to change the code and have that happen. I just don't know how.
After a bit more poking around I see that in ~.axis_preferences it "remembers" the recent opened files...
John
www.linuxcnc.org/docview/html/config_ini_config.html#sub:[DISPLAY]-section
I'm not sure how you might change this but it would be a useful option to have.
I also see that Axis does "remember" the last x files loaded up like some programs do. I would think that would be the place to start in modifying the code. Just thinking out loud here...
Oh, and to answer your question yes it is possible to change the code and have that happen. I just don't know how.
After a bit more poking around I see that in ~.axis_preferences it "remembers" the recent opened files...
John
Last edit: 13 Feb 2017 20:26 by BigJohnT.
Please Log in or Create an account to join the conversation.
11 Apr 2011 13:23 - 11 Apr 2011 13:40 #8759
by ArcEye
Replied by ArcEye on topic Re:opens on the last created file
Hi,
I thought this would be useful too, so I have hacked the axis python code to make it happen.
I don't know much about python, I normally use C++, but this seems to work OK.
Below link is a modified axis executable for EMC 2.4.6, rename your original as axis-old or similar and copy this in its place at /usr/bin/axis
myweb.tiscali.co.uk/drahthaar/CNC/modified_axis.tar.gz
I tried uploading it but it kept being corrupted.
If you are using a different version of EMC, follow the below steps to make the change manually.
In /usr/bin/axis (./emc2-dev/bin/axis if using a run in place installation) find the code block as below
Comment it out (put a # character at the start of each line)
Insert this modified code block in it place
All this does is get a string list from the ~.axis_preferences file of the recent files.
If there are files in this list it selects the most recent one and opens it when AXIS displays.
If no files are listed it defaults to the original actions set out in the script.
It can be overridden by specifying a file to open on the commandline, ie "emc ~/ngc/foo.ngc", which always did take precedence in the original.
Works fine on my simulator, let me know if you find any glitches
I thought this would be useful too, so I have hacked the axis python code to make it happen.
I don't know much about python, I normally use C++, but this seems to work OK.
Below link is a modified axis executable for EMC 2.4.6, rename your original as axis-old or similar and copy this in its place at /usr/bin/axis
myweb.tiscali.co.uk/drahthaar/CNC/modified_axis.tar.gz
I tried uploading it but it kept being corrupted.
If you are using a different version of EMC, follow the below steps to make the change manually.
In /usr/bin/axis (./emc2-dev/bin/axis if using a run in place installation) find the code block as below
if args:
initialfile = args[0]
elif os.environ.has_key("AXIS_OPEN_FILE"):
initialfile = os.environ["AXIS_OPEN_FILE"]
elif inifile.find("DISPLAY", "OPEN_FILE"):
initialfile = inifile.find("DISPLAY", "OPEN_FILE")
elif lathe:
initialfile = os.path.join(BASE, "share", "axis", "images","axis-lathe.ngc")
addrecent = False
else:
initialfile = os.path.join(BASE, "share", "axis", "images", "axis.ngc")
addrecent = False
Comment it out (put a # character at the start of each line)
Insert this modified code block in it place
lastfile = ""
recent = ap.getpref('recentfiles', [], repr)
if len(recent):
lastfile = recent.pop(0)
if args:
initialfile = args[0]
elif os.path.exists(lastfile):
initialfile = lastfile
print "Loading "
print initialfile
elif os.environ.has_key("AXIS_OPEN_FILE"):
initialfile = os.environ["AXIS_OPEN_FILE"]
elif inifile.find("DISPLAY", "OPEN_FILE"):
initialfile = inifile.find("DISPLAY", "OPEN_FILE")
elif lathe:
initialfile = os.path.join(BASE, "share", "axis", "images","axis-lathe.ngc")
addrecent = False
else:
initialfile = os.path.join(BASE, "share", "axis", "images", "axis.ngc")
addrecent = False
All this does is get a string list from the ~.axis_preferences file of the recent files.
If there are files in this list it selects the most recent one and opens it when AXIS displays.
If no files are listed it defaults to the original actions set out in the script.
It can be overridden by specifying a file to open on the commandline, ie "emc ~/ngc/foo.ngc", which always did take precedence in the original.
Works fine on my simulator, let me know if you find any glitches
Last edit: 11 Apr 2011 13:40 by ArcEye.
Please Log in or Create an account to join the conversation.
11 Apr 2011 15:52 #8768
by BigJohnT
Replied by BigJohnT on topic Re:opens on the last created file
Nice fix. I've alerted the developers so maybe they will add this in the master.
John
John
Please Log in or Create an account to join the conversation.
Time to create page: 0.101 seconds