call O subrutine from python

More
26 Nov 2013 06:14 #41168 by diegoroman17
Hi,

I have my own GUI in GladeVCP. I need execute a O subrutine that is in a .ngc file that I previously have opened. How can I do it? Thanks for help me.

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

More
26 Nov 2013 06:22 #41169 by BigJohnT
Use a MDI call to your subroutine.

JT

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

More
26 Nov 2013 14:44 #41173 by newbynobi
import linuxcnc
s = linuxcnc.stat()
c = linuxcnc.command()

def ok_for_mdi():
    s.poll()
    return not s.estop and s.enabled and s.homed and (s.interp_state == linuxcnc.INTERP_IDLE)

if ok_for_mdi():
   c.mode(linuxcnc.MODE_MDI)
   c.wait_complete() # wait until mode switch executed
   c.mdi("G0 X10 Y20 Z30")

This info is from here

Norbert

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

More
26 Nov 2013 21:36 #41178 by diegoroman17
Precisely I have used the same statements replaced "c.mdi("G0 X10 Y20 Z30") " with "c.mdi("o100 call")" but this don´t work. The error say unable for read the file 100, but I don´t need read the file I need read the o subrutine inside the file that I have opened.

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

More
26 Nov 2013 21:58 #41179 by mhaberler

Precisely I have used the same statements replaced "c.mdi("G0 X10 Y20 Z30") " with "c.mdi("o100 call")" but this don´t work. The error say unable for read the file 100, but I don´t need read the file I need read the o subrutine inside the file that I have opened.


That is a misunderstanding how o-word MDI calls are processed

Just put the subroutine in a file 100.ngc and go from there, and it will work

-Michael

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

More
26 Nov 2013 22:09 #41180 by diegoroman17
Thanks Michael I try it. I have wanted to use the same file but if is necessary create other file don't problem.

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

More
26 Nov 2013 22:20 #41183 by newbynobi
can you please give more information about your GUI?

Norbert

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

More
27 Nov 2013 00:12 #41185 by diegoroman17
sure.
Really in not only GUI. I have develop a custom CAM for CorelDraw that build the .ngc file for a laser machine. Now I want add the functionality of press a button en my GUI and the machine move along the perimeter without activate the laser. This is to see if the figures draw inside the material without do measurement of material. I have included the o subrutine that will draw the perimeter inside my .ngc and want only call this subrutine when I press the button "Trace". Now I have tried the solution of Michael and this work fine. Only is a few "ugly" have two files and the one only with o subrutine

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

More
27 Nov 2013 00:31 #41186 by newbynobi
Hallo,

is you CAM code open source?
I am asking, because I am planing to do something similar, and why invent the wheel twice?

If so, could you send me a copy?
What about screen shots?

Norbert

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

More
27 Nov 2013 01:13 #41187 by diegoroman17
unfortunately it is not open source. The platform is programmed in c # and corel draw and neither corel nor c # are open source. But I can help you with everything that is in my hands. I attached the screenshoots






Attachments:

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

Moderators: mhaberlerHansU
Time to create page: 0.170 seconds
Powered by Kunena Forum