Method and function

More
06 Feb 2022 04:11 - 06 Feb 2022 04:16 #234078 by smplc
Method and function was created by smplc
Just trying if step.ngc calls remapped g71.8 yet.  g71_8 function error self not defined of method and function self.execute().  Should a class and method from the import interpreter file define self and execute?  Could the interpreter file not be imported?  Python path has interpreter.py and probably all associated import files.  Are any import files missing for the interpreter.py?  Are any other import files expected?  The interpreter would be preference python communicating with ngc including if python iterates loops back and forth with ngc.

An alternative is import linuxcnc and program Neutral Messaging Language (NML) with Python but NML doesn't appear as flexible as the interpreter when communicating to ngc program.  Required would be X and Z axes, some random G, M and F codes.  I seen the Linux Developer Manual and NML messages but not sure which messages to use without enough description.  Some of the NML messages don't have written from and read to files.  Is a more detail description about NML messages and where including commanding X and Z axes, some random G, M and F codes?

step.ngc, a of g71.8 a0.5, parameter error regardless lathe.ini including remap g71.8 modalgroup=1 argspec=a py=g71_8 .  Could the argspec expect angle brackets with parameter but python doesn't accept angle brackets?  Would an ngc file with a remapped G-code and especially parameter accept a python file?
Last edit: 06 Feb 2022 04:16 by smplc. Reason: Add'l attachment

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

More
06 Feb 2022 12:11 #234096 by andypugh
Replied by andypugh on topic Method and function
Do you have a remap folder containing toplevel.py and remap.py ?

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

More
06 Feb 2022 16:24 #234121 by smplc
Replied by smplc on topic Method and function
Yes, it's the last image attached foregoing.  They were extracted from the Ubuntu search and Debian directory and placed at the new folder named python.

I was testing importing a file and a one way is from filename import* .  Then revised g71_8.py with from interpreter import* .  Axis, Lathe and Reloaded step.ngc and again error self of self.execute() not defined .  Is still missing some import files?   
Attachments:

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

More
06 Feb 2022 16:49 #234124 by andypugh
Replied by andypugh on topic Method and function
It might not be valid to use "A" as a parameter to a remapped code. (As it names an axis)

Also try
def g78_1(self, **words)

So that the remap passes the "self" struct into your code.

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

More
06 Feb 2022 18:38 #234144 by smplc
Replied by smplc on topic Method and function
Thanks.  self was probably out of scope regardless defined from the interpreter.  self.execute() is operable with one command yet.
Attachments:

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

More
06 Feb 2022 19:06 #234153 by smplc
Replied by smplc on topic Method and function
g71.8.ngc wouldn't accept parameter a (lowercase) of g71.8 even though remap included argspec=a py=g71_8. Changed to argspec=d and resolved. ngc probably should use an uppercase parameter if remapped g-code, python and using parameter **words.

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

More
06 Feb 2022 19:18 #234154 by andypugh
Replied by andypugh on topic Method and function
The examples I looked at all had
from interpreter import *
whereas you have
import interpreter

In the former case you can just use execute(....) but in the latter case it needs to be interpreter.execute

Basically "import" imports the namespace and the commands that it contains, whereas "from X import *" imports all the commands into the current namespace.

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

More
06 Feb 2022 20:26 #234168 by smplc
Replied by smplc on topic Method and function
from filename import * is retrievable from call.ngc as pictured foregoing.  Such a way importloop.py is a library.

g71_8.py the from interpreter import * causes an error upon opening Axis and Lathe.  Presently import interpreter isn't causing an error.  Then supposedly the interpreter class is only retrievable.  The interpreter class is the entire file. 

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

More
06 Feb 2022 20:39 #234170 by smplc
Replied by smplc on topic Method and function
LinuxCNC_Documentation.pdf and page 329 includes argspec parameter. It appears some uppercase parameters with argspec error too.

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

More
06 Feb 2022 21:35 #234176 by smplc
Replied by smplc on topic Method and function
g71_8.py the from interpreter import * no error now upon opening Axis and Lathe. interpretor was misspelled that caused error.

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

Time to create page: 0.195 seconds
Powered by Kunena Forum