problem for use remap

More
6 years 4 months ago - 6 years 4 months ago #172000 by mahdi2001h
Replied by mahdi2001h on topic problem for use remap
oow

I've seen this before

It didn't help me

Because it did the same

But I'm reviewing it now

thanks
Last edit: 6 years 4 months ago by mahdi2001h.

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

More
6 years 4 months ago #172020 by Aciera
Replied by Aciera on topic problem for use remap
Ok I've only done remaps with python script once before. My INI contains this:
Code:
REMAP=G91.2 modalgroup=1 argspec=xyzabc python=g912 REMAP=G91.3 modalgroup=1 argspec=xyzabc python=g913

Then my config folder contains a folder called python and inside that folder lives my remap.py (contains my python scripts for g912 and g913), toplevel.py, oword.py, stdglue.py and util.py.

toplevel.py contains
Code:
import oword import remap

oword.py contains:
Code:
from util import call_pydevd def foo(*args): print "foo!" # make debugger available as oword procedure def pydevd(self,*args): call_pydevd() # this would be defined in the oword module def mysub(self, *args): print "number of parameters passed:", len(args) for a in args: print a

stdglue.py is an empty file

util.py contains:
Code:
import inspect import emccanon # O-word procedure to trap into the Pydevd debugger # start debug server in Eclipse, then # call as 'O<pydevd> call' from MDI # example setup for debugging embedded Python code # see http://pydev.org/manual_adv_remote_debugger.html # if this points to a valid directory, def call_pydevd(): """ trap into the pydevd debugger""" import os,sys pydevdir= '/home/mah/.eclipse/org.eclipse.platform_3.5.0_155965261/plugins/org.python.pydev.debug_2.0.0.2011040403/pysrc/' # the 'emctask' module is present only in the milltask instance, otherwise both the UI and # milltask would try to connect to the debug server. if os.path.isdir(pydevdir) and 'emctask' in sys.builtin_module_names: sys.path.append(pydevdir) sys.path.insert(0,pydevdir) try: import pydevd emccanon.MESSAGE("pydevd imported, connecting to Eclipse debug server...") pydevd.settrace() except: emccanon.MESSAGE("no pydevd module found") pass def lineno(): """ return line number in the current Python script """ return inspect.currentframe().f_back.f_lineno def error_stack(self): """ print the Interpreters error stack (function names) """ print "error stack level=%d" % (self.stack_index) for s in self.stack(): print "--'%s'" % (s) def callstack(self): """ print the O-Word call stack """ for i in range(self.call_level): c = self.sub_context[i] print "%d: pos=%d seq=%d filename=%s sub=%s" % (i,c.position, c.sequence_number,c.filename,c.subname)
The following user(s) said Thank You: mahdi2001h

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

More
6 years 4 months ago #172220 by mahdi2001h
Replied by mahdi2001h on topic problem for use remap
Please also send your remap.py file

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

More
6 years 4 months ago #172222 by Aciera
Replied by Aciera on topic problem for use remap
remap.py:
Warning: Spoiler!
The following user(s) said Thank You: mahdi2001h

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

More
6 years 4 months ago - 6 years 4 months ago #172445 by mahdi2001h
Replied by mahdi2001h on topic problem for use remap
thanks alot for your reply

I checked your code

but my problem not solved

also I using Sim with remapping setup and add a line for log to terminal
And I saw the same problem there

I will tell you my problem again

when linuxcnc opening the ngc file , in one step all remap function run
and when maching start , in a moment all remap python function run

in fact I want to remaped a g-code to send a serial command by python
and the G-codes should run in own place but its not worked


i think when first run (when ngc file open) is for draw shape for preview and can solve it with check machine power status
but for second run i don't know what should to do
Last edit: 6 years 4 months ago by mahdi2001h.

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

More
6 years 4 months ago - 6 years 4 months ago #172453 by Aciera
Replied by Aciera on topic problem for use remap
Do you mean that these codes for G70 and G70.1 are running without being called?

def g700(self, **words):
s.poll()
if s.estop == 0:
print "test p =" , words["p"]
return INTERP_OK

def g701(self, **words):
s.poll()
if s.estop == 0:
print "test1"
return INTERP_OK

Last edit: 6 years 4 months ago by Aciera.

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

Time to create page: 0.277 seconds
Powered by Kunena Forum