- Posts: 90
- Thank you received: 0
Run linuxcnc from python interface without axis gui
6 years 8 months ago #156566
by prochj51
Run linuxcnc from python interface without axis gui was created by prochj51
Hi,
I am new to the linuxcnc and I have been trying to search for solution on
my own but was not successful.
I am playing with python interface on VirtualBox and
I want to start ordinary routine like this
import sys
import linuxcnc
try:
s = linuxcnc.stat() # create a connection to the status channel
s.poll() # get current values
except linuxcnc.error, detail:
print "error", detail
sys.exit(1)
when I first run axis GUI and then I run this script everything is fine.
But when I do not run axis GUI first, the line s.poll() gives me
an error emcStatusBuffer invalid err=3, apparently because linuxcnc is not initialized with ini file.
I would rather not have axis GUI on background, since I want to control from just from my custom python interface.
So my question is, how can run and initialize linuxcnc without starting axis GUI first.
I saw somewhere using subprocess like this
subprocess.Popen(["path/halshow.tcl", "-- -ini " + "myfile.ini"])
but it does not work fork and do not know if it is relevant.
Thank you for the answer and a bit of explanation in advance
Regards
Jiri
I am new to the linuxcnc and I have been trying to search for solution on
my own but was not successful.
I am playing with python interface on VirtualBox and
I want to start ordinary routine like this
import sys
import linuxcnc
try:
s = linuxcnc.stat() # create a connection to the status channel
s.poll() # get current values
except linuxcnc.error, detail:
print "error", detail
sys.exit(1)
when I first run axis GUI and then I run this script everything is fine.
But when I do not run axis GUI first, the line s.poll() gives me
an error emcStatusBuffer invalid err=3, apparently because linuxcnc is not initialized with ini file.
I would rather not have axis GUI on background, since I want to control from just from my custom python interface.
So my question is, how can run and initialize linuxcnc without starting axis GUI first.
I saw somewhere using subprocess like this
subprocess.Popen(["path/halshow.tcl", "-- -ini " + "myfile.ini"])
but it does not work fork and do not know if it is relevant.
Thank you for the answer and a bit of explanation in advance
Regards
Jiri
Please Log in to join the conversation.
6 years 8 months ago #156582
by phillc54
Replied by phillc54 on topic Run linuxcnc from python interface without axis gui
Please Log in to join the conversation.
6 years 8 months ago #156583
by cmorley
Replied by cmorley on topic Run linuxcnc from python interface without axis gui
If I recall correctly...
In the INI file
Change the DISPLAY =axis
To DISPLAY= python YOURGUINAME.py
Your gu must be in the appropriate location to load.
Also you can load AXIS and your gui at the same time by loafing your gui with HAL commands in the INI under the HAl section ..something like halcmd= loadusr python YOURGUINAME.py
In the INI file
Change the DISPLAY =axis
To DISPLAY= python YOURGUINAME.py
Your gu must be in the appropriate location to load.
Also you can load AXIS and your gui at the same time by loafing your gui with HAL commands in the INI under the HAl section ..something like halcmd= loadusr python YOURGUINAME.py
Please Log in to join the conversation.
6 years 8 months ago #156599
by prochj51
Replied by prochj51 on topic Run linuxcnc from python interface without axis gui
Thanks for replies.
The change from
DISPLAY = axis to DISPLAY = halui
works.
But I also had to delete line at
[HAL]
HALUI = halui
I guess there was ambiguity.
The change from
DISPLAY = axis to DISPLAY = halui
works.
But I also had to delete line at
[HAL]
HALUI = halui
I guess there was ambiguity.
Please Log in to join the conversation.
Time to create page: 0.085 seconds
