Get a #var to use in a Python script

More
6 years 10 months ago - 6 years 10 months ago #151862 by andypugh
self.params is available if your python imports canon. ie
Code:
import emccanon
As seen in stdglue.py

But, you can only import canon in remap python code.

If your script is not part of a G-code remap then would it make sense to re-cast it as one?

I am wondering if it is possible to send an MDI command via the python linuxcnc.command() interface
Code:
linuxcnc.command.mdi("(DEBUG, #5601)")
And somehow parse the output. (which might, or might not, appear in the python interface to the error channel). Zero marks for elegance, even if it does work.
Last edit: 6 years 10 months ago by andypugh.

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

More
6 years 10 months ago #151888 by Vmax549
It is ODD that as long as EMC has been around that there is NO link between teh 2 sections Python/Gcode to share variables or parameters. I can do half teh function from Gcode but cannot notify teh operator. I can do teh notify operator from teh Python side but cannot pass variable data to them.

I wonder WHY you cannot import emccanon from Python script. Python has no idea what emccanon is.

Catch22 , Close but no Cigar , (;-) TP

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

More
6 years 10 months ago #151890 by andypugh
I think it is because there are two halves of linuxCNC, and they don't always agree.

There is the interpreter, running in user-space, then there is the realtime code which controls the machine.

Often the interpreter has finished queuing several hours worth of cutting path into the motion controller before the tool even touches the work.
At that point there are two different opinions on the value of the parameters. The interpreter will hold the final value, and the realtime code the initial value.
And there is nothing sending currrent parameter values back to user-space from realtime. In fact I don't think the realtime code even knows what parameters are, it just sees numbers.

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

More
6 years 10 months ago #151893 by Vmax549
I think I may be able to use remap. I am testing now.

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

More
6 years 10 months ago #151895 by Vmax549
Same problem there only in reverse. You can access teh params fine BUT you cannot use python to notify teh operator of teh values.

Catch22, (;-) TP

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

More
6 years 10 months ago #151896 by andypugh
If remap works, would M68?
(Not that they have anything in common, except that remap=Gcode so you are running code when you want the value.

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

Time to create page: 0.258 seconds
Powered by Kunena Forum